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 test_techsupport.py so it could run with T1 topology #1538

Merged
merged 2 commits into from
Apr 6, 2020
Merged
Changes from 1 commit
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
16 changes: 11 additions & 5 deletions tests/show_techsupport/test_techsupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,16 @@ def neighbor_ip(duthost, testbed):
# ptf-32 topo is not supported in mirroring
if testbed['topo']['name'] == 'ptf32':
pytest.skip('Unsupported Topology')

mg_facts = duthost.minigraph_facts(host=duthost.hostname)['ansible_facts']
dst_ip = mg_facts["minigraph_portchannel_interfaces"][0]['peer_addr']
dst_ip = None
if mg_facts["minigraph_portchannel_interfaces"]:
dst_ip = mg_facts["minigraph_portchannel_interfaces"][0]['peer_addr']
else:
dst_ip = [(item['peer_addr']) for item in mg_facts["minigraph_interfaces"] if 'peer_addr' in item][0]
lguohan marked this conversation as resolved.
Show resolved Hide resolved

if dst_ip is None:
pytest.skip("No neighbor ip available. Skipping test.")

yield str(dst_ip)


Expand Down Expand Up @@ -173,7 +180,6 @@ def mirroring(duthost, neighbor_ip, mirror_setup, gre_version):
:param mirror_setup: mirror_setup fixture
:param mirror_config: mirror_config fixture
"""

logger.info("Adding mirror_session to DUT")
acl_rule_file = os.path.join(mirror_setup['dut_tmp_dir'], ACL_RULE_PERSISTENT_FILE)
extra_vars = {
Expand Down Expand Up @@ -257,8 +263,8 @@ def test_techsupport(request, config, duthost, testbed):

for i in range(loop_range):
logger.debug("Running show techsupport ... ")
wait_until(300, 20, execute_command, duthost, since)
tar_file = [i for i in pytest.tar_stdout.split('\n') if i != ''][-1]
wait_until(300, 20, execute_command, duthost, str(since))
tar_file = [j for j in pytest.tar_stdout.split('\n') if j != ''][-1]
stdout = duthost.command("rm -rf {}".format(tar_file))
logger.debug("Sleeping for {} seconds".format(loop_delay))
time.sleep(loop_delay)