diff options
author | Peter Mikus <pmikus@cisco.com> | 2020-04-22 16:10:58 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2020-04-23 14:16:57 +0000 |
commit | 01015c9025452966b23182c90fc6a5410a4ab31c (patch) | |
tree | 9381e85d65963053e303724bc87c3a958a039ac3 /resources/libraries/python/InterfaceUtil.py | |
parent | 5ff0bea21003b3cae863c5c48a8922bd0c448019 (diff) |
FIX: Mellanox jumbo frames
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Change-Id: I84b3c07e22a313e96ac59fc7818960c502507651
Diffstat (limited to 'resources/libraries/python/InterfaceUtil.py')
-rw-r--r-- | resources/libraries/python/InterfaceUtil.py | 43 |
1 files changed, 9 insertions, 34 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 9dcd1f8321..5bb6264676 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -228,45 +228,20 @@ class InterfaceUtil: ) @staticmethod - def set_interface_ethernet_mtu(node, iface_key, mtu): + def set_interface_mtu(node, pf_pcis, mtu=9200): """Set Ethernet MTU for specified interface. - Function can be used only for TGs. - - :param node: Node where the interface is. - :param iface_key: Interface key from topology file. - :param mtu: MTU to set. - :type node: dict - :type iface_key: str + :param node: Topology node. + :param pf_pcis: List of node's interfaces PCI addresses. + :param mtu: MTU to set. Default: 9200. + :type nodes: dict + :type pf_pcis: list :type mtu: int - :returns: Nothing. - :raises ValueError: If the node type is "DUT". - :raises ValueError: If the node has an unknown node type. """ - if node[u"type"] == NodeType.DUT: - msg = f"Node {node[u'host']}: Setting Ethernet MTU for interface " \ - f"on DUT nodes not supported" - elif node[u"type"] != NodeType.TG: - msg = f"Node {node[u'host']} has unknown NodeType: {node[u'type']}" - else: - iface_name = Topology.get_interface_name(node, iface_key) - cmd = f"ip link set {iface_name} mtu {mtu}" + for pf_pci in pf_pcis: + pf_eth = InterfaceUtil.pci_to_eth(node, pf_pci) + cmd = f"ip link set {pf_eth} mtu {mtu}" exec_cmd_no_error(node, cmd, sudo=True) - return - raise ValueError(msg) - - @staticmethod - def set_default_ethernet_mtu_on_all_interfaces_on_node(node): - """Set default Ethernet MTU on all interfaces on node. - - Function can be used only for TGs. - - :param node: Node where to set default MTU. - :type node: dict - :returns: Nothing. - """ - for ifc in node[u"interfaces"]: - InterfaceUtil.set_interface_ethernet_mtu(node, ifc, 1500) @staticmethod def vpp_set_interface_mtu(node, interface, mtu=9200): |