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

Fix the Keyerror issue caused by none conn_graph_fact in VS set-up #12751

Merged
3 changes: 3 additions & 0 deletions .azure-pipelines/pr_test_scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ dpu:

onboarding_t0:
- console/test_console_availability.py
- platform_tests/test_power_off_reboot.py
- platform_tests/test_sequential_restart.py
- platform_tests/test_xcvr_info_in_db.py


specific_param:
Expand Down
4 changes: 2 additions & 2 deletions tests/platform_tests/test_power_off_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def teardown_module(duthosts, enum_supervisor_dut_hostname, conn_graph_facts, xc
yield

logging.info("Tearing down: to make sure all the critical services, interfaces and transceivers are good")
interfaces = conn_graph_facts["device_conn"][duthost.hostname]
interfaces = conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {})
check_critical_processes(duthost, watch_secs=10)
check_interfaces_and_services(duthost, interfaces, xcvr_skip_list, INTERFACE_WAIT_TIME)

Expand Down Expand Up @@ -117,7 +117,7 @@ def test_power_off_reboot(duthosts, localhost, enum_supervisor_dut_hostname, con
poweroff_reboot_kwargs["all_outlets"] = all_outlets
poweroff_reboot_kwargs["power_on_seq"] = power_on_seq
poweroff_reboot_kwargs["delay_time"] = power_off_delay
reboot_and_check(localhost, duthost, conn_graph_facts["device_conn"][duthost.hostname],
reboot_and_check(localhost, duthost, conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {}),
xcvr_skip_list, REBOOT_TYPE_POWEROFF,
_power_off_reboot_helper, poweroff_reboot_kwargs)
except Exception as e:
Expand Down
14 changes: 7 additions & 7 deletions tests/platform_tests/test_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def teardown_module(duthosts, enum_rand_one_per_hwsku_hostname,

logging.info(
"Tearing down: to make sure all the critical services, interfaces and transceivers are good")
interfaces = conn_graph_facts["device_conn"][duthost.hostname]
interfaces = conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {})
wait_for_startup(duthost, localhost, delay=10, timeout=300)
check_critical_processes(duthost, watch_secs=10)
check_interfaces_and_services(duthost, interfaces, xcvr_skip_list)
Expand Down Expand Up @@ -171,7 +171,7 @@ def test_cold_reboot(duthosts, enum_rand_one_per_hwsku_hostname,
@summary: This test case is to perform cold reboot and check platform status
"""
duthost = duthosts[enum_rand_one_per_hwsku_hostname]
reboot_and_check(localhost, duthost, conn_graph_facts["device_conn"][duthost.hostname],
reboot_and_check(localhost, duthost, conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {}),
xcvr_skip_list, reboot_type=REBOOT_TYPE_COLD, duthosts=duthosts)


Expand All @@ -192,7 +192,7 @@ def test_soft_reboot(duthosts, enum_rand_one_per_hwsku_hostname,
if duthost.is_multi_asic:
pytest.skip("Multi-ASIC devices not supporting soft reboot")

reboot_and_check(localhost, duthost, conn_graph_facts["device_conn"][duthost.hostname],
reboot_and_check(localhost, duthost, conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {}),
xcvr_skip_list, reboot_type=REBOOT_TYPE_SOFT, duthosts=duthosts)


Expand All @@ -207,7 +207,7 @@ def test_fast_reboot(duthosts, enum_rand_one_per_hwsku_hostname,
if duthost.is_multi_asic:
pytest.skip("Multi-ASIC devices not supporting fast reboot")

reboot_and_check(localhost, duthost, conn_graph_facts["device_conn"][duthost.hostname],
reboot_and_check(localhost, duthost, conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {}),
xcvr_skip_list, reboot_type=REBOOT_TYPE_FAST, duthosts=duthosts)


Expand All @@ -230,7 +230,7 @@ def test_warm_reboot(duthosts, enum_rand_one_per_hwsku_hostname,
pytest.skip(
"ISSU is not supported on this DUT, skip this test case")

reboot_and_check(localhost, duthost, conn_graph_facts["device_conn"][duthost.hostname],
reboot_and_check(localhost, duthost, conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {}),
xcvr_skip_list, reboot_type=REBOOT_TYPE_WARM, duthosts=duthosts)


Expand Down Expand Up @@ -260,7 +260,7 @@ def test_watchdog_reboot(duthosts, enum_rand_one_per_hwsku_hostname,
# reboot on the DUT.
duthost.shell("sudo systemctl stop cpu_wdt", module_ignore_errors=True)

reboot_and_check(localhost, duthost, conn_graph_facts["device_conn"][duthost.hostname],
reboot_and_check(localhost, duthost, conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {}),
xcvr_skip_list, REBOOT_TYPE_WATCHDOG, duthosts=duthosts)
finally:
if "x86_64-cel_e1031-r0" in duthost.facts['platform']:
Expand All @@ -277,7 +277,7 @@ def test_continuous_reboot(duthosts, enum_rand_one_per_hwsku_hostname,
ls_starting_out = set(duthost.shell(
"ls /dev/C0-*", module_ignore_errors=True)["stdout"].split())
for i in range(3):
reboot_and_check(localhost, duthost, conn_graph_facts["device_conn"][duthost.hostname],
reboot_and_check(localhost, duthost, conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {}),
xcvr_skip_list, reboot_type=REBOOT_TYPE_COLD, duthosts=duthosts)
ls_ending_out = set(duthost.shell(
"ls /dev/C0-*", module_ignore_errors=True)["stdout"].split())
Expand Down
2 changes: 1 addition & 1 deletion tests/platform_tests/test_reload_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_reload_configuration(duthosts, enum_rand_one_per_hwsku_hostname,
@summary: This test case is to reload the configuration and check platform status
"""
duthost = duthosts[enum_rand_one_per_hwsku_hostname]
interfaces = conn_graph_facts["device_conn"][duthost.hostname]
interfaces = conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {})
asic_type = duthost.facts["asic_type"]

if config_force_option_supported(duthost):
Expand Down
6 changes: 3 additions & 3 deletions tests/platform_tests/test_sequential_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def test_restart_swss(duthosts, enum_rand_one_per_hwsku_hostname, enum_frontend_
@summary: This test case is to restart the swss service and check platform status
"""
duthost = duthosts[enum_rand_one_per_hwsku_hostname]
all_interfaces = conn_graph_facts["device_conn"][duthost.hostname]
all_interfaces = conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {})

if enum_frontend_asic_index is not None:
# Get the interface pertaining to that asic
Expand All @@ -124,5 +124,5 @@ def test_restart_syncd(duthosts, enum_rand_one_per_hwsku_hostname, enum_frontend
@summary: This test case is to restart the syncd service and check platform status
"""
duthost = duthosts[enum_rand_one_per_hwsku_hostname]
restart_service_and_check(localhost, duthost, enum_frontend_asic_index,
"syncd", conn_graph_facts["device_conn"][duthost.hostname], xcvr_skip_list)
restart_service_and_check(localhost, duthost, enum_frontend_asic_index, "syncd",
conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {}), xcvr_skip_list)
4 changes: 2 additions & 2 deletions tests/platform_tests/test_xcvr_info_in_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ def test_xcvr_info_in_db(duthosts, enum_rand_one_per_hwsku_frontend_hostname,
"""
duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
logging.info("Check transceiver status")
all_interfaces = conn_graph_facts["device_conn"][duthost.hostname]
all_interfaces = conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {})

if enum_frontend_asic_index is not None:
# Get the interface pertaining to that asic
interface_list = get_port_map(duthost, enum_frontend_asic_index)

# Check if the interfaces of this AISC is present in conn_graph_facts
all_interfaces = {k: v for k, v in list(interface_list.items())
if k in conn_graph_facts["device_conn"][duthost.hostname]}
if k in conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {})}
logging.info("ASIC {} interface_list {}".format(
enum_frontend_asic_index, all_interfaces))

Expand Down
Loading