Skip to content

Commit

Permalink
Fix vs test failure in test_buffer_traditional (#1881)
Browse files Browse the repository at this point in the history
Ref: #1875

The test expects buffer PGs created for all ports.
However, the vs image is deployed as cable length being 0m,
which provides the buffer PGs to be created and fails the test.

To fix the failure:
- Config the cable length of port under test to 300m if it was 0m
- Startup the port after cable length configured
  By doing that the buffer PG can be configured correctly
- Collect the orig_profiles after port is started up

Signed-off-by: Stephen Sun <stephens@nvidia.com>
  • Loading branch information
stephenxs committed Aug 27, 2021
1 parent 76e3406 commit db9ca83
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions tests/test_buffer_traditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,20 @@ def setup_teardown_test(self, dvs):
finally:
self.teardown()

@pytest.mark.skip(reason="Failing. Under investigation")
def test_zero_cable_len_profile_update(self, dvs, setup_teardown_test):
self.pg_name_map = setup_teardown_test
orig_cable_len = None
orig_speed = None
try:
dvs.runcmd("config interface startup {}".format(self.INTF))
self.orig_profiles = self.get_asic_buf_profile()
# get orig cable length and speed
fvs = self.config_db.get_entry("CABLE_LENGTH", "AZURE")
orig_cable_len = fvs[self.INTF]
if orig_cable_len == "0m":
fvs[self.INTF] = "300m"
cable_len_before_test = "300m"
self.config_db.update_entry("CABLE_LENGTH", "AZURE", fvs)
else:
cable_len_before_test = orig_cable_len
fvs = self.config_db.get_entry("PORT", self.INTF)
orig_speed = fvs["speed"]

Expand All @@ -88,9 +91,15 @@ def test_zero_cable_len_profile_update(self, dvs, setup_teardown_test):
test_speed = "100000"
test_cable_len = "0m"

dvs.runcmd("config interface startup {}".format(self.INTF))
# Make sure the buffer PG has been created
orig_lossless_profile = "pg_lossless_{}_{}_profile".format(orig_speed, cable_len_before_test)
self.app_db.wait_for_entry("BUFFER_PROFILE_TABLE", orig_lossless_profile)
self.orig_profiles = self.get_asic_buf_profile()

# check if the lossless profile for the test speed is already present
fvs = dict()
new_lossless_profile = "pg_lossless_{}_{}_profile".format(test_speed, orig_cable_len)
new_lossless_profile = "pg_lossless_{}_{}_profile".format(test_speed, cable_len_before_test)
fvs = self.app_db.get_entry("BUFFER_PROFILE_TABLE", new_lossless_profile)
if len(fvs):
profile_exp_cnt_diff = 0
Expand All @@ -110,15 +119,14 @@ def test_zero_cable_len_profile_update(self, dvs, setup_teardown_test):
self.app_db.wait_for_deleted_entry("BUFFER_PROFILE_TABLE", test_lossless_profile)

# buffer pgs should still point to the original buffer profile
orig_lossless_profile = "pg_lossless_{}_{}_profile".format(orig_speed, orig_cable_len)
self.app_db.wait_for_field_match("BUFFER_PG_TABLE", self.INTF + ":3-4", {"profile": "[BUFFER_PROFILE_TABLE:{}]".format(orig_lossless_profile)})
fvs = dict()
for pg in self.pg_name_map:
fvs["SAI_INGRESS_PRIORITY_GROUP_ATTR_BUFFER_PROFILE"] = self.buf_pg_profile[pg]
self.asic_db.wait_for_field_match("ASIC_STATE:SAI_OBJECT_TYPE_INGRESS_PRIORITY_GROUP", self.pg_name_map[pg], fvs)

# change cable length to 'orig_cable_len'
self.change_cable_len(orig_cable_len)
# change cable length to 'cable_len_before_test'
self.change_cable_len(cable_len_before_test)

# change intf speed to 'test_speed'
dvs.runcmd("config interface speed {} {}".format(self.INTF, test_speed))
Expand Down

0 comments on commit db9ca83

Please sign in to comment.