diff options
author | Tibor Frank <tifrank@cisco.com> | 2019-06-26 12:56:04 +0200 |
---|---|---|
committer | Tibor Frank <tifrank@cisco.com> | 2019-06-27 12:17:07 +0200 |
commit | a8b330a297d085a217ecdb39a74130ee0626b16e (patch) | |
tree | 7d2abf4e33eec2c010b3526bc6ba0ec46ce63bbf | |
parent | a5df75f5c9739ce84814d999ab3efc3142c47086 (diff) |
VAT-to-PAPI: IPFIX and SPAN
Change-Id: I34bdc17d6350e5a441dabd9154620627780f4c12
Signed-off-by: Tibor Frank <tifrank@cisco.com>
20 files changed, 23 insertions, 1608 deletions
diff --git a/bootstrap.sh b/bootstrap.sh index 989f786df0..44b0dc02ae 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -101,7 +101,7 @@ VIRL_SERVER_EXPECTED_STATUS="PRODUCTION" SSH_OPTIONS="-i ${VIRL_PKEY} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o BatchMode=yes -o LogLevel=error" -TEST_GROUPS=("ip4_tunnels,ip6,ip6_tunnels,l2bd" "ip4,l2xc,telemetry") +TEST_GROUPS=("ip6,ip4_tunnels,l2bd" "ip4,ip6_tunnels,l2xc") SUITE_PATH="tests.vpp.func" SKIP_PATCH="SKIP_PATCH" diff --git a/resources/libraries/python/telemetry/IPFIXSetup.py b/resources/libraries/python/telemetry/IPFIXSetup.py deleted file mode 100644 index db703c8a7e..0000000000 --- a/resources/libraries/python/telemetry/IPFIXSetup.py +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright (c) 2018 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. - -"""IPFIX setup library""" - -from resources.libraries.python.topology import Topology -from resources.libraries.python.VatExecutor import VatTerminal - - -class IPFIXSetup(object): - """Class contains methods for seting up IPFIX reporting on DUTs.""" - - def __init__(self): - """Initializer.""" - pass - - @staticmethod - def setup_ipfix_exporter(node, collector, source, fib=None, mtu=None, - interval=None): - """Setup an IPFIX exporter on node to export collected flow data. - - :param node: DUT node. - :param collector: IP address of flow data collector. - :param source: IP address of local interface to send flow data from. - :param fib: fib table ID. - :param mtu: Maximum transfer unit of path to collector. - :param interval: Frequency of sending template packets, in seconds. - :type node: dict - :type collector: str - :type source: str - :type fib: int - :type mtu: int - :type interval: int - """ - - fib = "vrf_id {0}".format(fib) if fib else '' - mtu = "path_mtu {0}".format(mtu) if mtu else '' - interval = "template_interval {0}".format(interval) if interval else '' - - with VatTerminal(node, json_param=False) as vat: - vat.vat_terminal_exec_cmd_from_template('ipfix_exporter_set.vat', - collector=collector, - source=source, - fib=fib, - mtu=mtu, - interval=interval) - - @staticmethod - def assign_interface_to_flow_table(node, interface, table_id, - ip_version='ip4'): - """Assigns a VPP interface to the specified classify table for IPFIX - flow data collection. - - :param node: DUT node. - :param interface: An interface on the DUT node. - :param table_id: ID of a classify table. - :param ip_version: Version of IP protocol. Valid options are ip4, ip6. - :type node: dict - :type interface: str or int - :type table_id: int - :type ip_version: str - """ - - if isinstance(interface, basestring): - sw_if_index = Topology.get_interface_sw_index(node, interface) - elif isinstance(interface, int): - sw_if_index = interface - else: - raise TypeError - - table = "{0}-table {1}".format(ip_version, table_id) - - with VatTerminal(node, json_param=False) as vat: - vat.vat_terminal_exec_cmd_from_template( - "ipfix_interface_enable.vat", - interface=sw_if_index, - table=table, - delete='') - - @staticmethod - def set_ipfix_stream(node, domain=None, src_port=None): - """Set an IPFIX export stream. Can be used to break up IPFIX reports - into separate reporting domains. - - :param node: DUT node. - :param domain: Desired index number of exporting domain. - :param src_port: Source port to use when sending IPFIX packets. Default - is the standard IPFIX port 4739. - :type node: dict - :type domain: int - :type src_port: int - """ - - domain = "domain {0}".format(domain) if domain else '' - src_port = "src_port {0}".format(src_port) if src_port else '' - - with VatTerminal(node, json_param=False) as vat: - vat.vat_terminal_exec_cmd_from_template("ipfix_stream_set.vat", - domain=domain, - src_port=src_port) - - @staticmethod - def assign_classify_table_to_exporter(node, table_id, ip_version='ip4'): - """Assign a classify table to an IPFIX exporter. Classified packets will - be included in the IPFIX flow report. - - :param node: DUT node. - :param table_id: ID of a classify table. - :param ip_version: Version of IP protocol. Valid options are ip4, ip6. - :type node: dict - :type table_id: int - :type ip_version: str - """ - - with VatTerminal(node, json_param=False) as vat: - vat.vat_terminal_exec_cmd_from_template("ipfix_table_add.vat", - table=table_id, - ip_version=ip_version, - add_del='add') diff --git a/resources/libraries/python/telemetry/IPFIXUtil.py b/resources/libraries/python/telemetry/IPFIXUtil.py deleted file mode 100644 index 2f83760759..0000000000 --- a/resources/libraries/python/telemetry/IPFIXUtil.py +++ /dev/null @@ -1,105 +0,0 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""IPFIX utilities library. Provides classes that allow scapy to work -with IPFIX packets. - - Note: - Template and data sets in one packet are not supported. - Option template sets (Set_ID = 3) are not supported. - """ - - -from scapy.all import Packet, bind_layers -from scapy.fields import ByteField, ShortField, IntField, LongField, IPField,\ - StrFixedLenField, FieldListField -from scapy.layers.inet import UDP -from scapy.layers.inet6 import IP6Field -from scapy.contrib.ppi_geotag import UTCTimeField - - -class IPFIXHandler(object): - """Class for handling IPFIX packets. To use, create instance of class before - dissecting IPFIX packets with scapy, then run update_template every time - an IPFIX template packet is received.""" - - template_elements = { - 4: ByteField("Protocol_ID", 0x00), - 7: ShortField("src_port", 0), - 8: IPField("IPv4_src", ""), - 11: ShortField("dst_port", 0), - 12: IPField("IPv4_dst", ""), - 27: IP6Field("IPv6_src", "::"), - 28: IP6Field("IPv6_dst", "::"), - 86: LongField("packetTotalCount", 0), - 180: ShortField("udp_src_port", 0), - 181: ShortField("udp_dst_port", 0), - 182: ShortField("tcp_src_port", 0), - 183: ShortField("tcp_dst_port", 0), - 193: ByteField("Next_header", 0x00) - } - - def __init__(self): - """Initializer, registers IPFIX header and template layers with scapy. - """ - bind_layers(UDP, IPFIXHeader, dport=4739) - bind_layers(IPFIXHeader, IPFIXTemplate, Set_ID=2) - - def update_template(self, packet): - """Updates IPFIXData class with new data template. Registers IPFIX data - layer with scapy using the new template. - - :param packet: Packet containing an IPFIX template. - :type packet: scapy.Ether - """ - template_list = packet['IPFIX template'].Template - template_id = packet['IPFIX template'].Template_ID - - IPFIXData.fields_desc = [] - for item in template_list[::2]: - try: - IPFIXData.fields_desc.append(self.template_elements[item]) - except KeyError: - raise KeyError( - "Unknown IPFIX template element with ID {0}".format(item)) - bind_layers(IPFIXHeader, IPFIXData, Set_ID=template_id) - # if the packet doesn't end here, assume it contains more data sets - bind_layers(IPFIXData, IPFIXData) - - -class IPFIXHeader(Packet): - """Class for IPFIX header.""" - name = "IPFIX header" - fields_desc = [StrFixedLenField("Version", 0x000a, length=2), - ShortField("Message Length", 0), - UTCTimeField("Timestamp(UTC)", ""), - IntField("Sequence Number", 0), - IntField("Observation Domain ID", 0), - ShortField("Set_ID", 0), - ShortField("Set_Length", 0)] - - -class IPFIXTemplate(Packet): - """Class for IPFIX template layer.""" - name = "IPFIX template" - fields_desc = [ShortField("Template_ID", 256), - ShortField("nFields", 2), - FieldListField("Template", [], ShortField("type_len", ""), - count_from=lambda p: p.nFields*2)] - - -class IPFIXData(Packet): - """Class for IPFIX data layer. Needs to be updated with - a template before use.""" - name = "IPFIX flow data" - fields_desc = [] diff --git a/resources/libraries/python/telemetry/SPAN.py b/resources/libraries/python/telemetry/SPAN.py index 048e89ba67..c282c6160b 100644 --- a/resources/libraries/python/telemetry/SPAN.py +++ b/resources/libraries/python/telemetry/SPAN.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Cisco and/or its affiliates. +# Copyright (c) 2019 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: @@ -14,7 +14,7 @@ """SPAN setup library""" from resources.libraries.python.topology import Topology -from resources.libraries.python.VatExecutor import VatTerminal +from resources.libraries.python.PapiExecutor import PapiExecutor class SPAN(object): @@ -25,39 +25,26 @@ class SPAN(object): pass @staticmethod - def set_span_mirroring(node, src_if, dst_if): - """Set Span mirroring on the specified node. - - :param node: DUT node. - :param src_if: Interface to mirror traffic from. - :param dst_if: Interface to mirror traffic to. - :type node: dict - :type src_if: str - :type dst_if: str - """ - - src_if = Topology.get_interface_sw_index(node, src_if) - dst_if = Topology.get_interface_sw_index(node, dst_if) - - with VatTerminal(node, json_param=False) as vat: - vat.vat_terminal_exec_cmd_from_template('span_create.vat', - src_sw_if_index=src_if, - dst_sw_if_index=dst_if) - - @staticmethod - def vpp_get_span_configuration(node): + def vpp_get_span_configuration(node, is_l2=False): """Get full SPAN configuration from VPP node. + Used by Honeycomb. + :param node: DUT node. :type node: dict + :returns: Full SPAN configuration as list. One list entry for every source/destination interface pair. :rtype: list of dict """ + args = dict( + is_l2=1 if is_l2 else 0 + ) + with PapiExecutor(node) as papi_exec: + dump = papi_exec.add("sw_interface_span_dump", **args). \ + get_dump().reply[0]["api_reply"] - with VatTerminal(node, json_param=True) as vat: - data = vat.vat_terminal_exec_cmd_from_template('span_dump.vat') - return data[0] + return dump @staticmethod def vpp_get_span_configuration_by_interface(node, dst_interface, @@ -65,6 +52,8 @@ class SPAN(object): """Get a list of all interfaces currently being mirrored to the specified interface. + Used by Honeycomb. + :param node: DUT node. :param dst_interface: Name, sw_if_index or key of interface. :param ret_format: Optional. Desired format of returned interfaces. @@ -78,12 +67,13 @@ class SPAN(object): data = SPAN.vpp_get_span_configuration(node) - dst_interface = Topology.convert_interface_reference( + dst_int = Topology.convert_interface_reference( node, dst_interface, "sw_if_index") src_interfaces = [] for item in data: - if item["dst-if-index"] == dst_interface: - src_interfaces.append(item["src-if-index"]) + if item["sw_interface_span_details"]["sw_if_index_to"] == dst_int: + src_interfaces.append( + item["sw_interface_span_details"]["sw_if_index_from"]) if ret_format != "sw_if_index": src_interfaces = [ diff --git a/resources/libraries/robot/telemetry/ipfix.robot b/resources/libraries/robot/telemetry/ipfix.robot deleted file mode 100644 index b7d8ac74f9..0000000000 --- a/resources/libraries/robot/telemetry/ipfix.robot +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""IPFIX keywords""" - -*** Settings *** -| Library | resources.libraries.python.TrafficScriptExecutor -| Library | resources.libraries.python.InterfaceUtil -| Resource | resources/libraries/robot/shared/default.robot -| Documentation | Traffic keywords - -*** Keywords *** -| Send packets and verify IPFIX -| | [Documentation] | Send simple TCP or UDP packets from source interface\ -| | ... | to destination interface. Listen for IPFIX flow report on source\ -| | ... | interface and verify received report against number of packets sent. -| | ... -| | ... | *Arguments:* -| | ... -| | ... | - tg_node - TG node. Type: dictionary -| | ... | - dst_node - Destination node. Type: dictionary -| | ... | - src_int - Source interface. Type: string -| | ... | - dst_int - Destination interface. Type: string -| | ... | - src_ip - Source IP address. Type: string -| | ... | - dst_ip - Destination IP address. Type: string -| | ... | - protocol - TCP or UDP (Optional, default is TCP). Type: string -| | ... | - port - Source and destination ports to use -| | ... | (Optional, default is port 20). Type: integer -| | ... | - count - Number of packets to send -| | ... | (Optional, default is one packet). Type: integer -| | ... | - timeout - Timeout value in seconds (Optional, default is 10 sec). -| | ... | Should be at least twice the configured IPFIX flow report interval. -| | ... | Type: integer -| | ... -| | ... | *Return:* -| | ... -| | ... | - No value returned -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Send packets and verify IPFIX \| ${nodes['TG']} | ${nodes['DUT1']}\ -| | ... | \| eth1 \| GigabitEthernet0/8/0 \| 16.0.0.1 \| 192.168.0.2 \| UDP \ -| | ... | \| ${20} \| ${5} \| ${10} \| -| | ... | -| | [Arguments] | ${tg_node} | ${dst_node} | ${src_int} | ${dst_int} | -| | ... | ${src_ip} | ${dst_ip} | ${protocol}=tcp | ${port}=20 | ${count}=1 -| | ... | ${timeout}=${10} -| | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int} -| | ${dst_mac}= | Get Interface Mac | ${dst_node} | ${dst_int} -| | ${src_int_name}= | Get interface name | ${tg_node} | ${src_int} -| | ${dst_int_name}= | Get interface name | ${dst_node} | ${dst_int} -| | ${args}= | Traffic Script Gen Arg | ${dst_int_name} | ${src_int_name} -| | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip} -| | ${args}= | Set Variable -| | ... | ${args} --protocol ${protocol} --port ${port} --count ${count} -| | Run Traffic Script On Node | ipfix_check.py | ${tg_node} | ${args} -| | ... | ${timeout} - -| Send session sweep and verify IPFIX -| | [Documentation] | Send simple TCP or UDP packets from source interface\ -| | ... | to destination interface using a range of source addresses. Listen\ -| | ... | for IPFIX flow report on source interface and verify received report\ -| | ... | against number of packets sent from each source address. -| | ... -| | ... | *Arguments:* -| | ... -| | ... | - tg_node - TG node. Type: dictionary -| | ... | - dst_node - Destination node. Type: dictionary -| | ... | - src_int - Source interface. Type: string -| | ... | - dst_int - Destination interface. Type: string -| | ... | - src_ip - Source IP address. Type: string -| | ... | - dst_ip - Destination IP address. Type: string -| | ... | - ip_range - Number of sequential source addresses. Type:integer -| | ... | - protocol - TCP or UDP (Optional, defaults to TCP). Type: string -| | ... | - port - Source and destination ports to use (Optional). Type: integer -| | ... | - count - Number of packets to send (Optional). Type: integer -| | ... | - timeout - Timeout value in seconds (optional). Type:integer -| | ... -| | ... | *Return:* -| | ... -| | ... | - No value returned -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Send packets and verify IPFIX \| ${nodes['TG']} | ${nodes['DUT1']}\ -| | ... | \| eth1 \| GigabitEthernet0/8/0 \| 16.0.0.1 \| 192.168.0.2 \| 20 \| -| | ... | UDP \| ${20} \| ${5} \| ${10} \| -| | ... | -| | [Arguments] | ${tg_node} | ${dst_node} | ${src_int} | ${dst_int} | -| | ... | ${src_ip} | ${dst_ip} | ${ip_range} | ${protocol}=tcp | ${port}=20 -| | ... | ${count}=${1} | ${timeout}=${10} -| | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int} -| | ${dst_mac}= | Set Variable | ${dut1_to_tg_mac} -| | ${src_int_name}= | Get interface name | ${tg_node} | ${src_int} -| | ${dst_int_name}= | Get interface name | ${dst_node} | ${dst_int} -| | ${args}= | Traffic Script Gen Arg | ${dst_int_name} | ${src_int_name} -| | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip} -| | ${args}= | Set Variable | ${args} --protocol ${protocol} --port ${port} -| | ${args}= | Set Variable | ${args} --count ${count} --sessions ${ip_range} -| | Run Traffic Script On Node | ipfix_sessions.py | ${tg_node} | ${args} -| | ... | ${timeout}
\ No newline at end of file diff --git a/resources/libraries/robot/telemetry/span.robot b/resources/libraries/robot/telemetry/span.robot index 3ef8716cfa..3d725bbbf7 100644 --- a/resources/libraries/robot/telemetry/span.robot +++ b/resources/libraries/robot/telemetry/span.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. +# Copyright (c) 2019 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: @@ -22,6 +22,8 @@ | | ... | link, then receive a copy of both the sent packet and the DUT's reply\ | | ... | on the second link. | | ... +| | ... | Used by Honeycomb. +| | ... | | ... | *Arguments:* | | ... | | ... | - tg_node - Node to execute scripts on (TG). Type: dictionary diff --git a/resources/templates/vat/ipfix_exporter_set.vat b/resources/templates/vat/ipfix_exporter_set.vat deleted file mode 100644 index 9217375e01..0000000000 --- a/resources/templates/vat/ipfix_exporter_set.vat +++ /dev/null @@ -1 +0,0 @@ -set_ipfix_exporter collector_address {collector} src_address {source} {fib} {mtu} {interval}
\ No newline at end of file diff --git a/resources/templates/vat/ipfix_interface_enable.vat b/resources/templates/vat/ipfix_interface_enable.vat deleted file mode 100644 index 5432a6916a..0000000000 --- a/resources/templates/vat/ipfix_interface_enable.vat +++ /dev/null @@ -1 +0,0 @@ -flow_classify_set_interface sw_if_index {interface} {table} {delete}
\ No newline at end of file diff --git a/resources/templates/vat/ipfix_stream_set.vat b/resources/templates/vat/ipfix_stream_set.vat deleted file mode 100644 index 97d84beb1c..0000000000 --- a/resources/templates/vat/ipfix_stream_set.vat +++ /dev/null @@ -1 +0,0 @@ -set_ipfix_classify_stream {domain} {src_port}
\ No newline at end of file diff --git a/resources/templates/vat/ipfix_table_add.vat b/resources/templates/vat/ipfix_table_add.vat deleted file mode 100644 index 87b0cc169d..0000000000 --- a/resources/templates/vat/ipfix_table_add.vat +++ /dev/null @@ -1 +0,0 @@ -ipfix_classify_table_add_del table {table} {ip_version} {add_del}
\ No newline at end of file diff --git a/resources/templates/vat/span_create.vat b/resources/templates/vat/span_create.vat deleted file mode 100644 index 3671d0b19e..0000000000 --- a/resources/templates/vat/span_create.vat +++ /dev/null @@ -1 +0,0 @@ -sw_interface_span_enable_disable src_sw_if_index {src_sw_if_index} dst_sw_if_index {dst_sw_if_index} diff --git a/resources/templates/vat/span_dump.vat b/resources/templates/vat/span_dump.vat deleted file mode 100644 index 0f83af73c3..0000000000 --- a/resources/templates/vat/span_dump.vat +++ /dev/null @@ -1 +0,0 @@ -sw_interface_span_dump
\ No newline at end of file diff --git a/resources/traffic_scripts/ipfix_check.py b/resources/traffic_scripts/ipfix_check.py deleted file mode 100755 index f5693cc7e8..0000000000 --- a/resources/traffic_scripts/ipfix_check.py +++ /dev/null @@ -1,195 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Traffic script - IPFIX listener.""" - -import sys - -from ipaddress import IPv4Address, IPv6Address, AddressValueError -from scapy.layers.inet import IP, TCP, UDP -from scapy.layers.inet6 import IPv6 -from scapy.layers.l2 import Ether - -from resources.libraries.python.PacketVerifier import RxQueue, TxQueue, auto_pad -from resources.libraries.python.TrafficScriptArg import TrafficScriptArg -from resources.libraries.python.telemetry.IPFIXUtil import IPFIXHandler -from resources.libraries.python.telemetry.IPFIXUtil import IPFIXData - - -def valid_ipv4(ip): - """Check if IP address has the correct IPv4 address format. - - :param ip: IP address. - :type ip: str - :return: True in case of correct IPv4 address format, - otherwise return false. - :rtype: bool - """ - try: - IPv4Address(unicode(ip)) - return True - except (AttributeError, AddressValueError): - return False - - -def valid_ipv6(ip): - """Check if IP address has the correct IPv6 address format. - - :param ip: IP address. - :type ip: str - :return: True in case of correct IPv6 address format, - otherwise return false. - :rtype: bool - """ - try: - IPv6Address(unicode(ip)) - return True - except (AttributeError, AddressValueError): - return False - - -def main(): - """Send packets to VPP, then listen for IPFIX flow report. Verify that - the correct packet count was reported.""" - args = TrafficScriptArg( - ['src_mac', 'dst_mac', 'src_ip', 'dst_ip', 'protocol', 'port', 'count'] - ) - - dst_mac = args.get_arg('dst_mac') - src_mac = args.get_arg('src_mac') - src_ip = args.get_arg('src_ip') - dst_ip = args.get_arg('dst_ip') - tx_if = args.get_arg('tx_if') - - protocol = args.get_arg('protocol') - source_port = int(args.get_arg('port')) - destination_port = int(args.get_arg('port')) - count = int(args.get_arg('count')) - - txq = TxQueue(tx_if) - rxq = RxQueue(tx_if) - - # generate simple packet based on arguments - if valid_ipv4(src_ip) and valid_ipv4(dst_ip): - ip_version = IP - elif valid_ipv6(src_ip) and valid_ipv6(dst_ip): - ip_version = IPv6 - else: - raise ValueError("Invalid IP version!") - - if protocol.upper() == 'TCP': - protocol = TCP - elif protocol.upper() == 'UDP': - protocol = UDP - else: - raise ValueError("Invalid type of protocol!") - - pkt_raw = (Ether(src=src_mac, dst=dst_mac) / - ip_version(src=src_ip, dst=dst_ip) / - protocol(sport=int(source_port), - dport=int(destination_port))) - - # do not print details for sent packets when sending more than one - if count > 1: - verbose = False - print("Sending more than one packet. Details will be filtered for " - "all packets sent.") - else: - verbose = True - - pkt_pad = auto_pad(pkt_raw) - ignore = [] - for _ in range(count): - txq.send(pkt_pad, verbose=verbose) - ignore.append(pkt_pad) - - # allow scapy to recognize IPFIX headers and templates - ipfix = IPFIXHandler() - data = None - # get IPFIX template and data - while True: - pkt = rxq.recv(10, ignore=ignore, verbose=verbose) - if pkt is None: - raise RuntimeError("RX timeout") - - if pkt.haslayer("ICMPv6ND_NS"): - # read another packet in the queue if the current one is ICMPv6ND_NS - continue - - if pkt.haslayer("IPFIXHeader"): - if pkt.haslayer("IPFIXTemplate"): - # create or update template for IPFIX data packets - ipfix.update_template(pkt) - elif pkt.haslayer("IPFIXData"): - data = pkt.getlayer(IPFIXData).fields - break - else: - raise RuntimeError("Unable to parse IPFIX set after header.") - else: - raise RuntimeError("Received non-IPFIX packet or IPFIX header " - "not recognized.") - - # verify packet count - if data["packetTotalCount"] != count: - raise RuntimeError("IPFIX reported wrong packet count. Count was {0}," - "but should be {1}".format(data["packetTotalCount"], - count)) - # verify IP addresses - keys = data.keys() - err = "{0} mismatch. Packets used {1}, but were classified as {2}." - if ip_version == IP: - if "IPv4_src" in keys: - if data["IPv4_src"] != src_ip: - raise RuntimeError( - err.format("Source IP", src_ip, data["IPv4_src"])) - if "IPv4_dst" in keys: - if data["IPv4_dst"] != dst_ip: - raise RuntimeError( - err.format("Destination IP", dst_ip, data["IPv4_dst"])) - else: - if "IPv6_src" in keys: - if data["IPv6_src"] != src_ip: - raise RuntimeError( - err.format("Source IP", src_ip, data["IPv6_src"])) - if "IPv6_dst" in keys: - if data["IPv6_dst"] != dst_ip: - raise RuntimeError( - err.format("Source IP", src_ip, data["IPv6_dst"])) - # verify port numbers - for item in ("src_port", "tcp_src_port", "udp_src_port"): - try: - if int(data[item]) != source_port: - raise RuntimeError( - err.format("Source port", source_port, data[item])) - except KeyError: - pass - for item in ("dst_port", "tcp_dst_port", "udp_dst_port"): - try: - if int(data[item]) != destination_port: - raise RuntimeError( - err.format("Source port", destination_port, data[item])) - except KeyError: - pass - # verify protocol ID - if "Protocol_ID" in keys: - if protocol == TCP and int(data["Protocol_ID"]) != 6: - raise RuntimeError("TCP Packets were classified as not TCP.") - if protocol == UDP and int(data["Protocol_ID"]) != 17: - raise RuntimeError("UDP Packets were classified as not UDP.") - sys.exit(0) - - -if __name__ == "__main__": - main() diff --git a/resources/traffic_scripts/ipfix_sessions.py b/resources/traffic_scripts/ipfix_sessions.py deleted file mode 100755 index 11e77fa08c..0000000000 --- a/resources/traffic_scripts/ipfix_sessions.py +++ /dev/null @@ -1,229 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Traffic script - IPFIX listener.""" - -import sys -from ipaddress import IPv4Address, IPv6Address, AddressValueError - -from scapy.layers.inet import IP, TCP, UDP -from scapy.layers.inet6 import IPv6 -from scapy.layers.l2 import Ether - -from resources.libraries.python.telemetry.IPFIXUtil import IPFIXHandler, \ - IPFIXData -from resources.libraries.python.PacketVerifier import RxQueue, TxQueue, auto_pad -from resources.libraries.python.TrafficScriptArg import TrafficScriptArg - - -def valid_ipv4(ip): - """Check if IP address has the correct IPv4 address format. - - :param ip: IP address. - :type ip: str - :return: True in case of correct IPv4 address format, - otherwise return false. - :rtype: bool - """ - try: - IPv4Address(unicode(ip)) - return True - except (AttributeError, AddressValueError): - return False - - -def valid_ipv6(ip): - """Check if IP address has the correct IPv6 address format. - - :param ip: IP address. - :type ip: str - :return: True in case of correct IPv6 address format, - otherwise return false. - :rtype: bool - """ - try: - IPv6Address(unicode(ip)) - return True - except (AttributeError, AddressValueError): - return False - - -def verify_data(data, count, src_ip, dst_ip, protocol): - """Compare data in IPFIX flow report against parameters used to send test - packets. - - :param data: Dictionary of fields in IPFIX flow report. - :param count: Number of packets expected. - :param src_ip: Expected source IP address. - :param dst_ip: Expected destination IP address. - :param protocol: Expected protocol, TCP or UDP. - :type data: dict - :type count: int - :type src_ip: str - :type dst_ip: str - :type protocol: scapy.layers - """ - - # verify packet count - if data["packetTotalCount"] != count: - raise RuntimeError( - "IPFIX reported wrong packet count. Count was {0}," - " but should be {1}".format(data["packetTotalCount"], count)) - # verify IP addresses - keys = data.keys() - e = "{0} mismatch. Packets used {1}, but were classified as {2}." - if valid_ipv4(src_ip) and valid_ipv4(dst_ip): - if "IPv4_src" in keys: - if data["IPv4_src"] != src_ip: - raise RuntimeError( - e.format("Source IP", src_ip, data["IPv4_src"])) - if "IPv4_dst" in keys: - if data["IPv4_dst"] != dst_ip: - raise RuntimeError( - e.format("Destination IP", dst_ip, data["IPv4_dst"])) - else: - if "IPv6_src" in keys: - if data["IPv6_src"] != src_ip: - raise RuntimeError( - e.format("Source IP", src_ip, data["IPv6_src"])) - if "IPv6_dst" in keys: - if data["IPv6_dst"] != dst_ip: - raise RuntimeError( - e.format("Source IP", src_ip, data["IPv6_dst"])) - # verify protocol ID - if "Protocol_ID" in keys: - if protocol == TCP and int(data["Protocol_ID"]) != 6: - raise RuntimeError( - "TCP Packets were classified as not TCP.") - if protocol == UDP and int(data["Protocol_ID"]) != 17: - raise RuntimeError( - "UDP Packets were classified as not UDP.") - # return port number - for item in ("src_port", "tcp_src_port", "udp_src_port", - "dst_port", "tcp_dst_port", "udp_dst_port"): - if item in keys: - return int(data[item]) - else: - raise RuntimeError("Data contains no port information.") - - -def main(): - """Send packets to VPP, then listen for IPFIX flow report. Verify that - the correct packet count was reported.""" - args = TrafficScriptArg( - ['src_mac', 'dst_mac', 'src_ip', 'dst_ip', 'protocol', 'port', 'count', - 'sessions'] - ) - - dst_mac = args.get_arg('dst_mac') - src_mac = args.get_arg('src_mac') - src_ip = args.get_arg('src_ip') - dst_ip = args.get_arg('dst_ip') - tx_if = args.get_arg('tx_if') - - protocol = args.get_arg('protocol') - count = int(args.get_arg('count')) - sessions = int(args.get_arg('sessions')) - - txq = TxQueue(tx_if) - rxq = RxQueue(tx_if) - - # generate simple packet based on arguments - ip_version = None - if valid_ipv4(src_ip) and valid_ipv4(dst_ip): - ip_version = IP - elif valid_ipv6(src_ip) and valid_ipv6(dst_ip): - ip_version = IPv6 - else: - ValueError("Invalid IP version!") - - if protocol.upper() == 'TCP': - protocol = TCP - elif protocol.upper() == 'UDP': - protocol = UDP - else: - raise ValueError("Invalid type of protocol!") - - packets = [] - for x in range(sessions): - pkt = (Ether(src=src_mac, dst=dst_mac) / - ip_version(src=src_ip, dst=dst_ip) / - protocol(sport=x, dport=x)) - pkt = auto_pad(pkt) - packets.append(pkt) - - # do not print details for sent packets - verbose = False - print("Sending more than one packet. Details will be filtered for " - "all packets sent.") - - ignore = [] - for x in range(sessions): - for _ in range(count): - txq.send(packets[x], verbose=verbose) - ignore.append(packets[x]) - - # allow scapy to recognize IPFIX headers and templates - ipfix = IPFIXHandler() - - # clear receive buffer - while True: - pkt = rxq.recv(1, ignore=packets, verbose=verbose) - if pkt is None: - break - - data = None - ports = [x for x in range(sessions)] - - # get IPFIX template and data - while True: - pkt = rxq.recv(5) - if pkt is None: - raise RuntimeError("RX timeout") - - if pkt.haslayer("ICMPv6ND_NS"): - # read another packet in the queue if the current one is ICMPv6ND_NS - continue - - if pkt.haslayer("IPFIXHeader"): - if pkt.haslayer("IPFIXTemplate"): - # create or update template for IPFIX data packets - ipfix.update_template(pkt) - elif pkt.haslayer("IPFIXData"): - for x in range(sessions): - try: - data = pkt.getlayer(IPFIXData, x+1).fields - except AttributeError: - raise RuntimeError("Could not find data layer " - "#{0}".format(x+1)) - port = verify_data(data, count, src_ip, dst_ip, protocol) - if port in ports: - ports.remove(port) - else: - raise RuntimeError("Unexpected or duplicate port {0} " - "in flow report.".format(port)) - print("All {0} sessions verified " - "with packet count {1}.".format(sessions, count)) - sys.exit(0) - else: - raise RuntimeError("Unable to parse IPFIX template " - "or data set.") - else: - raise RuntimeError("Received non-IPFIX packet or IPFIX header was" - "not recognized.") - - -if __name__ == "__main__": - main() diff --git a/tests/vpp/func/telemetry/eth2p-ethip4-ip4base-ip4ipfixbase-func.robot b/tests/vpp/func/telemetry/eth2p-ethip4-ip4base-ip4ipfixbase-func.robot deleted file mode 100644 index 27b254bc11..0000000000 --- a/tests/vpp/func/telemetry/eth2p-ethip4-ip4base-ip4ipfixbase-func.robot +++ /dev/null @@ -1,205 +0,0 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.Classify.Classify -| Library | resources.libraries.python.telemetry.IPFIXSetup -| Library | resources.libraries.python.Trace -| ... -| Resource | resources/libraries/robot/ip/ip4.robot -| Resource | resources/libraries/robot/shared/default.robot -| Resource | resources/libraries/robot/shared/interfaces.robot -| Resource | resources/libraries/robot/shared/testing_path.robot -| Resource | resources/libraries/robot/telemetry/ipfix.robot -| ... -| Force Tags | HW_ENV | VM_ENV | 3_NODE_SINGLE_LINK_TOPO -| ... -| Test Setup | Set up functional test -| ... -| Test Teardown | Tear down functional test -| ... -| Documentation | *IPFIX ipv4 test cases* -| ... -| ... | IPFIX tests use 3-node topology TG - DUT1 - DUT2 - TG with -| ... | one link between the nodes. DUT1 is configured with IPv4 -| ... | routing and static routes. IPFIX is configured on DUT1 with -| ... | DUT1->TG interface as collector. Test packets are -| ... | sent from TG to DUT1. TG listens for flow report packets -| ... | and verifies that they contains flow record of test packets sent. - -*** Variables *** -| ${dut1_to_tg_ip}= | 192.168.1.1 -| ${tg_to_dut1_ip}= | 192.168.1.2 -| ${dut2_to_dut1_ip}= | 192.168.2.1 -| ${prefix_length}= | 24 -| ${ip_version}= | ip4 -| ${port}= | 80 - -*** Test Cases *** -| TC01: DUT sends IPFIX template and data packets -| | [Documentation] -| | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface -| | ... | address as collector and a basic classify session. -| | ... | [Ver] Make TG listen for IPFIX template and data packets, verify -| | ... | that packet is received and correct. No packets are sent from TG. -| | ... | [Ref] RFC 7011 -| | Given Configure path in 3-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} -| | And Set interfaces in 3-node circular topology up -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${tg_to_dut1_mac} -| | ${table_index} | ${skip_n} | ${match_n}= -| | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | src -| | And VPP configures classify session L3 | ${dut1_node} | permit -| | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | src -| | ... | ${tg_to_dut1_ip} -| | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg} -| | ... | ${table_index} | ip_version=${ip_version} -| | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip} -| | ... | ${dut1_to_tg_ip} | interval=5 -| | And Set IPFIX stream | ${dut1_node} | ${1} -| | And Assign classify table to exporter | ${dut1_node} | ${table_index} -| | ... | ${ip_version} -| | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node} -| | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip} -| | ... | count=0 - -| TC02: DUT reports packet flow for traffic by source address -| | [Documentation] -| | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface -| | ... | address as collector and add classify session with TG source address. -| | ... | [Ver] Make TG send a packet to DUT1, then listen for IPFIX template -| | ... | and data packets, verify that IPFIX reported the received packet. -| | ... | [Ref] RFC 7011 -| | Given Configure path in 3-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} -| | And Set interfaces in 3-node circular topology up -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${tg_to_dut1_mac} -| | ${table_index} | ${skip_n} | ${match_n}= -| | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | src -| | And VPP configures classify session L3 | ${dut1_node} | permit -| | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | src -| | ... | ${tg_to_dut1_ip} -| | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg} -| | ... | ${table_index} | ip_version=${ip_version} -| | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip} -| | ... | ${dut1_to_tg_ip} | interval=5 -| | And Set IPFIX stream | ${dut1_node} | ${1} -| | And Assign classify table to exporter | ${dut1_node} | ${table_index} -| | ... | ${ip_version} -| | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node} -| | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip} - -| TC03: DUT reports packet flow for traffic with local destination address -| | [Documentation] -| | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface -| | ... | address as collector and add classify session with destination -| | ... | address of DUT1. -| | ... | [Ver] Make TG send a packet to DUT1, then listen for IPFIX template -| | ... | and data packets, verify that IPFIX reported the received packet. -| | ... | [Ref] RFC 7011 -| | Given Configure path in 3-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} -| | And Set interfaces in 3-node circular topology up -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${tg_to_dut1_mac} -| | ${table_index} | ${skip_n} | ${match_n}= -| | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | dst -| | And VPP configures classify session L3 | ${dut1_node} | permit -| | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | dst -| | ... | ${dut1_to_tg_ip} -| | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg} -| | ... | ${table_index} | ip_version=${ip_version} -| | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip} -| | ... | ${dut1_to_tg_ip} | interval=5 -| | And Set IPFIX stream | ${dut1_node} | ${1} -| | And Assign classify table to exporter | ${dut1_node} | ${table_index} -| | ... | ${ip_version} -| | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node} -| | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip} - -| TC04: DUT reports packet flow for traffic with remote destination address -| | [Documentation] -| | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface -| | ... | address as collector and add classify session with destination -| | ... | address of DUT2. -| | ... | [Ver] Make TG send a packet to DUT2 through DUT1, then listen -| | ... | for IPFIX template and data packets, verify that IPFIX reported -| | ... | the received packet. -| | ... | [Ref] RFC 7011 -| | Given Configure path in 3-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} -| | And Set interfaces in 3-node circular topology up -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${tg_to_dut1_mac} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_dut2} -| | ... | ${dut2_to_dut1_ip} | ${dut2_to_dut1_mac} -| | ${table_index} | ${skip_n} | ${match_n}= -| | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | dst -| | And VPP configures classify session L3 | ${dut1_node} | permit -| | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | dst -| | ... | ${dut2_to_dut1_ip} -| | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg} -| | ... | ${table_index} | ip_version=${ip_version} -| | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip} -| | ... | ${dut1_to_tg_ip} | interval=5 -| | And Set IPFIX stream | ${dut1_node} | ${1} -| | And Assign classify table to exporter | ${dut1_node} | ${table_index} -| | ... | ${ip_version} -| | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node} -| | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut2_to_dut1_ip} - -| TC05: DUT reports packet flow for traffic by source and destination port -| | [Tags] | SKIP_VPP_PATCH -| | [Documentation] -| | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface -| | ... | address as collector and add classify session with TG source address -| | ... | and source and destination ports. -| | ... | [Ver] Make TG send a packet to DUT1, then listen for IPFIX template -| | ... | and data packets, verify that IPFIX reported the received packet. -| | ... | [Ref] RFC 7011 -| | Given Configure path in 3-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} -| | And Set interfaces in 3-node circular topology up -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${tg_to_dut1_mac} -| | ${table_index} | ${skip_n} | ${match_n}= -| | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} -| | ... | src proto l4 src_port dst_port -| | And VPP configures classify session generic | ${dut1_node} -| | ... | acl-hit-next permit | ${table_index} | ${skip_n} | ${match_n} -| | ... | l3 ${ip_version} src ${tg_to_dut1_ip} -| | ... | proto 6 l4 src_port ${port} dst_port ${port} -| | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg} -| | ... | ${table_index} | ip_version=${ip_version} -| | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip} -| | ... | ${dut1_to_tg_ip} | interval=5 -| | And Set IPFIX stream | ${dut1_node} | ${1} -| | And Assign classify table to exporter | ${dut1_node} | ${table_index} -| | ... | ${ip_version} -| | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node} -| | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip} -| | ... | port=${port} - -# TODO: DUT reports packet flow when ACL is configured with wildcards diff --git a/tests/vpp/func/telemetry/eth2p-ethip4-ip4base-ip4ipfixscale-func.robot b/tests/vpp/func/telemetry/eth2p-ethip4-ip4base-ip4ipfixscale-func.robot deleted file mode 100644 index 41f86b4a36..0000000000 --- a/tests/vpp/func/telemetry/eth2p-ethip4-ip4base-ip4ipfixscale-func.robot +++ /dev/null @@ -1,115 +0,0 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.Classify.Classify -| Library | resources.libraries.python.telemetry.IPFIXSetup -| Library | resources.libraries.python.Trace -| ... -| Resource | resources/libraries/robot/ip/ip4.robot -| Resource | resources/libraries/robot/shared/default.robot -| Resource | resources/libraries/robot/shared/interfaces.robot -| Resource | resources/libraries/robot/shared/testing_path.robot -| Resource | resources/libraries/robot/telemetry/ipfix.robot -| ... -| Force Tags | HW_ENV | VM_ENV | 3_NODE_SINGLE_LINK_TOPO | SKIP_VPP_PATCH -| ... | EXPECTED_FAILING -| ... -| Test Setup | Set up functional test -| ... -| Test Teardown | Tear down functional test -| ... -| Documentation | *IPFIX ipv4 test cases* -| ... -| ... | IPFIX tests use 3-node topology TG - DUT1 - DUT2 - TG with -| ... | one link between the nodes. DUT1 is configured with IPv4 -| ... | routing and static routes. IPFIX is configured on DUT1 with -| ... | DUT1->TG interface as collector. Test packets are -| ... | sent from TG to DUT1. TG listens for flow report packets -| ... | and verifies that they contains flow record of test packets sent. - -*** Variables *** -| ${dut1_to_tg_ip}= | 192.168.1.1 -| ${tg_to_dut1_ip}= | 192.168.1.2 -| ${prefix_length}= | 24 -| ${ip_version}= | ip4 -| ${sessions}= | 80 - -*** Test Cases *** -| TC01: DUT reports packet flow with a large number of packets -| | [Documentation] -| | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface -| | ... | address as collector and add classify session with TG source address. -| | ... | [Ver] Make TG send packets to DUT1, then listen for IPFIX template -| | ... | and data packets, verify that IPFIX reported the received packets. -| | ... | [Ref] RFC 7011 -| | Given Configure path in 3-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} -| | And Set interfaces in 3-node circular topology up -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${tg_to_dut1_mac} -| | ${table_index} | ${skip_n} | ${match_n}= -| | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | src -| | And VPP configures classify session L3 | ${dut1_node} | permit -| | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | src -| | ... | ${tg_to_dut1_ip} -| | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg} -| | ... | ${table_index} | ip_version=${ip_version} -| | And setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip} -| | ... | ${dut1_to_tg_ip} | interval=5 -| | And Set IPFIX stream | ${dut1_node} | ${1} -| | And Assign classify table to exporter | ${dut1_node} | ${table_index} -| | ... | ${ip_version} -| | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node} -| | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip} -| | ... | count=20000 | timeout=10 - -| TC02: DUT reports packet flow when multiple sessions are configured -| | [Documentation] -| | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface -| | ... | address as collector and add several classify sessions with different -| | ... | ports. -| | ... | [Ver] Make TG send packets to DUT1 using a range of ports matching -| | ... | configured sessions, then listen for IPFIX template and data packets, -| | ... | verify that IPFIX reported the received packets for each session. -| | ... | [Ref] RFC 7011 -| | Given Configure path in 3-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} -| | And Set interfaces in 3-node circular topology up -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${tg_to_dut1_mac} -| | ${table_index} | ${skip_n} | ${match_n}= -| | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} -| | ... | src proto l4 src_port dst_port -| | :FOR | ${index} | IN RANGE | ${sessions} -| | | VPP configures classify session generic | ${dut1_node} -| | | ... | acl-hit-next permit | ${table_index} | ${skip_n} | ${match_n} -| | | ... | l3 ${ip_version} src ${tg_to_dut1_ip} -| | | ... | proto 6 l4 src_port ${index} dst_port ${index} -| | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg} -| | ... | ${table_index} | ip_version=${ip_version} -| | And setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip} -| | ... | ${dut1_to_tg_ip} -| | ... | mtu=1450 | interval=5 -| | And Set IPFIX stream | ${dut1_node} | ${1} -| | And Assign classify table to exporter | ${dut1_node} | ${table_index} -| | ... | ${ip_version} -| | Then Send session sweep and verify IPFIX | ${tg_node} | ${dut1_node} -| | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip} -| | ... | ${sessions} | timeout=10 | count=3 - -# TODO: DUT reports packet flow when ACL is configured with wildcards diff --git a/tests/vpp/func/telemetry/eth2p-ethip4-ip4base-spanrx-func.robot b/tests/vpp/func/telemetry/eth2p-ethip4-ip4base-spanrx-func.robot deleted file mode 100644 index d3cf5636fd..0000000000 --- a/tests/vpp/func/telemetry/eth2p-ethip4-ip4base-spanrx-func.robot +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.IPUtil -| Library | resources.libraries.python.Trace -| Library | resources.libraries.python.telemetry.SPAN -| ... -| Resource | resources/libraries/robot/shared/default.robot -| Resource | resources/libraries/robot/shared/testing_path.robot -| Resource | resources/libraries/robot/telemetry/span.robot -| ... -| Force Tags | HW_ENV | VM_ENV | 3_NODE_DOUBLE_LINK_TOPO -| ... -| Test Setup | Set up functional test -| ... -| Test Teardown | Tear down functional test -| ... -| Documentation | *SPAN test suite* -| ... | *[Top] Network Topologies:* TG=DUT1 2-node topology with two -| ... | links between nodes. -| ... | *[Cfg] DUT configuration:* DUT1 is configured with SPAN mirroring from -| ... | the first DUT1-TG interface to the second one. -| ... | *[Ver] TG verification:* Test ARP or ICMP packets are sent by TG -| ... | on first link to DUT1; On receipt through second link TG verifies -| ... | the copy of packet sent and the copy of DUT's reply packet. -| ... | *[Ref] Applicable standard specifications: None?* - -*** Variables *** -| ${tg_to_dut_if1_ip4}= | 192.168.1.1 -| ${dut_to_tg_if1_ip4}= | 192.168.1.2 -| ${prefix}= | 24 - -*** Test Cases *** -| TC01: DUT mirrors L2 packets from one interface to another -| | [Documentation] -| | ... | [Top] TG=DUT1 -| | ... | [Cfg] On DUT1 configure IPv4 address and set SPAN mirroring\ -| | ... | from one DUT interface to the other. -| | ... | [Ver] Make TG send an ARP packet to DUT through one interface,\ -| | ... | then receive a copy of sent packet and of DUT's ARP reply\ -| | ... | on the second interface. -| | Given Configure path in 2-node circular topology | ${nodes['TG']} -| | ... | ${nodes['DUT1']} | ${nodes['TG']} -| | And Set interfaces in 2-node circular topology up -| | And VPP Interface Set IP Address | ${dut_node} | ${dut_to_tg_if1} -| | ... | ${dut_to_tg_if1_ip4} | ${prefix} -| | And Set SPAN Mirroring | ${dut_node} | ${dut_to_tg_if1} | ${dut_to_tg_if2} -| | Then Send Packet And Check Received Copies | ${tg_node} -| | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac} -| | ... | ${dut_to_tg__if1_mac} | ${tg_to_dut_if2} -| | ... | ${tg_to_dut_if1_ip4} | ${dut_to_tg_if1_ip4} | ARP - -| TC02: DUT mirrors IPv4 packets from one interface to another -| | [Documentation] -| | ... | [Top] TG=DUT1 -| | ... | [Cfg] On DUT1 configure IPv4 address, add ARP entry for one TG \ -| | ... | interface and set SPAN mirroring from one DUT interface to the other. -| | ... | [Ver] Make TG send an ICMP packet to DUT through one interface,\ -| | ... | then receive a copy of sent packet and of DUT's ICMP reply\ -| | ... | on the other interface. -| | Given Configure path in 2-node circular topology | ${nodes['TG']} -| | ... | ${nodes['DUT1']} | ${nodes['TG']} -| | And Set interfaces in 2-node circular topology up -| | And VPP Interface Set IP Address | ${dut_node} | ${dut_to_tg_if1} -| | ... | ${dut_to_tg_if1_ip4} | ${prefix} -| | And VPP Add IP Neighbor | ${dut_node} | ${dut_to_tg_if1} -| | ... | ${tg_to_dut_if1_ip4} | ${tg_to_dut_if1_mac} -| | And Set SPAN Mirroring | ${dut_node} | ${dut_to_tg_if1} | ${dut_to_tg_if2} -| | Then Send Packet And Check Received Copies | ${tg_node} -| | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac} -| | ... | ${dut_to_tg__if1_mac} | ${tg_to_dut_if2} -| | ... | ${tg_to_dut_if1_ip4} | ${dut_to_tg_if1_ip4} | ICMP diff --git a/tests/vpp/func/telemetry/eth2p-ethip6-ip6base-ip6ipfixbase-func.robot b/tests/vpp/func/telemetry/eth2p-ethip6-ip6base-ip6ipfixbase-func.robot deleted file mode 100644 index ccf8526fe7..0000000000 --- a/tests/vpp/func/telemetry/eth2p-ethip6-ip6base-ip6ipfixbase-func.robot +++ /dev/null @@ -1,202 +0,0 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.Classify.Classify -| Library | resources.libraries.python.IPv6Util -| Library | resources.libraries.python.telemetry.IPFIXSetup -| Library | resources.libraries.python.Trace -| ... -| Resource | resources/libraries/robot/ip/ip4.robot -| Resource | resources/libraries/robot/shared/default.robot -| Resource | resources/libraries/robot/shared/interfaces.robot -| Resource | resources/libraries/robot/shared/testing_path.robot -| Resource | resources/libraries/robot/telemetry/ipfix.robot -| ... -| Force Tags | HW_ENV | VM_ENV | 3_NODE_SINGLE_LINK_TOPO -| ... -| Test Setup | Set up functional test -| ... -| Test Teardown | Tear down functional test -| ... -| Documentation | *IPFIX ipv6 test cases* -| ... -| ... | IPFIX tests use 3-node topology TG - DUT1 - DUT2 - TG with -| ... | one link between the nodes. DUT1 is configured with IPv4 and IPV6 -| ... | routing and static routes. IPFIX is configured on DUT1 with -| ... | DUT1->TG interface as collector.Test packets are -| ... | sent from TG to or through DUT1. TG listens for flow report packets -| ... | and verifies that they contains flow records of test packets sent. - -*** Variables *** -| ${dut1_to_tg_ip}= | 10::10 -| ${dut2_to_dut1_ip}= | 11::10 -| ${tg_to_dut1_ip}= | 12::10 -| ${prefix_length}= | 64 -| ${ip_version}= | ip6 -| ${port}= | 80 - -# IPv4 addresses used for IPFIX exporter. Export over IPv6 not (yet?) supported. -| ${dut1_to_tg_ip4}= | 192.168.1.1 -| ${tg_to_dut1_ip4}= | 192.168.1.2 - -*** Test Cases *** -| TC01: DUT reports packet flow for traffic by source address -| | [Tags] | EXPECTED_FAILING -| | [Documentation] -| | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface -| | ... | address as collector and add classify session with TG source address. -| | ... | [Ver] Make TG send a packet to DUT1, then listen for IPFIX template -| | ... | and data packets, verify that IPFIX reported the received packet. -| | ... | [Ref] RFC 7011 -| | Given Configure path in 3-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} -| | And Set interfaces in 3-node circular topology up -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length} -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip4} | ${24} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip4} -| | ... | ${tg_to_dut1_mac} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${tg_to_dut1_mac} -| | And VPP RA suppress link layer | ${dut1_node} | ${dut1_to_tg} -| | ${table_index} | ${skip_n} | ${match_n}= -| | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | src -| | And VPP configures classify session L3 | ${dut1_node} | permit -| | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | src -| | ... | ${tg_to_dut1_ip} -| | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg} -| | ... | ${table_index} | ip_version=${ip_version} -| | And setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip4} -| | ... | ${dut1_to_tg_ip4} | interval=5 -| | And Set IPFIX stream | ${dut1_node} | ${1} -| | And Assign classify table to exporter | ${dut1_node} | ${table_index} -| | ... | ${ip_version} -| | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node} -| | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip} - -| TC02: DUT reports packet flow for traffic with local destination address -| | [Documentation] -| | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface -| | ... | address as collector and add classify session with destination -| | ... | address of DUT1. -| | ... | [Ver] Make TG send a packet to DUT1, then listen for IPFIX template -| | ... | and data packets, verify that IPFIX reported the received packet. -| | ... | [Ref] RFC 7011 -| | Given Configure path in 3-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} -| | And Set interfaces in 3-node circular topology up -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length} -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip4} | ${24} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip4} -| | ... | ${tg_to_dut1_mac} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${tg_to_dut1_mac} -| | And VPP RA suppress link layer | ${dut1_node} | ${dut1_to_tg} -| | ${table_index} | ${skip_n} | ${match_n}= -| | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | dst -| | And VPP configures classify session L3 | ${dut1_node} | permit -| | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | dst -| | ... | ${dut1_to_tg_ip} -| | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg} -| | ... | ${table_index} | ip_version=${ip_version} -| | And setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip4} -| | ... | ${dut1_to_tg_ip4} | interval=5 -| | And Set IPFIX stream | ${dut1_node} | ${1} -| | And Assign classify table to exporter | ${dut1_node} | ${table_index} -| | ... | ${ip_version} -| | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node} -| | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip} - -| TC03: DUT reports packet flow for traffic with remote destination address -| | [Documentation] -| | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface -| | ... | address as collector and add classify session with destination -| | ... | address of DUT2. -| | ... | [Ver] Make TG send a packet to DUT2 through DUT1, then listen -| | ... | for IPFIX template and data packets, verify that IPFIX reported -| | ... | the received packet. -| | ... | [Ref] RFC 7011 -| | Given Configure path in 3-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} -| | And Set interfaces in 3-node circular topology up -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length} -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip4} | ${24} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip4} -| | ... | ${tg_to_dut1_mac} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${tg_to_dut1_mac} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_dut2} -| | ... | ${dut2_to_dut1_ip} | ${dut2_to_dut1_mac} -| | And VPP RA suppress link layer | ${dut1_node} | ${dut1_to_tg} -| | ${table_index} | ${skip_n} | ${match_n}= -| | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | dst -| | And VPP configures classify session L3 | ${dut1_node} | permit -| | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | dst -| | ... | ${dut2_to_dut1_ip} -| | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg} -| | ... | ${table_index} | ip_version=${ip_version} -| | And setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip4} -| | ... | ${dut1_to_tg_ip4} | interval=5 -| | And Set IPFIX stream | ${dut1_node} | ${1} -| | And Assign classify table to exporter | ${dut1_node} | ${table_index} -| | ... | ${ip_version} -| | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node} -| | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${dut2_to_dut1_ip} - -| TC04: DUT reports packet flow for traffic by source and destination port -| | [Tags] | SKIP_VPP_PATCH -| | [Documentation] -| | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface -| | ... | address as collector and add classify session with TG source address -| | ... | and source and destination ports. -| | ... | [Ver] Make TG send a packet to DUT1, then listen for IPFIX template -| | ... | and data packets, verify that IPFIX reported the received packet. -| | ... | [Ref] RFC 7011 -| | Given Configure path in 3-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} -| | And Set interfaces in 3-node circular topology up -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length} -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip4} | ${24} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip4} -| | ... | ${tg_to_dut1_mac} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${tg_to_dut1_mac} -| | And VPP RA suppress link layer | ${dut1_node} | ${dut1_to_tg} -| | ${table_index} | ${skip_n} | ${match_n}= -| | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} -| | ... | src proto l4 src_port dst_port -| | And VPP configures classify session generic | ${dut1_node} -| | ... | acl-hit-next permit | ${table_index} | ${skip_n} | ${match_n} -| | ... | l3 ${ip_version} src ${tg_to_dut1_ip} -| | ... | proto 6 l4 src_port ${port} dst_port ${port} -| | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg} -| | ... | ${table_index} | ip_version=${ip_version} -| | And setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip4} -| | ... | ${dut1_to_tg_ip4} | interval=5 -| | And Set IPFIX stream | ${dut1_node} | ${1} -| | And Assign classify table to exporter | ${dut1_node} | ${table_index} -| | ... | ${ip_version} -| | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node} -| | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip} -| | ... | port=${port} - -# TODO: DUT reports packet flow when ACL is configured with wildcards diff --git a/tests/vpp/func/telemetry/eth2p-ethip6-ip6base-ip6ipfixscale-func.robot b/tests/vpp/func/telemetry/eth2p-ethip6-ip6base-ip6ipfixscale-func.robot deleted file mode 100644 index d8b0444549..0000000000 --- a/tests/vpp/func/telemetry/eth2p-ethip6-ip6base-ip6ipfixscale-func.robot +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.Classify.Classify -| Library | resources.libraries.python.telemetry.IPFIXSetup -| Library | resources.libraries.python.Trace -| ... -| Resource | resources/libraries/robot/ip/ip4.robot -| Resource | resources/libraries/robot/shared/default.robot -| Resource | resources/libraries/robot/shared/interfaces.robot -| Resource | resources/libraries/robot/shared/testing_path.robot -| Resource | resources/libraries/robot/telemetry/ipfix.robot -| ... -| Force Tags | HW_ENV | VM_ENV | 3_NODE_SINGLE_LINK_TOPO | SKIP_VPP_PATCH -| ... | EXPECTED_FAILING -| ... -| Test Setup | Set up functional test -| ... -| Test Teardown | Tear down functional test -| ... -| Documentation | *IPFIX ipv6 test cases* -| ... -| ... | IPFIX tests use 3-node topology TG - DUT1 - DUT2 - TG with -| ... | one link between the nodes. DUT1 is configured with IPv4 and IPV6 -| ... | routing and static routes. IPFIX is configured on DUT1 with -| ... | DUT1->TG interface as collector.Test packets are -| ... | sent from TG to or through DUT1. TG listens for flow report packets -| ... | and verifies that they contains flow records of test packets sent. - -*** Variables *** -| ${dut1_to_tg_ip}= | 10::10 -| ${tg_to_dut1_ip}= | 12::10 -| ${prefix_length}= | 64 -| ${ip_version}= | ip6 -| ${sessions}= | 45 - -# IPv4 addresses used for IPFIX exporter. Export over IPv6 not (yet?) supported. -| ${dut1_to_tg_ip4}= | 192.168.1.1 -| ${tg_to_dut1_ip4}= | 192.168.1.2 - -*** Test Cases *** -| TC01: DUT reports packet flow with a large number of packets -| | [Documentation] -| | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface -| | ... | address as collector and add classify session with TG source address. -| | ... | [Ver] Make TG send packets to DUT1, then listen for IPFIX template -| | ... | and data packets, verify that IPFIX reported the received packets. -| | ... | [Ref] RFC 7011 -| | Given Configure path in 3-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} -| | And Set interfaces in 3-node circular topology up -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length} -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip4} | ${24} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip4} -| | ... | ${tg_to_dut1_mac} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${tg_to_dut1_mac} -| | And VPP RA suppress link layer | ${dut1_node} | ${dut1_to_tg} -| | ${table_index} | ${skip_n} | ${match_n}= -| | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | src -| | And VPP configures classify session L3 | ${dut1_node} | permit -| | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | src -| | ... | ${tg_to_dut1_ip} -| | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg} -| | ... | ${table_index} | ip_version=${ip_version} -| | And setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip4} -| | ... | ${dut1_to_tg_ip4} | interval=5 -| | And Set IPFIX stream | ${dut1_node} | ${1} -| | And Assign classify table to exporter | ${dut1_node} | ${table_index} -| | ... | ${ip_version} -| | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node} -| | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip} -| | ... | count=20000 | timeout=10 - -| TC02: DUT reports packet flow when multiple sessions are configured -| | [Documentation] -| | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface -| | ... | address as collector and add several classify sessions with different -| | ... | ports. -| | ... | [Ver] Make TG send packets to DUT1 using a range of ports matching -| | ... | configured sessions, then listen for IPFIX template and data packets, -| | ... | verify that IPFIX reported the received packets for each session. -| | ... | [Ref] RFC 7011 -| | Given Configure path in 3-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} -| | And Set interfaces in 3-node circular topology up -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length} -| | And VPP Interface Set IP Address | ${dut1_node} -| | ... | ${dut1_to_tg} | ${dut1_to_tg_ip4} | ${24} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip4} -| | ... | ${tg_to_dut1_mac} -| | And VPP Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip} -| | ... | ${tg_to_dut1_mac} -| | And VPP RA suppress link layer | ${dut1_node} | ${dut1_to_tg} -| | ${table_index} | ${skip_n} | ${match_n}= -| | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} -| | ... | src proto l4 src_port dst_port -| | :FOR | ${index} | IN RANGE | ${sessions} -| | | VPP configures classify session generic | ${dut1_node} -| | | ... | acl-hit-next permit | ${table_index} | ${skip_n} | ${match_n} -| | | ... | l3 ${ip_version} src ${tg_to_dut1_ip} -| | | ... | proto 6 l4 src_port ${index} dst_port ${index} -| | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg} -| | ... | ${table_index} | ip_version=${ip_version} -| | And setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip4} -| | ... | ${dut1_to_tg_ip4} | interval=5 -| | ... | mtu=1450 | interval=5 -| | And Set IPFIX stream | ${dut1_node} | ${1} -| | And Assign classify table to exporter | ${dut1_node} | ${table_index} -| | ... | ${ip_version} -| | Then Send session sweep and verify IPFIX | ${tg_node} | ${dut1_node} -| | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip} -| | ... | ${sessions} | timeout=10 | count=3 - -# TODO: DUT reports packet flow when ACL is configured with wildcards diff --git a/tests/vpp/func/telemetry/eth2p-ethip6-ip6base-spanrx-func.robot b/tests/vpp/func/telemetry/eth2p-ethip6-ip6base-spanrx-func.robot deleted file mode 100644 index 4e7b452338..0000000000 --- a/tests/vpp/func/telemetry/eth2p-ethip6-ip6base-spanrx-func.robot +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.IPUtil -| Library | resources.libraries.python.IPv6Util -| Library | resources.libraries.python.telemetry.SPAN -| Library | resources.libraries.python.Trace -| ... -| Resource | resources/libraries/robot/shared/default.robot -| Resource | resources/libraries/robot/shared/testing_path.robot -| Resource | resources/libraries/robot/telemetry/span.robot -| ... -| Force Tags | HW_ENV | VM_ENV | 3_NODE_DOUBLE_LINK_TOPO -| ... -| Test Setup | Set up functional test -| ... -| Test Teardown | Tear down functional test -| ... -| Documentation | *SPAN test suite* -| ... | *[Top] Network Topologies:* TG=DUT1 2-node topology with two -| ... | links between nodes. -| ... | *[Cfg] DUT configuration:* DUT1 is configured with SPAN mirroring from -| ... | the first DUT1-TG interface to the second one. -| ... | *[Ver] TG verification:* Test ARP or ICMP packets are sent by TG -| ... | on first link to DUT1; On receipt through second link TG verifies -| ... | the copy of packet sent and the copy of DUT's reply packet. -| ... | *[Ref] Applicable standard specifications: None?* - -*** Variables *** -| ${tg_to_dut_if1_ip6}= | 11::1 -| ${dut_to_tg_if1_ip6}= | 10::1 -| ${prefix}= | 24 - -*** Test Cases *** -| TC01: DUT mirrors IPv6 packets from one interface to another -| | [Documentation] -| | ... | [Top] TG=DUT1 -| | ... | [Cfg] On DUT1 configure IPv6 address, add ARP entry for one TG \ -| | ... | interface and set SPAN mirroring from one DUT interface to the other. -| | ... | [Ver] Make TG send an ICMP packet to DUT through one interface,\ -| | ... | then receive a copy of sent packet and of DUT's ICMP reply\ -| | ... | on the other interface. -| | Given Configure path in 2-node circular topology -| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']} -| | And Set interfaces in 2-node circular topology up -| | And VPP Interface Set IP Address -| | ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_to_tg_if1_ip6} | ${prefix} -| | And VPP Add IP Neighbor | ${dut_node} -| | ... | ${dut_to_tg_if1} | ${tg_to_dut_if1_ip6} | ${tg_to_dut_if1_mac} -| | And Vpp Route Add | ${dut_node} | ${tg_to_dut_if1_ip6} | ${prefix} -| | ... | gateway=${dut_to_tg_if1_ip6} | interface=${dut_to_tg_if1} -| | And Vpp Ra Suppress Link Layer | ${dut_node} | ${dut_to_tg_if1} -| | And Set SPAN Mirroring | ${dut_node} | ${dut_to_tg_if1} | ${dut_to_tg_if2} -| | Then Send Packet And Check Received Copies -| | ... | ${tg_node} | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac} -| | ... | ${dut_to_tg__if1_mac} | ${tg_to_dut_if2} -| | ... | ${tg_to_dut_if1_ip6} | ${dut_to_tg_if1_ip6} | ICMPv6 |