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