11import logging
22import pytest
33import time
4+ from tests .common import config_reload
45from tests .common .utilities import wait_until
56
67from tests .common .helpers .assertions import pytest_assert
@@ -172,9 +173,8 @@ def prepare_test(self, duthosts, rand_one_dut_hostname, ptfhost):
172173
173174 yield target_ports_to_ptf_mapping , ptf_ports_available_in_topo , conf_facts
174175
175- logging .info ("startup all interfaces on DUT" )
176- for port in dut_ports :
177- duthost .shell ("sudo config interface startup {}" .format (port ))
176+ logging .info ("reload device %s to recover" , duthost .hostname )
177+ config_reload (duthost , config_source = 'running_golden_config' , safe_reload = True )
178178
179179 @pytest .fixture (autouse = True )
180180 def cleanup_arp_fdb (self , duthosts , rand_one_dut_hostname ):
@@ -309,8 +309,6 @@ def testARPCompleted(self, ptfadapter, duthosts, rand_one_dut_hostname, ptfhost,
309309 self .configureNeighborIp (ptfhost , ptf_ports_available_in_topo [ptf_port_index ], action = "add" )
310310 time .sleep (2 )
311311 ptfhost .shell ("ping {} -c 3 -I {}" .format (self .DUT_INTF_IP , self .PTF_HOST_IP ), module_ignore_errors = True )
312-
313- finally :
314312 int_ip_found = any ((dut_interface in line and self .DUT_INTF_IP in line )
315313 for line in duthost .command ("show ip interface" )["stdout_lines" ])
316314 pytest_assert (int_ip_found , "%s is not configured on %s" % (self .DUT_INTF_IP , dut_interface ))
@@ -323,5 +321,6 @@ def testARPCompleted(self, ptfadapter, duthosts, rand_one_dut_hostname, ptfhost,
323321 pytest_assert (items [2 ] == dut_interface , "ARP entry for ip address {}"
324322 " is incomplete. Interface is missing" .format (self .PTF_HOST_IP ))
325323 pytest_assert (arp_found , "ARP entry not found for ip address {}" .format (self .PTF_HOST_IP ))
324+ finally :
326325 self .configureInterfaceIp (duthost , dut_interface , action = "remove" )
327326 self .configureNeighborIp (ptfhost , ptf_ports_available_in_topo [ptf_port_index ], action = "del" )
0 commit comments