From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 198A1A0548; Fri, 3 Dec 2021 03:13:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 123B5426FB; Fri, 3 Dec 2021 03:13:16 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 289A3426FA for ; Fri, 3 Dec 2021 03:13:13 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10186"; a="235629874" X-IronPort-AV: E=Sophos;i="5.87,283,1631602800"; d="scan'208";a="235629874" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2021 18:13:12 -0800 X-IronPort-AV: E=Sophos;i="5.87,283,1631602800"; d="scan'208";a="610220014" Received: from unknown (HELO dpdk.lan) ([10.240.183.77]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2021 18:13:10 -0800 From: Yan Xia To: dts@dpdk.org Cc: Yan Xia Subject: [dts][PATCH V1 3/3] tests/fdir: delete fdir Date: Fri, 3 Dec 2021 10:13:11 +0000 Message-Id: <20211203101311.148370-3-yanx.xia@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211203101311.148370-1-yanx.xia@intel.com> References: <20211203101311.148370-1-yanx.xia@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org delete fdir dpdk commit-id: 1be514fbc ethdev: remove legacy FDIR filter type support Signed-off-by: Yan Xia --- tests/TestSuite_fdir.py | 1335 --------------------------------------- 1 file changed, 1335 deletions(-) delete mode 100644 tests/TestSuite_fdir.py diff --git a/tests/TestSuite_fdir.py b/tests/TestSuite_fdir.py deleted file mode 100644 index b418b68d..00000000 --- a/tests/TestSuite_fdir.py +++ /dev/null @@ -1,1335 +0,0 @@ -# BSD LICENSE -# -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Intel Corporation nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -""" -DPDK Test suite. - -Test 82599 and fortville Flow Director Support in DPDK -""" - -import imp -import re -import string -import sys -import time -from time import sleep - -from scapy.utils import PcapWriter, socket, struct - -import framework.utils as utils -from framework.pktgen import PacketGeneratorHelper -from framework.pmd_output import PmdOutput -from framework.settings import HEADER_SIZE -from framework.test_case import TestCase - - -class TestFdir(TestCase): - - # - # - # Utility methods and other non-test code. - # - ########################################################################### - scapyCmds = [] - - def start_scapy(self): - self.tester.scapy_foreground() - self.tester.send_expect('scapy', '>>> ', 10) - sleep(2) - - def end_scapy(self): - self.tester.send_expect("exit()", "#") - - def scapy_execute(self, timeout=60): - for cmd in self.scapyCmds: - self.tester.send_expect(cmd, ">>> ", timeout) - - self.scapyCmds = [] - - def send_and_verify(self, condition, packet, queueid = -2): - """ - Send packages and verify behavior. - """ - self.scapyCmds.append(packet) - self.dut.send_expect("start", "testpmd>") - - self.pmd_output = PmdOutput(self.dut) - res = self.pmd_output.wait_link_status_up('all', timeout=15) - self.verify(res is True, 'there have port link is down') - - self.scapy_execute() - time.sleep(.5) - out = self.dut.get_session_output() - self.dut.send_expect("stop", "testpmd>") - - if(self.nic in ["kawela", "niantic", "fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - if ("fwd" == self.fdir_type): - if condition: - self.queue = 2 - else: - self.queue = 0 - elif("drop" == self.fdir_type): - if condition: - self.queue = 0 - else: - self.queue = -1 - else: - self.queue = queueid - - result_scanner = r"port ([0-9]+)/queue ([0-9]+): received ([0-9]+) packets\s*src=[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2} - dst=[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}" - scanner = re.compile(result_scanner, re.DOTALL) - m = scanner.search(out) - - print("**************Print sub-case result****************") - if m: - m.groups() - if (self.queue == int(m.group(2))): - print(utils.GREEN("Pass: queue id is " + m.group(2))) - self.verify(1, "Pass") - else: - print(utils.RED("Fail: queue id is " + m.group(2))) - self.verify(0, "Fail") - print(out) - else: - print("not match") - if (-1 == self.queue): - print(utils.GREEN("Pass: fdir should not match ")) - self.verify(1, "Pass") - else: - print(utils.RED("Fail")) - self.verify(0, "Fail") - print(out) - print("**************Print sub-case result****************") - - # - # - # - # Test cases. - # - def set_up_all(self): - """ - Run at the start of each test suite. - - PMD prerequisites. - """ - #self.verify('bsdapp' not in self.path, "FDIR not support freebsd") - # this feature support Fortville, Niantic - #self.verify(self.nic in ["kawela_2", "niantic", "bartonhills", "82545EM", - # "82540EM", "springfountain", "fortville_eagle", - # "fortville_spirit", "fortville_spirit_single"], - # "NIC Unsupported: " + str(self.nic)) - - # Based on h/w type, choose how many ports to use - self.dut_ports = self.dut.get_ports(self.nic) - # Verify that enough ports are available - self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing") - - # Verify that enough threads are available - self.all_cores_mask = utils.create_mask(self.dut.get_core_list("all")) - cores = self.dut.get_core_list("1S/5C/1T") - self.verify(cores is not None, "Insufficient cores for speed testing") - self.coreMask = utils.create_mask(cores) - self.portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) - self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) - self.dut_rx_port = self.tester.get_local_port(self.dut_ports[0]) - self.dut_rx_interface = self.tester.get_interface(self.dut_rx_port) - self.dut_tx_port = self.tester.get_local_port(self.dut_ports[1]) - self.dut_tx_interface = self.tester.get_interface(self.dut_rx_port) - self.path=self.dut.apps_name['test-pmd'] - - self.blocklist = "" - - self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE[ - 'ip'] + HEADER_SIZE['udp'] - self.src_ip = "192.168.1.1" - self.dst_ip = "192.168.2.1" - self.default_queue = 2 - - # performance test parameter - # self.frame_sizes = [1500] - self.frame_sizes = [64, 65, 128, 256, 512, 1024, 1280, 1500] - self.rxfreet_values = [0, 8, 16, 32, 64, 128] - """ - self.test_cycles = [{'cores': '1S/1C/1T', 'Mpps': {}, 'pct': {}}, - {'cores': '1S/1C/2T', 'Mpps': {}, 'pct': {}}, - {'cores': '1S/2C/1T', 'Mpps': {}, 'pct': {}}, - {'cores': '1S/2C/2T', 'Mpps': {}, 'pct': {}}, - {'cores': '1S/4C/2T', 'Mpps': {}, 'pct': {}} - ] - """ - self.test_cycles = [{'cores': '1S/4C/2T', 'Mpps': {}, 'pct': {}}] - - # Niantic only support 2bytes payload, Fortville support 16 bytes - self.flexbytes = [{'length': 2, 'flexbytes': '0x11,0x11', 'payload': '\\x11\\x11'}, - {'length': 16, 'flexbytes': '0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x88,0x88', 'payload': '\\x11\\x11\\x22\\x22\\x33\\x33\\x44\\x44\\x55\\x55\\x66\\x66\\x77\\x77\\x88\\x88'} - ] - - # self.test_types = ['fdir_2flexbytes'] - self.test_types = ['fdir_disable', 'fdir_enable', 'fdir_noflexbytes', 'fdir_2flexbytes', 'fdir_16flexbytes'] - """ - self.flows= [{"flows":1, "rules":1}, - {"flows":64, "rules":16}, - {"flows":64, "rules":512} - #{"flows":8192, "rules":8192} - ] - """ - self.flows = [{"flows": 8192, "rules": 8192}] - # performance report head line - self.table_header = ['Frame Size'] - for test_cycle in self.test_cycles: - self.table_header.append("%s Mpps" % test_cycle['cores']) - self.table_header.append("% linerate") - # create an instance to set stream field setting - self.pktgen_helper = PacketGeneratorHelper() - - def set_up(self): - """ - Run before each test case. - """ - self.start_scapy() - - def fdir_set_rule(self): - """ - Fdir Performance Benchmarking set rules - """ - self.dut.send_expect("port stop %s" % self.dut_ports[0], "testpmd>") - if(self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_flex_payload %s l2 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_flex_payload %s l3 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_flex_payload %s l4 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_flex_mask %s flow all (0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff)" % self.dut_ports[0], "testpmd>") - elif (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_flex_payload %s raw (12,13)" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_flex_mask %s flow raw (0xff,0xff)" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("port start %s" % self.dut_ports[0], "testpmd>") - - def fdir_get_flexbytes(self, sctp=False): - - """ - Fdir get flexbytes and payload according NIC - """ - - if(self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortpark_BASE-T","fortville_25g", "carlsville", "foxville"]): - if not sctp: - self.flexbytes = "0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x77,0x77" - else: - self.flexbytes = '0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0' - self.payload = b'\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x77\x77' - self.flexlength = 16 - elif (self.nic in ["niantic", "sagepond", "sageville"]): - self.flexbytes = "0x00,0x00" - self.payload = b'\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x77\x77' - self.flexlength = 2 - self.payload = str(self.payload) - self.payload = self.payload.split("'")[1] - - def test_fdir_noflexword_fwd_ipv4(self): - """ - FDir signature matching mode. - """ - - self.dut.kill_all() - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - # fwd command testing - self.fdir_type = "fwd" - - # ipv4 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"),dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - # update command only work in niantic - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv4 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv4 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv4 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.fdir_get_flexbytes() - - # ipv4 frag - # ip-frag only support in fortville - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2", frag=1, flags="MF")/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"),dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2", frag=1, flags="MF")/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_noflexword_fwd_ipv6(self): - """ - FDir signature matching mode. - """ - - self.dut.kill_all() - if self.nic in ["niantic", "sagepond", "sageville"]: - # Niantic ipv6 only support signature mode - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=signature" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - elif self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortpark_BASE-T","fortville_25g", "carlsville"]: - # Fortville ipv6 support perfect mode - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - # fwd comand testing - self.fdir_type = "fwd" - - # ipv6 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv6 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv6 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - #ipv6 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter 0 mode IP add flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d "%(2,1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter 0 mode IP del flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d "%(2,1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter 0 mode IP add flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d "%(1,1), "testpmd>") - self.dut.send_expect("flow_director_filter 0 mode IP update flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d "%(2,1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter 0 mode IP del flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d "%(2,1), "testpmd>") - self.fdir_get_flexbytes() - - # ipv6 frag - # ip-frag only support in fortville - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=44)/IPv6ExtHdrFragment()/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=44)/IPv6ExtHdrFragment()/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_noflexword_drop_ipv4(self): - # drop command testing - self.dut.kill_all() - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - # fwd comand testing - self.fdir_type = "drop" - - # ipv4 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv4 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv4 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv4 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.fdir_get_flexbytes() - - # ipv4 frag - # ip-frag only support in fortville - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2", frag=1, flags="MF")/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"),dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2", frag=1, flags="MF")/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_noflexword_drop_ipv6(self): - # drop not support signature mode, niantic only can work in signature mode with ipv6 - # Niantic is not support in drop ipv6 - if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortpark_BASE-T","fortville_25g", "carlsville"]: - # drop command testing - self.dut.kill_all() - - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - # fwd comand testing - self.fdir_type = "drop" - - # ipv6 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - # ipv6 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - # ipv6 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - # ipv6 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d "%(self.dut_ports[0],2,1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d "%(self.dut_ports[0],2,1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d "%(self.dut_ports[0],1,1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d "%(self.dut_ports[0],2,1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d "%(self.dut_ports[0],2,1), "testpmd>") - self.fdir_get_flexbytes() - - # ipv6 frag - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=44)/IPv6ExtHdrFragment()/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=44)/IPv6ExtHdrFragment()/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_flexword_fwd_ipv4(self): - """ - FDir signature matching mode. - """ - # fwd comand testing - self.fdir_type = "fwd" - - self.dut.kill_all() - # fwd testing with flexword - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_set_rule() - self.fdir_get_flexbytes() - - # ipv4 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'),dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - - # ipv4 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - - # ipv4 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - - # ipv4 frag - # ip-frag only support fortville - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortpark_BASE-T","fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2', frag=1, flags='MF')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'),dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2', frag=1, flags='MF')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv4 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 2, 1), "testpmd>") - self.fdir_get_flexbytes() - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_flexword_fwd_ipv6(self): - """ - FDir signature matching mode. - """ - # fwd comand testing - self.fdir_type = "fwd" - - self.dut.kill_all() - # fwd testing with flexword - if self.nic in ["niantic", "sagepond", "sageville"]: - # Niantic ipv6 only support signature mode - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=signature" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - elif self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]: - # fortville ipv6 support perfect mode - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_set_rule() - self.fdir_get_flexbytes() - - # ipv6 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - - # ipv6 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - - # ipv6 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - #ipv6 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes,2,1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes,2,1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes,1,1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes,2,1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes,2,1), "testpmd>") - self.fdir_get_flexbytes() - - # ipv6 frag - # ip-frag only support fortville - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=44)/IPv6ExtHdrFragment()/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=44)/IPv6ExtHdrFragment()/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_flexword_drop_ipv4(self): - - # drop testing with flexword - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_set_rule() - self.fdir_get_flexbytes() - # fwd comand testing - self.fdir_type = "drop" - - # ipv4 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv4 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv4 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv4 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.fdir_get_flexbytes() - - # ipv4 frag - # ip-frag only support fortville - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2', frag=1, flags='MF')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'),dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2', frag=1, flags='MF')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_flexword_drop_ipv6(self): - # drop not support signature mode, niantic only can work in signature mode with ipv6 - # Niantic is not support in drop ipv6 - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortpark_BASE-T","fortville_25g", "carlsville"]): - # drop testing with flexword - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_set_rule() - self.fdir_get_flexbytes() - # fwd comand testing - self.fdir_type = "drop" - - # ipv6 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv6 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv6 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv6 frag - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=44)/IPv6ExtHdrFragment()/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=44)/IPv6ExtHdrFragment()/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_ipv4_tos_proto_ttl(self): - """ - Expand Flow Director for fortville to support ipv4 TOS, ipv4 PROTO, ipv4 TTL - """ - if not self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortville_25g", "carlsville", "foxville"]: - self.verify(False, "This case only support fortville nic") - self.dut.kill_all() - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_set_rule() - self.fdir_get_flexbytes() - # fwd comand testing - self.fdir_type = " " - self.dut.send_expect("set_fdir_input_set %d ipv4-other none select" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("set_fdir_input_set %d ipv4-other src-ipv4 add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("set_fdir_input_set %d ipv4-other dst-ipv4 add" % self.dut_ports[0], "testpmd>") - - # test add and remove tso rule - self.dut.send_expect("set_fdir_input_set %d ipv4-other ipv4-tos add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 8 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=255, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 1) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=8, proto=255, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 2) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 8 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=255, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=8, proto=255, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - - # test add and remove proto rule - self.dut.send_expect("set_fdir_input_set %d ipv4-other ipv4-proto add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 253 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 254 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=253, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 1) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=254, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 2) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 253 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 254 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=253, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=254, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - - # test add and remove ttl rule - self.dut.send_expect("set_fdir_input_set %d ipv4-other ipv4-ttl add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 255 ttl 32 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 255 ttl 64 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=255, ttl=32) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 1) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=255, ttl=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 2) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 255 ttl 32 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 255 ttl 64 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=255, ttl=32) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=255, ttl=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - - def test_fdir_ipv6_tc(self): - """ - Expand Flow Director for fortville to support ipv6 TC, next-header, hop-limits - """ - if not self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortville_25g", "carlsville", "foxville"]: - self.verify(False, "This case only support fortville nic") - self.dut.kill_all() - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_set_rule() - self.fdir_get_flexbytes() - # fwd comand testing - self.fdir_type = " " - self.dut.send_expect("set_fdir_input_set %d ipv6-other none select" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("set_fdir_input_set %d ipv6-other src-ipv6 add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("set_fdir_input_set %d ipv6-other dst-ipv6 add" % self.dut_ports[0], "testpmd>") - - # test add and remove ipv6 tc rule - self.dut.send_expect("set_fdir_input_set %d ipv6-other ipv6-tc add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv6-other src 2000::1 dst 2000::2 \ - tos 8 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=255, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 1) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=8, nh=255, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 2) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv6-other src 2000::1 dst 2000::2 \ - tos 8 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=255, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=8, nh=255, hlim=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - - # test add and remove ipv6-next-header rule - self.dut.send_expect("set_fdir_input_set %d ipv6-other ipv6-next-header add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 253 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 254 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=253, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 1) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=254, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 2) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 253 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 254 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=253, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=254, hlim=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - - # test add and remove ipv6-hop-limits rule - self.dut.send_expect("set_fdir_input_set %d ipv6-other ipv6-hop-limits add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 255 ttl 32 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 255 ttl 64 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=255, hlim=32) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 1) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=255, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 2) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 255 ttl 32 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 255 ttl 64 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=255, hlim=32) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=255, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - - def test_fdir_ivlan(self): - """ - Expand Flow Director for fortville to support ipv4 TOS, ipv4 PROTO, ipv4 TTL - """ - if not self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortville_25g", "carlsville", "foxville"]: - self.verify(False, "This case only support fortville nic") - self.dut.kill_all() - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_type = " " - self.dut.send_expect("set_fdir_input_set %d ipv4-udp ivlan add" % self.dut_ports[0], "testpmd>") - - - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002 \ - tos 2 ttl 40 vlan 1 flexbytes () fwd pf queue 1 fd_id 1" - % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 15 flexbytes () fwd pf queue 2 fd_id 2" - % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 255 flexbytes () fwd pf queue 3 fd_id 3" - % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 4095 flexbytes () fwd pf queue 3 fd_id 4" - % self.dut_ports[0], "testpmd>") - - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=1) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 1) - - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=15) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 2) - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=255) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 3) - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=4095) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 3) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 1 flexbytes () fwd pf queue 1 fd_id 1" - % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 15 flexbytes () fwd pf queue 2 fd_id 2" - % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 255 flexbytes () fwd pf queue 3 fd_id 3" - % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 4095 flexbytes () fwd pf queue 3 fd_id 4" - % self.dut_ports[0], "testpmd>") - - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=1) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 0) - - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=15) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=255) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=4095) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 0) - - - - def failed_test_fdir_flush(self): - """ - FDir flush in Fortville. - """ - - self.dut.kill_all() - - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=8 --txq=8 --nb-cores=16 --nb-ports=2 --pkt-filter-mode=perfect" % (self.path, self.all_cores_mask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - # set up a fdir rule and check guarant_count - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - out = self.dut.send_expect("show port fdir all", "testpmd>") - result_scanner = r"guarant_count: 1" - scanner = re.compile(result_scanner, re.DOTALL) - m = scanner.search(out) - if m: - self.verify(1, "Pass") - else: - self.verify(0, "Fail") - - # flush all fdir rule and check guarant_count - out = self.dut.send_expect("flush_flow_director %s" % self.dut_ports[0], "testpmd>") - result_scanner = r"guarant_count: 1" - scanner = re.compile(result_scanner, re.DOTALL) - m = scanner.search(out) - if m: - self.verify(0, "Fail") - else: - self.verify(1, "Pass") - - def increment_ip_address(self, addr, val): - """ - Returns the IP address from a given one, like - 192.168.1.1 ->193.168.1.1 - If disable ip hw chksum, csum routine will increase ip - """ - ip2int = lambda ipstr: struct.unpack('!I', socket.inet_aton(ipstr))[0] - x = ip2int(addr) - int2ip = lambda n: socket.inet_ntoa(struct.pack('!I', n)) - return int2ip(x + 1) - - def fdir_perf_set_rules(self, num_rules): - - src_ip_temp = self.src_ip - dst_ip_temp = self.dst_ip - for i in range(num_rules): - src_ip_temp = self.increment_ip_address(src_ip_temp, 1) - dst_ip_temp = self.increment_ip_address(dst_ip_temp, 1) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src %s dst %s tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], src_ip_temp, dst_ip_temp, self.flexbytes, i % self.queue, i), "testpmd>") - - def fdir_perf_set_flows(self, num_flows, frame_size): - """ - Fdir Performance Benchmarking set Ixia flows - """ - flows = [] - src_ip_temp = self.src_ip - dst_ip_temp = self.dst_ip - print("*src_ip_temp = " + src_ip_temp + "dst_ip_temp = " + dst_ip_temp) - flows.append("Ether(src='52:00:00:00:00:00', dst='00:1B:21:8E:B2:30')/IP(src='%s',dst='%s')/UDP(sport=%d,dport=%d)/Raw(load='%s' + 'X'*(%d - 42 - %d))" % (src_ip_temp, dst_ip_temp, 1021, 1021, self.payload, frame_size, self.flexlength)) - self.scapyCmds.append('wrpcap("/root/test1.pcap", [%s])' % ','.join(flows)) - flows = [] - flows.append("Ether(src='52:00:00:00:00:01', dst='00:1B:21:8E:B2:31')/IP(src='%s',dst='%s')/UDP(sport=%d,dport=%d)/Raw(load='%s' + 'X'*(%d - 42 - %d))" % (src_ip_temp, dst_ip_temp, 1021, 1021, self.payload, frame_size, self.flexlength)) - self.scapyCmds.append('wrpcap("/root/test2.pcap", [%s])' % ','.join(flows)) - - def perf_fdir_performance_2ports(self, test_type, num_rules, num_flows): - """ - fdir Performance Benchmarking with 2 ports. - """ - # prepare traffic generator input - tgen_input = [] - - tgen_input.append((self.tester.get_local_port(self.dut_ports[0]), - self.tester.get_local_port(self.dut_ports[1]), - "/root/test1.pcap")) - tgen_input.append((self.tester.get_local_port(self.dut_ports[1]), - self.tester.get_local_port(self.dut_ports[0]), - "/root/test2.pcap")) - - print("self.ports_socket=%s" % (self.ports_socket)) - # run testpmd for each core config - for test_cycle in self.test_cycles: - print("******************test cycles*********************\n") - core_config = test_cycle['cores'] - - core_list = self.dut.get_core_list(core_config, socket=self.ports_socket) - - if len(core_list) > 2: - self.queues = len(core_list) / 2 - else: - self.queues = 1 - - core_mask = utils.create_mask(core_list) - port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) - - if test_type == "fdir_disable": - command_line = "%s -c 0xff00ff -n %d -- -i --rxq=2 --txq=2 --rxd=512 --txd=512 --burst=32 --rxfreet=64 --txfreet=64 --mbcache=256 \ - --portmask=%s --nb-cores=4 --nb-ports=2 --rss-ip\ - " % (self.path, self.dut.get_memory_channels(), port_mask) - else: - command_line = "%s -c 0xff00ff -n %d -- -i --rxq=2 --txq=2 --rxd=512 --txd=512 --burst=32 --rxfreet=64 --txfreet=64 --mbcache=256 \ - --portmask=%s --nb-cores=4 --nb-ports=2 --rss-ip\ - --pkt-filter-mode=perfect" % (self.path, self.dut.get_memory_channels(), port_mask) - - info = "Executing PMD using %s\n" % test_cycle['cores'] - self.logger.info(info) - self.rst_report(info, annex=True) - self.rst_report(command_line + "\n\n", frame=True, annex=True) - - out = self.dut.send_expect(command_line, "testpmd> ", 100) - print(out) - - self.fdir_get_flexbytes() - - if test_type in ["fdir_noflex", "fdir_2flex", "fdir_16flex"]: - self.fdir_set_rule() - self.fdir_perf_set_rules(num_rules) - out = self.dut.send_expect("start", "testpmd> ") - print(out) - for frame_size in self.frame_sizes: - print("******************frame size = %d*********************\n" % (frame_size)) - wirespeed = self.wirespeed(self.nic, frame_size, 2) - # create pcap file - self.logger.info("Running with frame size %d " % frame_size) - self.fdir_perf_set_flows(num_flows, frame_size) - - self.scapy_execute() - - """ - tgen_input.append([self.tester.get_local_port(self.dut_ports[0]), - self.tester.get_local_port(self.dut_ports[1]), - "test.pcap", (512.00 / wirespeed * 100.00), 1]) - tgen_input.append([self.tester.get_local_port(self.dut_ports[1]), - self.tester.get_local_port(self.dut_ports[0]), - "test.pcap", (512.00 / wirespeed * 100.00), 1]) - """ - - """ - # create pcap file - self.logger.info("Running with frame size %d " % frame_size) - self.fdir_perf_set_flows(num_flows, frame_size) - - self.tester.scapy_execute() - """ - - # run traffic generator - streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, - None, self.tester.pktgen) - _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams) - """ - _, pps, _ = self.throughputRate(tgen_input) - """ - - out = self.dut.send_expect("show port stats all", "testpmd> ", timeout=60) - print(out) - - pps /= 1000000.0 - test_cycle['Mpps'][frame_size] = pps - test_cycle['pct'][frame_size] = pps * 100 / wirespeed - - self.dut.send_expect("stop", "testpmd> ") - self.dut.send_expect("quit", "# ", 30) - sleep(5) - - for n in range(len(self.test_cycles)): - for frame_size in self.frame_sizes: - self.verify(self.test_cycles[n]['Mpps'][ - frame_size] > 0, "No traffic detected") - - # Print results - self.result_table_create(self.table_header) - for frame_size in self.frame_sizes: - table_row = [frame_size] - for test_cycle in self.test_cycles: - table_row.append(test_cycle['Mpps'][frame_size]) - table_row.append(test_cycle['pct'][frame_size]) - - self.result_table_add(table_row) - - self.result_table_print() - - def test_perf_fdir_performance_2ports(self): - """ - fdir Performance Benchmarking with 2 ports. - """ - for test_type in self.test_types: - print("***************\n") - print(test_type) - print("***************\n") - if test_type in ["fdir_enable", "fdir_disable"]: - num_rules = 0 - num_flows = 64 - print("************%d rules/%d flows********************" % (num_rules, num_flows)) - self.perf_fdir_performance_2ports(test_type, num_rules, num_flows) - elif test_type in ["fdir_noflexbytes", "fdir_2flexbytes", "fdir_16flexbytes"]: - for flows in self.flows: - num_rules = flows["rules"] - num_flows = flows["flows"] - print("************%d rules/%d flows********************" % (num_rules, num_flows)) - self.perf_fdir_performance_2ports(test_type, num_rules, num_flows) - - def tear_down(self): - """ - Run after each test case. - """ - self.end_scapy() - - def tear_down_all(self): - """ - Run after each test suite. - """ - pass -- 2.33.1