5 #include <boost/uuid/uuid_io.hpp>
6 #include <vnc_cfg_types.h>
32 persistent_(false), subtype_(
INVALID), physical_device_(NULL) {
43 return "PORT <" +
name() +
">";
63 ret = osOperStateData->
OnResync(
this);
70 if (new_vrf !=
vrf_.get()) {
103 bond_childIntf_map[
intf_name] = bondIntf;
118 std::size_t pos =
name().find_last_of(
":");
119 if (pos != string::npos) {
120 return name().substr(pos + 1);
141 std::string interface_name =
name();
153 int fd = socket(AF_LOCAL, SOCK_STREAM, 0);
157 memset(&ifr, 0,
sizeof(ifr));
158 strncpy(ifr.ifr_name, interface_name.c_str(), IF_NAMESIZE-1);
160 if (ioctl(fd, SIOCGIFFLAGS, (
void *)&ifr) < 0) {
161 LOG(ERROR,
"Error <" << errno <<
": " << strerror(errno) <<
162 "> setting promiscuous flag for interface <" << interface_name <<
">");
167 ifr.ifr_flags |= IFF_PROMISC;
168 if (ioctl(fd, SIOCSIFFLAGS, (
void *)&ifr) < 0) {
169 LOG(ERROR,
"Error <" << errno <<
": " << strerror(errno) <<
170 "> setting promiscuous flag for interface <" << interface_name <<
">");
184 boost::uuids::nil_uuid(), name, false) {
221 const string &vrf_name,
226 const string &display_name,
229 InterfaceData(agent, node, transport), subtype_(subtype), encap_type_(encap),
230 no_arp_(no_arp), device_uuid_(device_uuid), display_name_(display_name),
253 autogen::PhysicalInterface *port =
254 static_cast <autogen::PhysicalInterface *>(node->
GetObject());
259 vector<string> elements;
260 split(elements, node->
name(), boost::is_any_of(
":"), boost::token_compress_on);
261 if (elements.size() == 3) {
262 device = elements[1];
284 autogen::PhysicalInterface *port =
285 static_cast <autogen::PhysicalInterface *>(node->
GetObject());
290 vector<string> elements;
291 split(elements, node->
name(), boost::is_any_of(
":"), boost::token_compress_on);
292 if (elements.size() == 3) {
293 device = elements[1];
309 autogen::PhysicalRouter *router =
310 static_cast<autogen::PhysicalRouter *
>(adj_node->
GetObject());
311 autogen::IdPermsType id_perms = router->id_perms();
312 CfgUuidSet(id_perms.uuid.uuid_mslong, id_perms.uuid.uuid_lslong,
317 agent()->fabric_vrf_name(),
321 port->display_name(),
334 const string &vrf_name,
SubType subtype,
342 encap, no_arp, device_uuid,
343 ifname, ip, transport));
348 const string &vrf_name,
SubType subtype,
356 encap, no_arp, device_uuid,
357 ifname, ip, transport));
365 req.
data.reset(NULL);
372 req.data.reset(NULL);
PhysicalInterface::SubType subtype_
static void CfgUuidSet(uint64_t ms_long, uint64_t ls_long, boost::uuids::uuid &u)
PhysicalInterface(const std::string &name, const boost::uuids::uuid &logical_router_uuid)
std::string display_name_
void EthInit(const std::string &vrf_name)
NextHopTable * nexthop_table() const
DBTableBase * get_table() const
std::string GetPhysicalInterfaceName() const
friend struct PhysicalInterfaceKey
PhysicalDeviceTable * physical_device_table() const
ConfigManager * config_manager() const
void AddPhysicalInterfaceNode(IFMapNode *node)
virtual bool OnResync(PhysicalInterface *phy_intf) const
std::unique_ptr< DBRequestData > data
std::string display_name_
AgentDBEntry * FindActiveEntry(const DBEntry *key)
bool Enqueue(DBRequest *req)
const MacAddress & mac() const
std::unique_ptr< DBRequestKey > KeyPtr
virtual bool OnChange(const InterfaceTable *table, const PhysicalInterfaceData *data)
boost::uuids::uuid logical_router_uuid_
bool server_gateway_mode() const
bool PhysicalInterfaceProcessConfig(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
PhysicalDevice * Find(const boost::uuids::uuid &u)
IFMapNode * FindAdjacentIFMapNode(IFMapNode *node, const char *type)
boost::uuids::uuid device_uuid_
const BondChildIntfMap & getBondChildIntfMap() const
PhysicalDeviceRef physical_device_
static void Create(InterfaceTable *table, const std::string &ifname, const std::string &vrf_name, SubType subtype, EncapType encap, bool no_arp, const boost::uuids::uuid &device_uuid, const Ip4Address &ip, Interface::Transport transport_)
NextHopConstRef flow_key_nh_
std::unique_ptr< DBRequestKey > key
virtual ~PhysicalInterfaceKey()
virtual KeyPtr GetDBRequestKey() const
uint32_t pi_ifnode_to_req_
bool PhysicalInterfaceIFNodeToReq(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
virtual void Process(DBRequest &req)
const std::string & agent_name() const
const std::string & name() const
boost::asio::ip::address_v4 Ip4Address
VrfTable * vrf_table() const
virtual ~PhysicalInterface()
IFMapObject * GetObject()
PhysicalInterfaceKey(const std::string &name)
PhysicalInterface::EncapType encap_type_
static void DeletePhysicalInterfaceNh(const string &ifname, const MacAddress &mac)
Interface * AllocEntry(const InterfaceTable *table) const
InterfaceKey * Clone() const
static PhysicalInterfaceKey * BuildKey(const std::string &name)
static void CreatePhysicalInterfaceNh(const string &ifname, const MacAddress &mac)
virtual bool CmpInterface(const DBEntry &rhs) const
void setBondChildIntfMap(const BondChildIntfMap bondChildIntfMap)
#define LOG(_Level, _Msg)
static void DeleteReq(InterfaceTable *table, const std::string &ifname)
struct InterfaceOsParams os_params_
const std::string & name() const
PhysicalDevice * physical_device() const
virtual std::string ToString() const
bool RemotePhysicalInterfaceIFNodeToReq(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
std::map< const std::string, Bond_ChildIntf > BondChildIntfMap
PhysicalInterfaceData(Agent *agent, IFMapNode *node, const std::string &vrf_name, PhysicalInterface::SubType subtype, PhysicalInterface::EncapType encap, bool no_arp, const boost::uuids::uuid &device_uuid, const std::string &display_name, const Ip4Address &ip, Interface::Transport transport)
static void CreateReq(InterfaceTable *table, const std::string &ifname, const std::string &vrf_name, SubType subtype, EncapType encap, bool no_arp, const boost::uuids::uuid &device_uuid, const Ip4Address &ip, Interface::Transport transport)