Skip to content

Commit

Permalink
[vnet]: Fix FDB related failure in "vnet_bitmap" virtual switch test (s…
Browse files Browse the repository at this point in the history
…onic-net#1034)

Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
  • Loading branch information
Volodymyr Samotiy authored and dgsudharsan committed Oct 7, 2019
1 parent 1e1cbdc commit e55d667
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/test_vnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,21 @@ def get_created_entry(db, table, existed_entries):
return new_entries[0]


def get_created_entries(db, table, existed_entries, count):
def get_all_created_entries(db, table, existed_entries):
tbl = swsscommon.Table(db, table)
entries = set(tbl.getKeys())
new_entries = list(entries - existed_entries)
assert len(new_entries) == count, "Wrong number of created entries."
assert len(new_entries) > 0, "No created entries."
new_entries.sort()
return new_entries


def get_created_entries(db, table, existed_entries, count):
new_entries = get_all_created_entries(db, table, existed_entries)
assert len(new_entries) == count, "Wrong number of created entries."
return new_entries


def get_deleted_entries(db, table, existed_entries, count):
tbl = swsscommon.Table(db, table)
entries = set(tbl.getKeys())
Expand Down Expand Up @@ -894,12 +900,16 @@ def check_vnet_routes(self, dvs, name, endpoint, tunnel, mac="", vni=0):
_vni = str(vni) if vni != 0 else self.vnet_map[name]['vni']

if (mac,_vni) not in self.vnet_mac_vni_list:
new_fdb = get_created_entry(asic_db, self.ASIC_FDB_ENTRY, self.fdbs)
new_fdbs = get_all_created_entries(asic_db, self.ASIC_FDB_ENTRY, self.fdbs)

expected_attrs = {
"SAI_FDB_ENTRY_ATTR_TYPE": "SAI_FDB_ENTRY_TYPE_STATIC",
"SAI_FDB_ENTRY_ATTR_ENDPOINT_IP": endpoint
}

new_fdb = next(iter([fdb for fdb in new_fdbs if (mac if mac != "" else "00:00:00:00:00:00") in fdb]), None)
assert new_fdb, "Wrong number of created FDB entries."

check_object(asic_db, self.ASIC_FDB_ENTRY, new_fdb, expected_attrs)

self.fdbs.add(new_fdb)
Expand Down

0 comments on commit e55d667

Please sign in to comment.