aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2020-01-20 12:49:02 +0100
committerJan Gelety <jgelety@cisco.com>2020-02-10 16:13:06 +0000
commit256743b509bec8dec3075d91e384b3e6bb01cf77 (patch)
tree87e1919c923920dfa2c56614ad8663ea2fbce300 /resources/libraries
parent574397e8d5e606ebeff4656d75829c494af418a9 (diff)
FIX: set host physical interface mac address to rdma interface
Reason is that the traffic generator is initialized with MAC addresses of physical interfaces in the suite setup while rdma interfaces are created later. Change-Id: I2cf182cde20f14778624740a1f0467096c336306 Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/libraries')
-rw-r--r--resources/libraries/python/InterfaceUtil.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py
index 5724af01c0..ad76eac4f8 100644
--- a/resources/libraries/python/InterfaceUtil.py
+++ b/resources/libraries/python/InterfaceUtil.py
@@ -492,6 +492,27 @@ class InterfaceUtil:
return if_data.get(u"l2_address")
@staticmethod
+ def vpp_set_interface_mac(node, interface, mac):
+ """Set MAC address for the given interface.
+
+ :param node: VPP node to set interface MAC.
+ :param interface: Numeric index or name string of a specific interface.
+ :param mac: Required MAC address.
+ :type node: dict
+ :type interface: int or str
+ :type mac: str
+ """
+ cmd = u"sw_interface_set_mac_address"
+ args = dict(
+ sw_if_index=InterfaceUtil.get_interface_index(node, interface),
+ mac_address=L2Util.mac_to_bin(mac)
+ )
+ err_msg = f"Failed to set MAC address of interface {interface}" \
+ f"on host {node[u'host']}"
+ with PapiSocketExecutor(node) as papi_exec:
+ papi_exec.add(cmd, **args).get_reply(err_msg)
+
+ @staticmethod
def tg_set_interface_driver(node, pci_addr, driver):
"""Set interface driver on the TG node.
@@ -1183,6 +1204,9 @@ class InterfaceUtil:
with PapiSocketExecutor(node) as papi_exec:
sw_if_index = papi_exec.add(cmd, **args).get_sw_if_index(err_msg)
+ InterfaceUtil.vpp_set_interface_mac(
+ node, sw_if_index, Topology.get_interface_mac(node, if_key)
+ )
InterfaceUtil.add_eth_interface(
node, sw_if_index=sw_if_index, ifc_pfx=u"eth_rdma",
host_if_key=if_key