Skip to content

Commit c395fdd

Browse files
authored
enable and fortify ECN config GCU testing (#21236)
1 parent 695ab61 commit c395fdd

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

tests/common/plugins/conditional_mark/tests_mark_conditions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2506,7 +2506,7 @@ generic_config_updater/test_ecn_config_update.py::test_ecn_config_updates:
25062506
reason: "This test is not run on this asic type, topology, or version currently"
25072507
conditions_logical_operator: "OR"
25082508
conditions:
2509-
- "asic_type in ['cisco-8000']"
2509+
- "hwsku in ['Cisco-8800-LC-48H-C48']"
25102510
- "topo_type in ['m0', 'mx', 'm1']"
25112511
- "release in ['202211']"
25122512

tests/generic_config_updater/test_ecn_config_update.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,16 @@ def get_asic_db_values(duthost, fields, cli_namespace_prefix):
6060
asic_db_values = {}
6161
for wred_object in wred_objects:
6262
oid = wred_object[wred_object.rfind(':') + 1:]
63-
asic_db_values[oid] = {}
6463
wred_data = duthost.shell('sonic-db-cli {} ASIC_DB hgetall {}'
6564
.format(cli_namespace_prefix, wred_object))["stdout"]
6665
if "NULL" in wred_data:
6766
continue
6867
wred_data = ast.literal_eval(wred_data)
68+
values = {}
6969
for field in fields:
70-
value = int(wred_data[WRED_MAPPING[field]])
71-
asic_db_values[oid][field] = value
70+
values[field] = int(wred_data[WRED_MAPPING[field]])
71+
if values:
72+
asic_db_values[oid] = values
7273
return asic_db_values
7374

7475

@@ -137,8 +138,7 @@ def validate_wred_objects_in_asic_db():
137138
def get_wred_profiles(duthost, cli_namespace_prefix):
138139
wred_profiles = duthost.shell(f"sonic-db-cli {cli_namespace_prefix} CONFIG_DB keys \
139140
'WRED_PROFILE|*' | cut -d '|' -f 2")["stdout"]
140-
wred_profiles = wred_profiles.split('\n')
141-
return wred_profiles
141+
return [w for w in wred_profiles.split('\n') if w]
142142

143143

144144
@pytest.mark.parametrize("configdb_field", ["green_min_threshold", "green_max_threshold", "green_drop_probability",
@@ -168,12 +168,14 @@ def test_ecn_config_updates(duthost, ensure_dut_readiness, configdb_field, opera
168168
for field in fields:
169169
value = int(ecn_data[field])
170170
if "probability" in field:
171-
if 0 <= value <= 99:
171+
if 0 <= value < 99:
172172
value += 1
173-
elif value == 100:
173+
elif value >= 99:
174174
value -= 1
175175
else:
176176
raise ValueError("Invalid probability value: {}".format(value))
177+
elif "min" in field:
178+
value -= 1
177179
else:
178180
value += 1
179181
new_values[wred_profile][field] = value

0 commit comments

Comments
 (0)