Line data Source code
1 : /* 2 : * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. 3 : * Copyright Contributors to the OpenSDN project 4 : */ 5 : #ifndef src_vnsw_agent_oper_remote_physical_interface_hpp 6 : #define src_vnsw_agent_oper_remote_physical_interface_hpp 7 : 8 : struct RemotePhysicalInterfaceData; 9 : 10 : ///////////////////////////////////////////////////////////////////////////// 11 : // Remote Physical Ports represents physical ports on an external device 12 : // UUID is the key 13 : ///////////////////////////////////////////////////////////////////////////// 14 : class RemotePhysicalInterface : public Interface { 15 : public: 16 : RemotePhysicalInterface(const std::string &name); 17 : virtual ~RemotePhysicalInterface(); 18 : 19 : virtual bool CmpInterface(const DBEntry &rhs) const; 20 : virtual void GetOsParams(Agent *agent); 21 : virtual std::string ToString() const; 22 : virtual KeyPtr GetDBRequestKey() const; 23 : virtual bool OnChange(const InterfaceTable *table, 24 : const RemotePhysicalInterfaceData *data); 25 : 26 : const std::string &display_name() const { return display_name_; } 27 0 : PhysicalDevice *physical_device() const { 28 0 : return physical_device_.get(); 29 : } 30 : 31 : // Helper functions 32 : static void CreateReq(InterfaceTable *table, const std::string &fqdn, 33 : const std::string &display_name, 34 : const std::string &vrf_name, 35 : const boost::uuids::uuid &device_uuid); 36 : static void Create(InterfaceTable *table, const std::string &fqdn, 37 : const std::string &display_name, 38 : const std::string &vrf_name, 39 : const boost::uuids::uuid &device_uuid); 40 : static void DeleteReq(InterfaceTable *table, const std::string &ifname); 41 : static void Delete(InterfaceTable *table, const std::string &ifname); 42 : 43 : friend struct RemotePhysicalInterfaceKey; 44 : private: 45 : std::string display_name_; 46 : PhysicalDeviceRef physical_device_; 47 : DISALLOW_COPY_AND_ASSIGN(RemotePhysicalInterface); 48 : }; 49 : 50 : struct RemotePhysicalInterfaceKey : public InterfaceKey { 51 : RemotePhysicalInterfaceKey(const std::string &name); 52 : ~RemotePhysicalInterfaceKey(); 53 : 54 : Interface *AllocEntry(const InterfaceTable *table) const; 55 : Interface *AllocEntry(const InterfaceTable *table, 56 : const InterfaceData *data) const; 57 : InterfaceKey *Clone() const; 58 : }; 59 : 60 : struct RemotePhysicalInterfaceData : public InterfaceData { 61 : RemotePhysicalInterfaceData(Agent *agent, IFMapNode *node, 62 : const std::string &display_name, 63 : const std::string &vrf_name, 64 : const boost::uuids::uuid &device_uuid); 65 : virtual ~RemotePhysicalInterfaceData(); 66 : 67 : std::string display_name_; 68 : boost::uuids::uuid device_uuid_; 69 : }; 70 : 71 : #endif // src_vnsw_agent_oper_remote_physical_interface_hpp