aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--resources/libraries/python/DUTSetup.py29
-rw-r--r--resources/libraries/python/InterfaceUtil.py2
-rw-r--r--resources/libraries/python/SFC/SFCTest.py9
-rw-r--r--resources/libraries/python/SFC/VerifyPacket.py8
-rw-r--r--resources/libraries/python/honeycomb/HoneycombSetup.py7
5 files changed, 27 insertions, 28 deletions
diff --git a/resources/libraries/python/DUTSetup.py b/resources/libraries/python/DUTSetup.py
index efc588783a..7260292959 100644
--- a/resources/libraries/python/DUTSetup.py
+++ b/resources/libraries/python/DUTSetup.py
@@ -106,7 +106,7 @@ class DUTSetup(object):
:param node: DUT node.
:type node: dict
- :return: PID
+ :returns: PID
:rtype: int
:raises RuntimeError if it is not possible to get the PID.
"""
@@ -132,7 +132,7 @@ class DUTSetup(object):
else:
logger.debug("More then one VPP PID found on node {0}".
format(node['host']))
- ret_list = ()
+ ret_list = list()
for line in stdout.splitlines():
ret_list.append(int(line))
return ret_list
@@ -145,7 +145,7 @@ class DUTSetup(object):
:param nodes: DUT nodes.
:type nodes: dict
- :return: PIDs
+ :returns: PIDs
:rtype: dict
"""
@@ -186,8 +186,8 @@ class DUTSetup(object):
ssh.connect(node)
cryptodev = Topology.get_cryptodev(node)
- cmd = 'cat /sys/bus/pci/devices/{}/sriov_numvfs'.format(
- cryptodev.replace(':', r'\:'))
+ cmd = 'cat /sys/bus/pci/devices/{}/sriov_numvfs'.\
+ format(cryptodev.replace(':', r'\:'))
# Try to read number of VFs from PCI address of QAT device
for _ in range(3):
@@ -196,8 +196,8 @@ class DUTSetup(object):
try:
sriov_numvfs = int(stdout)
except ValueError:
- logger.trace('Reading sriov_numvfs info failed on: {}'\
- .format(node['host']))
+ logger.trace('Reading sriov_numvfs info failed on: {}'.
+ format(node['host']))
else:
if sriov_numvfs != numvfs:
if force_init:
@@ -205,9 +205,10 @@ class DUTSetup(object):
# with numvfs
DUTSetup.crypto_device_init(node, numvfs)
else:
- raise RuntimeError('QAT device {} is not '\
- 'initialized to {} on host: {}'.format(\
- cryptodev, numvfs, node['host']))
+ raise RuntimeError('QAT device {} is not '
+ 'initialized to {} on host: {}'.
+ format(cryptodev, numvfs,
+ node['host']))
break
@staticmethod
@@ -314,8 +315,8 @@ class DUTSetup(object):
# Module is not loaded and we want to load it
DUTSetup.kernel_module_load(node, module)
else:
- raise RuntimeError('Kernel module {} is not loaded on host: '\
- '{}'.format(module, node['host']))
+ raise RuntimeError('Kernel module {} is not loaded on host: {}'.
+ format(module, node['host']))
@staticmethod
def kernel_module_load(node, module):
@@ -335,5 +336,5 @@ class DUTSetup(object):
ret_code, _, _ = ssh.exec_command_sudo("modprobe {}".format(module))
if int(ret_code) != 0:
- raise RuntimeError('Failed to load {} kernel module on host: '\
- '{}'.format(module, node['host']))
+ raise RuntimeError('Failed to load {} kernel module on host: {}'.
+ format(module, node['host']))
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py
index 750029e197..71d36c1c9d 100644
--- a/resources/libraries/python/InterfaceUtil.py
+++ b/resources/libraries/python/InterfaceUtil.py
@@ -375,7 +375,7 @@ class InterfaceUtil(object):
if name == 'Driver:':
return value if value else None
else:
- raise RuntimeError('Get interface driver for: {0}'\
+ raise RuntimeError('Get interface driver for: {0}'
.format(pci_addr))
@staticmethod
diff --git a/resources/libraries/python/SFC/SFCTest.py b/resources/libraries/python/SFC/SFCTest.py
index ec08efd17c..2584632af9 100644
--- a/resources/libraries/python/SFC/SFCTest.py
+++ b/resources/libraries/python/SFC/SFCTest.py
@@ -20,11 +20,12 @@ from resources.libraries.python.ssh import SSH
from resources.libraries.python.constants import Constants as con
from resources.libraries.python.topology import Topology
+
class SFCTest(object):
"""Configure and Start the NSH SFC functional tests."""
@staticmethod
- def config_and_start_SFC_test(dut_node, dut_if1, dut_if2, if1_adj_mac,
+ def config_and_start_sfc_test(dut_node, dut_if1, dut_if2, if1_adj_mac,
if2_adj_mac, testtype):
"""
Start the SFC functional on the dut_node.
@@ -61,9 +62,9 @@ class SFCTest(object):
else:
exec_shell = "set_sfc_sff.sh"
- cmd = 'cd {0}/tests/nsh_sfc/sfc_scripts/ && sudo ./{1} {2} ' \
- '{3} {4} {5}'.format(con.REMOTE_FW_DIR, exec_shell, vpp_intf_name1,
- vpp_intf_name2, if1_adj_mac, if2_adj_mac)
+ cmd = 'cd {0}/tests/nsh_sfc/sfc_scripts/ && sudo ./{1} {2} {3} {4} ' \
+ '{5}'.format(con.REMOTE_FW_DIR, exec_shell, vpp_intf_name1,
+ vpp_intf_name2, if1_adj_mac, if2_adj_mac)
(ret_code, _, _) = ssh.exec_command(cmd, timeout=600)
if ret_code != 0:
diff --git a/resources/libraries/python/SFC/VerifyPacket.py b/resources/libraries/python/SFC/VerifyPacket.py
index fd72bb296b..189301002c 100644
--- a/resources/libraries/python/SFC/VerifyPacket.py
+++ b/resources/libraries/python/SFC/VerifyPacket.py
@@ -20,11 +20,9 @@ import ipaddress
from scapy.layers.inet import IP, UDP
from scapy.all import Raw
-from resources.libraries.python.constants import Constants as con
from resources.libraries.python.SFC.SFCConstants import SFCConstants as sfccon
from resources.libraries.python.SFC.TunnelProtocol import VxLAN, VxLANGPE, NSH
-from robot.api import logger
def valid_ipv4(ipaddr):
"""Check if IP address has the correct IPv4 address format.
@@ -185,9 +183,9 @@ class VerifyPacket(object):
recv_pkt_len = len(ether)
if recv_pkt_len != expect_pkt_len:
- raise RuntimeError("Received packet size {0} not " \
- "the expect size {1}".format(recv_pkt_len, \
- expect_pkt_len))
+ raise RuntimeError("Received packet size {0} not "
+ "the expect size {1}".format(recv_pkt_len,
+ expect_pkt_len))
if not ether.haslayer(IP):
raise RuntimeError("Not a IPv4 packet")
diff --git a/resources/libraries/python/honeycomb/HoneycombSetup.py b/resources/libraries/python/honeycomb/HoneycombSetup.py
index 32992c03de..bf948715e2 100644
--- a/resources/libraries/python/honeycomb/HoneycombSetup.py
+++ b/resources/libraries/python/honeycomb/HoneycombSetup.py
@@ -573,8 +573,7 @@ class HoneycombSetup(object):
"odl_client/odl_netconf_connector")
try:
- status_code, _ = HTTPRequest.get(node, path, timeout=10,
- enable_logging=False)
+ HTTPRequest.get(node, path, timeout=10, enable_logging=False)
raise HoneycombError("ODL client is still running.")
except HTTPRequestError:
logger.debug("Connection refused, checking process state....")
@@ -714,8 +713,8 @@ class HoneycombStartupConfig(object):
self.ssh.connect(node)
cmd = "echo '{config}' > /tmp/honeycomb " \
"&& chmod +x /tmp/honeycomb " \
- "&& sudo mv -f /tmp/honeycomb /opt/honeycomb".format(
- config=self.config)
+ "&& sudo mv -f /tmp/honeycomb /opt/honeycomb".\
+ format(config=self.config)
self.ssh.exec_command(cmd)
def set_cpu_scheduler(self, scheduler="FIFO"):