Skip to content
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
18 changes: 13 additions & 5 deletions tests/show_techsupport/test_techsupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,18 @@ 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:
peer_addr_list = [(item['peer_addr']) for item in mg_facts["minigraph_interfaces"] if 'peer_addr' in item]
if peer_addr_list:
dst_ip = peer_addr_list[0]

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

yield str(dst_ip)


Expand Down Expand Up @@ -173,7 +182,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 +265,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)