From 648fa787d8ed7a045da18cf1a0761f3ca0d5b947 Mon Sep 17 00:00:00 2001 From: xinfeng zhao Date: Fri, 3 Sep 2021 15:49:05 +0800 Subject: [PATCH] Add flow test suites The comms DDP package needs to be installed to support all flow protocols Signed-off-by: xinfeng zhao Change-Id: I6ab1bd8beb9edb8c9889a0ed9a999080ca3cef3d --- GPL/traffic_scripts/send_flow_packet.py | 109 ++++ docs/job_specs/vpp_device/vpp-1n-skx.md | 52 +- docs/tag_documentation.rst | 12 + resources/api/vpp/supported_crcs.yaml | 8 + resources/libraries/bash/function/common.sh | 4 + resources/libraries/python/FlowUtil.py | 570 +++++++++++++++++++++ resources/libraries/python/Trace.py | 15 +- resources/libraries/robot/shared/default.robot | 1 + resources/libraries/robot/shared/traffic.robot | 55 ++ ...1l-10ge2p1x710-ethip4-flow-ip4-gtpu-scapy.robot | 123 +++++ ...0ge2p1x710-ethip4-flow-ip4-ipsec-ah-scapy.robot | 123 +++++ ...ge2p1x710-ethip4-flow-ip4-ipsec-esp-scapy.robot | 123 +++++ ...ge2p1x710-ethip4-flow-ip4-l2tpv3oip-scapy.robot | 123 +++++ ...e2p1x710-ethip4-flow-ip4-ntuple-tcp-scapy.robot | 124 +++++ ...e2p1x710-ethip4-flow-ip4-ntuple-udp-scapy.robot | 124 +++++ ...n1l-10ge2p1x710-ethip4-flow-ip4-tcp-scapy.robot | 119 +++++ ...n1l-10ge2p1x710-ethip4-flow-ip4-udp-scapy.robot | 119 +++++ ...e2p1x710-ethip6-flow-ip6-ntuple-tcp-scapy.robot | 124 +++++ ...e2p1x710-ethip6-flow-ip6-ntuple-udp-scapy.robot | 124 +++++ ...n1l-10ge2p1x710-ethip6-flow-ip6-tcp-scapy.robot | 119 +++++ ...n1l-10ge2p1x710-ethip6-flow-ip6-udp-scapy.robot | 119 +++++ tests/vpp/device/flow/regenerate_testcases.py | 18 + 22 files changed, 2304 insertions(+), 4 deletions(-) create mode 100644 GPL/traffic_scripts/send_flow_packet.py create mode 100644 resources/libraries/python/FlowUtil.py create mode 100644 tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-gtpu-scapy.robot create mode 100644 tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ipsec-ah-scapy.robot create mode 100644 tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ipsec-esp-scapy.robot create mode 100644 tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-l2tpv3oip-scapy.robot create mode 100644 tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ntuple-tcp-scapy.robot create mode 100644 tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ntuple-udp-scapy.robot create mode 100644 tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-tcp-scapy.robot create mode 100644 tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-udp-scapy.robot create mode 100644 tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-ntuple-tcp-scapy.robot create mode 100644 tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-ntuple-udp-scapy.robot create mode 100644 tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-tcp-scapy.robot create mode 100644 tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-udp-scapy.robot create mode 100755 tests/vpp/device/flow/regenerate_testcases.py diff --git a/GPL/traffic_scripts/send_flow_packet.py b/GPL/traffic_scripts/send_flow_packet.py new file mode 100644 index 0000000000..dba3788bfb --- /dev/null +++ b/GPL/traffic_scripts/send_flow_packet.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2021 Intel and/or its affiliates. +# +# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later +# +# Licensed under the Apache License 2.0 or +# GNU General Public License v2.0 or later; you may not use this file +# except in compliance with one of these Licenses. You +# may obtain a copy of the Licenses at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html +# +# Note: If this file is linked with Scapy, which is GPLv2+, your use of it +# must be under GPLv2+. If at any point in the future it is no longer linked +# with Scapy (or other GPLv2+ licensed software), you are free to choose +# Apache 2. +# +# 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. + +"""Traffic script that send flow packet from one interface +to the other. +""" + +import sys +import binascii + +from scapy.layers.inet import IP, UDP, TCP +from scapy.layers.inet6 import IPv6 +from scapy.layers.l2 import Ether, ARP +from scapy.packet import Raw +from scapy.contrib.gtp import GTP_U_Header +from scapy.layers.ipsec import ESP, AH +from scapy.layers.vxlan import VXLAN + +from .PacketVerifier import TxQueue +from .TrafficScriptArg import TrafficScriptArg + + +def main(): + """Send packet from one traffic generator interface to the other.""" + + args = TrafficScriptArg( + [ + u"tg_if1_mac", u"dut_if1_mac", u"flow_type", u"proto", + ], + [ + u"src_ip", u"dst_ip", u"src_port", u"dst_port", u"value" + ] + ) + tx_if = args.get_arg(u"tx_if") + tx_src_mac = args.get_arg(u"tg_if1_mac") + tx_dst_mac = args.get_arg(u"dut_if1_mac") + flow_type = args.get_arg(u"flow_type") + proto = args.get_arg(u"proto") + + src = args.get_arg(u"src_ip") + dst = args.get_arg(u"dst_ip") + sport = eval(args.get_arg(u"src_port")) + dport = eval(args.get_arg(u"dst_port")) + value = eval(args.get_arg(u"value")) + + txq = TxQueue(tx_if) + + if flow_type == u"IP4": + pkt_raw = (Ether(src=tx_src_mac, dst=tx_dst_mac) / + IP(src=src, dst=dst)) + elif flow_type == u"IP6": + pkt_raw = (Ether(src=tx_src_mac, dst=tx_dst_mac) / + IPv6(src=src, dst=dst)) + elif flow_type == u"ETHER": + pkt_raw = Ether(src=tx_src_mac, dst=tx_dst_mac) + else: + raise ValueError(f"Flow type error: {flow_type}") + + if proto == u"TCP": + pkt_raw /= TCP(sport=sport, dport=dport) + elif proto == u"UDP": + pkt_raw /= UDP(sport=sport, dport=dport) + elif proto == u"AH": + pkt_raw /= AH(spi=value) + elif proto == u"ESP": + pkt_raw /= ESP(spi=value) + elif proto == u"GTPU": + pkt_raw /= (UDP()/GTP_U_Header(teid=value)/IP(src=u"192.168.10.20")) + elif proto == u"L2TPV3": + value_hex = hex(value).replace('0x', (8-len(hex(value))+2)*'0') + session_id = binascii.a2b_hex(value_hex) + pkt_raw.proto = 115 + pkt_raw /= Raw(session_id) + elif proto == u"VXLAN": + pkt_raw /= (UDP()/VXLAN(vni=value)) + elif proto == u"ARP": + pkt_raw.type = value + pkt_raw /= ARP() + else: + raise ValueError(f"Flow proto error: {proto}") + + pkt_raw /= Raw() + txq.send(pkt_raw) + sys.exit(0) + +if __name__ == u"__main__": + main() diff --git a/docs/job_specs/vpp_device/vpp-1n-skx.md b/docs/job_specs/vpp_device/vpp-1n-skx.md index 175520fc47..02dad011f9 100644 --- a/docs/job_specs/vpp_device/vpp-1n-skx.md +++ b/docs/job_specs/vpp_device/vpp-1n-skx.md @@ -26,6 +26,56 @@ 0c AND 78b AND scapy AND x710 AND drv_vfio_pci AND ethip6ipsec1tnlsw-ip6base-policy-aes128cbc-hmac512sha ##### ethip6ipsec1tptsw-ip6base-policy-aes128cbc-hmac512sha 0c AND 78b AND scapy AND x710 AND drv_vfio_pci AND ethip6ipsec1tptsw-ip6base-policy-aes128cbc-hmac512sha +## ./flow +### intel-e810cq +#### avf +##### ethip4-flow-ip4-ipsec-ah +0c AND 64b AND scapy AND e810cq AND drv_avf AND ethip4-flow-ip4-ipsec-ah +##### ethip4-flow-ip4-ipsec-esp +0c AND 64b AND scapy AND e810cq AND drv_avf AND ethip4-flow-ip4-ipsec-esp +##### ethip4-flow-ip4-l2tpv3oip +0c AND 64b AND scapy AND e810cq AND drv_avf AND ethip4-flow-ip4-l2tpv3oip +##### ethip4-flow-ip4-ntuple-tcp +0c AND 64b AND scapy AND e810cq AND drv_avf AND ethip4-flow-ip4-ntuple-tcp +##### ethip4-flow-ip4-ntuple-udp +0c AND 64b AND scapy AND e810cq AND drv_avf AND ethip4-flow-ip4-ntuple-udp +##### ethip4-flow-ip4-tcp +0c AND 64b AND scapy AND e810cq AND drv_avf AND ethip4-flow-ip4-tcp +##### ethip4-flow-ip4-udp +0c AND 64b AND scapy AND e810cq AND drv_avf AND ethip4-flow-ip4-udp +##### ethip6-flow-ip6-ntuple-tcp +0c AND 64b AND scapy AND e810cq AND drv_avf AND ethip6-flow-ip6-ntuple-tcp +##### ethip6-flow-ip6-ntuple-udp +0c AND 64b AND scapy AND e810cq AND drv_avf AND ethip6-flow-ip6-ntuple-udp +##### ethip6-flow-ip6-tcp +0c AND 64b AND scapy AND e810cq AND drv_avf AND ethip6-flow-ip6-tcp +##### ethip6-flow-ip6-udp +0c AND 64b AND scapy AND e810cq AND drv_avf AND ethip6-flow-ip6-udp +#### dpdk-vfio-pci +##### ethip4-flow-ip4-gtpu +0c AND 64b AND scapy AND e810cq AND drv_vfio_pci AND ethip4-flow-ip4-gtpu +##### ethip4-flow-ip4-ipsec-ah +0c AND 64b AND scapy AND e810cq AND drv_vfio_pci AND ethip4-flow-ip4-ipsec-ah +##### ethip4-flow-ip4-ipsec-esp +0c AND 64b AND scapy AND e810cq AND drv_vfio_pci AND ethip4-flow-ip4-ipsec-esp +##### ethip4-flow-ip4-l2tpv3oip +0c AND 64b AND scapy AND e810cq AND drv_vfio_pci AND ethip4-flow-ip4-l2tpv3oip +##### ethip4-flow-ip4-ntuple-tcp +0c AND 64b AND scapy AND e810cq AND drv_vfio_pci AND ethip4-flow-ip4-ntuple-tcp +##### ethip4-flow-ip4-ntuple-udp +0c AND 64b AND scapy AND e810cq AND drv_vfio_pci AND ethip4-flow-ip4-ntuple-udp +##### ethip4-flow-ip4-tcp +0c AND 64b AND scapy AND e810cq AND drv_vfio_pci AND ethip4-flow-ip4-tcp +##### ethip4-flow-ip4-udp +0c AND 64b AND scapy AND e810cq AND drv_vfio_pci AND ethip4-flow-ip4-udp +##### ethip6-flow-ip6-ntuple-tcp +0c AND 64b AND scapy AND e810cq AND drv_vfio_pci AND ethip6-flow-ip6-ntuple-tcp +##### ethip6-flow-ip6-ntuple-udp +0c AND 64b AND scapy AND e810cq AND drv_vfio_pci AND ethip6-flow-ip6-ntuple-udp +##### ethip6-flow-ip6-tcp +0c AND 64b AND scapy AND e810cq AND drv_vfio_pci AND ethip6-flow-ip6-tcp +##### ethip6-flow-ip6-udp +0c AND 64b AND scapy AND e810cq AND drv_vfio_pci AND ethip6-flow-ip6-udp ## ./interfaces ### intel-x710 #### dpdk-vfio-pci @@ -155,4 +205,4 @@ ### intel-x710 #### dpdk-vfio-pci ##### ethip6-ip6base-eth-2vhost-1vm -0c AND 78b AND scapy AND x710 AND drv_vfio_pci AND ethip6-ip6base-eth-2vhost-1vm \ No newline at end of file +0c AND 78b AND scapy AND x710 AND drv_vfio_pci AND ethip6-ip6base-eth-2vhost-1vm diff --git a/docs/tag_documentation.rst b/docs/tag_documentation.rst index b2130c1f28..f0f23c223b 100644 --- a/docs/tag_documentation.rst +++ b/docs/tag_documentation.rst @@ -559,6 +559,18 @@ Encapsulation Tags All test cases with GENEVE tunnel in L3 mode. +.. topic:: FLOW + + All test cases with FLOW. + +.. topic:: NTUPLE + + All test cases with NTUPLE. + +.. topic:: L2TPV3 + + All test cases with L2TPV3. + Interface Tags -------------- diff --git a/resources/api/vpp/supported_crcs.yaml b/resources/api/vpp/supported_crcs.yaml index fefdc07ea6..840abe8084 100644 --- a/resources/api/vpp/supported_crcs.yaml +++ b/resources/api/vpp/supported_crcs.yaml @@ -96,6 +96,14 @@ det44_session_dump: '0xe45a3af7' # dev # TODO: Which test to run to verify det44_* messages? # dhcp_proxy_dump / details # honeycomb + flow_add: '0xf946ed84' # dev + flow_add_reply: '0x8587dc85' # dev + flow_enable: '0x2024be69' # dev + flow_enable_reply: '0xe8d4e804' # dev + flow_disable: '0x2024be69' #dev + flow_disable_reply: '0xe8d4e804' #dev + flow_del: '0xb6b9b02c' #dev + flow_del_reply: '0xe8d4e804' #dev geneve_add_del_tunnel2: '0x8c2a9999' # dev geneve_add_del_tunnel2_reply: '0x5383d31f' # dev geneve_tunnel_details: '0x6b16eb24' # dev diff --git a/resources/libraries/bash/function/common.sh b/resources/libraries/bash/function/common.sh index 85f6e08b68..510ccb0072 100644 --- a/resources/libraries/bash/function/common.sh +++ b/resources/libraries/bash/function/common.sh @@ -936,6 +936,10 @@ function select_tags () { *"1n-vbox"*) test_tag_array+=("!avf") test_tag_array+=("!vhost") + test_tag_array+=("!flow") + ;; + *"1n_tx2"*) + test_tag_array+=("!flow") ;; *"2n-skx"*) test_tag_array+=("!ipsechw") diff --git a/resources/libraries/python/FlowUtil.py b/resources/libraries/python/FlowUtil.py new file mode 100644 index 0000000000..1f647a8e11 --- /dev/null +++ b/resources/libraries/python/FlowUtil.py @@ -0,0 +1,570 @@ +# copyright (c) 2021 Intel 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. + +"""Flow Utilities Library.""" + +from ipaddress import ip_address + +from resources.libraries.python.topology import Topology +from resources.libraries.python.ssh import exec_cmd_no_error +from resources.libraries.python.PapiExecutor import PapiSocketExecutor + +class FlowUtil: + """Utilities for flow configuration.""" + + @staticmethod + def vpp_create_ip4_n_tuple_flow( + node, src_ip, dst_ip, src_port, dst_port, + proto, action, value=0): + """Create IP4_N_TUPLE flow. + + :param node: DUT node. + :param src_ip: Source IP4 address. + :param dst_ip: Destination IP4 address. + :param src_port: Source port. + :param dst_port: Destination port. + :param proto: TCP or UDP. + :param action: Mark, drop or redirect-to-queue. + :param value: Action value. + + :type node: dict + :type src_ip: str + :type dst_ip: str + :type src_port: int + :type dst_port: int + :type proto: str + :type action: str + :type value: int + :returns: flow_index. + :rtype: int + """ + from vpp_papi import VppEnum + + flow = u"ip4_n_tuple" + flow_type = VppEnum.vl_api_flow_type_t.FLOW_TYPE_IP4_N_TUPLE + + if proto == u"TCP": + flow_proto = VppEnum.vl_api_ip_proto_t.IP_API_PROTO_TCP + elif proto == u"UDP": + flow_proto = VppEnum.vl_api_ip_proto_t.IP_API_PROTO_UDP + else: + raise ValueError(f"proto error: {proto}") + + pattern = { + u'src_addr': {u'addr': src_ip, u'mask': u"255.255.255.255"}, + u'dst_addr': {u'addr': dst_ip, u'mask': u"255.255.255.255"}, + u'src_port': {u'port': src_port, u'mask': 0xFFFF}, + u'dst_port': {u'port': dst_port, u'mask': 0xFFFF}, + u'protocol': {u'prot': flow_proto} + } + + flow_index = FlowUtil.vpp_flow_add( + node, flow, flow_type, pattern, action, value) + + return flow_index + + @staticmethod + def vpp_create_ip6_n_tuple_flow( + node, src_ip, dst_ip, src_port, dst_port, + proto, action, value=0): + """Create IP6_N_TUPLE flow. + + :param node: DUT node. + :param src_ip: Source IP6 address. + :param dst_ip: Destination IP6 address. + :param src_port: Source port. + :param dst_port: Destination port. + :param proto: TCP or UDP. + :param action: Mark, drop or redirect-to-queue. + :param value: Action value. + + :type node: dict + :type src_ip: str + :type dst_ip: str + :type src_port: int + :type dst_port: int + :type proto: str + :type action: str + :type value: int + :returns: flow_index. + :rtype: int + """ + from vpp_papi import VppEnum + + flow = u"ip6_n_tuple" + flow_type = VppEnum.vl_api_flow_type_t.FLOW_TYPE_IP6_N_TUPLE + + if proto == u"TCP": + flow_proto = VppEnum.vl_api_ip_proto_t.IP_API_PROTO_TCP + elif proto == u"UDP": + flow_proto = VppEnum.vl_api_ip_proto_t.IP_API_PROTO_UDP + else: + raise ValueError(f"proto error: {proto}") + + pattern = { + u'src_addr': {u'addr': src_ip, \ + u'mask': u"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"}, + u'dst_addr': {u'addr': dst_ip, \ + u'mask': u"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"}, + u'src_port': {u'port': src_port, u'mask': 0xFFFF}, + u'dst_port': {u'port': dst_port, u'mask': 0xFFFF}, + u'protocol': {u'prot': flow_proto} + } + + flow_index = FlowUtil.vpp_flow_add( + node, flow, flow_type, pattern, action, value) + + return flow_index + + @staticmethod + def vpp_create_ip4_flow( + node, src_ip, dst_ip, proto, action, value=0): + """Create IP4 flow. + + :param node: DUT node. + :param src_ip: Source IP4 address. + :param dst_ip: Destination IP4 address. + :param proto: TCP or UDP. + :param action: Mark, drop or redirect-to-queue. + :param value: Action value. + + :type node: dict + :type src_ip: str + :type dst_ip: str + :type proto: str + :type action: str + :type value: int + :returns: flow_index. + :rtype: int + """ + from vpp_papi import VppEnum + + flow = u"ip4" + flow_type = VppEnum.vl_api_flow_type_t.FLOW_TYPE_IP4 + + if proto == u"TCP": + flow_proto = VppEnum.vl_api_ip_proto_t.IP_API_PROTO_TCP + elif proto == u"UDP": + flow_proto = VppEnum.vl_api_ip_proto_t.IP_API_PROTO_UDP + else: + raise ValueError(f"proto error: {proto}") + + pattern = { + u'src_addr': {u'addr': src_ip, u'mask': u"255.255.255.255"}, + u'dst_addr': {u'addr': dst_ip, u'mask': u"255.255.255.255"}, + u'protocol': {u'prot': flow_proto} + } + + flow_index = FlowUtil.vpp_flow_add( + node, flow, flow_type, pattern, action, value) + + return flow_index + + @staticmethod + def vpp_create_ip6_flow( + node, src_ip, dst_ip, proto, action, value=0): + """Create IP6 flow. + + :param node: DUT node. + :param src_ip: Source IP6 address. + :param dst_ip: Destination IP6 address. + :param proto: TCP or UDP. + :param action: Mark, drop or redirect-to-queue. + :param value: Action value. + + :type node: dict + :type src_ip: str + :type dst_ip: str + :type proto: str + :type action: str + :type value: int + :returns: flow_index. + :rtype: int + """ + from vpp_papi import VppEnum + + flow = u"ip6" + flow_type = VppEnum.vl_api_flow_type_t.FLOW_TYPE_IP6 + + if proto == u"TCP": + flow_proto = VppEnum.vl_api_ip_proto_t.IP_API_PROTO_TCP + elif proto == u"UDP": + flow_proto = VppEnum.vl_api_ip_proto_t.IP_API_PROTO_UDP + else: + raise ValueError(f"proto error: {proto}") + + pattern = { + u'src_addr': {u'addr': src_ip, \ + u'mask': u"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"}, + u'dst_addr': {'addr': dst_ip, \ + u'mask': u"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"}, + u'protocol': {u'prot': flow_proto} + } + + flow_index = FlowUtil.vpp_flow_add( + node, flow, flow_type, pattern, action, value) + + return flow_index + + @staticmethod + def vpp_create_ip4_gtpu_flow( + node, src_ip, dst_ip, teid, action, value=0): + """Create IP4_GTPU flow. + + :param node: DUT node. + :param src_ip: Source IP4 address. + :param dst_ip: Destination IP4 address. + :param teid: Tunnel endpoint identifier. + :param action: Mark, drop or redirect-to-queue. + :param value: Action value. + + :type node: dict + :type src_ip: str + :type dst_ip: str + :type teid: int + :type action: str + :type value: int + :returns: flow_index. + :rtype: int + """ + from vpp_papi import VppEnum + + flow = u"ip4_gtpu" + flow_type = VppEnum.vl_api_flow_type_t.FLOW_TYPE_IP4_GTPU + flow_proto = VppEnum.vl_api_ip_proto_t.IP_API_PROTO_UDP + + pattern = { + u'src_addr': {u'addr': src_ip, u'mask': u"255.255.255.255"}, + u'dst_addr': {u'addr': dst_ip, u'mask': u"255.255.255.255"}, + u'protocol': {u'prot': flow_proto}, + u'teid': teid + } + + flow_index = FlowUtil.vpp_flow_add( + node, flow, flow_type, pattern, action, value) + + return flow_index + + @staticmethod + def vpp_create_ip4_ipsec_flow(node, proto, spi, action, value=0): + """Create IP4_IPSEC flow. + + :param node: DUT node. + :param proto: TCP or UDP. + :param spi: Security Parameters Index. + :param action: Mark, drop or redirect-to-queue. + :param value: Action value. + + :type node: dict + :type proto: str + :type spi: int + :type action: str + :type value: int + :returns: flow_index. + :rtype: int + """ + from vpp_papi import VppEnum + + if proto == u"ESP": + flow = u"ip4_ipsec_esp" + flow_proto = VppEnum.vl_api_ip_proto_t.IP_API_PROTO_ESP + flow_type = VppEnum.vl_api_flow_type_t.FLOW_TYPE_IP4_IPSEC_ESP + elif proto == u"AH": + flow = u"ip4_ipsec_ah" + flow_proto = VppEnum.vl_api_ip_proto_t.IP_API_PROTO_AH + flow_type = VppEnum.vl_api_flow_type_t.FLOW_TYPE_IP4_IPSEC_AH + else: + raise ValueError(f"proto error: {proto}") + + pattern = { + u'protocol': {u'prot': flow_proto}, + u'spi': spi + } + + flow_index = FlowUtil.vpp_flow_add( + node, flow, flow_type, pattern, action, value) + + return flow_index + + @staticmethod + def vpp_create_ip4_l2tp_flow(node, session_id, action, value=0): + """Create IP4_L2TPV3OIP flow. + + :param node: DUT node. + :param session_id: PPPoE session ID + :param action: Mark, drop or redirect-to-queue. + :param value: Action value. + + :type node: dict + :type session_id: int + :type action: str + :type value: int + :returns: flow_index. + :rtype: int + """ + from vpp_papi import VppEnum + + flow = u"ip4_l2tpv3oip" + flow_proto = 115 # IP_API_PROTO_L2TP + flow_type = VppEnum.vl_api_flow_type_t.FLOW_TYPE_IP4_L2TPV3OIP + + pattern = { + u'protocol': {u'prot': flow_proto}, + u'session_id': session_id + } + + flow_index = FlowUtil.vpp_flow_add( + node, flow, flow_type, pattern, action, value) + + return flow_index + + @staticmethod + def vpp_create_ip4_vxlan_flow(node, src_ip, dst_ip, vni, action, value=0): + """Create IP4_VXLAN flow. + + :param node: DUT node. + :param src_ip: Source IP4 address. + :param dst_ip: Destination IP4 address. + :param vni: Virtual network instance. + :param action: Mark, drop or redirect-to-queue. + :param value: Action value. + + :type node: dict + :type src_ip: str + :type dst_ip: str + :type vni: int + :type action: str + :type value: int + :returns: flow_index. + """ + from vpp_papi import VppEnum + + flow = u"ip4_vxlan" + flow_type = VppEnum.vl_api_flow_type_t.FLOW_TYPE_IP4_VXLAN + flow_proto = VppEnum.vl_api_ip_proto_t.IP_API_PROTO_UDP + + pattern = { + u'src_addr': {u'addr': src_ip, u'mask': u"255.255.255.255"}, + u'dst_addr': {u'addr': dst_ip, u'mask': u"255.255.255.255"}, + u'dst_port': {u'port': 4789, 'mask': 0xFFFF}, + u'protocol': {u'prot': flow_proto}, + u'vni': vni + } + + flow_index = FlowUtil.vpp_flow_add( + node, flow, flow_type, pattern, action, value) + + return flow_index + + @staticmethod + def vpp_flow_add(node, flow, flow_type, pattern, action, value=0): + """Flow add. + + :param node: DUT node. + :param flow: Name of flow. + :param flow_type: Type of flow. + :param pattern: Pattern of flow. + :param action: Mark, drop or redirect-to-queue. + :param value: Action value. + + :type node: dict + :type node: str + :type flow_type: str + :type pattern: dict + :type action: str + :type value: int + :returns: flow_index. + :rtype: int + :raises ValueError: If action type is not supported. + """ + from vpp_papi import VppEnum + + cmd = u"flow_add" + + if action == u"redirect-to-queue": + flow_rule = { + u'type': flow_type, + u'actions': VppEnum.vl_api_flow_action_t.\ + FLOW_ACTION_REDIRECT_TO_QUEUE, + u'redirect_queue': value, + u'flow': {flow : pattern} + } + elif action == u"mark": + flow_rule = { + u'type': flow_type, + u'actions': VppEnum.vl_api_flow_action_t.FLOW_ACTION_MARK, + u'mark_flow_id': value, + u'flow': {flow : pattern} + } + elif action == u"drop": + flow_rule = { + u'type': flow_type, + u'actions': VppEnum.vl_api_flow_action_t.FLOW_ACTION_DROP, + u'flow': {flow : pattern} + } + else: + raise ValueError(f"Unsupported action type: {action}") + + err_msg = f"Failed to create {flow} flow on host {node[u'host']}." + args = dict(flow=flow_rule) + flow_index = -1 + with PapiSocketExecutor(node) as papi_exec: + reply = papi_exec.add(cmd, **args).get_reply(err_msg) + flow_index = reply[u"flow_index"] + + return flow_index + + @staticmethod + def vpp_flow_enable(node, interface, flow_index=0): + """Flow enable. + + :param node: DUT node. + :param interface: Interface sw_if_index. + :param flow_index: Flow index. + + :type node: dict + :type interface: int + :type flow_index: int + :returns: Nothing. + """ + cmd = u"flow_enable" + sw_if_index = Topology.get_interface_sw_index(node, interface) + args = dict( + flow_index=int(flow_index), + hw_if_index=int(sw_if_index) + ) + + err_msg = u"Failed to enable flow on host {node[u'host']}" + with PapiSocketExecutor(node) as papi_exec: + papi_exec.add(cmd, **args).get_reply(err_msg) + + @staticmethod + def vpp_flow_disable(node, interface, flow_index=0): + """Flow disable. + + :param node: DUT node. + :param interface: Interface sw_if_index. + :param flow_index: Flow index. + + :type node: dict + :type interface: int + :type flow_index: int + :returns: Nothing. + """ + cmd = u"flow_disable" + sw_if_index = Topology.get_interface_sw_index(node, interface) + args = dict( + flow_index=int(flow_index), + hw_if_index=int(sw_if_index) + ) + + err_msg = u"Failed to disable flow on host {node[u'host']}" + with PapiSocketExecutor(node) as papi_exec: + papi_exec.add(cmd, **args).get_reply(err_msg) + + @staticmethod + def vpp_flow_del(node, flow_index=0): + """Flow delete. + + :param node: DUT node. + :param flow_index: Flow index. + + :type node: dict + :type flow_index: int + :returns: Nothing. + """ + cmd = u"flow_del" + args = dict( + flow_index=int(flow_index) + ) + + err_msg = u"Failed to delete flow on host {node[u'host']}" + with PapiSocketExecutor(node) as papi_exec: + papi_exec.add(cmd, **args).get_reply(err_msg) + + @staticmethod + def vpp_show_flow_entry(node): + """Show flow entry. + + :param node: DUT node. + + :type node: dict + :returns: flow entry. + :rtype: str + """ + cmd = u"vppctl show flow entry" + + err_msg = u"Failed to show flow on host {node[u'host']}" + stdout, _ = exec_cmd_no_error( + node, cmd, sudo=False, message=err_msg, retries=120 + ) + + return stdout.strip() + + @staticmethod + def vpp_verify_flow_action( + node, action, value, + src_mac=u"11:22:33:44:55:66", dst_mac=u"11:22:33:44:55:66", + src_ip=None, dst_ip=None): + """Verify the correctness of the flow action. + + :param node: DUT node. + :param action: Action. + :param value: Action value. + :param src_mac: Source mac address. + :param dst_mac: Destination mac address. + :param src_ip: Source IP address. + :param dst_ip: Destination IP address. + + :type node: dict + :type action: str + :type value: int + :type src_mac: str + :type dst_mac: str + :type src_ip: str + :type dst_ip: str + :returns: Nothing. + :raises RuntimeError: If the verification of flow action fails. + :raises ValueError: If action type is not supported. + """ + err_msg = f"Failed to show trace on host {node[u'host']}" + cmd = u"vppctl show trace" + stdout, _ = exec_cmd_no_error( + node, cmd, sudo=False, message=err_msg, retries=120 + ) + + err_info = f"Verify flow {action} failed" + + if src_ip is None: + expected_str = f"{src_mac} -> {dst_mac}" + else: + src_ip = ip_address(src_ip) + dst_ip = ip_address(dst_ip) + expected_str = f"{src_ip} -> {dst_ip}" + + if action == u"drop": + if expected_str in stdout: + raise RuntimeError(err_info) + elif action == u"redirect-to-queue": + if f"queue {value}" not in stdout \ + and f"qid {value}" not in stdout: + raise RuntimeError(err_info) + if expected_str not in stdout: + raise RuntimeError(err_info) + elif action == u"mark": + if u"PKT_RX_FDIR" not in stdout and u"flow-id 1" not in stdout: + raise RuntimeError(err_info) + if expected_str not in stdout: + raise RuntimeError(err_info) + else: + raise ValueError(f"Unsupported action type: {action}") diff --git a/resources/libraries/python/Trace.py b/resources/libraries/python/Trace.py index f54ae1060e..f82ab95f2e 100644 --- a/resources/libraries/python/Trace.py +++ b/resources/libraries/python/Trace.py @@ -37,12 +37,21 @@ class Trace: @staticmethod def clear_packet_trace_on_all_duts(nodes): - """Clear VPP packet trace. + """Clear VPP packet trace on all duts. :param nodes: Nodes where the packet trace will be cleared. :type nodes: dict """ for node in nodes.values(): if node[u"type"] == NodeType.DUT: - PapiSocketExecutor.run_cli_cmd_on_all_sockets( - node, u"clear trace") + Trace.clear_packet_trace_on_dut(node) + + @staticmethod + def clear_packet_trace_on_dut(node): + """Clear VPP packet trace on dut. + + :param node: Node where the packet trace will be cleared. + :type node: dict + """ + PapiSocketExecutor.run_cli_cmd_on_all_sockets( + node, u"clear trace") diff --git a/resources/libraries/robot/shared/default.robot b/resources/libraries/robot/shared/default.robot index 93aa3976a2..58bbb97acb 100644 --- a/resources/libraries/robot/shared/default.robot +++ b/resources/libraries/robot/shared/default.robot @@ -25,6 +25,7 @@ | Library | resources.libraries.python.CpuUtils | Library | resources.libraries.python.CoreDumpUtil | Library | resources.libraries.python.DUTSetup +| Library | resources.libraries.python.FlowUtil | Library | resources.libraries.python.L2Util | Library | resources.libraries.python.InterfaceUtil | Library | resources.libraries.python.IPUtil diff --git a/resources/libraries/robot/shared/traffic.robot b/resources/libraries/robot/shared/traffic.robot index bd8edcf751..af348bb12e 100644 --- a/resources/libraries/robot/shared/traffic.robot +++ b/resources/libraries/robot/shared/traffic.robot @@ -652,3 +652,58 @@ | | ... | --tun_vni ${tun_vni} | --tun_src_ip ${tun_src_ip} | | ... | --tun_dst_ip ${tun_dst_ip} | | Run Traffic Script On Node | geneve_tunnel.py | ${node} | ${args} + +| Send flow packet and verify action +| | [Documentation] | Send packet and verify the correctness of flow action. +| | +| | ... | *Arguments:* +| | +| | ... | _NOTE:_ Arguments are based on topology: +| | ... | TG(if1)->(if1)DUT +| | +| | ... | - tg_node - Node to execute scripts on (TG). Type: dictionary +| | ... | - tx_interface - TG Interface 1. Type: string +| | ... | - tx_dst_mac - MAC address of DUT-if1. Type: string +| | ... | - flow_type - Flow packet type. Type: string +| | ... | - proto - Flow packet protocol. Type: string +| | ... | - src_ip - Source ip address. Type: string +| | ... | - dst_ip - Destination IP address. Type: string +| | ... | - src_port - Source port. Type: int +| | ... | - dst_port - Destination port. Type: int +| | ... | - value - Additional packet value. Type: integer +| | ... | - traffic_script - Traffic script that send packet. Type: string +| | ... | - action - drop, mark or redirect-to-queue. Type: string +| | ... | - action_value - action value. Type: integer +| | +| | ... | *Return:* +| | ... | - No value returned +| | +| | ... | *Example:* +| | ... | \| Send flow packet and verify actions \| ${nodes['TG']} \| eth2 \ +| | ... | \| 08:00:27:a2:52:5b \| IP4 \| UDP \ +| | ... | \| src_ip=1.1.1.1 \| dst_ip=2.2.2.2 \ +| | ... | \| src_port=${100} \| dst_port=${200} \ +| | ... | \| traffic_script=send_flow_packet \ +| | ... | \|action=mark \| action_value=${3} \| +| | +| | [Arguments] | ${tg_node} | ${tx_interface} | ${tx_dst_mac} +| | ... | ${flow_type} | ${proto} +| | ... | ${src_ip}=${None} | ${dst_ip}=${None} +| | ... | ${src_port}=${None} | ${dst_port}=${None} +| | ... | ${value}=${None} +| | ... | ${traffic_script}=send_flow_packet +| | ... | ${action}=redirect-to-queue +| | ... | ${action_value}=${3} +| | +| | ${tx_src_mac}= | Get Interface Mac | ${tg_node} | ${tx_interface} +| | ${tx_if_name}= | Get interface name | ${tg_node} | ${tx_interface} +| | ${args}= | Catenate +| | ... | --tg_if1_mac ${tx_src_mac} | --dut_if1_mac ${tx_dst_mac} +| | ... | --tx_if ${tx_if_name} | --flow_type ${flow_type} | --proto ${proto} +| | ... | --src_ip ${src_ip} | --dst_ip ${dst_ip} +| | ... | --src_port ${src_port} | --dst_port ${dst_port} +| | ... | --value ${value} +| | Run Traffic Script On Node | ${traffic_script}.py | ${tg_node} | ${args} +| | Vpp Verify Flow action | ${dut1} | ${action} | ${action_value} +| | ... | ${tx_src_mac} | ${tx_dst_mac} +| | ... | ${src_ip} | ${dst_ip} diff --git a/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-gtpu-scapy.robot b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-gtpu-scapy.robot new file mode 100644 index 0000000000..0b8e44ade6 --- /dev/null +++ b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-gtpu-scapy.robot @@ -0,0 +1,123 @@ +# Copyright (c) 2021 Intel 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 *** +| Resource | resources/libraries/robot/shared/default.robot +| +| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY +| ... | NIC_Intel-X710 | ETH | IP4FWD | FLOW | GTPU | DRV_VFIO_PCI +| ... | RXQ_SIZE_0 | TXQ_SIZE_0 +| ... | ethip4-flow-ip4-gtpu +| +| Suite Setup | Setup suite topology interfaces | scapy +| Test Setup | Setup test +| Test Teardown | Tear down test | packet_trace | telemetry +| +| Test Template | Local Template +| +| Documentation | *IP4_GTPU flow test cases* +| ... +| ... | *[Top] Network Topologies:* TG-DUT1 2-node topology with one link\ +| ... | between nodes. +| ... | *[Enc] Packet Encapsulations:* Eth-IP4-GTPU. +| ... | *[Cfg] DUT configuration:* DUT is configured with IP4_GTPU flow. +| ... | *[Ver] TG verification:* Verify if the flow action is correct. + +*** Variables *** +| @{plugins_to_enable}= | dpdk_plugin.so | perfmon_plugin.so +| ${crypto_type}= | ${None} +| ${nic_name}= | Intel-X710 +| ${nic_driver}= | vfio-pci +| ${nic_rxq_size}= | 0 +| ${nic_txq_size}= | 0 +| ${nic_pfs}= | 2 +| ${nic_vfs}= | 0 +| ${overhead}= | ${0} +| ${src_ip}= | 1.1.1.1 +| ${dst_ip}= | 2.2.2.2 +| ${teid}= | ${12345} +| ${rxq}= | ${4} +# Telemetry +| ${telemetry_profile}= | vpp_test_teardown + +*** Keywords *** +| Local Template +| | [Documentation] +| | ... | [Ver] Make TG send IP4-GTPU packet routed over DUT1 interfaces.\ +| | ... | Make VPP verify flow packet is correct. +| | +| | ... | *Arguments:* +| | ... | - frame_size - Framesize in Bytes in integer. Type: integer +| | ... | - phy_cores - Number of physical cores. Type: integer +| | ... | - rxq - Number of RX queues. Type: integer +| | +| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${rxq} +| | +| | Set Test Variable | \${frame_size} +| | +| | Given Set Max Rate And Jumbo +| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq} +| | And Pre-initialize layer driver | ${nic_driver} +| | And Apply startup configuration on all VPP DUTs | with_trace=${True} +| | When Initialize layer driver | ${nic_driver} +| | And Initialize layer interface +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 Gtpu Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | teid=${teid} +| | ... | action=redirect-to-queue | value=${${rxq}-1} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=GTPU +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | value=${teid} +| | ... | action=redirect-to-queue | action_value=${${rxq}-1} +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 Gtpu Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | teid=${teid} +| | ... | action=drop +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=GTPU +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | value=${teid} +| | ... | action=drop +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 Gtpu Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | teid=${teid} +| | ... | action=mark | value=${7} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=GTPU +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | value=${teid} +| | ... | action=mark +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} + +*** Test Cases *** +| 64B-0c-ethip4-flow-ip4-gtpu-scapy +| | [Tags] | 64B | 0C +| | frame_size=${64} | phy_cores=${0} diff --git a/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ipsec-ah-scapy.robot b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ipsec-ah-scapy.robot new file mode 100644 index 0000000000..64829d914f --- /dev/null +++ b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ipsec-ah-scapy.robot @@ -0,0 +1,123 @@ +# Copyright (c) 2021 Intel 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 *** +| Resource | resources/libraries/robot/shared/default.robot +| +| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY +| ... | NIC_Intel-X710 | ETH | IP4FWD | FLOW | IPSEC | DRV_VFIO_PCI +| ... | RXQ_SIZE_0 | TXQ_SIZE_0 +| ... | ethip4-flow-ip4-ipsec-ah +| +| Suite Setup | Setup suite topology interfaces | scapy +| Test Setup | Setup test +| Test Teardown | Tear down test | packet_trace | telemetry +| +| Test Template | Local Template +| +| Documentation | *IP4_IPSEC flow test cases* +| ... +| ... | *[Top] Network Topologies:* TG-DUT1 2-node topology with one link\ +| ... | between nodes. +| ... | *[Enc] Packet Encapsulations:* Eth-IP4-AH. +| ... | *[Cfg] DUT configuration:* DUT is configured with IP4_IPSEC flow. +| ... | *[Ver] TG verification:* Verify if the flow action is correct. + +*** Variables *** +| @{plugins_to_enable}= | dpdk_plugin.so | perfmon_plugin.so +| ${crypto_type}= | ${None} +| ${nic_name}= | Intel-X710 +| ${nic_driver}= | vfio-pci +| ${nic_rxq_size}= | 0 +| ${nic_txq_size}= | 0 +| ${nic_pfs}= | 2 +| ${nic_vfs}= | 0 +| ${overhead}= | ${0} +| ${src_ip}= | 1.1.1.1 +| ${dst_ip}= | 2.2.2.2 +| ${spi}= | ${12345} +| ${rxq}= | ${4} +# Telemetry +| ${telemetry_profile}= | vpp_test_teardown + +*** Keywords *** +| Local Template +| | [Documentation] +| | ... | [Ver] Make TG send IP4-IPSEC packet routed over DUT1 interfaces.\ +| | ... | Make VPP verify flow packet is correct. +| | +| | ... | *Arguments:* +| | ... | - frame_size - Framesize in Bytes in integer. Type: integer +| | ... | - phy_cores - Number of physical cores. Type: integer +| | ... | - rxq - Number of RX queues. Type: integer +| | +| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${rxq} +| | +| | Set Test Variable | \${frame_size} +| | +| | Given Set Max Rate And Jumbo +| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq} +| | And Pre-initialize layer driver | ${nic_driver} +| | And Apply startup configuration on all VPP DUTs | with_trace=${True} +| | When Initialize layer driver | ${nic_driver} +| | And Initialize layer interface +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create IP4 Ipsec Flow | ${dut1} +| | ... | proto=AH | spi=${spi} +| | ... | action=redirect-to-queue | value=${${rxq}-1} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=AH +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | value=${spi} +| | ... | action=redirect-to-queue | action_value=${${rxq}-1} +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create IP4 Ipsec Flow | ${dut1} +| | ... | proto=AH | spi=${spi} +| | ... | action=drop +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=AH +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | value=${spi} +| | ... | action=drop +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create IP4 Ipsec Flow | ${dut1} +| | ... | proto=AH | spi=${spi} +| | ... | action=mark | value=${7} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=AH +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | value=${spi} +| | ... | action=mark +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} + +*** Test Cases *** +| 64B-0c-ethip4-flow-ip4-ipsec-ah-scapy +| | [Tags] | 64B | 0C +| | frame_size=${64} | phy_cores=${0} diff --git a/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ipsec-esp-scapy.robot b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ipsec-esp-scapy.robot new file mode 100644 index 0000000000..e1c93bf7ee --- /dev/null +++ b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ipsec-esp-scapy.robot @@ -0,0 +1,123 @@ +# Copyright (c) 2021 Intel 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 *** +| Resource | resources/libraries/robot/shared/default.robot +| +| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY +| ... | NIC_Intel-X710 | ETH | IP4FWD | FLOW | IPSEC | DRV_VFIO_PCI +| ... | RXQ_SIZE_0 | TXQ_SIZE_0 +| ... | ethip4-flow-ip4-ipsec-esp +| +| Suite Setup | Setup suite topology interfaces | scapy +| Test Setup | Setup test +| Test Teardown | Tear down test | packet_trace | telemetry +| +| Test Template | Local Template +| +| Documentation | *IP4_IPSEC flow test cases* +| ... +| ... | *[Top] Network Topologies:* TG-DUT1 2-node topology with one link\ +| ... | between nodes. +| ... | *[Enc] Packet Encapsulations:* Eth-IP4-ESP. +| ... | *[Cfg] DUT configuration:* DUT is configured with IP4_IPSEC flow. +| ... | *[Ver] TG verification:* Verify if the flow action is correct. + +*** Variables *** +| @{plugins_to_enable}= | dpdk_plugin.so | perfmon_plugin.so +| ${crypto_type}= | ${None} +| ${nic_name}= | Intel-X710 +| ${nic_driver}= | vfio-pci +| ${nic_rxq_size}= | 0 +| ${nic_txq_size}= | 0 +| ${nic_pfs}= | 2 +| ${nic_vfs}= | 0 +| ${overhead}= | ${0} +| ${src_ip}= | 1.1.1.1 +| ${dst_ip}= | 2.2.2.2 +| ${spi}= | ${12345} +| ${rxq}= | ${4} +# Telemetry +| ${telemetry_profile}= | vpp_test_teardown + +*** Keywords *** +| Local Template +| | [Documentation] +| | ... | [Ver] Make TG send IP4-IPSEC packet routed over DUT1 interfaces.\ +| | ... | Make VPP verify flow packet is correct. +| | +| | ... | *Arguments:* +| | ... | - frame_size - Framesize in Bytes in integer. Type: integer +| | ... | - phy_cores - Number of physical cores. Type: integer +| | ... | - rxq - Number of RX queues. Type: integer +| | +| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${rxq} +| | +| | Set Test Variable | \${frame_size} +| | +| | Given Set Max Rate And Jumbo +| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq} +| | And Pre-initialize layer driver | ${nic_driver} +| | And Apply startup configuration on all VPP DUTs | with_trace=${True} +| | When Initialize layer driver | ${nic_driver} +| | And Initialize layer interface +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create IP4 Ipsec Flow | ${dut1} +| | ... | proto=ESP | spi=${spi} +| | ... | action=redirect-to-queue | value=${${rxq}-1} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=ESP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | value=${spi} +| | ... | action=redirect-to-queue | action_value=${${rxq}-1} +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create IP4 Ipsec Flow | ${dut1} +| | ... | proto=ESP | spi=${spi} +| | ... | action=drop +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=ESP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | value=${spi} +| | ... | action=drop +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create IP4 Ipsec Flow | ${dut1} +| | ... | proto=ESP | spi=${spi} +| | ... | action=mark | value=${7} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=ESP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | value=${spi} +| | ... | action=mark +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} + +*** Test Cases *** +| 64B-0c-ethip4-flow-ip4-ipsec-esp-scapy +| | [Tags] | 64B | 0C +| | frame_size=${64} | phy_cores=${0} diff --git a/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-l2tpv3oip-scapy.robot b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-l2tpv3oip-scapy.robot new file mode 100644 index 0000000000..c10af0cbb2 --- /dev/null +++ b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-l2tpv3oip-scapy.robot @@ -0,0 +1,123 @@ +# Copyright (c) 2021 Intel 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 *** +| Resource | resources/libraries/robot/shared/default.robot +| +| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY +| ... | NIC_Intel-X710 | ETH | IP4FWD | FLOW | L2TPV3 | DRV_VFIO_PCI +| ... | RXQ_SIZE_0 | TXQ_SIZE_0 +| ... | ethip4-flow-ip4-l2tpv3oip +| +| Suite Setup | Setup suite topology interfaces | scapy +| Test Setup | Setup test +| Test Teardown | Tear down test | packet_trace | telemetry +| +| Test Template | Local Template +| +| Documentation | *IP4_L2TPV3OIP flow test cases* +| ... +| ... | *[Top] Network Topologies:* TG-DUT1 2-node topology with one link\ +| ... | between nodes. +| ... | *[Enc] Packet Encapsulations:* Eth-IP4-L2TPV3. +| ... | *[Cfg] DUT configuration:* DUT is configured with IP4_L2TPV3OIP flow. +| ... | *[Ver] TG verification:* Verify if the flow action is correct. + +*** Variables *** +| @{plugins_to_enable}= | dpdk_plugin.so | perfmon_plugin.so +| ${crypto_type}= | ${None} +| ${nic_name}= | Intel-X710 +| ${nic_driver}= | vfio-pci +| ${nic_rxq_size}= | 0 +| ${nic_txq_size}= | 0 +| ${nic_pfs}= | 2 +| ${nic_vfs}= | 0 +| ${overhead}= | ${0} +| ${src_ip}= | 1.1.1.1 +| ${dst_ip}= | 2.2.2.2 +| ${session_id}= | ${12345} +| ${rxq}= | ${4} +# Telemetry +| ${telemetry_profile}= | vpp_test_teardown + +*** Keywords *** +| Local Template +| | [Documentation] +| | ... | [Ver] Make TG send IP4-L2TPV3OIP packet routed over DUT1 interfaces.\ +| | ... | Make VPP verify flow packet is correct. +| | +| | ... | *Arguments:* +| | ... | - frame_size - Framesize in Bytes in integer. Type: integer +| | ... | - phy_cores - Number of physical cores. Type: integer +| | ... | - rxq - Number of RX queues. Type: integer +| | +| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${rxq} +| | +| | Set Test Variable | \${frame_size} +| | +| | Given Set Max Rate And Jumbo +| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq} +| | And Pre-initialize layer driver | ${nic_driver} +| | And Apply startup configuration on all VPP DUTs | with_trace=${True} +| | When Initialize layer driver | ${nic_driver} +| | And Initialize layer interface +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create IP4 L2tp Flow | ${dut1} +| | ... | session_id=${session_id} +| | ... | action=redirect-to-queue | value=${${rxq}-1} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=L2TPV3 +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | value=${session_id} +| | ... | action=redirect-to-queue | action_value=${${rxq}-1} +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create IP4 L2tp Flow | ${dut1} +| | ... | session_id=${session_id} +| | ... | action=drop +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=L2TPV3 +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | value=${session_id} +| | ... | action=drop +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create IP4 L2tp Flow | ${dut1} +| | ... | session_id=${session_id} +| | ... | action=mark | value=${7} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=L2TPV3 +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | value=${session_id} +| | ... | action=mark +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} + +*** Test Cases *** +| 64B-0c-ethip4-flow-ip4-l2tpv3oip-scapy +| | [Tags] | 64B | 0C +| | frame_size=${64} | phy_cores=${0} diff --git a/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ntuple-tcp-scapy.robot b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ntuple-tcp-scapy.robot new file mode 100644 index 0000000000..6aee4a89a7 --- /dev/null +++ b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ntuple-tcp-scapy.robot @@ -0,0 +1,124 @@ +# Copyright (c) 2021 Intel 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 *** +| Resource | resources/libraries/robot/shared/default.robot +| +| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY +| ... | NIC_Intel-X710 | ETH | IP4FWD | FLOW | NTUPLE | TCP | DRV_VFIO_PCI +| ... | RXQ_SIZE_0 | TXQ_SIZE_0 +| ... | ethip4-flow-ip4-ntuple-tcp +| +| Suite Setup | Setup suite topology interfaces | scapy +| Test Setup | Setup test +| Test Teardown | Tear down test | packet_trace | telemetry +| +| Test Template | Local Template +| +| Documentation | *IP4_N_TUPLE flow test cases* +| ... +| ... | *[Top] Network Topologies:* TG-DUT1 2-node topology with one link\ +| ... | between nodes. +| ... | *[Enc] Packet Encapsulations:* Eth-IP4-TCP. +| ... | *[Cfg] DUT configuration:* DUT is configured with IP4_N_TUPLE flow. +| ... | *[Ver] TG verification:* Verify if the flow action is correct. + +*** Variables *** +| @{plugins_to_enable}= | dpdk_plugin.so | perfmon_plugin.so +| ${crypto_type}= | ${None} +| ${nic_name}= | Intel-X710 +| ${nic_driver}= | vfio-pci +| ${nic_rxq_size}= | 0 +| ${nic_txq_size}= | 0 +| ${nic_pfs}= | 2 +| ${nic_vfs}= | 0 +| ${overhead}= | ${0} +| ${src_ip}= | 1.1.1.1 +| ${dst_ip}= | 2.2.2.2 +| ${src_port}= | ${100} +| ${dst_port}= | ${200} +| ${rxq}= | ${4} +# Telemetry +| ${telemetry_profile}= | vpp_test_teardown + +*** Keywords *** +| Local Template +| | [Documentation] +| | ... | [Ver] Make TG send IP4 packet routed over DUT1 interfaces.\ +| | ... | Make VPP verify flow packet is correct. +| | +| | ... | *Arguments:* +| | ... | - frame_size - Framesize in Bytes in integer. Type: integer +| | ... | - phy_cores - Number of physical cores. Type: integer +| | ... | - rxq - Number of RX queues. Type: integer +| | +| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${rxq} +| | +| | Set Test Variable | \${frame_size} +| | +| | Given Set Max Rate And Jumbo +| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq} +| | And Pre-initialize layer driver | ${nic_driver} +| | And Apply startup configuration on all VPP DUTs | with_trace=${True} +| | When Initialize layer driver | ${nic_driver} +| | And Initialize layer interface +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 N Tuple Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | ${src_port} | ${dst_port} +| | ... | proto=TCP | action=redirect-to-queue | value=${${rxq}-1} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=TCP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | src_port=${src_port} | dst_port=${dst_port} +| | ... | action=redirect-to-queue | action_value=${${rxq}-1} +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 N Tuple Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | ${src_port} | ${dst_port} +| | ... | proto=TCP | action=drop +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=TCP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | src_port=${src_port} | dst_port=${dst_port} +| | ... | action=drop +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 N Tuple Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | ${src_port} | ${dst_port} +| | ... | proto=TCP | action=mark | value=${7} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=TCP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | src_port=${src_port} | dst_port=${dst_port} +| | ... | action=mark +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} + +*** Test Cases *** +| 64B-0c-ethip4-flow-ip4-ntuple-tcp-scapy +| | [Tags] | 64B | 0C +| | frame_size=${64} | phy_cores=${0} diff --git a/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ntuple-udp-scapy.robot b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ntuple-udp-scapy.robot new file mode 100644 index 0000000000..f9e747641e --- /dev/null +++ b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-ntuple-udp-scapy.robot @@ -0,0 +1,124 @@ +# Copyright (c) 2021 Intel 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 *** +| Resource | resources/libraries/robot/shared/default.robot +| +| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY +| ... | NIC_Intel-X710 | ETH | IP4FWD | FLOW | NTUPLE | UDP | DRV_VFIO_PCI +| ... | RXQ_SIZE_0 | TXQ_SIZE_0 +| ... | ethip4-flow-ip4-ntuple-udp +| +| Suite Setup | Setup suite topology interfaces | scapy +| Test Setup | Setup test +| Test Teardown | Tear down test | packet_trace | telemetry +| +| Test Template | Local Template +| +| Documentation | *IP4_N_TUPLE flow test cases* +| ... +| ... | *[Top] Network Topologies:* TG-DUT1 2-node topology with one link\ +| ... | between nodes. +| ... | *[Enc] Packet Encapsulations:* Eth-IP4-UDP. +| ... | *[Cfg] DUT configuration:* DUT is configured with IP4_N_TUPLE flow. +| ... | *[Ver] TG verification:* Verify if the flow action is correct. + +*** Variables *** +| @{plugins_to_enable}= | dpdk_plugin.so | perfmon_plugin.so +| ${crypto_type}= | ${None} +| ${nic_name}= | Intel-X710 +| ${nic_driver}= | vfio-pci +| ${nic_rxq_size}= | 0 +| ${nic_txq_size}= | 0 +| ${nic_pfs}= | 2 +| ${nic_vfs}= | 0 +| ${overhead}= | ${0} +| ${src_ip}= | 1.1.1.1 +| ${dst_ip}= | 2.2.2.2 +| ${src_port}= | ${100} +| ${dst_port}= | ${200} +| ${rxq}= | ${4} +# Telemetry +| ${telemetry_profile}= | vpp_test_teardown + +*** Keywords *** +| Local Template +| | [Documentation] +| | ... | [Ver] Make TG send IP4 packet routed over DUT1 interfaces.\ +| | ... | Make VPP verify flow packet is correct. +| | +| | ... | *Arguments:* +| | ... | - frame_size - Framesize in Bytes in integer. Type: integer +| | ... | - phy_cores - Number of physical cores. Type: integer +| | ... | - rxq - Number of RX queues. Type: integer +| | +| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${rxq} +| | +| | Set Test Variable | \${frame_size} +| | +| | Given Set Max Rate And Jumbo +| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq} +| | And Pre-initialize layer driver | ${nic_driver} +| | And Apply startup configuration on all VPP DUTs | with_trace=${True} +| | When Initialize layer driver | ${nic_driver} +| | And Initialize layer interface +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 N Tuple Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | ${src_port} | ${dst_port} +| | ... | proto=UDP | action=redirect-to-queue | value=${${rxq}-1} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=UDP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | src_port=${src_port} | dst_port=${dst_port} +| | ... | action=redirect-to-queue | action_value=${${rxq}-1} +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 N Tuple Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | ${src_port} | ${dst_port} +| | ... | proto=UDP | action=drop +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=UDP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | src_port=${src_port} | dst_port=${dst_port} +| | ... | action=drop +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 N Tuple Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | ${src_port} | ${dst_port} +| | ... | proto=UDP | action=mark | value=${7} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=UDP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | src_port=${src_port} | dst_port=${dst_port} +| | ... | action=mark +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} + +*** Test Cases *** +| 64B-0c-ethip4-flow-ip4-ntuple-udp-scapy +| | [Tags] | 64B | 0C +| | frame_size=${64} | phy_cores=${0} diff --git a/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-tcp-scapy.robot b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-tcp-scapy.robot new file mode 100644 index 0000000000..b5d3548e1d --- /dev/null +++ b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-tcp-scapy.robot @@ -0,0 +1,119 @@ +# Copyright (c) 2021 Intel 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 *** +| Resource | resources/libraries/robot/shared/default.robot +| +| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY +| ... | NIC_Intel-X710 | ETH | IP4FWD | FLOW | TCP | DRV_VFIO_PCI +| ... | RXQ_SIZE_0 | TXQ_SIZE_0 +| ... | ethip4-flow-ip4-tcp +| +| Suite Setup | Setup suite topology interfaces | scapy +| Test Setup | Setup test +| Test Teardown | Tear down test | packet_trace | telemetry +| +| Test Template | Local Template +| +| Documentation | *IP4 flow test cases* +| ... +| ... | *[Top] Network Topologies:* TG-DUT1 2-node topology with one link\ +| ... | between nodes. +| ... | *[Enc] Packet Encapsulations:* Eth-IP4-TCP. +| ... | *[Cfg] DUT configuration:* DUT is configured with IP4 flow. +| ... | *[Ver] TG verification:* Verify if the flow action is correct. + +*** Variables *** +| @{plugins_to_enable}= | dpdk_plugin.so | perfmon_plugin.so +| ${crypto_type}= | ${None} +| ${nic_name}= | Intel-X710 +| ${nic_driver}= | vfio-pci +| ${nic_rxq_size}= | 0 +| ${nic_txq_size}= | 0 +| ${nic_pfs}= | 2 +| ${nic_vfs}= | 0 +| ${overhead}= | ${0} +| ${src_ip}= | 1.1.1.1 +| ${dst_ip}= | 2.2.2.2 +| ${rxq}= | ${4} +# Telemetry +| ${telemetry_profile}= | vpp_test_teardown + +*** Keywords *** +| Local Template +| | [Documentation] +| | ... | [Ver] Make TG send IP4 packet routed over DUT1 interfaces.\ +| | ... | Make VPP verify flow packet is correct. +| | +| | ... | *Arguments:* +| | ... | - frame_size - Framesize in Bytes in integer. Type: integer +| | ... | - phy_cores - Number of physical cores. Type: integer +| | ... | - rxq - Number of RX queues. Type: integer +| | +| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${rxq} +| | +| | Set Test Variable | \${frame_size} +| | +| | Given Set Max Rate And Jumbo +| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq} +| | And Pre-initialize layer driver | ${nic_driver} +| | And Apply startup configuration on all VPP DUTs | with_trace=${True} +| | When Initialize layer driver | ${nic_driver} +| | And Initialize layer interface +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | proto=TCP +| | ... | action=redirect-to-queue | value=${${rxq}-1} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=TCP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | action=redirect-to-queue | action_value=${${rxq}-1} +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | proto=TCP +| | ... | action=drop +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=TCP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | action=drop +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | proto=TCP +| | ... | action=mark | value=${7} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=TCP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | action=mark +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} + +*** Test Cases *** +| 64B-0c-ethip4-flow-ip4-tcp-scapy +| | [Tags] | 64B | 0C +| | frame_size=${64} | phy_cores=${0} diff --git a/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-udp-scapy.robot b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-udp-scapy.robot new file mode 100644 index 0000000000..47f625cc02 --- /dev/null +++ b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip4-flow-ip4-udp-scapy.robot @@ -0,0 +1,119 @@ +# Copyright (c) 2021 Intel 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 *** +| Resource | resources/libraries/robot/shared/default.robot +| +| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY +| ... | NIC_Intel-X710 | ETH | IP4FWD | FLOW | UDP | DRV_VFIO_PCI +| ... | RXQ_SIZE_0 | TXQ_SIZE_0 +| ... | ethip4-flow-ip4-udp +| +| Suite Setup | Setup suite topology interfaces | scapy +| Test Setup | Setup test +| Test Teardown | Tear down test | packet_trace | telemetry +| +| Test Template | Local Template +| +| Documentation | *IP4 flow test cases* +| ... +| ... | *[Top] Network Topologies:* TG-DUT1 2-node topology with one link\ +| ... | between nodes. +| ... | *[Enc] Packet Encapsulations:* Eth-IP4-UDP. +| ... | *[Cfg] DUT configuration:* DUT is configured with IP4 flow. +| ... | *[Ver] TG verification:* Verify if the flow action is correct. + +*** Variables *** +| @{plugins_to_enable}= | dpdk_plugin.so | perfmon_plugin.so +| ${crypto_type}= | ${None} +| ${nic_name}= | Intel-X710 +| ${nic_driver}= | vfio-pci +| ${nic_rxq_size}= | 0 +| ${nic_txq_size}= | 0 +| ${nic_pfs}= | 2 +| ${nic_vfs}= | 0 +| ${overhead}= | ${0} +| ${src_ip}= | 1.1.1.1 +| ${dst_ip}= | 2.2.2.2 +| ${rxq}= | ${4} +# Telemetry +| ${telemetry_profile}= | vpp_test_teardown + +*** Keywords *** +| Local Template +| | [Documentation] +| | ... | [Ver] Make TG send IP4 packet routed over DUT1 interfaces.\ +| | ... | Make VPP verify flow packet is correct. +| | +| | ... | *Arguments:* +| | ... | - frame_size - Framesize in Bytes in integer. Type: integer +| | ... | - phy_cores - Number of physical cores. Type: integer +| | ... | - rxq - Number of RX queues. Type: integer +| | +| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${rxq} +| | +| | Set Test Variable | \${frame_size} +| | +| | Given Set Max Rate And Jumbo +| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq} +| | And Pre-initialize layer driver | ${nic_driver} +| | And Apply startup configuration on all VPP DUTs | with_trace=${True} +| | When Initialize layer driver | ${nic_driver} +| | And Initialize layer interface +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | proto=UDP +| | ... | action=redirect-to-queue | value=${${rxq}-1} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=UDP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | action=redirect-to-queue | action_value=${${rxq}-1} +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | proto=UDP +| | ... | action=drop +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=UDP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | action=drop +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip4 Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | proto=UDP +| | ... | action=mark | value=${7} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP4 | proto=UDP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | action=mark +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} + +*** Test Cases *** +| 64B-0c-ethip4-flow-ip4-udp-scapy +| | [Tags] | 64B | 0C +| | frame_size=${64} | phy_cores=${0} diff --git a/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-ntuple-tcp-scapy.robot b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-ntuple-tcp-scapy.robot new file mode 100644 index 0000000000..4c4e862461 --- /dev/null +++ b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-ntuple-tcp-scapy.robot @@ -0,0 +1,124 @@ +# Copyright (c) 2021 Intel 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 *** +| Resource | resources/libraries/robot/shared/default.robot +| +| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY +| ... | NIC_Intel-X710 | ETH | IP6FWD | FLOW | NTUPLE | TCP | DRV_VFIO_PCI +| ... | RXQ_SIZE_0 | TXQ_SIZE_0 +| ... | ethip6-flow-ip6-ntuple-tcp +| +| Suite Setup | Setup suite topology interfaces | scapy +| Test Setup | Setup test +| Test Teardown | Tear down test | packet_trace | telemetry +| +| Test Template | Local Template +| +| Documentation | *IP6_N_TUPLE flow test cases* +| ... +| ... | *[Top] Network Topologies:* TG-DUT1 2-node topology with one link\ +| ... | between nodes. +| ... | *[Enc] Packet Encapsulations:* Eth-IP6-TCP. +| ... | *[Cfg] DUT configuration:* DUT is configured with IP6_N_TUPLE flow. +| ... | *[Ver] TG verification:* Verify if the flow action is correct. + +*** Variables *** +| @{plugins_to_enable}= | dpdk_plugin.so | perfmon_plugin.so +| ${crypto_type}= | ${None} +| ${nic_name}= | Intel-X710 +| ${nic_driver}= | vfio-pci +| ${nic_rxq_size}= | 0 +| ${nic_txq_size}= | 0 +| ${nic_pfs}= | 2 +| ${nic_vfs}= | 0 +| ${overhead}= | ${0} +| ${src_ip}= | 2001:0db8:3c4d:0015:0000:0000:1a2f:1a2b +| ${dst_ip}= | 1011:2022:3033:4044:5055:6066:7077:8088 +| ${src_port}= | ${100} +| ${dst_port}= | ${200} +| ${rxq}= | ${4} +# Telemetry +| ${telemetry_profile}= | vpp_test_teardown + +*** Keywords *** +| Local Template +| | [Documentation] +| | ... | [Ver] Make TG send IP6 packet routed over DUT1 interfaces.\ +| | ... | Make VPP verify flow packet is correct. +| | +| | ... | *Arguments:* +| | ... | - frame_size - Framesize in Bytes in integer. Type: integer +| | ... | - phy_cores - Number of physical cores. Type: integer +| | ... | - rxq - Number of RX queues. Type: integer +| | +| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${rxq} +| | +| | Set Test Variable | \${frame_size} +| | +| | Given Set Max Rate And Jumbo +| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq} +| | And Pre-initialize layer driver | ${nic_driver} +| | And Apply startup configuration on all VPP DUTs | with_trace=${True} +| | When Initialize layer driver | ${nic_driver} +| | And Initialize layer interface +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip6 N Tuple Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | ${src_port} | ${dst_port} +| | ... | proto=TCP | action=redirect-to-queue | value=${${rxq}-1} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP6 | proto=TCP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | src_port=${src_port} | dst_port=${dst_port} +| | ... | action=redirect-to-queue | action_value=${${rxq}-1} +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip6 N Tuple Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | ${src_port} | ${dst_port} +| | ... | proto=TCP | action=drop +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP6 | proto=TCP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | src_port=${src_port} | dst_port=${dst_port} +| | ... | action=drop +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip6 N Tuple Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | ${src_port} | ${dst_port} +| | ... | proto=TCP | action=mark | value=${7} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP6 | proto=TCP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | src_port=${src_port} | dst_port=${dst_port} +| | ... | action=mark +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} + +*** Test Cases *** +| 64B-0c-ethip6-flow-ip6-ntuple-tcp-scapy +| | [Tags] | 64B | 0C +| | frame_size=${64} | phy_cores=${0} diff --git a/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-ntuple-udp-scapy.robot b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-ntuple-udp-scapy.robot new file mode 100644 index 0000000000..8f27b4cf83 --- /dev/null +++ b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-ntuple-udp-scapy.robot @@ -0,0 +1,124 @@ +# Copyright (c) 2021 Intel 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 *** +| Resource | resources/libraries/robot/shared/default.robot +| +| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY +| ... | NIC_Intel-X710 | ETH | IP6FWD | FLOW | NTUPLE | UDP | DRV_VFIO_PCI +| ... | RXQ_SIZE_0 | TXQ_SIZE_0 +| ... | ethip6-flow-ip6-ntuple-udp +| +| Suite Setup | Setup suite topology interfaces | scapy +| Test Setup | Setup test +| Test Teardown | Tear down test | packet_trace | telemetry +| +| Test Template | Local Template +| +| Documentation | *IP6_N_TUPLE flow test cases* +| ... +| ... | *[Top] Network Topologies:* TG-DUT1 2-node topology with one link\ +| ... | between nodes. +| ... | *[Enc] Packet Encapsulations:* Eth-IP6-UDP. +| ... | *[Cfg] DUT configuration:* DUT is configured with IP6_N_TUPLE flow. +| ... | *[Ver] TG verification:* Verify if the flow action is correct. + +*** Variables *** +| @{plugins_to_enable}= | dpdk_plugin.so | perfmon_plugin.so +| ${crypto_type}= | ${None} +| ${nic_name}= | Intel-X710 +| ${nic_driver}= | vfio-pci +| ${nic_rxq_size}= | 0 +| ${nic_txq_size}= | 0 +| ${nic_pfs}= | 2 +| ${nic_vfs}= | 0 +| ${overhead}= | ${0} +| ${src_ip}= | 2001:0db8:3c4d:0015:0000:0000:1a2f:1a2b +| ${dst_ip}= | 1011:2022:3033:4044:5055:6066:7077:8088 +| ${src_port}= | ${100} +| ${dst_port}= | ${200} +| ${rxq}= | ${4} +# Telemetry +| ${telemetry_profile}= | vpp_test_teardown + +*** Keywords *** +| Local Template +| | [Documentation] +| | ... | [Ver] Make TG send IP6 packet routed over DUT1 interfaces.\ +| | ... | Make VPP verify flow packet is correct. +| | +| | ... | *Arguments:* +| | ... | - frame_size - Framesize in Bytes in integer. Type: integer +| | ... | - phy_cores - Number of physical cores. Type: integer +| | ... | - rxq - Number of RX queues. Type: integer +| | +| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${rxq} +| | +| | Set Test Variable | \${frame_size} +| | +| | Given Set Max Rate And Jumbo +| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq} +| | And Pre-initialize layer driver | ${nic_driver} +| | And Apply startup configuration on all VPP DUTs | with_trace=${True} +| | When Initialize layer driver | ${nic_driver} +| | And Initialize layer interface +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip6 N Tuple Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | ${src_port} | ${dst_port} +| | ... | proto=UDP | action=redirect-to-queue | value=${${rxq}-1} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP6 | proto=UDP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | src_port=${src_port} | dst_port=${dst_port} +| | ... | action=redirect-to-queue | action_value=${${rxq}-1} +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip6 N Tuple Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | ${src_port} | ${dst_port} +| | ... | proto=UDP | action=drop +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP6 | proto=UDP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | src_port=${src_port} | dst_port=${dst_port} +| | ... | action=drop +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip6 N Tuple Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | ${src_port} | ${dst_port} +| | ... | proto=UDP | action=mark | value=${7} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP6 | proto=UDP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | src_port=${src_port} | dst_port=${dst_port} +| | ... | action=mark +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} + +*** Test Cases *** +| 64B-0c-ethip6-flow-ip6-ntuple-udp-scapy +| | [Tags] | 64B | 0C +| | frame_size=${64} | phy_cores=${0} diff --git a/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-tcp-scapy.robot b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-tcp-scapy.robot new file mode 100644 index 0000000000..9e50a278e7 --- /dev/null +++ b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-tcp-scapy.robot @@ -0,0 +1,119 @@ +# Copyright (c) 2021 Intel 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 *** +| Resource | resources/libraries/robot/shared/default.robot +| +| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY +| ... | NIC_Intel-X710 | ETH | IP6FWD | FLOW | TCP | DRV_VFIO_PCI +| ... | RXQ_SIZE_0 | TXQ_SIZE_0 +| ... | ethip6-flow-ip6-tcp +| +| Suite Setup | Setup suite topology interfaces | scapy +| Test Setup | Setup test +| Test Teardown | Tear down test | packet_trace | telemetry +| +| Test Template | Local Template +| +| Documentation | *IP6 flow test cases* +| ... +| ... | *[Top] Network Topologies:* TG-DUT1 2-node topology with one link\ +| ... | between nodes. +| ... | *[Enc] Packet Encapsulations:* Eth-IP6-TCP. +| ... | *[Cfg] DUT configuration:* DUT is configured with IP6 flow. +| ... | *[Ver] TG verification:* Verify if the flow action is correct. + +*** Variables *** +| @{plugins_to_enable}= | dpdk_plugin.so | perfmon_plugin.so +| ${crypto_type}= | ${None} +| ${nic_name}= | Intel-X710 +| ${nic_driver}= | vfio-pci +| ${nic_rxq_size}= | 0 +| ${nic_txq_size}= | 0 +| ${nic_pfs}= | 2 +| ${nic_vfs}= | 0 +| ${overhead}= | ${0} +| ${src_ip}= | 2001:0db8:3c4d:0015:0000:0000:1a2f:1a2b +| ${dst_ip}= | 1011:2022:3033:4044:5055:6066:7077:8088 +| ${rxq}= | ${4} +# Telemetry +| ${telemetry_profile}= | vpp_test_teardown + +*** Keywords *** +| Local Template +| | [Documentation] +| | ... | [Ver] Make TG send IP6 packet routed over DUT1 interfaces.\ +| | ... | Make VPP verify flow packet is correct. +| | +| | ... | *Arguments:* +| | ... | - frame_size - Framesize in Bytes in integer. Type: integer +| | ... | - phy_cores - Number of physical cores. Type: integer +| | ... | - rxq - Number of RX queues. Type: integer +| | +| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${rxq} +| | +| | Set Test Variable | \${frame_size} +| | +| | Given Set Max Rate And Jumbo +| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq} +| | And Pre-initialize layer driver | ${nic_driver} +| | And Apply startup configuration on all VPP DUTs | with_trace=${True} +| | When Initialize layer driver | ${nic_driver} +| | And Initialize layer interface +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip6 Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | proto=TCP +| | ... | action=redirect-to-queue | value=${${rxq}-1} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP6 | proto=TCP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | action=redirect-to-queue | action_value=${${rxq}-1} +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip6 Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | proto=TCP +| | ... | action=drop +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP6 | proto=TCP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | action=drop +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip6 Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | proto=TCP +| | ... | action=mark | value=${7} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP6 | proto=TCP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | action=mark +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} + +*** Test Cases *** +| 64B-0c-ethip6-flow-ip6-tcp-scapy +| | [Tags] | 64B | 0C +| | frame_size=${64} | phy_cores=${0} diff --git a/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-udp-scapy.robot b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-udp-scapy.robot new file mode 100644 index 0000000000..996a631713 --- /dev/null +++ b/tests/vpp/device/flow/2n1l-10ge2p1x710-ethip6-flow-ip6-udp-scapy.robot @@ -0,0 +1,119 @@ +# Copyright (c) 2021 Intel 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 *** +| Resource | resources/libraries/robot/shared/default.robot +| +| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY +| ... | NIC_Intel-X710 | ETH | IP6FWD | FLOW | UDP | DRV_VFIO_PCI +| ... | RXQ_SIZE_0 | TXQ_SIZE_0 +| ... | ethip6-flow-ip6-udp +| +| Suite Setup | Setup suite topology interfaces | scapy +| Test Setup | Setup test +| Test Teardown | Tear down test | packet_trace | telemetry +| +| Test Template | Local Template +| +| Documentation | *IP6 flow test cases* +| ... +| ... | *[Top] Network Topologies:* TG-DUT1 2-node topology with one link\ +| ... | between nodes. +| ... | *[Enc] Packet Encapsulations:* Eth-IP6-UDP. +| ... | *[Cfg] DUT configuration:* DUT is configured with IP6 flow. +| ... | *[Ver] TG verification:* Verify if the flow action is correct. + +*** Variables *** +| @{plugins_to_enable}= | dpdk_plugin.so | perfmon_plugin.so +| ${crypto_type}= | ${None} +| ${nic_name}= | Intel-X710 +| ${nic_driver}= | vfio-pci +| ${nic_rxq_size}= | 0 +| ${nic_txq_size}= | 0 +| ${nic_pfs}= | 2 +| ${nic_vfs}= | 0 +| ${overhead}= | ${0} +| ${src_ip}= | 2001:0db8:3c4d:0015:0000:0000:1a2f:1a2b +| ${dst_ip}= | 1011:2022:3033:4044:5055:6066:7077:8088 +| ${rxq}= | ${4} +# Telemetry +| ${telemetry_profile}= | vpp_test_teardown + +*** Keywords *** +| Local Template +| | [Documentation] +| | ... | [Ver] Make TG send IP6 packet routed over DUT1 interfaces.\ +| | ... | Make VPP verify flow packet is correct. +| | +| | ... | *Arguments:* +| | ... | - frame_size - Framesize in Bytes in integer. Type: integer +| | ... | - phy_cores - Number of physical cores. Type: integer +| | ... | - rxq - Number of RX queues. Type: integer +| | +| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${rxq} +| | +| | Set Test Variable | \${frame_size} +| | +| | Given Set Max Rate And Jumbo +| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq} +| | And Pre-initialize layer driver | ${nic_driver} +| | And Apply startup configuration on all VPP DUTs | with_trace=${True} +| | When Initialize layer driver | ${nic_driver} +| | And Initialize layer interface +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip6 Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | proto=UDP +| | ... | action=redirect-to-queue | value=${${rxq}-1} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP6 | proto=UDP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | action=redirect-to-queue | action_value=${${rxq}-1} +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip6 Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | proto=UDP +| | ... | action=drop +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP6 | proto=UDP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | action=drop +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} +| | +| | Clear Packet Trace On Dut | ${dut1} +| | Vpp Enable Traces On Dut | ${dut1} +| | ${flow_index} = | And Vpp Create Ip6 Flow | ${dut1} +| | ... | ${src_ip} | ${dst_ip} | proto=UDP +| | ... | action=mark | value=${7} +| | And Vpp Flow Enable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | Then Send flow packet and verify action +| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_${int}1_mac}[0] +| | ... | flow_type=IP6 | proto=UDP +| | ... | src_ip=${src_ip} | dst_ip=${dst_ip} +| | ... | action=mark +| | And Vpp Flow Disable | ${dut1} | ${DUT1_${int}1}[0] | ${flow_index} +| | And Vpp Flow Del | ${dut1} | ${flow_index} + +*** Test Cases *** +| 64B-0c-ethip6-flow-ip6-udp-scapy +| | [Tags] | 64B | 0C +| | frame_size=${64} | phy_cores=${0} diff --git a/tests/vpp/device/flow/regenerate_testcases.py b/tests/vpp/device/flow/regenerate_testcases.py new file mode 100755 index 0000000000..87521e662d --- /dev/null +++ b/tests/vpp/device/flow/regenerate_testcases.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2021 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.autogen.Regenerator import Regenerator + +Regenerator().regenerate_glob(u"*.robot") -- 2.16.6