diff options
-rw-r--r-- | resources/libraries/python/InterfaceUtil.py | 24 | ||||
-rw-r--r-- | resources/libraries/robot/l2/l2_bridge_domain.robot | 8 | ||||
-rw-r--r-- | resources/libraries/robot/l2/l2_xconnect.robot | 6 | ||||
-rw-r--r-- | resources/libraries/robot/overlay/srv6.robot | 8 | ||||
-rw-r--r-- | resources/libraries/robot/performance/performance_vars.robot | 13 | ||||
-rw-r--r-- | resources/libraries/robot/shared/interfaces.robot | 34 |
6 files changed, 38 insertions, 55 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 24a65e86a9..7e645d1f5f 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -347,32 +347,28 @@ class InterfaceUtil: exec_cmd_no_error(node, cmd, sudo=True) @staticmethod - def vpp_set_interface_mtu(node, interface, mtu=9200): - """Set Ethernet MTU on interface. + def vpp_set_interface_mtu(node, interface, mtu): + """Apply new MTU value to a VPP hardware interface. + + The interface should be down when this is called. :param node: VPP node. - :param interface: Interface to setup MTU. Default: 9200. + :param interface: Interface to set MTU on. :param mtu: Ethernet MTU size in Bytes. :type node: dict :type interface: str or int :type mtu: int + :raises AsserionError: If VPP refused to change the MTU or set if state. """ if isinstance(interface, str): sw_if_index = Topology.get_interface_sw_index(node, interface) else: sw_if_index = interface - cmd = u"hw_interface_set_mtu" err_msg = f"Failed to set interface MTU on host {node[u'host']}" - args = dict( - sw_if_index=sw_if_index, - mtu=int(mtu) - ) - try: - with PapiSocketExecutor(node) as papi_exec: - papi_exec.add(cmd, **args).get_reply(err_msg) - except AssertionError as err: - logger.debug(f"Setting MTU failed.\n{err}") + args = dict(sw_if_index=sw_if_index, mtu=int(mtu)) + with PapiSocketExecutor(node) as papi_exec: + papi_exec.add(cmd, **args).get_reply(err_msg) @staticmethod def vpp_node_interfaces_ready_wait(node, retries=15): @@ -1994,7 +1990,7 @@ class InterfaceUtil: thread_data = VPPUtil.vpp_show_threads(node) worker_cnt = len(thread_data) - 1 if not worker_cnt: - return None + return worker_ids = list() if workers: for item in thread_data: diff --git a/resources/libraries/robot/l2/l2_bridge_domain.robot b/resources/libraries/robot/l2/l2_bridge_domain.robot index dbf26d3f84..00044e1253 100644 --- a/resources/libraries/robot/l2/l2_bridge_domain.robot +++ b/resources/libraries/robot/l2/l2_bridge_domain.robot @@ -1,5 +1,5 @@ -# Copyright (c) 2022 Cisco and/or its affiliates. -# Copyright (c) 2022 PANTHEON.tech and/or its affiliates. +# Copyright (c) 2023 Cisco and/or its affiliates. +# Copyright (c) 2023 PANTHEON.tech and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -491,8 +491,6 @@ | | Set interfaces in path up | | ${dut1_eth_bond_if1}= | VPP Create Bond Interface | | ... | ${dut1} | ${bond_mode} | ${lb_mode} -| | Set Interface State | ${dut1} | ${dut1_eth_bond_if1} | up -| | VPP Set interface MTU | ${dut1} | ${dut1_eth_bond_if1} | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1 | | | ${_even}= | Evaluate | ${pf} % 2 | | | Run Keyword If | not ${even} @@ -501,8 +499,6 @@ | | END | | ${dut2_eth_bond_if1}= | VPP Create Bond Interface | | ... | ${dut2} | ${bond_mode} | ${lb_mode} -| | Set Interface State | ${dut2} | ${dut2_eth_bond_if1} | up -| | VPP Set interface MTU | ${dut2} | ${dut2_eth_bond_if1} | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1 | | | ${_even}= | Evaluate | ${pf} % 2 | | | Run Keyword If | ${even} diff --git a/resources/libraries/robot/l2/l2_xconnect.robot b/resources/libraries/robot/l2/l2_xconnect.robot index 1d4d40db3d..b782602827 100644 --- a/resources/libraries/robot/l2/l2_xconnect.robot +++ b/resources/libraries/robot/l2/l2_xconnect.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Cisco and/or its affiliates. +# Copyright (c) 2023 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -243,8 +243,6 @@ | | Set interfaces in path up | | ${dut1_eth_bond_if1}= | VPP Create Bond Interface | | ... | ${dut1} | ${bond_mode} | ${lb_mode} -| | Set Interface State | ${dut1} | ${dut1_eth_bond_if1} | up -| | VPP Set interface MTU | ${dut1} | ${dut1_eth_bond_if1} | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1 | | | ${_even}= | Evaluate | ${pf} % 2 | | | Run Keyword If | not ${even} @@ -253,8 +251,6 @@ | | END | | ${dut2_eth_bond_if1}= | VPP Create Bond Interface | | ... | ${dut2} | ${bond_mode} | ${lb_mode} -| | Set Interface State | ${dut2} | ${dut2_eth_bond_if1} | up -| | VPP Set interface MTU | ${dut2} | ${dut2_eth_bond_if1} | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1 | | | ${_even}= | Evaluate | ${pf} % 2 | | | Run Keyword If | ${even} diff --git a/resources/libraries/robot/overlay/srv6.robot b/resources/libraries/robot/overlay/srv6.robot index 6ce7f74712..83ec8949a4 100644 --- a/resources/libraries/robot/overlay/srv6.robot +++ b/resources/libraries/robot/overlay/srv6.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Cisco and/or its affiliates. +# Copyright (c) 2023 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -367,16 +367,10 @@ | | Set up memif interfaces on DUT node | ${dut1} | ${sock1} | ${sock1} | | ... | ${1} | dut1-memif-1-if1 | dut1-memif-1-if2 | ${rxq_count_int} | | ... | ${rxq_count_int} -| | VPP Set interface MTU | ${dut1} | ${dut1-memif-1-if1} -| | VPP Set interface MTU | ${dut1} | ${dut1-memif-1-if2} | | Run Keyword If | ${dut2_status} | | ... | Set up memif interfaces on DUT node | ${dut2} | ${sock2} | ${sock2} | | ... | ${1} | dut2-memif-1-if1 | dut2-memif-1-if2 | ${rxq_count_int} | | ... | ${rxq_count_int} -| | Run Keyword If | ${dut2_status} -| | ... | VPP Set interface MTU | ${dut2} | ${dut2-memif-1-if1} -| | Run Keyword If | ${dut2_status} -| | ... | VPP Set interface MTU | ${dut2} | ${dut2-memif-1-if2} | | FOR | ${dut} | IN | @{duts} | | | Show Memif | ${nodes['${dut}']} | | END diff --git a/resources/libraries/robot/performance/performance_vars.robot b/resources/libraries/robot/performance/performance_vars.robot index 0721634f71..a0fa277e4c 100644 --- a/resources/libraries/robot/performance/performance_vars.robot +++ b/resources/libraries/robot/performance/performance_vars.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Cisco and/or its affiliates. +# Copyright (c) 2023 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -404,6 +404,8 @@ | | ... | *Test variables set:* | | ... | - jumbo - Jumbo boolean, true if jumbo packet support has to be | | ... | enabled. Type: boolean +| | ... | - recommended_mtu - Resonable value (with space for encap overhead) +| | ... | according to jumbo. Type: int | | | | ... | *Example:* | | @@ -413,11 +415,14 @@ | | Set Numeric Frame Sizes | | ${jumbo} = | Evaluate | ${max_frame_size} >= 1522 | | Set Test Variable | \${jumbo} +| | ${recommended_mtu} = | Set Variable If | ${jumbo} | ${9200} | ${1800} +| | Set Test Variable | \${recommended_mtu} | Set Max Rate And Jumbo | | [Documentation] -| | ... | This keyword computes maximal unidirectional transmit rate -| | ... | and jumbo boolean (some suites need that for configuration decisions). +| | ... | This keyword computes maximal unidirectional transmit rate, +| | ... | jumbo boolean (some suites need that for configuration decisions), +| | ... | and recommended MTU value (depends on jumbo). | | ... | To streamline suite autogeneration, both input and output values | | ... | are communicated as test (or broader scope) variables, | | ... | instead of explicit arguments and return values. @@ -447,6 +452,8 @@ | | ... | Type: float | | ... | - jumbo - Jumbo boolean, true if jumbo packet support has to be | | ... | enabled. Type: boolean +| | ... | - recommended_mtu - Resonable value (with space for encap overhead) +| | ... | according to jumbo. Type: int | | ... | - max_frame_size - Maximal frame size including overhead. Type: float | | ... | - avg_directional_frame_size - Average frame size including overhead | | ... | for the more loaded direction. Type: float diff --git a/resources/libraries/robot/shared/interfaces.robot b/resources/libraries/robot/shared/interfaces.robot index 6279dd0bd2..a905373401 100644 --- a/resources/libraries/robot/shared/interfaces.robot +++ b/resources/libraries/robot/shared/interfaces.robot @@ -22,7 +22,7 @@ | Set single interfaces in path up | | [Documentation] | | ... | *Set UP state on single physical VPP interfaces in path on all DUT -| | ... | nodes and set maximal MTU.* +| | ... | nodes.* | | | | ... | *Arguments:* | | ... | - pf - NIC physical function (physical port). @@ -41,8 +41,7 @@ | Set interfaces in path up | | [Documentation] -| | ... | *Set UP state on VPP interfaces in path on all DUT nodes and set -| | ... | maximal MTU.* +| | ... | *Set UP state on VPP interfaces in path on all DUT nodes.* | | | | ... | *Arguments:* | | ... | - validate - Validate interfaces are up. @@ -58,8 +57,7 @@ | Set interfaces in path up on node | | [Documentation] -| | ... | *Set UP state on VPP interfaces in path on specified DUT node and -| | ... | set maximal MTU.* +| | ... | *Set UP state on VPP interfaces in path on specified DUT node.* | | | | ... | *Arguments:* | | ... | - dut - DUT node on which to set the interfaces up. @@ -77,8 +75,7 @@ | Set interfaces in path up on node on PF | | [Documentation] -| | ... | *Set UP state on VPP interfaces in path on specified DUT node and -| | ... | set maximal MTU.* +| | ... | *Set UP state on VPP interfaces in path on specified DUT node.* | | | | ... | *Arguments:* | | ... | - dut - DUT node on which to set the interfaces up. @@ -97,7 +94,6 @@ | | ${_id}= | Set Variable If | '${_chains}' == 'PASS' | _1 | ${EMPTY} | | FOR | ${if} | IN | @{${dut}_${int}${pf}${_id}} | | | Set Interface State | ${nodes['${dut}']} | ${if} | up -| | | VPP Set Interface MTU | ${nodes['${dut}']} | ${if} | | END | Pre-initialize layer driver @@ -181,10 +177,8 @@ | | ... | Pre-initialize rdma-core driver. | | | | FOR | ${dut} | IN | @{duts} -| | | Run Keyword If | ${jumbo} -| | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=9200 -| | | ... | ELSE -| | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=1518 +| | | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} +| | | ... | mtu=${recommended_mtu} | | | Set Interface Flow Control | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off" | | END @@ -194,10 +188,6 @@ | | ... | Pre-initialize mlx5_core driver. | | | | FOR | ${dut} | IN | @{duts} -| | | Run Keyword If | ${jumbo} -| | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=9200 -| | | ... | ELSE -| | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=1518 | | | Set Interface Flow Control | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off" | | END @@ -357,7 +347,7 @@ | Initialize layer vfio-pci on node | | [Documentation] | | ... | Initialize vfio-pci interfaces on DUT on NIC PF. -| | ... | Currently no operation. +| | ... | Currently just set MTU to the recommended value. | | | | ... | *Arguments:* | | ... | - dut - DUT node. Type: string @@ -369,7 +359,9 @@ | | | | [Arguments] | ${dut} | ${pf} | | -| | No operation +| | Set Interface State | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | down +| | VPP Set Interface MTU +| | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | mtu=${recommended_mtu} | Initialize layer avf on node | | [Documentation] @@ -457,7 +449,7 @@ | Initialize layer mlx5_core on node | | [Documentation] | | ... | Initialize mlx5_core interfaces on DUT on NIC PF. -| | ... | Currently no operation. +| | ... | Currently just set MTU to the recommended value. | | | | ... | *Arguments:* | | ... | - dut - DUT node. Type: string @@ -469,7 +461,9 @@ | | | | [Arguments] | ${dut} | ${pf} | | -| | No operation +| | Set Interface State | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | down +| | VPP Set Interface MTU +| | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | mtu=${recommended_mtu} | Initialize layer interface | | [Documentation] |