Skip to content
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
10 changes: 3 additions & 7 deletions tests/arp/test_wr_arp.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def removePtfhostIp(self, ptfhost):
ptfhost.script('./scripts/remove_ip.sh')

@pytest.fixture(scope='class', autouse=True)
def prepareSshKeys(self, duthost, ptfhost):
def prepareSshKeys(self, duthost, ptfhost, creds):
'''
Prepares testbed ssh keys by generating ssh key on ptf host and adding this key to known_hosts on duthost
This class-scope fixture runs once before test start
Expand All @@ -182,15 +182,11 @@ def prepareSshKeys(self, duthost, ptfhost):
Returns:
None
'''
hostVars = duthost.host.options['variable_manager']._hostvars[duthost.hostname]
invetory = hostVars['inventory_file'].split('/')[-1]
secrets = duthost.host.options['variable_manager']._hostvars[duthost.hostname]['secret_group_vars']

prepareTestbedSshKeys(duthost, ptfhost, secrets[invetory]['sonicadmin_user'])
prepareTestbedSshKeys(duthost, ptfhost, creds['sonicadmin_user'])

def testWrArp(self, request, duthost, ptfhost):
'''
Control Plane Assistent test for Warm-Reboot.
Control Plane Assistant test for Warm-Reboot.

The test first start Ferret server, implemented in Python. Then initiate Warm-Reboot procedure. While the
host in Warm-Reboot test continuously sending ARP request to the Vlan member ports and expect to receive ARP
Expand Down
20 changes: 9 additions & 11 deletions tests/common/fixtures/advanced_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ class AdvancedReboot:
'''
AdvancedReboot is used to perform reboot dut while running preboot/inboot operations

Thed class collects information about the current testbed. This information is used by test cases to build
This class collects information about the current testbed. This information is used by test cases to build
inboot/preboot list. The class transfers number of configuration files to the dut/ptf in preparation for reboot test.
Test cases can trigger test start utilizing runRebootTestcase API.
'''
def __init__(self, request, duthost, ptfhost, localhost, testbed, **kwargs):
def __init__(self, request, duthost, ptfhost, localhost, testbed, creds, **kwargs):
'''
Class contructor.
Class constructor.
@param request: pytest request object
@param duthost: AnsibleHost instance of DUT
@param ptfhost: PTFHost for interacting with PTF through ansible
Expand All @@ -44,6 +44,7 @@ def __init__(self, request, duthost, ptfhost, localhost, testbed, **kwargs):
self.ptfhost = ptfhost
self.localhost = localhost
self.testbed = testbed
self.creds = creds
self.__dict__.update(kwargs)
self.__extractTestParam()
self.rebootData = {}
Expand Down Expand Up @@ -121,11 +122,8 @@ def __buildTestbedData(self):
self.rebootData['vlan_ip_range'] = self.mgFacts['minigraph_vlan_interfaces'][0]['subnet']
self.rebootData['dut_vlan_ip'] = self.mgFacts['minigraph_vlan_interfaces'][0]['addr']

hostVars = self.duthost.host.options['variable_manager']._hostvars[self.duthost.hostname]
invetory = hostVars['inventory_file'].split('/')[-1]
secrets = hostVars['secret_group_vars']
self.rebootData['dut_username'] = secrets[invetory]['sonicadmin_user']
self.rebootData['dut_password'] = secrets[invetory]['sonicadmin_password']
self.rebootData['dut_username'] = creds['sonicadmin_user']
self.rebootData['dut_password'] = creds['sonicadmin_password']

# Change network of the dest IP addresses (used by VM servers) to be different from Vlan network
prefixLen = self.mgFacts['minigraph_vlan_interfaces'][0]['prefixlen'] - 3
Expand Down Expand Up @@ -449,7 +447,7 @@ def __runPtfRunner(self, rebootOper=None):

def __restorePrevImage(self):
'''
Resotre previous image and reboot DUT
Restore previous image and reboot DUT
'''
currentImage = self.duthost.shell('sonic_installer list | grep Current | cut -f2 -d " "')['stdout']
if currentImage != self.currentImage:
Expand Down Expand Up @@ -481,7 +479,7 @@ def tearDown(self):
self.__restorePrevImage()

@pytest.fixture
def get_advanced_reboot(request, duthost, ptfhost, localhost, testbed):
def get_advanced_reboot(request, duthost, ptfhost, localhost, testbed, creds):
'''
Pytest test fixture that provides access to AdvancedReboot test fixture
@param request: pytest request object
Expand All @@ -497,7 +495,7 @@ def get_advanced_reboot(**kwargs):
API that returns instances of AdvancedReboot class
'''
assert len(instances) == 0, "Only one instance of reboot data is allowed"
advancedReboot = AdvancedReboot(request, duthost, ptfhost, localhost, testbed, **kwargs)
advancedReboot = AdvancedReboot(request, duthost, ptfhost, localhost, testbed, creds, **kwargs)
instances.append(advancedReboot)
return advancedReboot

Expand Down