Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vnet]: Fix FDB related failure in "vnet_bitmap" virtual switch test #1034

Merged
merged 1 commit into from
Aug 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know why there're extra FDB entries in the ASIC database?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I tried many times and I wasn't able to reproduce it in my environment. Probably it's specific to public environment were VS tests are running.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. thanks.


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