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

Add sanity check command to debug PTF unreachable issue #16444

Merged
Merged
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
14 changes: 7 additions & 7 deletions tests/common/dualtor/data_plane_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ def run_test(
return tor_IO


def cleanup(ptfadapter, duthosts_list):
print_logs(duthosts_list, print_dual_tor_logs=True)
def cleanup(ptfadapter, duthosts_list, ptfhost):
print_logs(duthosts_list, ptfhost, print_dual_tor_logs=True)
# cleanup torIO
ptfadapter.dataplane.flush()
for duthost in duthosts_list:
Expand Down Expand Up @@ -303,7 +303,7 @@ def t1_to_server_io_test(activehost, tor_vlan_port=None,

yield t1_to_server_io_test

cleanup(ptfadapter, duthosts)
cleanup(ptfadapter, duthosts, ptfhost)


@pytest.fixture
Expand Down Expand Up @@ -373,7 +373,7 @@ def server_to_t1_io_test(activehost, tor_vlan_port=None,

yield server_to_t1_io_test

cleanup(ptfadapter, duthosts)
cleanup(ptfadapter, duthosts, ptfhost)


@pytest.fixture
Expand Down Expand Up @@ -402,7 +402,7 @@ def soc_to_t1_io_test(activehost, tor_vlan_port=None,

yield soc_to_t1_io_test

cleanup(ptfadapter, duthosts)
cleanup(ptfadapter, duthosts, ptfhost)


@pytest.fixture
Expand Down Expand Up @@ -433,7 +433,7 @@ def t1_to_soc_io_test(activehost, tor_vlan_port=None,

yield t1_to_soc_io_test

cleanup(ptfadapter, duthosts)
cleanup(ptfadapter, duthosts, ptfhost)


@pytest.fixture
Expand Down Expand Up @@ -479,4 +479,4 @@ def server_to_server_io_test(activehost, test_mux_ports, delay=0,

yield server_to_server_io_test

cleanup(ptfadapter, duthosts)
cleanup(ptfadapter, duthosts, ptfhost)
13 changes: 11 additions & 2 deletions tests/common/plugins/sanity_check/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def _update_check_items(old_items, new_items, supported_items):
return updated_items


def print_logs(duthosts, print_dual_tor_logs=False):
def print_logs(duthosts, ptfhost, print_dual_tor_logs=False):
for dut in duthosts:
logger.info("Run commands to print logs")

Expand All @@ -90,6 +90,15 @@ def print_logs(duthosts, print_dual_tor_logs=False):
cmds.remove(constants.PRINT_LOGS['mux_status'])
cmds.remove(constants.PRINT_LOGS['mux_config'])

# check PTF device reachability
if ptfhost.mgmt_ip:
cmds.append("ping {} -c 1 -W 3".format(ptfhost.mgmt_ip))
cmds.append("traceroute {}".format(ptfhost.mgmt_ip))

if ptfhost.mgmt_ipv6:
cmds.append("ping6 {} -c 1 -W 3".format(ptfhost.mgmt_ipv6))
cmds.append("traceroute6 {}".format(ptfhost.mgmt_ipv6))

results = dut.shell_cmds(cmds=cmds, module_ignore_errors=True, verbose=False)['results']
outputs = []
for res in results:
Expand Down Expand Up @@ -285,7 +294,7 @@ def sanity_check_full(ptfhost, prepare_parallel_run, localhost, duthosts, reques
for item in set(pre_check_items):
request.fixturenames.append(item)
dual_tor = 'dualtor' in tbinfo['topo']['name']
print_logs(duthosts, print_dual_tor_logs=dual_tor)
print_logs(duthosts, ptfhost, print_dual_tor_logs=dual_tor)

check_results = do_checks(request, pre_check_items, stage=STAGE_PRE_TEST)
logger.debug("Pre-test sanity check results:\n%s" %
Expand Down
Loading