aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
Diffstat (limited to 'resources')
-rw-r--r--resources/api/vpp/supported_crcs.yaml2
-rw-r--r--resources/libraries/python/InterfaceUtil.py24
2 files changed, 26 insertions, 0 deletions
diff --git a/resources/api/vpp/supported_crcs.yaml b/resources/api/vpp/supported_crcs.yaml
index f7a943b371..fd4ba73cc9 100644
--- a/resources/api/vpp/supported_crcs.yaml
+++ b/resources/api/vpp/supported_crcs.yaml
@@ -245,6 +245,8 @@
sw_interface_set_l2_bridge_reply: '0xe8d4e804' # dev
sw_interface_set_l2_xconnect: '0x95de3988' # dev
sw_interface_set_l2_xconnect_reply: '0xe8d4e804' # dev
+ sw_interface_set_mac_address: '0x6aca746a' # perf
+ sw_interface_set_mac_address_reply: '0xe8d4e804' # perf
sw_interface_set_rx_placement: '0xdb65f3c9' # perf
sw_interface_set_rx_placement_reply: '0xe8d4e804' # perf
# ^^ see tc01-64B-1c-dot1q-l2bdbasemaclrn-eth-2memif-1dcr-mrr above
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