From be157c8643a2c095d169e3ea78e8db60000189eb Mon Sep 17 00:00:00 2001 From: Patrik Hrnciar Date: Tue, 8 Mar 2016 17:34:18 +0100 Subject: Add vxlan tests using xconnect Change-Id: I190689d5a624f1c876df90ce29b05a2b0b8a2df4 Signed-off-by: Patrik Hrnciar --- resources/libraries/python/IPv4Util.py | 2 -- resources/libraries/python/InterfaceSetup.py | 2 -- resources/libraries/python/InterfaceUtil.py | 10 +++++-- resources/libraries/python/L2Util.py | 21 ++++++++++---- resources/libraries/robot/vxlan.robot | 33 +++++++++++++++------- tests/suites/vxlan/vxlan_bd_untagged.robot | 35 ++++++++++++++++++++++++ tests/suites/vxlan/vxlan_untagged.robot | 27 ------------------ tests/suites/vxlan/vxlan_xconnect_untagged.robot | 33 ++++++++++++++++++++++ 8 files changed, 113 insertions(+), 50 deletions(-) create mode 100644 tests/suites/vxlan/vxlan_bd_untagged.robot delete mode 100644 tests/suites/vxlan/vxlan_untagged.robot create mode 100644 tests/suites/vxlan/vxlan_xconnect_untagged.robot diff --git a/resources/libraries/python/IPv4Util.py b/resources/libraries/python/IPv4Util.py index 3b500ab1d9..b7035f272c 100644 --- a/resources/libraries/python/IPv4Util.py +++ b/resources/libraries/python/IPv4Util.py @@ -36,8 +36,6 @@ class IPv4Util(object): get_node(node).arp_ping(ip_address, interface) @staticmethod - @keyword('Node "${node}" interface "${port}" has IPv4 address "${address}"' - ' with prefix length "${prefix_length}"') def set_interface_address(node, interface, address, length): """See IPv4Node.set_ip for more information. diff --git a/resources/libraries/python/InterfaceSetup.py b/resources/libraries/python/InterfaceSetup.py index f981d2323a..946c8fc8fd 100644 --- a/resources/libraries/python/InterfaceSetup.py +++ b/resources/libraries/python/InterfaceSetup.py @@ -151,8 +151,6 @@ class InterfaceSetup(object): if_v['driver']) @staticmethod - @keyword('Create VXLAN interface on "${DUT}" with VNI "${VNI}"' - ' from "${SRC_IP}" to "${DST_IP}"') def create_vxlan_interface(node, vni, source_ip, destination_ip): """Create VXLAN interface and return index of created interface diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index aeb54be86a..be126503f7 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -30,10 +30,10 @@ class InterfaceUtil(object): Function can be used for DUTs as well as for TGs. :param node: node where the interface is - :param interface: interface name + :param interface: interface name or sw_if_index :param state: one of 'up' or 'down' :type node: dict - :type interface: str + :type interface: str or int :type state: str :return: nothing """ @@ -45,7 +45,11 @@ class InterfaceUtil(object): else: raise ValueError('Unexpected interface state: {}'.format(state)) - sw_if_index = Topology.get_interface_sw_index(node, interface) + if isinstance(interface, basestring): + sw_if_index = Topology.get_interface_sw_index(node, interface) + else: + sw_if_index = interface + VatExecutor.cmd_from_template(node, 'set_if_state.vat', sw_if_index=sw_if_index, state=state) diff --git a/resources/libraries/python/L2Util.py b/resources/libraries/python/L2Util.py index c0a764fa2d..4dc230cf16 100644 --- a/resources/libraries/python/L2Util.py +++ b/resources/libraries/python/L2Util.py @@ -159,14 +159,23 @@ class L2Util(object): """Create bidirectional cross-connect between 2 interfaces on vpp node. :param node: Node to add bidirectional cross-connect - :param interface1: first interface - :param interface2: second interface + :param interface1: first interface name or sw_if_index + :param interface2: second interface name or sw_if_index :type node: dict - :type interface1: str - :type interface2: str + :type interface1: str or int + :type interface2: str or int """ - sw_iface1 = Topology().get_interface_sw_index(node, interface1) - sw_iface2 = Topology().get_interface_sw_index(node, interface2) + + if isinstance(interface1, basestring): + sw_iface1 = Topology().get_interface_sw_index(node, interface1) + else: + sw_iface1 = interface1 + + if isinstance(interface2, basestring): + sw_iface2 = Topology().get_interface_sw_index(node, interface2) + else: + sw_iface2 = interface2 + with VatTerminal(node) as vat: vat.vat_terminal_exec_cmd_from_template('l2_xconnect.vat', interface1=sw_iface1, diff --git a/resources/libraries/robot/vxlan.robot b/resources/libraries/robot/vxlan.robot index e38c678d2b..e855f2499d 100644 --- a/resources/libraries/robot/vxlan.robot +++ b/resources/libraries/robot/vxlan.robot @@ -15,6 +15,7 @@ | Library | Collections | Resource | resources/libraries/robot/default.robot | Resource | resources/libraries/robot/bridge_domain.robot +| Resource | resources/libraries/robot/l2_xconnect.robot | Library | resources.libraries.python.L2Util | Library | resources.libraries.python.IPUtil | Library | resources.libraries.python.IPv4Util @@ -48,21 +49,33 @@ | | Set Suite Variable | ${duts_ip_address_prefix} | 24 | | Set Interface State | ${TG} | ${tgs_to_dut1} | up | | Set Interface State | ${TG} | ${tgs_to_dut2} | up -| | Setup DUT for VXLAN | ${DUT1} | ${VNI} | ${dut1s_ip_address} | ${dut2s_ip_address} -| | ... | ${dut1s_to_tg} | ${dut1s_to_dut2} | ${dut1s_ip_address} | ${duts_ip_address_prefix} -| | Setup DUT for VXLAN | ${DUT2} | ${VNI} | ${dut2s_ip_address} | ${dut1s_ip_address} -| | ... | ${dut2s_to_tg} | ${dut2s_to_dut1} | ${dut2s_ip_address} | ${duts_ip_address_prefix} +| | ${vxlan_dut1}= | Setup VXLAN on DUT | ${DUT1} | ${VNI} | ${dut1s_ip_address} +| | ... | ${dut2s_ip_address} | ${dut1s_to_tg} +| | ... | ${dut1s_to_dut2} | ${dut1s_ip_address} +| | ... | ${duts_ip_address_prefix} +| | Set Suite Variable | ${vxlan_dut1} +| | ${vxlan_dut2}= | Setup VXLAN on DUT | ${DUT2} | ${VNI} | ${dut2s_ip_address} +| | ... | ${dut1s_ip_address} | ${dut2s_to_tg} +| | ... | ${dut2s_to_dut1} | ${dut2s_ip_address} +| | ... | ${duts_ip_address_prefix} +| | Set Suite Variable | ${vxlan_dut2} | | @{test_nodes}= | Create list | ${DUT1} | ${DUT2} | | Vpp Nodes Interfaces Ready Wait | ${test_nodes} # ip arp table must be filled on both nodes with neighbors address | | VPP IP Probe | ${DUT1} | ${dut1s_to_dut2} | ${dut2s_ip_address} -| Setup DUT for VXLAN -| | [Arguments] | ${DUT} | ${VNI} | ${SRC_IP} | ${DST_IP} | ${INGRESS} | ${EGRESS} | ${IP} | ${PREFIX} -| | Set Interface State | ${DUT} | ${EGRESS} | up -| | Set Interface State | ${DUT} | ${INGRESS} | up -| | Node "${DUT}" interface "${EGRESS}" has IPv4 address "${IP}" with prefix length "${PREFIX}" -| | ${vxlan_if_index}= | Create VXLAN interface on "${DUT}" with VNI "${VNI}" from "${SRC_IP}" to "${DST_IP}" +| Setup DUT for VXLAN using BD +| | [Arguments] | ${DUT} | ${VNI} | ${INGRESS} | ${vxlan_if_index} | | Create L2 BD | ${DUT} | ${VNI} | | Add sw if index To L2 BD | ${DUT} | ${vxlan_if_index} | ${VNI} | | Add Interface To L2 BD | ${DUT} | ${INGRESS} | ${VNI} + +| Setup VXLAN on DUT +| | [Arguments] | ${DUT} | ${VNI} | ${SRC_IP} | ${DST_IP} | ${INGRESS} +| | ... | ${EGRESS} | ${IP} | ${PREFIX} +| | Set Interface State | ${DUT} | ${EGRESS} | up +| | Set Interface State | ${DUT} | ${INGRESS} | up +| | Set Interface Address | ${DUT} | ${EGRESS} | ${IP} | ${PREFIX} +| | ${vxlan_if_index}= | Create VXLAN interface | ${DUT} | ${VNI} | ${SRC_IP} +| | ... | ${DST_IP} +| | [Return] | ${vxlan_if_index} diff --git a/tests/suites/vxlan/vxlan_bd_untagged.robot b/tests/suites/vxlan/vxlan_bd_untagged.robot new file mode 100644 index 0000000000..2e5d27a721 --- /dev/null +++ b/tests/suites/vxlan/vxlan_bd_untagged.robot @@ -0,0 +1,35 @@ +# 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. + +*** Settings *** +| Documentation | VXLAN tunnel untagged traffic tests using bridge domain. +| Resource | resources/libraries/robot/default.robot +| Resource | resources/libraries/robot/vxlan.robot +| Resource | resources/libraries/robot/l2_traffic.robot +| Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | HW_ENV +| Suite Setup | Run Keywords | Setup all DUTs before test +| ... | AND | Setup all TGs before traffic script +| ... | AND | Setup VXLAN tunnel on nodes | ${nodes['TG']} +| | ... | ${nodes['DUT1']} | ${nodes['DUT2']} | ${VNI} + +*** Variables *** +| ${VNI}= | 23 + +*** Test Cases *** +| VPP can encapsulate L2 in VXLAN over V4 +| | Setup DUT for VXLAN using BD | ${nodes['DUT1']} | ${23} | ${dut1s_to_tg} +| | ... | ${vxlan_dut1} +| | Setup DUT for VXLAN using BD | ${nodes['DUT2']} | ${23} | ${dut2s_to_tg} +| | ... | ${vxlan_dut2} +| | Send and receive ICMPv4 | ${nodes['TG']} | ${tgs_to_dut1} | ${tgs_to_dut2} +| | Send and receive ICMPv4 | ${nodes['TG']} | ${tgs_to_dut2} | ${tgs_to_dut1} diff --git a/tests/suites/vxlan/vxlan_untagged.robot b/tests/suites/vxlan/vxlan_untagged.robot deleted file mode 100644 index 638c056e8d..0000000000 --- a/tests/suites/vxlan/vxlan_untagged.robot +++ /dev/null @@ -1,27 +0,0 @@ -# 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. - -*** Settings *** -| Documentation | VXLAN tunnel untagged traffic tests -| Resource | resources/libraries/robot/default.robot -| Resource | resources/libraries/robot/vxlan.robot -| Resource | resources/libraries/robot/l2_traffic.robot -| Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | HW_ENV -| Suite Setup | Run Keywords | Setup all DUTs before test -| ... | AND | Setup all TGs before traffic script -| ... | AND | Setup VXLAN tunnel on nodes | ${nodes['TG']} -| | ... | ${nodes['DUT1']} | ${nodes['DUT2']} | ${23} - -*** Test Cases *** -| VPP can encapsulate L2 in VXLAN over V4 -| | Send and receive ICMPv4 | ${nodes['TG']} | ${tgs_to_dut1} | ${tgs_to_dut2} diff --git a/tests/suites/vxlan/vxlan_xconnect_untagged.robot b/tests/suites/vxlan/vxlan_xconnect_untagged.robot new file mode 100644 index 0000000000..c3d2a3c0a4 --- /dev/null +++ b/tests/suites/vxlan/vxlan_xconnect_untagged.robot @@ -0,0 +1,33 @@ +# 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. + +*** Settings *** +| Documentation | VXLAN tunnel untagged traffic tests using xconnect. +| Resource | resources/libraries/robot/default.robot +| Resource | resources/libraries/robot/vxlan.robot +| Resource | resources/libraries/robot/l2_traffic.robot +| Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | HW_ENV +| Suite Setup | Run Keywords | Setup all DUTs before test +| ... | AND | Setup all TGs before traffic script +| ... | AND | Setup VXLAN tunnel on nodes | ${nodes['TG']} +| | ... | ${nodes['DUT1']} | ${nodes['DUT2']} | ${VNI} + +*** Variables *** +| ${VNI}= | 24 + +*** Test Cases *** +| VPP can pass IPv4 bidirectionally through VXLAN tunnel using l2-xconnect +| | L2 setup xconnect on DUT | ${nodes['DUT1']} | ${dut1s_to_tg} | ${vxlan_dut1} +| | L2 setup xconnect on DUT | ${nodes['DUT2']} | ${dut2s_to_tg} | ${vxlan_dut2} +| | Send and receive ICMPv4 | ${nodes['TG']} | ${tgs_to_dut1} | ${tgs_to_dut2} +| | Send and receive ICMPv4 | ${nodes['TG']} | ${tgs_to_dut2} | ${tgs_to_dut1} -- cgit 1.2.3-korg