Skip to content
Open
Show file tree
Hide file tree
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
19 changes: 10 additions & 9 deletions tests/override_config_table/test_override_config_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
from tests.common import mellanox_data
from tests.common import broadcom_data

# Tables known to be overriden in run-time config, which will appear different
# if the golden config is overridden empty.
GOLDEN_OVERRRIDDEN_TABLES = ["FEATURE", "PORT"]

GOLDEN_CONFIG = "/etc/sonic/golden_config_db.json"
GOLDEN_CONFIG_BACKUP = "/etc/sonic/golden_config_db.json_before_override"
Expand Down Expand Up @@ -94,21 +97,19 @@ def load_minigraph_with_golden_empty_input(duthost):
reload_minigraph_with_golden_config(duthost, empty_input)

current_config = get_running_config(duthost)
problem_tables = []
for table in initial_config:
if table in NON_USER_CONFIG_TABLES:
if table in NON_USER_CONFIG_TABLES or table in GOLDEN_OVERRRIDDEN_TABLES:
continue

if table == "ACL_TABLE":
pytest_assert(
compare_dicts_ignore_list_order(initial_config[table], current_config[table]),
"empty input ACL_TABLE compare fail!"
)
if not compare_dicts_ignore_list_order(initial_config[table], current_config[table]):
problem_tables.append(table)
else:
pytest_assert(
initial_config[table] == current_config[table],
"empty input compare fail! {}".format(table)
)
if not initial_config[table] == current_config[table]:
problem_tables.append(table)

pytest_assert(not problem_tables, "empty input compare fail: {}".format(problem_tables))

def load_minigraph_with_golden_partial_config(duthost):
"""Test Golden Config with partial config.
Expand Down
39 changes: 28 additions & 11 deletions tests/override_config_table/test_override_config_table_masic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
from tests.common.utilities import update_pfcwd_default_state
from tests.common.config_reload import config_reload
from tests.common.utilities import backup_config, restore_config, get_running_config,\
reload_minigraph_with_golden_config, file_exists_on_dut, NON_USER_CONFIG_TABLES
reload_minigraph_with_golden_config, file_exists_on_dut, compare_dicts_ignore_list_order, \
NON_USER_CONFIG_TABLES

# Tables known to be overriden in run-time config, which will appear different
# if the golden config is overridden empty.
GOLDEN_OVERRRIDDEN_TABLES = ["FEATURE", "PORT"]

GOLDEN_CONFIG = "/etc/sonic/golden_config_db.json"
GOLDEN_CONFIG_BACKUP = "/etc/sonic/golden_config_db.json_before_override"
Expand Down Expand Up @@ -89,28 +94,40 @@ def load_minigraph_with_golden_empty_input(duthost):
initial_asic0_config = get_running_config(duthost, "asic0")

empty_input = {}

problem_tuples = []

reload_minigraph_with_golden_config(duthost, empty_input)

# Test host running config override
host_current_config = get_running_config(duthost)
for table in initial_host_config:
if table in NON_USER_CONFIG_TABLES:
if table in NON_USER_CONFIG_TABLES or table in GOLDEN_OVERRRIDDEN_TABLES:
continue
pytest_assert(
initial_host_config[table] == host_current_config[table],
"empty input compare fail! {}".format(table)
)

if table == "ACL_TABLE":
if not compare_dicts_ignore_list_order(initial_host_config[table],
host_current_config[table]):
problem_tuples.append((table, None))
else:
if not initial_host_config[table] == host_current_config[table]:
problem_tuples.append((table, None))

# Test asic0 running config override
asic0_current_config = get_running_config(duthost, "asic0")
for table in initial_asic0_config:
if table in NON_USER_CONFIG_TABLES:
if table in NON_USER_CONFIG_TABLES or table in GOLDEN_OVERRRIDDEN_TABLES:
continue
pytest_assert(
initial_asic0_config[table] == asic0_current_config[table],
"empty input compare fail! {}".format(table)
)

if table == "ACL_TABLE":
if not compare_dicts_ignore_list_order(initial_asic0_config[table],
asic0_current_config[table]):
problem_tuples.append((table, "asic0"))
else:
if not initial_asic0_config[table] == asic0_current_config[table]:
problem_tuples.append((table, "asic0"))

pytest_assert(not problem_tuples, "empty input compare fail: {}".format(problem_tuples))

def load_minigraph_with_golden_partial_config(duthost):
"""Test Golden Config with partial config.
Expand Down
Loading