Skip to content

Commit db9ca83

Browse files
authored
Fix vs test failure in test_buffer_traditional (#1881)
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 <[email protected]>
1 parent 76e3406 commit db9ca83

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

tests/test_buffer_traditional.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,20 @@ def setup_teardown_test(self, dvs):
6868
finally:
6969
self.teardown()
7070

71-
@pytest.mark.skip(reason="Failing. Under investigation")
7271
def test_zero_cable_len_profile_update(self, dvs, setup_teardown_test):
7372
self.pg_name_map = setup_teardown_test
7473
orig_cable_len = None
7574
orig_speed = None
7675
try:
77-
dvs.runcmd("config interface startup {}".format(self.INTF))
78-
self.orig_profiles = self.get_asic_buf_profile()
7976
# get orig cable length and speed
8077
fvs = self.config_db.get_entry("CABLE_LENGTH", "AZURE")
8178
orig_cable_len = fvs[self.INTF]
79+
if orig_cable_len == "0m":
80+
fvs[self.INTF] = "300m"
81+
cable_len_before_test = "300m"
82+
self.config_db.update_entry("CABLE_LENGTH", "AZURE", fvs)
83+
else:
84+
cable_len_before_test = orig_cable_len
8285
fvs = self.config_db.get_entry("PORT", self.INTF)
8386
orig_speed = fvs["speed"]
8487

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

94+
dvs.runcmd("config interface startup {}".format(self.INTF))
95+
# Make sure the buffer PG has been created
96+
orig_lossless_profile = "pg_lossless_{}_{}_profile".format(orig_speed, cable_len_before_test)
97+
self.app_db.wait_for_entry("BUFFER_PROFILE_TABLE", orig_lossless_profile)
98+
self.orig_profiles = self.get_asic_buf_profile()
99+
91100
# check if the lossless profile for the test speed is already present
92101
fvs = dict()
93-
new_lossless_profile = "pg_lossless_{}_{}_profile".format(test_speed, orig_cable_len)
102+
new_lossless_profile = "pg_lossless_{}_{}_profile".format(test_speed, cable_len_before_test)
94103
fvs = self.app_db.get_entry("BUFFER_PROFILE_TABLE", new_lossless_profile)
95104
if len(fvs):
96105
profile_exp_cnt_diff = 0
@@ -110,15 +119,14 @@ def test_zero_cable_len_profile_update(self, dvs, setup_teardown_test):
110119
self.app_db.wait_for_deleted_entry("BUFFER_PROFILE_TABLE", test_lossless_profile)
111120

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

120-
# change cable length to 'orig_cable_len'
121-
self.change_cable_len(orig_cable_len)
128+
# change cable length to 'cable_len_before_test'
129+
self.change_cable_len(cable_len_before_test)
122130

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

0 commit comments

Comments
 (0)