diff options
author | Juraj Sloboda <jsloboda@cisco.com> | 2016-02-23 15:03:13 +0100 |
---|---|---|
committer | Stefan Kobza <skobza@cisco.com> | 2016-03-07 18:40:42 +0100 |
commit | da8aebf2e722f2c441a03b300de71f9143d010a3 (patch) | |
tree | 386aa3af6c6050df29b4b0e850b1098d60b4c7f1 /resources/libraries | |
parent | 8120dcdc84da7ff1dee097240bc1ecf18914397c (diff) |
Modify sweep ping test cases
- Write separate sweep ping test cases for jumbo frames
- Compute sweep ping end size from reported MTU on DUT interface
- Set MTU on TG according to MTU on DUT interface
- Log VPP packet traces on IPv4 and IPv6 tests failure
- Remove VM_ENV tag from sweep ping test cases for jumbo frames
Change-Id: I47aa7977bcff9c4366c67578aef542924a1d055b
Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
Diffstat (limited to 'resources/libraries')
-rw-r--r-- | resources/libraries/python/InterfaceUtil.py | 40 | ||||
-rw-r--r-- | resources/libraries/python/Trace.py | 24 | ||||
-rw-r--r-- | resources/libraries/python/topology.py | 24 | ||||
-rw-r--r-- | resources/libraries/robot/interfaces.robot | 15 | ||||
-rw-r--r-- | resources/libraries/robot/ipv4.robot | 14 | ||||
-rw-r--r-- | resources/libraries/robot/ipv6.robot | 26 |
6 files changed, 119 insertions, 24 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 14473ee4d4..aeb54be86a 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -53,7 +53,45 @@ class InterfaceUtil(object): cmd = 'ip link set {} {}'.format(interface, state) exec_cmd_no_error(node, cmd, sudo=True) else: - raise Exception('Unknown NodeType: "{}"'.format(node['type'])) + raise Exception('Node {} has unknown NodeType: "{}"'. + format(node['host'], node['type'])) + + @staticmethod + def set_interface_ethernet_mtu(node, interface, mtu): + """Set Ethernet MTU for specified interface. + + Function can be used only for TGs. + + :param node: node where the interface is + :param interface: interface name + :param mtu: MTU to set + :type node: dict + :type interface: str + :type mtu: int + :return: nothing + """ + if node['type'] == NodeType.DUT: + ValueError('Node {}: Setting Ethernet MTU for interface ' + 'on DUT nodes not supported', node['host']) + elif node['type'] == NodeType.TG: + cmd = 'ip link set {} mtu {}'.format(interface, mtu) + exec_cmd_no_error(node, cmd, sudo=True) + else: + raise ValueError('Node {} has unknown NodeType: "{}"'. + format(node['host'], node['type'])) + + @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 + :return: nothing + """ + for ifc in node['interfaces'].values(): + InterfaceUtil.set_interface_ethernet_mtu(node, ifc['name'], 1500) @staticmethod def vpp_node_interfaces_ready_wait(node, timeout=10): diff --git a/resources/libraries/python/Trace.py b/resources/libraries/python/Trace.py new file mode 100644 index 0000000000..8168b909ea --- /dev/null +++ b/resources/libraries/python/Trace.py @@ -0,0 +1,24 @@ +# Copyright (c) 2016 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: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from resources.libraries.python.VatExecutor import VatExecutor +from resources.libraries.python.topology import NodeType + +class Trace(object): + + @staticmethod + def show_packet_trace_on_all_duts(nodes): + for node in nodes.values(): + if node['type'] == NodeType.DUT: + vat = VatExecutor() + vat.execute_script("show_trace.vat", node, json_out=False) diff --git a/resources/libraries/python/topology.py b/resources/libraries/python/topology.py index e2c069fc98..75542ad070 100644 --- a/resources/libraries/python/topology.py +++ b/resources/libraries/python/topology.py @@ -257,6 +257,7 @@ class Topology(object): format(ifc, if_mac)) ifc['name'] = interface_dict["interface_name"] ifc['vpp_sw_index'] = interface_dict["sw_if_index"] + ifc['mtu'] = interface_dict["mtu"] def update_vpp_interface_data_on_node(self, node): """Update vpp generated interface data for a given node in DICT__nodes @@ -347,14 +348,31 @@ class Topology(object): """ for port in node['interfaces'].values(): port_name = port.get('name') - if port_name is None: - continue if port_name == interface: return port.get('vpp_sw_index') return None @staticmethod + def get_interface_mtu(node, interface): + """Get interface MTU. + + Returns physical layer MTU (max. size of Ethernet frame). + :param node: Node to get interface MTU on. + :param interface: Interface name. + :type node: dict + :type interface: str + :return: MTU or None if not found. + :rtype: int + """ + for port in node['interfaces'].values(): + port_name = port.get('name') + if port_name == interface: + return port.get('mtu') + + return None + + @staticmethod def get_interface_mac_by_port_key(node, port_key): """Get MAC address for the interface based on port key. @@ -382,8 +400,6 @@ class Topology(object): """ for port in node['interfaces'].values(): port_name = port.get('name') - if port_name is None: - continue if port_name == interface: return port.get('mac_address') diff --git a/resources/libraries/robot/interfaces.robot b/resources/libraries/robot/interfaces.robot index 18c9c0cc81..649ee63253 100644 --- a/resources/libraries/robot/interfaces.robot +++ b/resources/libraries/robot/interfaces.robot @@ -11,6 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. *** Settings *** +| Library | resources.libraries.python.InterfaceUtil +| Library | resources.libraries.python.NodePath | Resource | resources/libraries/robot/vat/interfaces.robot *** Keywords *** @@ -18,3 +20,16 @@ | | VPP reports interfaces through VAT on | ${node} #| | VPP reports interfaces through ODL on | ${node} #| | VPP reports interfaces through DEBUGCLI on | ${node} + +| Setup MTU on TG based on MTU on DUT +| | [Documentation] | Type of the tg_node must be TG and dut_node must be DUT +| | [Arguments] | ${tg_node} | ${dut_node} +| | Append Nodes | ${tg_node} | ${dut_node} +| | Compute Path +| | ${tg_port} | ${tg_node}= | First Interface +| | ${dut_port} | ${dut_node}= | Last Interface +| | # get physical layer MTU (max. size of Ethernet frame) +| | ${mtu}= | Get Interface MTU | ${dut_node} | ${dut_port} +| | # Ethernet MTU is physical layer MTU minus size of Ethernet header and FCS +| | ${eth_mtu}= | Evaluate | ${mtu} - 14 - 4 +| | Set Interface Ethernet MTU | ${tg_node} | ${tg_port} | ${eth_mtu} diff --git a/resources/libraries/robot/ipv4.robot b/resources/libraries/robot/ipv4.robot index 4c76644c54..63a1188332 100644 --- a/resources/libraries/robot/ipv4.robot +++ b/resources/libraries/robot/ipv4.robot @@ -75,18 +75,20 @@ | Ipv4 icmp echo sweep | | [Documentation] | Type of the src_node must be TG and dst_node must be DUT -| | [Arguments] | ${src_node} | ${dst_node} | ${src_port} | ${dst_port} +| | [Arguments] | ${src_node} | ${dst_node} | ${start_size} | ${end_size} | ${step} +| | Append Nodes | ${src_node} | ${dst_node} +| | Compute Path +| | ${src_port} | ${src_node}= | First Interface +| | ${dst_port} | ${dst_node}= | Last Interface | | ${src_ip}= | Get IPv4 address of node "${src_node}" interface "${src_port}" from "${nodes_ipv4_addr}" | | ${dst_ip}= | Get IPv4 address of node "${dst_node}" interface "${dst_port}" from "${nodes_ipv4_addr}" | | ${src_mac}= | Get Interface Mac | ${src_node} | ${src_port} | | ${dst_mac}= | Get Interface Mac | ${dst_node} | ${dst_port} | | ${args}= | Traffic Script Gen Arg | ${src_port} | ${src_port} | ${src_mac} | | | ... | ${dst_mac} | ${src_ip} | ${dst_ip} -| # TODO: end_size is currently minimum MTU size for Ethernet minus IPv4 and -| # ICMP echo header size (1500 - 20 - 8), -| # MTU info is not in VAT sw_interface_dump output -| | ${args}= | Set Variable | ${args} --start_size 1 --end_size 1472 --step 1 -| | Run Traffic Script On Node | ipv4_sweep_ping.py | ${src_node} | ${args} +| | ${args}= | Set Variable +| | ... | ${args} --start_size ${start_size} --end_size ${end_size} --step ${step} +| | Run Traffic Script On Node | ipv4_sweep_ping.py | ${src_node} | ${args} | ${20} | Send ARP request and validate response | | [Arguments] | ${tg_node} | ${vpp_node} diff --git a/resources/libraries/robot/ipv6.robot b/resources/libraries/robot/ipv6.robot index 78a8eda45a..17ab14274f 100644 --- a/resources/libraries/robot/ipv6.robot +++ b/resources/libraries/robot/ipv6.robot @@ -14,12 +14,12 @@ """IPv6 keywords""" *** Settings *** -| Library | resources/libraries/python/IPv6Util.py -| Library | resources/libraries/python/IPv6Setup.py -| Library | resources/libraries/python/TrafficScriptExecutor.py -| Library | resources/libraries/python/NodePath.py -| Library | resources/libraries/python/Routing.py -| Library | resources/libraries/python/InterfaceUtil.py +| Library | resources.libraries.python.IPv6Util +| Library | resources.libraries.python.IPv6Setup +| Library | resources.libraries.python.TrafficScriptExecutor +| Library | resources.libraries.python.NodePath +| Library | resources.libraries.python.Routing +| Library | resources.libraries.python.InterfaceUtil | Library | resources.libraries.python.topology.Topology | Resource | resources/libraries/robot/default.robot | Resource | resources/libraries/robot/counters.robot @@ -42,12 +42,13 @@ | | Run Traffic Script On Node | icmpv6_echo.py | ${tg_node} | ${args} | | Vpp dump stats | ${dst_node} | | ${ipv6_counter}= | Vpp get interface ipv6 counter | ${dst_node} | ${dst_port} -| | Should Be Equal | ${ipv6_counter} | ${2} | #ICMPv6 neighbor advertisment + ICMPv6 echo request +| | Should Be Equal | ${ipv6_counter} | ${2} | #ICMPv6 neighbor advertisement + ICMPv6 echo request | Ipv6 icmp echo sweep | | [Documentation] | Type of the src_node must be TG and dst_node must be DUT -| | [Arguments] | ${tg_node} | ${dut_node} | ${nodes_addr} -| | Append Nodes | ${tg_node} | ${dut_node} +| | [Arguments] | ${src_node} | ${dst_node} | ${start_size} | ${end_size} +| | ... | ${step} | ${nodes_addr} +| | Append Nodes | ${src_node} | ${dst_node} | | Compute Path | | ${src_port} | ${src_node}= | First Interface | | ${dst_port} | ${dst_node}= | Last Interface @@ -57,10 +58,9 @@ | | ${dst_mac}= | Get Interface Mac | ${dst_node} | ${dst_port} | | ${args}= | Traffic Script Gen Arg | ${src_port} | ${src_port} | ${src_mac} | | | ... | ${dst_mac} | ${src_ip} | ${dst_ip} -| # TODO: end_size is currently minimum MTU size for IPv6 minus IPv6 and ICMPv6 -| # echo header size, MTU info is not in VAT sw_interface_dump output -| | ${args}= | Set Variable | ${args} --start_size 0 --end_size 1232 --step 1 -| | Run Traffic Script On Node | ipv6_sweep_ping.py | ${tg_node} | ${args} | ${20} +| | ${args}= | Set Variable +| | ... | ${args} --start_size ${start_size} --end_size ${end_size} --step ${step} +| | Run Traffic Script On Node | ipv6_sweep_ping.py | ${src_node} | ${args} | ${20} | Ipv6 tg to dut1 egress | | [Documentation] | Send traffic from TG to first DUT egress interface |