LCOV - code coverage report
Current view: top level - vnsw/agent/oper - logical_interface.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 1 3 33.3 %
Date: 2026-06-08 02:02:55 Functions: 1 3 33.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : #ifndef SRC_VNSW_AGENT_OPER_LOGICAL_PORT_H_
       5             : #define SRC_VNSW_AGENT_OPER_LOGICAL_PORT_H_
       6             : 
       7             : #include <cmn/agent_cmn.h>
       8             : #include <cmn/agent.h>
       9             : #include <string>
      10             : 
      11             : class IFMapDependencyManager;
      12             : 
      13             : class VmInterface;
      14             : class SandeshLogicalInterface;
      15             : 
      16             : struct LogicalInterfaceKey;
      17             : struct LogicalInterfaceData;
      18             : 
      19             : class LogicalInterface : public Interface {
      20             :  public:
      21             :     enum Type {
      22             :         VLAN
      23             :     };
      24             : 
      25             :     explicit LogicalInterface(const boost::uuids::uuid &uuid,
      26             :                               const std::string &name,
      27             :                               const boost::uuids::uuid &logical_router_uuid);
      28             :     virtual ~LogicalInterface();
      29             : 
      30             :     virtual bool CmpInterface(const DBEntry &rhs) const;
      31             :     virtual std::string ToString() const;
      32             :     virtual bool Delete(const DBRequest *req);
      33             :     virtual void GetOsParams(Agent *agent);
      34             :     virtual bool OnChange(const InterfaceTable *table,
      35             :                           const LogicalInterfaceData *data);
      36             : 
      37             :     const std::string &display_name() const { return display_name_; }
      38           0 :     const std::string &phy_dev_display_name() const { return phy_dev_display_name_; }
      39           0 :     const std::string &phy_intf_display_name() const { return phy_intf_display_name_; }
      40             :     Interface *physical_interface() const;
      41             :     VmInterface *vm_interface() const;
      42             :     PhysicalDevice *physical_device() const;
      43             : 
      44             :  private:
      45             :     friend class InterfaceTable;
      46             :     std::string display_name_;
      47             :     InterfaceRef physical_interface_;
      48             :     InterfaceRef vm_interface_;
      49             :     boost::uuids::uuid vm_uuid_;
      50             :     PhysicalDeviceRef physical_device_;
      51             :     std::string phy_dev_display_name_;
      52             :     std::string phy_intf_display_name_;
      53             :     boost::uuids::uuid vn_uuid_;
      54             :     DISALLOW_COPY_AND_ASSIGN(LogicalInterface);
      55             : };
      56             : 
      57             : struct LogicalInterfaceKey : public InterfaceKey {
      58             :     explicit LogicalInterfaceKey(const boost::uuids::uuid &uuid,
      59             :                             const std::string &name);
      60             :     virtual ~LogicalInterfaceKey();
      61             : 
      62             : };
      63             : 
      64             : struct LogicalInterfaceData : public InterfaceData {
      65             :     LogicalInterfaceData(Agent *agent, IFMapNode *node,
      66             :                          const std::string &display_name,
      67             :                          const std::string &physical_interface,
      68             :                          const boost::uuids::uuid &vif,
      69             :                          const boost::uuids::uuid &device_uuid,
      70             :                          const std::string &phy_dev_display_name,
      71             :                          const std::string &phy_intf_display_name);
      72             :     virtual ~LogicalInterfaceData();
      73             : 
      74             :     std::string display_name_;
      75             :     std::string physical_interface_;
      76             :     boost::uuids::uuid vm_interface_;
      77             :     boost::uuids::uuid device_uuid_;
      78             :     std::string phy_dev_display_name_;
      79             :     std::string phy_intf_display_name_;
      80             : };
      81             : 
      82             : struct VlanLogicalInterfaceKey : public LogicalInterfaceKey {
      83             :     explicit VlanLogicalInterfaceKey(const boost::uuids::uuid &uuid,
      84             :                                 const std::string &name);
      85             :     virtual ~VlanLogicalInterfaceKey();
      86             : 
      87             :     virtual LogicalInterface *AllocEntry(const InterfaceTable *table) const;
      88             :     virtual LogicalInterface *AllocEntry(const InterfaceTable *table,
      89             :                                          const InterfaceData *data) const;
      90             :     virtual InterfaceKey *Clone() const;
      91             : };
      92             : 
      93             : struct VlanLogicalInterfaceData : public LogicalInterfaceData {
      94             :     VlanLogicalInterfaceData(Agent *agent, IFMapNode *node,
      95             :                              const std::string &display_name,
      96             :                              const std::string &physical_interface,
      97             :                              const boost::uuids::uuid &vif,
      98             :                              const boost::uuids::uuid &device_uuid,
      99             :                              const std::string &phy_dev_display_name,
     100             :                              const std::string &phy_intf_display_name,
     101             :                              uint16_t vlan);
     102             :     virtual ~VlanLogicalInterfaceData();
     103             : 
     104             :     uint16_t vlan_;
     105             : };
     106             : 
     107             : class VlanLogicalInterface : public LogicalInterface {
     108             :  public:
     109             :     explicit VlanLogicalInterface(const boost::uuids::uuid &uuid,
     110             :                                   const std::string &name, uint16_t vlan,
     111             :                                   const boost::uuids::uuid &lr_uuid);
     112             :     virtual ~VlanLogicalInterface();
     113             :     virtual DBEntryBase::KeyPtr GetDBRequestKey() const;
     114             : 
     115           7 :     uint16_t vlan() const { return vlan_; }
     116             : 
     117             :  private:
     118             :     // IMP: vlan_ cannot be changed
     119             :     uint16_t vlan_;
     120             :     DISALLOW_COPY_AND_ASSIGN(VlanLogicalInterface);
     121             : };
     122             : 
     123             : #endif  // SRC_VNSW_AGENT_OPER_LOGICAL_PORT_H_

Generated by: LCOV version 1.14