From 779a443559603d4039cbe0ed16e3bd9b8fb7c4f5 Mon Sep 17 00:00:00 2001 From: Prabhjot Singh Sethi Date: Thu, 9 Jul 2015 12:22:58 +0530 Subject: [PATCH] Handle display name change from empty to non-empty Issue: ------ In certain configuration update scenarios we may receive Physical Device or Physical Interface entry without display name, however while translating this information to OVSDB we need to mandatory have display name available, not having display name available was not handled. Fix: ---- Ignore logical interface object till display name for both Physical Device and Interface is available, added change to trigger updates to logical interface on display name change using dependency tracker. Fix propagation of Physical Device display name to Physical Device VN as well. Fixed test case to check for vxlan-id of ovs-logical-switch validation Added test case to simulate order in which display name for Physical Device and Physical Interface is not available during creation time. Partial-Bug: 1471201 Change-Id: I958792a7c28da0e5019c5342dd1e7bdc473aae9d (cherry picked from commit a0ee99004c86575cfdb9672ae47fb975cc20b180) --- src/vnsw/agent/oper/agent.sandesh | 6 +++ src/vnsw/agent/oper/interface.cc | 22 +++++++--- src/vnsw/agent/oper/logical_interface.cc | 43 ++++++++++++++++--- src/vnsw/agent/oper/logical_interface.h | 14 +++++- src/vnsw/agent/oper/physical_device_vn.cc | 5 +++ src/vnsw/agent/oper/physical_device_vn.h | 4 +- .../oper/test/test_xml_physical_device.cc | 35 +++++++++++---- .../oper/test/test_xml_physical_device.h | 2 + .../ovsdb_client/logical_switch_ovsdb.cc | 21 ++------- .../ovsdb_client/test/test_xml_ovsdb.cc | 10 ++++- .../ovsdb_client/test/test_xml_ovsdb.h | 2 + .../test/xml/vlan-port-binding-incomplete.xml | 19 ++++++-- .../ovsdb_client/vlan_port_binding_ovsdb.cc | 26 ++++------- 13 files changed, 148 insertions(+), 61 deletions(-) diff --git a/src/vnsw/agent/oper/agent.sandesh b/src/vnsw/agent/oper/agent.sandesh index 9327f54a194..ef4b5ed75f3 100644 --- a/src/vnsw/agent/oper/agent.sandesh +++ b/src/vnsw/agent/oper/agent.sandesh @@ -94,6 +94,8 @@ struct ItfSandeshData { 44: string transport; 45: string logical_interface_uuid; 46: optional bool flood_unknown_unicast; + 47: string physical_device; + 48: string physical_interface; } struct VnIpamData { @@ -1076,6 +1078,10 @@ trace sandesh MulticastLog { 4: i32 label; } +trace sandesh OperTrace { + 1: string message; +} + trace sandesh OperVrf { 1: string message; 2: string vrf_name; diff --git a/src/vnsw/agent/oper/interface.cc b/src/vnsw/agent/oper/interface.cc index 4bf8697753d..a57870d9e12 100644 --- a/src/vnsw/agent/oper/interface.cc +++ b/src/vnsw/agent/oper/interface.cc @@ -60,10 +60,15 @@ void InterfaceTable::RegisterDBClients(IFMapDependencyManager *dep) { typedef IFMapDependencyTracker::ReactionMap ReactionMap; ReactionMap physical_port_react = map_list_of - ("self", list_of("self") ("physical-router-physical-interface")) + ("self", + list_of("self") + ("physical-router-physical-interface") + ("physical-interface-logical-interface")) ("physical-interface-logical-interface", list_of("physical-router-physical-interface")) - ("physical-router-physical-interface", list_of("self")); + ("physical-router-physical-interface", + list_of("self") + ("physical-interface-logical-interface")); dep->RegisterReactionMap("physical-interface", physical_port_react); dep->Register("physical-interface", boost::bind(&AgentOperDBTable::ConfigEventHandler, this, _1)); @@ -73,7 +78,8 @@ void InterfaceTable::RegisterDBClients(IFMapDependencyManager *dep) { ReactionMap logical_port_react = map_list_of ("self", list_of("self") ("physical-interface-logical-interface")) ("physical-interface-logical-interface", - list_of("physical-router-physical-interface")) + list_of("self") + ("physical-router-physical-interface")) ("logical-interface-virtual-machine-interface", list_of("physical-interface-logical-interface") ("self")); dep->RegisterReactionMap("logical-interface", logical_port_react); @@ -719,8 +725,14 @@ void Interface::SetItfSandeshData(ItfSandeshData &data) const { break; case Interface::LOGICAL: - data.set_type("logical-port"); - data.set_vrf_name("--NA--"); + { + const LogicalInterface *lintf = + static_cast(this); + data.set_type("logical-port"); + data.set_vrf_name("--NA--"); + data.set_physical_device(lintf->phy_dev_display_name()); + data.set_physical_interface(lintf->phy_intf_display_name()); + } break; case Interface::VM_INTERFACE: { diff --git a/src/vnsw/agent/oper/logical_interface.cc b/src/vnsw/agent/oper/logical_interface.cc index 67b13d7ebef..fe00c63bb50 100644 --- a/src/vnsw/agent/oper/logical_interface.cc +++ b/src/vnsw/agent/oper/logical_interface.cc @@ -30,7 +30,8 @@ using boost::uuids::uuid; LogicalInterface::LogicalInterface(const boost::uuids::uuid &uuid, const std::string &name) : Interface(Interface::LOGICAL, uuid, name, NULL), display_name_(), - physical_interface_(), vm_interface_(), physical_device_(NULL) { + physical_interface_(), vm_interface_(), physical_device_(NULL), + phy_dev_display_name_(), phy_intf_display_name_() { } LogicalInterface::~LogicalInterface() { @@ -72,6 +73,14 @@ bool LogicalInterface::OnChange(const InterfaceTable *table, ret = true; } + if (phy_intf_display_name_ != data->phy_intf_display_name_) { + OPER_TRACE(Trace, "Changing Physical Interface display name from " + + phy_intf_display_name_ + " to " + + data->phy_intf_display_name_); + phy_intf_display_name_ = data->phy_intf_display_name_; + ret = true; + } + VmInterfaceKey vmi_key(AgentKey::ADD_DEL_CHANGE, data->vm_interface_, ""); Interface *interface = static_cast (table->agent()->interface_table()->FindActiveEntry(&vmi_key)); @@ -88,6 +97,14 @@ bool LogicalInterface::OnChange(const InterfaceTable *table, ret = true; } + if (phy_dev_display_name_ != data->phy_dev_display_name_) { + OPER_TRACE(Trace, "Changing Physical Device display name from " + + phy_dev_display_name_ + " to " + + data->phy_dev_display_name_); + phy_dev_display_name_ = data->phy_dev_display_name_; + ret = true; + } + return ret; } @@ -129,10 +146,14 @@ LogicalInterfaceData::LogicalInterfaceData(Agent *agent, IFMapNode *node, const std::string &display_name, const std::string &port, const boost::uuids::uuid &vif, - const uuid &device_uuid) : + const uuid &device_uuid, + const std::string &phy_dev_display_name, + const std::string &phy_intf_display_name) : InterfaceData(agent, node, Interface::TRANSPORT_INVALID), display_name_(display_name), - physical_interface_(port), vm_interface_(vif), device_uuid_(device_uuid) { + physical_interface_(port), vm_interface_(vif), device_uuid_(device_uuid), + phy_dev_display_name_(phy_dev_display_name), + phy_intf_display_name_(phy_intf_display_name) { } LogicalInterfaceData::~LogicalInterfaceData() { @@ -191,8 +212,11 @@ InterfaceKey *VlanLogicalInterfaceKey::Clone() const { VlanLogicalInterfaceData::VlanLogicalInterfaceData (Agent *agent, IFMapNode *node, const std::string &display_name, const std::string &physical_interface, - const boost::uuids::uuid &vif, const boost::uuids::uuid &u, uint16_t vlan) : - LogicalInterfaceData(agent, node, display_name, physical_interface, vif, u), + const boost::uuids::uuid &vif, const boost::uuids::uuid &u, + const std::string &phy_dev_display_name, + const std::string &phy_intf_display_name, uint16_t vlan) : + LogicalInterfaceData(agent, node, display_name, physical_interface, vif, u, + phy_dev_display_name, phy_intf_display_name), vlan_(vlan) { } @@ -217,17 +241,24 @@ static LogicalInterfaceData *BuildData(Agent *agent, IFMapNode *node, const autogen::LogicalInterface *port) { // Find link with physical-interface adjacency string physical_interface; + string phy_dev_display_name; + string phy_intf_display_name; IFMapNode *adj_node = NULL; boost::uuids::uuid dev_uuid = nil_uuid(); adj_node = agent->cfg_listener()->FindAdjacentIFMapNode (agent, node, "physical-interface"); if (adj_node) { physical_interface = adj_node->name(); + autogen::PhysicalInterface *port = + static_cast (adj_node->GetObject()); + assert(port); + phy_intf_display_name = port->display_name(); IFMapNode *prouter_node = agent->cfg_listener()->FindAdjacentIFMapNode (agent, adj_node, "physical-router"); if (prouter_node) { autogen::PhysicalRouter *router = static_cast(prouter_node->GetObject()); + phy_dev_display_name = router->display_name(); autogen::IdPermsType id_perms = router->id_perms(); CfgUuidSet(id_perms.uuid.uuid_mslong, id_perms.uuid.uuid_lslong, dev_uuid); @@ -280,6 +311,8 @@ static LogicalInterfaceData *BuildData(Agent *agent, IFMapNode *node, return new VlanLogicalInterfaceData(agent, node, port->display_name(), physical_interface, vmi_uuid, dev_uuid, + phy_dev_display_name, + phy_intf_display_name, port->vlan_tag()); } diff --git a/src/vnsw/agent/oper/logical_interface.h b/src/vnsw/agent/oper/logical_interface.h index c2cb4463fdd..3daf7224efd 100644 --- a/src/vnsw/agent/oper/logical_interface.h +++ b/src/vnsw/agent/oper/logical_interface.h @@ -34,6 +34,8 @@ class LogicalInterface : public Interface { const LogicalInterfaceData *data); const std::string &display_name() const { return display_name_; } + const std::string &phy_dev_display_name() const { return phy_dev_display_name_; } + const std::string &phy_intf_display_name() const { return phy_intf_display_name_; } Interface *physical_interface() const; VmInterface *vm_interface() const; PhysicalDevice *physical_device() const; @@ -45,6 +47,8 @@ class LogicalInterface : public Interface { InterfaceRef vm_interface_; boost::uuids::uuid vm_uuid_; PhysicalDeviceRef physical_device_; + std::string phy_dev_display_name_; + std::string phy_intf_display_name_; DISALLOW_COPY_AND_ASSIGN(LogicalInterface); }; @@ -59,14 +63,18 @@ struct LogicalInterfaceData : public InterfaceData { LogicalInterfaceData(Agent *agent, IFMapNode *node, const std::string &display_name, const std::string &physical_interface, - const boost::uuids::uuid &vif, - const boost::uuids::uuid &device_uuid); + const boost::uuids::uuid &vif, + const boost::uuids::uuid &device_uuid, + const std::string &phy_dev_display_name, + const std::string &phy_intf_display_name); virtual ~LogicalInterfaceData(); std::string display_name_; std::string physical_interface_; boost::uuids::uuid vm_interface_; boost::uuids::uuid device_uuid_; + std::string phy_dev_display_name_; + std::string phy_intf_display_name_; }; struct VlanLogicalInterfaceKey : public LogicalInterfaceKey { @@ -86,6 +94,8 @@ struct VlanLogicalInterfaceData : public LogicalInterfaceData { const std::string &physical_interface, const boost::uuids::uuid &vif, const boost::uuids::uuid &device_uuid, + const std::string &phy_dev_display_name, + const std::string &phy_intf_display_name, uint16_t vlan); virtual ~VlanLogicalInterfaceData(); diff --git a/src/vnsw/agent/oper/physical_device_vn.cc b/src/vnsw/agent/oper/physical_device_vn.cc index 647f52b4261..acd50a70f87 100644 --- a/src/vnsw/agent/oper/physical_device_vn.cc +++ b/src/vnsw/agent/oper/physical_device_vn.cc @@ -65,6 +65,11 @@ bool PhysicalDeviceVn::Copy(PhysicalDeviceVnTable *table, ret = true; } + if (dev && (dev->name() != device_display_name_)) { + device_display_name_ = dev->name(); + ret = true; + } + VnEntry *vn = table->agent()->vn_table()->Find(vn_uuid_); if (vn != vn_.get()) { vn_.reset(vn); diff --git a/src/vnsw/agent/oper/physical_device_vn.h b/src/vnsw/agent/oper/physical_device_vn.h index e5930b8c9db..a1d39ea88d0 100644 --- a/src/vnsw/agent/oper/physical_device_vn.h +++ b/src/vnsw/agent/oper/physical_device_vn.h @@ -66,7 +66,7 @@ class PhysicalDeviceVn : AgentRefCount, PhysicalDeviceVn(const boost::uuids::uuid &device_uuid, const boost::uuids::uuid &vn_uuid) : device_uuid_(device_uuid), vn_uuid_(vn_uuid), device_(), vn_(), - vxlan_id_(0), tor_ip_(Ip4Address(0)) { } + vxlan_id_(0), tor_ip_(Ip4Address(0)), device_display_name_() { } virtual ~PhysicalDeviceVn() { } virtual bool IsLess(const DBEntry &rhs) const; @@ -84,6 +84,7 @@ class PhysicalDeviceVn : AgentRefCount, VnEntry *vn() const { return vn_.get(); } int vxlan_id() const { return vxlan_id_; } const IpAddress &tor_ip() const {return tor_ip_;} + const std::string &device_display_name() const {return device_display_name_;} bool Copy(PhysicalDeviceVnTable *table, const PhysicalDeviceVnData *data); void SendObjectLog(AgentLogEvent::type event) const; @@ -98,6 +99,7 @@ class PhysicalDeviceVn : AgentRefCount, VnEntryRef vn_; int vxlan_id_; IpAddress tor_ip_; + std::string device_display_name_; DISALLOW_COPY_AND_ASSIGN(PhysicalDeviceVn); }; diff --git a/src/vnsw/agent/oper/test/test_xml_physical_device.cc b/src/vnsw/agent/oper/test/test_xml_physical_device.cc index 9a1f6cefc9f..107c0c77a64 100644 --- a/src/vnsw/agent/oper/test/test_xml_physical_device.cc +++ b/src/vnsw/agent/oper/test/test_xml_physical_device.cc @@ -95,7 +95,12 @@ bool AgentUtXmlPhysicalDevice::ReadXml() { bool AgentUtXmlPhysicalDevice::ToXml(xml_node *parent) { xml_node n = AddXmlNodeWithAttr(parent, NodeType().c_str()); AddXmlNodeWithValue(&n, "name", name()); - AddXmlNodeWithValue(&n, "display-name", name()); + string display_name; + if (GetStringAttribute(node(), "display", &display_name)) { + AddXmlNodeWithValue(&n, "display-name", display_name); + } else { + AddXmlNodeWithValue(&n, "display-name", name()); + } AddXmlNodeWithValue(&n, "physical-router-dataplane-ip", "111.111.111.111"); AddIdPerms(&n); return true; @@ -139,8 +144,8 @@ bool AgentUtXmlPhysicalInterface::ToXml(xml_node *parent) { AddIdPerms(&n); if (device_name_ != "") { - LinkXmlNode(parent, NodeType(), name(), "physical-router", - device_name_); + LinkXmlNode(parent, "physical-router", device_name_, + NodeType(), name()); } return true; @@ -187,12 +192,17 @@ bool AgentUtXmlRemotePhysicalInterface::ToXml(xml_node *parent) { fqdn = "dummy:" + agent->agent_name() + ":" + name(); } AddXmlNodeWithValue(&n, "name", fqdn); - AddXmlNodeWithValue(&n, "display-name", name()); + string display_name; + if (GetStringAttribute(node(), "display", &display_name)) { + AddXmlNodeWithValue(&n, "display-name", display_name); + } else { + AddXmlNodeWithValue(&n, "display-name", name()); + } AddIdPerms(&n); if (device_name_ != "") { - LinkXmlNode(parent, NodeType(), fqdn, "physical-router", - device_name_); + LinkXmlNode(parent, "physical-router", device_name_, + NodeType(), fqdn); } return true; @@ -265,13 +275,16 @@ string AgentUtXmlLogicalInterface::NodeType() { ///////////////////////////////////////////////////////////////////////////// AgentUtXmlPhysicalDeviceValidate::AgentUtXmlPhysicalDeviceValidate (const string &name, const uuid &id, const xml_node &node) : - AgentUtXmlValidationNode(name, node), id_(id) { + AgentUtXmlValidationNode(name, node), id_(id), match_display_name_(false) { } AgentUtXmlPhysicalDeviceValidate::~AgentUtXmlPhysicalDeviceValidate() { } bool AgentUtXmlPhysicalDeviceValidate::ReadXml() { + if (AgentUtXmlValidationNode::ReadXml() == false) + return false; + match_display_name_ = GetStringAttribute(node(), "display", &display_name_); return true; } @@ -281,7 +294,13 @@ bool AgentUtXmlPhysicalDeviceValidate::Validate() { dev = static_cast (Agent::GetInstance()->physical_device_table()->FindActiveEntry(&key)); if (present()) { - return dev != NULL; + if (dev != NULL) { + if (match_display_name_ && display_name_ != dev->name()) { + return false; + } + return true; + } + return false; } else { return dev == NULL; } diff --git a/src/vnsw/agent/oper/test/test_xml_physical_device.h b/src/vnsw/agent/oper/test/test_xml_physical_device.h index 93d11a0f716..f7cce95a9b0 100644 --- a/src/vnsw/agent/oper/test/test_xml_physical_device.h +++ b/src/vnsw/agent/oper/test/test_xml_physical_device.h @@ -94,6 +94,8 @@ class AgentUtXmlPhysicalDeviceValidate : public AgentUtXmlValidationNode { virtual const std::string ToString(); private: const boost::uuids::uuid id_; + std::string display_name_; + bool match_display_name_; }; class AgentUtXmlPhysicalInterfaceValidate : public AgentUtXmlValidationNode { diff --git a/src/vnsw/agent/ovs_tor_agent/ovsdb_client/logical_switch_ovsdb.cc b/src/vnsw/agent/ovs_tor_agent/ovsdb_client/logical_switch_ovsdb.cc index 2fe6fee647a..94cbfddb3be 100644 --- a/src/vnsw/agent/ovs_tor_agent/ovsdb_client/logical_switch_ovsdb.cc +++ b/src/vnsw/agent/ovs_tor_agent/ovsdb_client/logical_switch_ovsdb.cc @@ -16,7 +16,6 @@ extern "C" { #include #include -#include #include #include #include @@ -35,8 +34,8 @@ LogicalSwitchEntry::LogicalSwitchEntry(OvsdbDBObject *table, name_(UuidToString(entry->vn()->GetUuid())), mcast_local_row_(NULL), mcast_remote_row_(NULL), mc_flood_entry_(NULL) { vxlan_id_ = entry->vxlan_id(); - device_name_ = entry->device()->name(); - tor_ip_ = entry->device()->ip(); + device_name_ = entry->device_display_name(); + tor_ip_ = entry->tor_ip(); } LogicalSwitchEntry::LogicalSwitchEntry(OvsdbDBObject *table, @@ -183,8 +182,8 @@ bool LogicalSwitchEntry::Sync(DBEntry *db_entry) { vxlan_id_ = entry->vxlan_id(); change = true; } - if (device_name_ != entry->device()->name()) { - device_name_ = entry->device()->name(); + if (device_name_ != entry->device_display_name()) { + device_name_ = entry->device_display_name(); change = true; } if (tor_ip_ != entry->tor_ip()) { @@ -465,18 +464,6 @@ KSyncDBObject::DBFilterResp LogicalSwitchTable::OvsdbDBEntryFilter( const PhysicalDeviceVn *entry = static_cast(db_entry); - // Physical Device missing, trigger delete - if (entry->device() == NULL) { - if (ovsdb_entry != NULL) { - OVSDB_TRACE(Trace, "Missing Physical Device info, triggering delete" - " of logical switch"); - } else { - OVSDB_TRACE(Trace, "Missing Physical Device info, ignoring" - " logical switch"); - } - return DBFilterDelete; - } - // Delete the entry which has invalid VxLAN id associated. if (entry->vxlan_id() == 0) { return DBFilterDelete; diff --git a/src/vnsw/agent/ovs_tor_agent/ovsdb_client/test/test_xml_ovsdb.cc b/src/vnsw/agent/ovs_tor_agent/ovsdb_client/test/test_xml_ovsdb.cc index 191aede357a..4d01d0c7821 100644 --- a/src/vnsw/agent/ovs_tor_agent/ovsdb_client/test/test_xml_ovsdb.cc +++ b/src/vnsw/agent/ovs_tor_agent/ovsdb_client/test/test_xml_ovsdb.cc @@ -69,7 +69,8 @@ void AgentUtXmlOvsdbInit(AgentUtXmlTest *test) { ///////////////////////////////////////////////////////////////////////////// AgentUtXmlLogicalSwitchValidate::AgentUtXmlLogicalSwitchValidate (const string &name, const uuid &id, const xml_node &node) : - AgentUtXmlValidationNode(name, node), id_(id) { + AgentUtXmlValidationNode(name, node), id_(id), vxlan_id_(0), + match_vxlan_(false) { } AgentUtXmlLogicalSwitchValidate::~AgentUtXmlLogicalSwitchValidate() { @@ -78,6 +79,7 @@ AgentUtXmlLogicalSwitchValidate::~AgentUtXmlLogicalSwitchValidate() { bool AgentUtXmlLogicalSwitchValidate::ReadXml() { if (AgentUtXmlValidationNode::ReadXml() == false) return false; + match_vxlan_ = GetUintAttribute(node(), "vxlan-id", &vxlan_id_); return true; } @@ -87,7 +89,11 @@ bool AgentUtXmlLogicalSwitchValidate::Validate() { LogicalSwitchEntry *entry = static_cast (table->Find(&key)); if (present()) { - return (entry != NULL && entry->GetState() == KSyncEntry::IN_SYNC); + bool ret = (entry != NULL && entry->GetState() == KSyncEntry::IN_SYNC); + if (ret == true && match_vxlan_) { + ret = ((uint16_t)entry->vxlan_id() == vxlan_id_); + } + return ret; } else { return (entry == NULL); } diff --git a/src/vnsw/agent/ovs_tor_agent/ovsdb_client/test/test_xml_ovsdb.h b/src/vnsw/agent/ovs_tor_agent/ovsdb_client/test/test_xml_ovsdb.h index 1592591827f..d5c1fa604ce 100644 --- a/src/vnsw/agent/ovs_tor_agent/ovsdb_client/test/test_xml_ovsdb.h +++ b/src/vnsw/agent/ovs_tor_agent/ovsdb_client/test/test_xml_ovsdb.h @@ -29,6 +29,8 @@ class AgentUtXmlLogicalSwitchValidate : public AgentUtXmlValidationNode { private: const boost::uuids::uuid id_; + uint16_t vxlan_id_; + bool match_vxlan_; }; class AgentUtXmlOvsdbVrfValidate : public AgentUtXmlValidationNode { diff --git a/src/vnsw/agent/ovs_tor_agent/ovsdb_client/test/xml/vlan-port-binding-incomplete.xml b/src/vnsw/agent/ovs_tor_agent/ovsdb_client/test/xml/vlan-port-binding-incomplete.xml index a4aa7c83bde..092bfe02f8a 100644 --- a/src/vnsw/agent/ovs_tor_agent/ovsdb_client/test/xml/vlan-port-binding-incomplete.xml +++ b/src/vnsw/agent/ovs_tor_agent/ovsdb_client/test/xml/vlan-port-binding-incomplete.xml @@ -2,7 +2,7 @@ - + @@ -12,7 +12,7 @@ uuid="1" name="tap1" mac="00:00:00:00:00:01" vn-name="vn-2" vn-uuid="2" vm-name="vm1" vm-uuid="1" vrf="vrf1" ip="1.1.1.1" /> - + @@ -46,8 +46,19 @@ + + + + + + + - + + + + + @@ -64,7 +75,7 @@ + right="virtual-machine-interface" right-name="tap1" del="1"/> #include -#include #include #include #include @@ -34,14 +33,9 @@ VlanPortBindingEntry::VlanPortBindingEntry(VlanPortBindingTable *table, VlanPortBindingEntry::VlanPortBindingEntry(VlanPortBindingTable *table, const VlanLogicalInterface *entry) : OvsdbDBEntry(table_), - logical_switch_name_(), physical_port_name_(), - physical_device_name_(""), vlan_(entry->vlan()), vmi_uuid_(nil_uuid()), - old_logical_switch_name_() { - RemotePhysicalInterface *phy_intf = dynamic_cast - (entry->physical_interface()); - assert(phy_intf); - physical_port_name_ = phy_intf->display_name(); - physical_device_name_ = phy_intf->physical_device()->name(); + logical_switch_name_(), physical_port_name_(entry->phy_intf_display_name()), + physical_device_name_(entry->phy_dev_display_name()), vlan_(entry->vlan()), + vmi_uuid_(nil_uuid()), old_logical_switch_name_() { } VlanPortBindingEntry::VlanPortBindingEntry(VlanPortBindingTable *table, @@ -292,18 +286,16 @@ KSyncDBObject::DBFilterResp VlanPortBindingTable::OvsdbDBEntryFilter( // Since we need physical port name and device name as key, ignore entry // if physical port or device is not yet present. - RemotePhysicalInterface *phy_intf = dynamic_cast - (l_port->physical_interface()); - if (phy_intf == NULL) { + if (l_port->phy_intf_display_name().empty()) { OVSDB_TRACE(Trace, "Ignoring Port Vlan Binding due to physical port " - "unavailablity Logical port = " + l_port->name()); - return DBFilterIgnore; // TODO(Prabhjot) check if Delete is required. + "name unavailablity Logical port = " + l_port->name()); + return DBFilterIgnore; } - if (phy_intf->physical_device() == NULL) { - OVSDB_TRACE(Trace, "Ignoring Port Vlan Binding due to device " + if (l_port->phy_dev_display_name().empty()) { + OVSDB_TRACE(Trace, "Ignoring Port Vlan Binding due to device name " "unavailablity Logical port = " + l_port->name()); - return DBFilterIgnore; // TODO(Prabhjot) check if Delete is required. + return DBFilterIgnore; } return DBFilterAccept; }