Skip to content

Commit

Permalink
[test_virtual_chassis]: use wait_for to make test more robust (#1640)
Browse files Browse the repository at this point in the history
Signed-off-by: Guohan Lu <[email protected]>
  • Loading branch information
lguohan authored Feb 15, 2021
1 parent f2854f8 commit 1238076
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/test_virtual_chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def test_chassis_system_neigh(self, vct):
assert res == "", "Error configuring static neigh"

asic_db = dvs.get_asic_db()
asic_db.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY", 1)
neighkeys = asic_db.get_keys("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY")
assert len(neighkeys), "No neigh entries in ASIC_DB"

Expand All @@ -195,8 +196,12 @@ def test_chassis_system_neigh(self, vct):

# Check for presence of encap index, retrieve and store it for sync verification
test_neigh_entry = asic_db.wait_for_entry("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY", test_neigh)
encap_index = test_neigh_entry.get("SAI_NEIGHBOR_ENTRY_ATTR_ENCAP_INDEX")
assert encap_index != "", "VOQ encap index is not programmed in ASIC_DB"
test_neigh_entry_attrs = asic_db.wait_for_fields("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY", test_neigh, ["SAI_NEIGHBOR_ENTRY_ATTR_ENCAP_INDEX"])
print(test_neigh)
print(test_neigh_entry)
print(test_neigh_entry_attrs)
encap_index = test_neigh_entry_attrs["SAI_NEIGHBOR_ENTRY_ATTR_ENCAP_INDEX"]
assert encap_index != "" and encap_index != None, "VOQ encap index is not programmed in ASIC_DB"

break

Expand Down

0 comments on commit 1238076

Please sign in to comment.