aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2020-09-18 12:33:05 +0000
committerPeter Mikus <pmikus@cisco.com>2020-09-23 05:50:18 +0000
commita6a146fa760295d6e2a3169114e07a8c92477189 (patch)
tree145768d8dc8cf0145f82bf18e4536ca1d76628a1 /resources/libraries/python
parenteac13752fdccb5687f2ee0b41c128a6230fb1624 (diff)
Framework: AVF
Fix 1/3: Explicitly put PF interface up (this patch) Fix 2/3: Done on TB Fix 3/3: VPP bug displaying VF up if underlying PF is not up Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: I45d66986ec76e6e14eebaad6828ef72724c626ab
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/InterfaceUtil.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py
index e751160077..1245a3312a 100644
--- a/resources/libraries/python/InterfaceUtil.py
+++ b/resources/libraries/python/InterfaceUtil.py
@@ -1547,6 +1547,25 @@ class InterfaceUtil:
exec_cmd_no_error(node, cmd, sudo=True)
@staticmethod
+ def set_linux_interface_state(
+ node, interface, namespace=None, state=u"up"):
+ """Set operational state for interface in linux.
+
+ :param node: Node where to execute command.
+ :param interface: Interface in namespace.
+ :param namespace: Execute command in namespace. Optional
+ :param state: Up/Down.
+ :type node: dict
+ :type interface: str
+ :type namespace: str
+ :type state: str
+ """
+ ns_str = f"ip netns exec {namespace}" if namespace else u""
+
+ cmd = f"{ns_str} ip link set dev {interface} {state}"
+ exec_cmd_no_error(node, cmd, sudo=True)
+
+ @staticmethod
def init_avf_interface(node, ifc_key, numvfs=1, osi_layer=u"L2"):
"""Init PCI device by creating VIFs and bind them to vfio-pci for AVF
driver testing on DUT.
@@ -1610,6 +1629,9 @@ class InterfaceUtil:
InterfaceUtil.set_linux_interface_mac(
node, pf_dev, vf_mac_addr, vf_id=vf_id
)
+ InterfaceUtil.set_linux_interface_state(
+ node, pf_dev, state=u"up"
+ )
DUTSetup.pci_vf_driver_unbind(node, pf_pci_addr, vf_id)
DUTSetup.pci_vf_driver_bind(node, pf_pci_addr, vf_id, uio_driver)