Skip to content

Commit

Permalink
FIX bugs and add VLAN scale test (sonic-net#27)
Browse files Browse the repository at this point in the history
* FIX bugs and add VLAN scale test

* Code-review comments addressed

* Addressed code-review comments

Co-authored-by: Vasant <vapatil@linkedin.com>
  • Loading branch information
vasant17 and Vasant committed May 11, 2020
1 parent 5ad0bdd commit 8e5c284
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 6 deletions.
39 changes: 38 additions & 1 deletion orchagent/fdborch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,50 @@ void FdbOrch::doTask(NotificationConsumer& consumer)
}
}

void FdbOrch::flushFDBEntries(sai_object_id_t bridge_port_oid,
sai_object_id_t vlan_oid)
{
vector<sai_attribute_t> attrs;
sai_attribute_t attr;
sai_status_t rv = SAI_STATUS_SUCCESS;

SWSS_LOG_ENTER();

if (SAI_NULL_OBJECT_ID == bridge_port_oid ||
SAI_NULL_OBJECT_ID == vlan_oid)
{
SWSS_LOG_WARN("Couldn't flush FDB. Bridge port OID: 0x%" PRIx64 " bvid:%" PRIx64 ",",
bridge_port_oid, vlan_oid);
return;
}

attr.id = SAI_FDB_FLUSH_ATTR_BRIDGE_PORT_ID;
attr.value.oid = bridge_port_oid;
attrs.push_back(attr);

attr.id = SAI_FDB_FLUSH_ATTR_BV_ID;
attr.value.oid = vlan_oid;
attrs.push_back(attr);

SWSS_LOG_INFO("Flushing FDB bridge_port_oid: 0x%" PRIx64 ", and bvid_oid:0x%" PRIx64 ".", bridge_port_oid, vlan_oid);

rv = sai_fdb_api->flush_fdb_entries(gSwitchId, (uint32_t)attrs.size(), attrs.data());
if (SAI_STATUS_SUCCESS != rv)
{
SWSS_LOG_ERROR("Flushing FDB failed. rv:%d", rv);
}
}

void FdbOrch::updateVlanMember(const VlanMemberUpdate& update)
{
SWSS_LOG_ENTER();

if (!update.add)
{
return; // we need additions only
swss::Port vlan = update.vlan;
swss::Port port = update.member;
flushFDBEntries(port.m_bridge_port_id, vlan.m_vlan_info.vlan_oid);
return;
}

string port_name = update.member.m_alias;
Expand Down
2 changes: 2 additions & 0 deletions orchagent/fdborch.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class FdbOrch: public Orch, public Subject, public Observer
void updateVlanMember(const VlanMemberUpdate&);
bool addFdbEntry(const FdbEntry&, const string&, const string&);
bool removeFdbEntry(const FdbEntry&);
void flushFDBEntries(sai_object_id_t bridge_port_oid,
sai_object_id_t vlan_oid);

bool storeFdbEntryState(const FdbUpdate& update);
};
Expand Down
5 changes: 2 additions & 3 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3155,8 +3155,7 @@ bool PortsOrch::removeBridgePort(Port &port)
}

/* Flush FDB entries pointing to this bridge port */
// TODO: Remove all FDB entries associated with this bridge port before
// removing the bridge port itself
flushFDBEntries(port.m_bridge_port_id);

/* Remove bridge port */
status = sai_bridge_api->remove_bridge_port(port.m_bridge_port_id);
Expand Down Expand Up @@ -4014,6 +4013,6 @@ void PortsOrch::flushFDBEntries(sai_object_id_t bridge_port_id)

if (rv != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Flush fdb by bridge port id: %" PRIx64 "failed: %d", bridge_port_id, rv);
SWSS_LOG_ERROR("Flush fdb by bridge port id: %" PRIx64 " failed: %d", bridge_port_id, rv);
}
}
2 changes: 0 additions & 2 deletions tests/test_fdb_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from swsscommon import swsscommon
from distutils.version import StrictVersion

<<<<<<< HEAD

class TestFdbUpdate(object):
def create_entry(self, tbl, key, pairs):
fvs = swsscommon.FieldValuePairs(pairs)
Expand Down

0 comments on commit 8e5c284

Please sign in to comment.