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

refactor: enhance override config masic test #16226

Merged
merged 1 commit into from
Jan 2, 2025
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
21 changes: 15 additions & 6 deletions tests/override_config_table/test_override_config_table_masic.py
Original file line number Diff line number Diff line change
@@ -78,8 +78,8 @@ def setup_env(duthosts, tbinfo, enum_rand_one_per_hwsku_frontend_hostname):
restore_config(duthost, GOLDEN_CONFIG, GOLDEN_CONFIG_BACKUP)
else:
duthost.file(path=GOLDEN_CONFIG, state='absent')
# Restore config before test
config_reload(duthost)
# Restore config after test
config_reload(duthost, safe_reload=True)


def load_minigraph_with_golden_empty_input(duthost):
@@ -220,20 +220,29 @@ def load_minigraph_with_golden_empty_table_removal(duthost):
)


def test_load_minigraph_with_golden_config(duthosts, setup_env, tbinfo, enum_upstream_dut_hostname,
enum_rand_one_per_hwsku_frontend_hostname):
yejianquan marked this conversation as resolved.
Show resolved Hide resolved
def is_upstream_t2_dut(duthost, tbinfo):
upstream_nbr_type = "T3"
minigraph_facts = duthost.get_extended_minigraph_facts(tbinfo)
minigraph_neighbors = minigraph_facts['minigraph_neighbors']
for key, value in minigraph_neighbors.items():
if upstream_nbr_type in value['name']:
return True

return False


def test_load_minigraph_with_golden_config(duthosts, setup_env, tbinfo, enum_rand_one_per_hwsku_frontend_hostname):
"""
Test Golden Config override during load minigraph
Note: Skip full config override for multi-asic duts for now, because we
don't have CLI to get new golden config that contains 'localhost' and 'asicxx'
"""
duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
duthost_up = duthosts[enum_upstream_dut_hostname]
if not duthost.is_multi_asic:
pytest.skip("Skip override-config-table multi-asic testing on single-asic platforms,\
test provided golden config format is not compatible with single-asics")
topo_type = tbinfo["topo"]["type"]
if topo_type == 't2' and duthost != duthost_up:
if topo_type == 't2' and not is_upstream_t2_dut(duthost, tbinfo):
# Skip empty golden-config testing on upstream linecards,
# since the handling of empty golden config doesn't work on upstream linecards
load_minigraph_with_golden_empty_input(duthost)
Loading