From dc81a21c855985c67fecfbebe6b5a036fb2786f9 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Tue, 20 Aug 2019 20:22:01 +0300 Subject: [PATCH] [vnet]: Fix FDB related failure in "vnet_bitmap" virtual switch test (#1034) Signed-off-by: Volodymyr Samotiy --- tests/test_vnet.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/test_vnet.py b/tests/test_vnet.py index 14ead661b91f..5eac68381ce3 100644 --- a/tests/test_vnet.py +++ b/tests/test_vnet.py @@ -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()) @@ -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)