From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id C7B9A1B5FD for ; Wed, 18 Oct 2017 04:03:18 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 17 Oct 2017 19:03:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,393,1503385200"; d="scan'208";a="324454973" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 17 Oct 2017 19:03:17 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 17 Oct 2017 19:03:17 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 17 Oct 2017 19:03:16 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.218]) with mapi id 14.03.0319.002; Wed, 18 Oct 2017 10:03:14 +0800 From: "Liu, Yong" To: "Peng, Yuan" , "dts@dpdk.org" CC: "Peng, Yuan" Thread-Topic: [dts] [PATCH v1] tests: add test cases of generic_flow_api Thread-Index: AQHTItUGF3bXriXjTUSnK6mbqpe0G6LpHWAg Date: Wed, 18 Oct 2017 02:03:13 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62EF85CC@SHSMSX103.ccr.corp.intel.com> References: <1504237691-109737-1-git-send-email-yuan.peng@intel.com> In-Reply-To: <1504237691-109737-1-git-send-email-yuan.peng@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH v1] tests: add test cases of generic_flow_api X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Oct 2017 02:03:20 -0000 Thanks, Yuan. Some comments below. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Peng,Yuan > Sent: Friday, September 01, 2017 11:48 AM > To: dts@dpdk.org > Cc: Peng, Yuan > Subject: [dts] [PATCH v1] tests: add test cases of generic_flow_api >=20 > From: Peng Yuan >=20 > Signed-off-by: Peng Yuan >=20 > diff --git a/tests/TestSuite_generic_flow_api.py > b/tests/TestSuite_generic_flow_api.py > new file mode 100644 > index 0000000..dda1a3e > --- /dev/null > +++ b/tests/TestSuite_generic_flow_api.py > @@ -0,0 +1,1386 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2017 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 the support of VLAN Offload Features by Poll Mode Drivers. > + > +""" > + > +import utils > +import time > +import re > + > +from test_case import TestCase > +from settings import HEADER_SIZE > +from pmd_output import PmdOutput > +from settings import DRIVERS > + > +from virt_dut import VirtDut > +from project_dpdk import DPDKdut > +from dut import Dut > +from packet import Packet > + > + > +class TestGeneric_flow_api(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + > + > + Generic filter Prerequistites > + """ > + > + # Based on h/w type, choose how many ports to use > + self.dut_ports =3D self.dut.get_ports(self.nic) > + # Verify that enough ports are available > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports") > + > + localPort =3D self.tester.get_local_port(self.dut_ports[0]) > + self.tester_itf =3D self.tester.get_interface(localPort) > + self.pf_interface =3D self.dut.ports_info[self.dut_ports[0]]['in= tf'] > + self.pf_mac =3D self.dut.get_mac_address(0) > + self.pf_pci =3D self.dut.ports_info[self.dut_ports[0]]['pci'] > + > + if(self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", "fortpark_TLV"]): > + self.session_secondary =3D self.dut.new_session() > + self.session_third =3D self.dut.new_session() > + # create two vfs > + self.dut.generate_sriov_vfs_by_port(self.dut_ports[0], 2, > self.drivername) > + self.sriov_vfs_port =3D > self.dut.ports_info[self.dut_ports[0]]['vfs_port'] > + try: > + > + for port in self.sriov_vfs_port: > + port.bind_driver(driver=3D"vfio-pci") > + except Exception as e: > + raise Exception(e) This judgement can't skip this case when NIC is not XL710 family. Please ad= d some explanation about why to create VFs device on Fortville.=20 > + > + self.outer_mac =3D "00:11:22:33:44:55" > + self.inner_mac =3D "00:11:22:33:44:66" > + self.wrong_mac =3D "00:11:22:33:44:77" > + self.vf_flag =3D 0 > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + pass > + > + def verify_result(self, pf_vf, expect_rxpkts, expect_queue): > + """ > + verify the packet to the expected queue or be dropped > + """ > + self.tester.scapy_execute() > + time.sleep(2) Scapy_execute function is strange here. If packets are just normal, please = use packet module to send those kind of packets. Otherwise, please move it just after scapy command setting functions. > + > + if self.vf_flag =3D=3D 1: > + outstring_vf1 =3D self.session_secondary.send_expect("stop", > "testpmd> ") > + outstring_vf2 =3D self.session_third.send_expect("stop", > "testpmd> ") > + outstring_pf =3D self.dut.send_expect("stop", "testpmd> ") > + > + if expect_rxpkts =3D=3D "0": > + if pf_vf =3D=3D "pf": > + self.verify("Queue" not in outstring_pf, "the packet is > not dropped.") > + elif pf_vf =3D=3D "vf1": > + self.verify("Queue" not in outstring_vf1, "the packet is > not dropped.") > + else: > + self.verify("Queue" not in outstring_vf2, "the packet is > not dropped.") > + else: > + result_scanner =3D r"Forward Stats for RX > Port=3D %s/Queue=3D\s?([0-9]+)" % self.dut_ports[0] > + scanner =3D re.compile(result_scanner, re.DOTALL) > + if pf_vf =3D=3D "pf": > + m =3D scanner.search(outstring_pf) > + elif pf_vf =3D=3D "vf1": > + m =3D scanner.search(outstring_vf1)=09 > + else: > + m =3D scanner.search(outstring_vf2) > + queue_id =3D m.group(1) > + print "queue_id is %s !!!!!!!" % queue_id Please use self.logger.info for tracking important information. > + self.verify(expect_queue =3D=3D queue_id, "the actual queue > doesn't equal to the expected queue.") > + > + self.dut.send_expect("start", "testpmd> ") > + if self.vf_flag =3D=3D 1: > + self.session_secondary.send_expect("start", "testpmd> ") > + self.session_third.send_expect("start", "testpmd> ") > + > + def get_and_compare_rules_in_memory(self, outstring, expectedRules): Function name is too complex, please simplifies it to at most three words l= ike "compare_memory_rules". > + """ > + dump all flow rules that have been created in memory and compare > that total rules number with the given expected number > + to see if they are equal, as to get your conclusion after you > have deleted any flow rule entry. > + """ > + print outstring If print is just debug code, please remove it. > + result_scanner =3D r'\d*.*?\d*.*?\d*.*?=3D>*' > + scanner =3D re.compile(result_scanner, re.DOTALL) > + m =3D scanner.findall(outstring) > + print "All flow entries are: " > + for i in range(len(m)): > + print m[i] > + print 'Expected rules are: %d - actual are: %d' % (expectedRules= , > len(m)) > + self.verify(expectedRules =3D=3D len(m), 'Total rules number > mismatched') > + > + def test_SYN_filter(self): > + > + self.verify(self.nic in ["niantic", "kawela_4", "kawela", > "bartonhills", "twinville", "sagepond", "sageville", > + "powerville"], "%s nic not support SYN > filter" % self.nic) > + It's better to also add this kind of information in conf/test_case_checklis= t. > + self.dut.send_expect("./%s/app/testpmd -c ff -n 4 -- -i --rxq=3D= 8 - > -txq=3D8 --disable-rss" % self.target, "testpmd>", 120) Please utilize pmd_out module to start testpmd.=20 > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # create the flow rules > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 / tcp flags spec > 0x02 flags mask 0x02 / end actions queue index 3 / end", "created") > + # send the packets and verify the results > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/TCP(dport=3D80,flags=3D"S")/Raw("x" * 20)], iface=3D= "%s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"3"= ) > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/TCP(dport=3D80,flags=3D"PA")/Raw("x" * 20)], iface= =3D"%s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= ) > + >>From overall look like the test logic is that: 1. configured flow 2. Send packets match flow 3. Check packets received in expected queues Please add one more generic function to do this kind of function.=20 You can get the reference code from run_test function in uni_pkt suite. > + # the ipv6 rule is conflicted with ipv4 rule. > + self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ", 120) > + > + # create the flow rules > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv6 / tcp flags spec > 0x02 flags mask 0x02 / end actions queue index 4 / end", "created") > + # send the packets and verify the results > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/TCP(dport=3D80,flags=3D"S")/Raw("x" * 20)], iface=3D"%s"= )' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"4"= ) > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/TCP(dport=3D80,flags=3D"PA")/Raw("x" * 20)], iface=3D"%s= ")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= ) > + > + # check if there are 3 flow rules have been created > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 1) > + # check if one rule destoried with success > + self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 0) > + # check if all flow rules have been removed with success > + self.dut.send_expect("flow flush 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 0) > + > + def test_n_tuple_filter(self): > + > + self.verify(self.nic in ["niantic", "kawela_4", "kawela", > "bartonhills", "twinville", > + "powerville"], "%s nic not support n- > tuple filter" % self.nic) > + > + self.dut.send_expect("./%s/app/testpmd -c ff -n 4 -- -i --rxq=3D= 8 - > -txq=3D8 --disable-rss" % self.target, "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + if (self.nic in ["niantic", "kawela_4", "kawela", "twinville"]): > + # create the flow rules > + # ipv4-other > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.1 dst is 192.168.0.2 / end actions queue index 1 / end", > "created") > + # ipv4-udp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.1 dst is 192.168.0.3 proto is 17 / udp src is 22 dst is 23 / en= d > actions queue index 2 / end", "created") > + # ipv4-tcp > + self.dut.send_expect( > + "flow create 0 ingress pattern ipv4 src is 192.168.0.1 > dst is 192.168.0.3 proto is 6 / tcp src is 32 dst is 33 / end actions > queue index 3 / end", "created") > + # ipv4-sctp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.1 dst is 192.168.0.3 proto is 132 / sctp src is 44 dst is 45 / > end actions queue index 4 / end", "created") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"1") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.3")/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.3")/UDP(sport=3D22,dport=3D23)/Raw("x" * 20)], iface=3D"= %s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"2") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.3")/TCP(sport=3D32,dport=3D33)/Raw("x" * 20)], iface=3D"= %s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"3") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.3")/SCTP(sport=3D44,dport=3D45)/Raw("x" * 20)], iface=3D= "%s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"4") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.3")/SCTP(sport=3D44,dport=3D46)/Raw("x" * 20)], iface=3D= "%s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/SCTP(sport=3D44,dport=3D45)/Raw("x" * 20)], iface=3D= "%s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"1") > + > + else: > + # i350 and 82580 only support 2-tuple, and don't support SCT= P > + # ipv4-udp The test process is totally different from 8259X family NICs. Suggest to ad= d one new test case name like " test_2_tuple_filter" for distinguishing dif= ferent types of NICs. > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 proto is 17 / > udp dst is 23 / end actions queue index 1 / end", "created") > + # ipv4-tcp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 proto is 6 / > tcp dst is 33 / end actions queue index 2 / end", "created") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/UDP(sport=3D22,dport=3D23)/Raw("x" * 20)], iface=3D"= %s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"1") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/UDP(sport=3D22,dport=3D24)/Raw("x" * 20)], iface=3D"= %s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/TCP(sport=3D32,dport=3D33)/Raw("x" * 20)], iface=3D"= %s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"2") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/TCP(sport=3D32,dport=3D34)/Raw("x" * 20)], iface=3D"= %s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0") > + > + def test_ethertype_filter(self): > + > + self.verify(self.nic in ["niantic", "kawela_4", "kawela", > "bartonhills", "twinville", "sagepond", "sageville", > + "powerville", "fortville_eagle", > "fortville_spirit", > + "fortville_spirit_single", > "fortpark_TLV"], "%s nic not support ethertype filter" % self.nic) > + > + self.dut.send_expect("./%s/app/testpmd -c 0xff -n 4 -w %s --file= - > prefix=3Dtest1 -- -i --rxq=3D8 --txq=3D8" % (self.target, self.pf_pci), > "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # i40e,ixgbe and igb support different packet types. > + if (self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", "fortpark_TLV"]): > + # create the flow rules > + self.dut.send_expect( > + "flow validate 0 ingress pattern eth type is 0x0806 / en= d > actions queue index 1 / end", "Flow rule validated") > + self.dut.send_expect( > + "flow validate 0 ingress pattern eth type is 0x08bb / en= d > actions queue index 8 / end", "Invalid queue ID for FDIR") > + self.dut.send_expect( > + "flow validate 0 ingress pattern eth type is 0x88cc / en= d > actions queue index 5 / end", "Check the mode in fdir_conf") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth type is 0x08bb / end > actions queue index 8 / end", "Invalid queue ID for FDIR") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth type is 0x0806 / end > actions queue index 2 / end", "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth type is 0x88bb / end > actions queue index 3 / end", "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth dst is %s type is > 0x88e5 / end actions queue index 4 / end" % self.pf_mac, "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth type is 0x8864 / end > actions drop / end", "created") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"ff:ff:ff:ff:ff:ff")/ARP(pdst=3D"192.168.1.1")], > iface=3D"%s")' % self.tester_itf) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"2") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s",type=3D0x88BB)/Raw("x" * 20)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"3") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s",type=3D0x88E5)/Raw("x" * 20)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"4") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s",type=3D0x8864)/Raw("x" * 20)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"0", > expect_queue=3D"NULL") > + > + # check if there are 3 flow rules have been created > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 4) > + # check if one rule destoried with success > + self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 3) > + # check if all flow rules have been removed with success > + self.dut.send_expect("flow flush 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 0) > + > + else: > + # create the flow rules > + self.dut.send_expect( > + "flow validate 0 ingress pattern eth type is 0x0806 / en= d > actions queue index 1 / end", "Flow rule validated") > + self.dut.send_expect( > + "flow validate 0 ingress pattern eth type is 0x88cc / en= d > actions queue index 8 / end", "Not supported by L2 tunnel filter") > + self.dut.send_expect( > + "flow validate 0 ingress pattern eth type is 0x86dd / en= d > actions queue index 5 / end", "Not supported by L2 tunnel filter") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth type is 0x88cc / end > actions queue index 8 / end", "Failed to create flow") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth type is 0x0806 / end > actions queue index 2 / end", "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth type is 0x88cc / end > actions queue index 3 / end", "created") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"ff:ff:ff:ff:ff:ff")/ARP(pdst=3D"192.168.1.1")], > iface=3D"%s")' % self.tester_itf) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"2") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s",type=3D0x88CC)/Raw("x" * 20)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"3") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s",type=3D0x88E5)/Raw("x" * 20)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0") > + > + # check if there are 3 flow rules have been created > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 2) > + # check if one rule destoried with success > + self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 1) > + # check if all flow rules have been removed with success > + self.dut.send_expect("flow flush 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 0) > + > + def test_fdir_for_L2_payload(self): > + > + self.verify(self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", > "fortpark_TLV"], "%s nic not support fdir L2 payload filter" % self.nic) > + > + self.dut.send_expect("./%s/app/testpmd -c 0x1ffff -n 4 -w %s -- > file-prefix=3Dtest1 -- -i --rxq=3D16 --txq=3D16 --pkt-filter-mode=3Dperfe= ct" % > (self.target, self.pf_pci), "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # create the flow rules > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 1 / end > actions queue index 1 / end", "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth type is 0x0807 / end > actions queue index 2 / end", "created") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D1)/Raw("x" * 20)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"1"= ) > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s", type=3D0x0807)/Dot1Q(vlan=3D1)/Raw= ("x" * > 20)], iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"2"= ) > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s", type=3D0x0807)/IP(src=3D"192.168.0= .5", > dst=3D"192.168.0.6")/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"2"= ) > + > + # check if there are 3 flow rules have been created > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 2) > + # check if one rule destoried with success > + self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 1) > + # check if all flow rules have been removed with success > + self.dut.send_expect("flow flush 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 0) > + > + def test_fdir_for_ipv4(self): > + > + self.verify(self.nic in ["niantic", "twinville", "sagepond", > "sageville", > + "fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", > "fortpark_TLV"], "%s nic not support fdir ipv4 filter" % self.nic) > + > + # i40e > + if (self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", "fortpark_TLV"]): > + self.vf_flag =3D 1 > + self.dut.send_expect("./%s/app/testpmd -c 0x1ffff -n 4 -w %s > --file-prefix=3Dpf --socket-mem=3D1024,1024 -- -i --rxq=3D16 --txq=3D16 -= - > txqflags=3D0x0 --disable-rss --pkt-filter-mode=3Dperfect" % (self.target, > self.pf_pci), "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + self.session_secondary.send_expect("./%s/app/testpmd -c > 0x1e0000 -n 4 --socket-mem 1024,1024 -w %s --file-prefix=3Dvf1 -- -i --rx= q=3D4 > --txq=3D4 --txqflags=3D0x0 --disable-rss --pkt-filter-mode=3Dperfect" % > (self.target, self.sriov_vfs_port[0].pci), "testpmd>", 120) > + self.session_secondary.send_expect("set fwd rxonly", > "testpmd>") > + self.session_secondary.send_expect("set verbose 1", > "testpmd>") > + self.session_secondary.send_expect("start", "testpmd>") > + time.sleep(2) > + self.session_third.send_expect("./%s/app/testpmd -c > 0x1e000000 -n 4 --socket-mem 1024,1024 -w %s --file-prefix=3Dvf2 -- -i -- > rxq=3D4 --txq=3D4 --txqflags=3D0x0 --disable-rss --pkt-filter-mode=3Dperf= ect" % > (self.target, self.sriov_vfs_port[1].pci), "testpmd>", 120) > + self.session_third.send_expect("set fwd rxonly", "testpmd>") > + self.session_third.send_expect("set verbose 1", "testpmd>") > + self.session_third.send_expect("start", "testpmd>") > + time.sleep(2) > + > + # create the flow rules > + # ipv4-other > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.1 dst is 192.168.0.2 proto is 3 / end actions queue index 1 / > end", "created") > + # ipv4-udp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.1 dst is 192.168.0.2 ttl is 3 / udp src is 22 dst is 23 / end > actions queue index 2 / end", "created") > + # ipv4-tcp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.1 dst is 192.168.0.2 tos is 3 / tcp src is 32 dst is 33 / end > actions queue index 3 / end", "created") > + # ipv4-sctp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 1 / ipv= 4 > src is 192.168.0.1 dst is 192.168.0.2 tos is 3 ttl is 3 / sctp src is 44 > dst is 45 tag is 1 / end actions queue index 4 / end", "created") > + # ipv4-sctp drop > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 1 / ipv= 4 > src is 192.168.0.5 dst is 192.168.0.6 tos is 3 ttl is 3 / sctp src is 44 > dst is 45 tag is 1 / end actions drop / end", "created") > + # ipv4-other-vf0-exceed-max-queue > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.1 dst is 192.168.0.3 proto is 3 / vf id is 0 / end actions queu= e > index 4 / end", "Invalid queue ID for FDIR") > + # ipv4-other-vf0 > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.1 dst is 192.168.0.3 proto is 3 / vf id is 0 / end actions queu= e > index 1 / end", "created") > + # ipv4-sctp-vf1 > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 2 / ipv= 4 > src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 4 / sctp src is 46 > dst is 47 tag is 1 / vf id is 1 / end actions queue index 2 / end", > "created") > + # ipv4-sctp passthru-flag > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 3 / ipv= 4 > src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 4 / sctp src is 44 > dst is 45 tag is 1 / end actions passthru / flag / end", "created") > + # ipv4-udp queue-flag > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.1 dst is 192.168.0.2 ttl is 4 / udp src is 22 dst is 23 / end > actions queue index 5 / flag / end", "created") > + # ipv4-tcp queue-mark > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.1 dst is 192.168.0.2 tos is 4 / tcp src is 32 dst is 33 / end > actions queue index 6 / mark id 3 / end", "created") > + # ipv4-other passthru-mark > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.3 dst is 192.168.0.4 proto is 3 / end actions passthru / mark i= d > 4 / end", "created") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2", proto=3D3)/Raw("x" * 20)], iface=3D"%s")' % (self.pf= _mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"1") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2", ttl=3D3)/UDP(sport=3D22,dport=3D23)/Raw("x" * 20)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"2") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2", tos=3D3)/TCP(sport=3D32,dport=3D33)/Raw("x" * 20)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"3") > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D1)/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2", tos=3D3, > ttl=3D3)/SCTP(sport=3D44,dport=3D45,tag=3D1)/SCTPChunkData(data=3D"X" * 2= 0)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"4") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.3", proto=3D3)/Raw("x" * 20)], iface=3D"%s")' % (self.ou= ter_mac, > self.tester_itf)) > + self.verify_result("vf1", expect_rxpkts=3D"1", expect_queue= =3D"1") > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D2)/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2", tos=3D4, ttl=3D4)/SCTP(sport=3D46,dport=3D47,tag=3D1= )/Raw("x" * > 20)], iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("vf2", expect_rxpkts=3D"1", expect_queue= =3D"2") > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D1)/IP(src=3D"192.168.0.5", > dst=3D"192.168.0.6", tos=3D3, > ttl=3D3)/SCTP(sport=3D44,dport=3D45,tag=3D1)/SCTPChunkData(data=3D"X" * 2= 0)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"0", > expect_queue=3D"NULL") > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D3)/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2", tos=3D4, ttl=3D4)/SCTP(sport=3D44,dport=3D45,tag=3D1= )/Raw("x" * > 20)], iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2", ttl=3D4)/UDP(sport=3D22,dport=3D23)/Raw("x" * 20)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"5") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2", tos=3D4)/TCP(sport=3D32,dport=3D33)/Raw("x" * 20)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"6") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.3", > dst=3D"192.168.0.4", proto=3D3)/Raw("x" * 20)], iface=3D"%s")' % (self.pf= _mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0") > + > + # check if there are 3 flow rules have been created > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 11) > + # check if one rule destoried with success > + self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 10) > + # check if all flow rules have been removed with success > + self.dut.send_expect("flow flush 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 0) > + > + # ixgbe > + else: > + self.dut.send_expect("./%s/app/testpmd -c 0xff -n 4 -- -i -- > rxq=3D16 --txq=3D16 --disable-rss --pkt-filter-mode=3Dperfect" % self.tar= get, > "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # create the flow rules > + # ipv4-udp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.3 dst is 192.168.0.4 / udp src is 22 dst is 23 / end actions > queue index 2 / end", "created") > + # ipv4-tcp > + self.dut.send_expect( > + "flow create 0 ingress pattern ipv4 src is 192.168.0.3 > dst is 192.168.0.4 / tcp src is 32 dst is 33 / end actions queue index 3 = / > end", "created") > + > + if (self.nic in ["sagepond", "sageville"]): > + # ipv4-sctp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.3 dst is 192.168.0.4 / sctp src is 44 dst is 45 / end actions > queue index 4 / end", "created") > + # ipv4-sctp drop > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.3 dst is 192.168.0.4 / sctp src is 46 dst is 47 / end actions > drop / end", "created") > + else: > + # ipv4-sctp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.3 dst is 192.168.0.4 / sctp / end actions queue index 4 / end", > "created") > + # ipv4-sctp drop > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.5 dst is 192.168.0.6 / sctp / end actions drop / end", "created= ") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.3", > dst=3D"192.168.0.4")/UDP(sport=3D22,dport=3D23)/Raw("x" * 20)], iface=3D"= %s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"2") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.3", > dst=3D"192.168.0.4")/TCP(sport=3D32,dport=3D33)/Raw("x" * 20)], iface=3D"= %s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"3") > + > + if (self.nic in ["sagepond", "sageville"]): > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.3", > dst=3D"192.168.0.4")/SCTP(sport=3D44,dport=3D45)/Raw("x" * 20)], iface=3D= "%s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"4") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.3", > dst=3D"192.168.0.4")/SCTP(sport=3D42,dport=3D43)/Raw("x" * 20)], iface=3D= "%s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"0") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.3", > dst=3D"192.168.0.4")/SCTP(sport=3D46,dport=3D47)/Raw("x" * 20)], iface=3D= "%s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"0", > expect_queue=3D"NULL") > + > + else: > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.3", > dst=3D"192.168.0.4")/SCTP()/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac= , > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"4") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.3", > dst=3D"192.168.0.5")/SCTP()/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac= , > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"0") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.5", > dst=3D"192.168.0.6")/SCTP()/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac= , > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"0", > expect_queue=3D"NULL") > + > + def test_fdir_for_ipv6(self): > + > + self.verify(self.nic in ["niantic", "twinville", "sagepond", > "sageville", > + "fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", > "fortpark_TLV"], "%s nic not support fdir ipv6 filter" % self.nic) > + # i40e > + if (self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", "fortpark_TLV"]): > + self.vf_flag =3D 1 > + self.dut.send_expect("./%s/app/testpmd -c 0x1ffff -n 4 -w %s > --file-prefix=3Dpf --socket-mem=3D1024,1024 -- -i --rxq=3D16 --txq=3D16 -= - > txqflags=3D0x0 --disable-rss --pkt-filter-mode=3Dperfect" % (self.target, > self.pf_pci), "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + self.session_secondary.send_expect("./%s/app/testpmd -c > 0x1e0000 -n 4 --socket-mem 1024,1024 -w %s --file-prefix=3Dvf1 -- -i --rx= q=3D4 > --txq=3D4 --txqflags=3D0x0 --disable-rss --pkt-filter-mode=3Dperfect" % > (self.target, self.sriov_vfs_port[0].pci), "testpmd>", 120) > + self.session_secondary.send_expect("set fwd rxonly", > "testpmd>") > + self.session_secondary.send_expect("set verbose 1", > "testpmd>") > + self.session_secondary.send_expect("start", "testpmd>") > + time.sleep(2) > + self.session_third.send_expect("./%s/app/testpmd -c > 0x1e000000 -n 4 --socket-mem 1024,1024 -w %s --file-prefix=3Dvf2 -- -i -- > rxq=3D4 --txq=3D4 --txqflags=3D0x0 --disable-rss --pkt-filter-mode=3Dperf= ect" % > (self.target, self.sriov_vfs_port[1].pci), "testpmd>", 120) > + self.session_third.send_expect("set fwd rxonly", "testpmd>") > + self.session_third.send_expect("set verbose 1", "testpmd>") > + self.session_third.send_expect("start", "testpmd>") > + time.sleep(2) > + > + # create the flow rules > + # ipv6-other > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 1 / ipv= 6 > src is 2001::1 dst is 2001::2 tc is 1 proto is 5 hop is 10 / end actions > queue index 1 / end", "created") > + # ipv6-udp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 2 / ipv= 6 > src is 2001::1 dst is 2001::2 tc is 2 hop is 20 / udp src is 22 dst is 23 > / end actions queue index 2 / end", "created") > + # ipv6-tcp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 3 / ipv= 6 > src is 2001::1 dst is 2001::2 tc is 3 hop is 30 / tcp src is 32 dst is 33 > / end actions queue index 3 / end", "created") > + # ipv6-sctp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 4 / ipv= 6 > src is 2001::1 dst is 2001::2 tc is 4 hop is 40 / sctp src is 44 dst is 4= 5 > tag is 1 / end actions queue index 4 / end", "created") > + # ipv6-other-vf0 > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 5 / ipv= 6 > src is 2001::3 dst is 2001::4 tc is 5 proto is 5 hop is 50 / vf id is 0 / > end actions queue index 1 / end", "created") > + # ipv6-tcp-vf1 > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 4095 / > ipv6 src is 2001::3 dst is 2001::4 tc is 6 hop is 60 / tcp src is 32 dst > is 33 / vf id is 1 / end actions queue index 3 / end", "created") > + # ipv6-sctp-drop > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 7 / ipv= 6 > src is 2001::1 dst is 2001::2 tc is 7 hop is 70 / sctp src is 44 dst is 4= 5 > tag is 1 / end actions drop / end", "created") > + # ipv6-tcp-vf1-drop > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 8 / ipv= 6 > src is 2001::3 dst is 2001::4 tc is 8 hop is 80 / tcp src is 32 dst is 33 > / vf id is 1 / end actions drop / end", "created") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D1)/IPv6(src=3D"20= 01::1", > dst=3D"2001::2", tc=3D1, nh=3D5, hlim=3D10)/Raw("x" * 20)], iface=3D"%s")= ' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"1") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D2)/IPv6(src=3D"20= 01::1", > dst=3D"2001::2", tc=3D1, nh=3D5, hlim=3D10)/Raw("x" * 20)], iface=3D"%s")= ' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D2)/IPv6(src=3D"20= 01::1", > dst=3D"2001::2", tc=3D2, hlim=3D20)/UDP(sport=3D22,dport=3D23)/Raw("x" * = 20)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"2") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D3)/IPv6(src=3D"20= 01::1", > dst=3D"2001::2", tc=3D3, hlim=3D30)/TCP(sport=3D32,dport=3D33)/Raw("x" * = 20)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"3") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D4)/IPv6(src=3D"20= 01::1", > dst=3D"2001::2", tc=3D4, nh=3D132, > hlim=3D40)/SCTP(sport=3D44,dport=3D45,tag=3D1)/SCTPChunkData(data=3D"X" *= 20)], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"4") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D5)/IPv6(src=3D"20= 01::3", > dst=3D"2001::4", tc=3D5, nh=3D5, hlim=3D50)/Raw("x" * 20)], iface=3D"%s")= ' % > (self.outer_mac, self.tester_itf)) > + self.verify_result("vf1", expect_rxpkts=3D"1", expect_queue= =3D"1") > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D4095)/IPv6(src=3D"2001::3", dst=3D= "2001::4", > tc=3D6, hlim=3D60)/TCP(sport=3D32,dport=3D33)/Raw("x" * 20)], iface=3D"%s= ")' % > (self.outer_mac, self.tester_itf)) > + self.verify_result("vf2", expect_rxpkts=3D"1", expect_queue= =3D"3") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D7)/IPv6(src=3D"20= 01::1", > dst=3D"2001::2", tc=3D7, nh=3D132, > hlim=3D70)/SCTP(sport=3D44,dport=3D45,tag=3D1)/SCTPChunkData(data=3D"X" *= 20)], > iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"0", > expect_queue=3D"NULL") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D8)/IPv6(src=3D"20= 01::3", > dst=3D"2001::4", tc=3D8, hlim=3D80)/TCP(sport=3D32,dport=3D33)/Raw("x" * = 20)], > iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.verify_result("vf2", expect_rxpkts=3D"0", > expect_queue=3D"NULL") > + > + # check if there are 3 flow rules have been created > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 8) > + # check if one rule destoried with success > + self.dut.send_expect("flow destroy 0 rule 7", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 7) > + # check if all flow rules have been removed with success > + self.dut.send_expect("flow flush 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 0) > + > + # ixgbe signature > + else: > + self.dut.send_expect("./%s/app/testpmd -c 0xff -n 4 -- -i -- > rxq=3D16 --txq=3D16 --disable-rss --pkt-filter-mode=3Dsignature" % self.t= arget, > "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # create the flow rules > + # ipv6-other and ipv4-other > + if (self.nic in ["niantic", "twinville"]): > + self.dut.send_expect( > + "flow create 0 ingress pattern fuzzy thresh is 1 / > ipv6 src is 2001::1 dst is 2001::2 / end actions queue index 1 / end", > "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern fuzzy thresh is 1 / > eth / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / end actions queue inde= x > 6 / end", "created") > + > + # ipv6-udp and ipv4-udp > + self.dut.send_expect( > + "flow create 0 ingress pattern fuzzy thresh spec 2 thres= h > last 5 thresh mask 0xffffffff / ipv6 src is 2001::1 dst is 2001::2 / udp > src is 22 dst is 23 / end actions queue index 2 / end", "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern fuzzy thresh is 2 / eth / > ipv4 src is 192.168.0.1 dst is 192.168.0.2 / udp src is 22 dst is 23 / en= d > actions queue index 7 / end", "created") > + > + # ipv6-tcp and ipv4-udp > + self.dut.send_expect( > + "flow create 0 ingress pattern fuzzy thresh is 3 / ipv6 > src is 2001::1 dst is 2001::2 / tcp src is 32 dst is 33 / end actions > queue index 3 / end", "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern fuzzy thresh is 3 / ipv4 > src is 192.168.0.1 dst is 192.168.0.2 / tcp src is 32 dst is 33 / end > actions queue index 8 / end", "created") > + > + if (self.nic in ["sagepond", "sageville"]): > + # ipv6-sctp and ipv4-sctp > + self.dut.send_expect( > + "flow create 0 ingress pattern fuzzy thresh is 4 / > ipv6 src is 2001::1 dst is 2001::2 / sctp src is 44 dst is 45 / end > actions queue index 4 / end", "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern fuzzy thresh is 4 / > eth / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / sctp src is 44 dst is > 45 / end actions queue index 9 / end", "created") > + > + else: > + # ipv6-sctp and ipv4-sctp > + self.dut.send_expect( > + "flow create 0 ingress pattern fuzzy thresh is 4 / > ipv6 src is 2001::1 dst is 2001::2 / sctp / end actions queue index 4 / > end", "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern fuzzy thresh is 5 / > eth / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / sctp / end actions > queue index 9 / end", "created") > + > + # send the packets and verify the results > + if (self.nic in ["niantic", "twinville"]): > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"1") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"6") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/UDP(sport=3D22,dport=3D23)/Raw("x" * 20)], iface=3D"%s")= ' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"2") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/UDP(sport=3D22,dport=3D23)/Raw("x" * 20)], iface=3D"= %s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"7") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/TCP(sport=3D32,dport=3D33)/Raw("x" * 20)], iface=3D"%s")= ' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"3") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/TCP(sport=3D32,dport=3D33)/Raw("x" * 20)], iface=3D"= %s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"8") > + > + if (self.nic in ["sagepond", "sageville"]): > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2",nh=3D132)/SCTP(sport=3D44,dport=3D45,tag=3D1)/SCTPChunkDa= ta(data=3D"cd > xxxx")], iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"4") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2",nh=3D132)/SCTP(sport=3D46,dport=3D47,tag=3D1)/SCTPChunkDa= ta(data=3D"cd > xxxx")/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"0") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/SCTP(sport=3D44,dport=3D45)/Raw("x" * 20)], iface=3D= "%s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"9") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/SCTP(sport=3D42,dport=3D43)/Raw("x" * 20)], iface=3D= "%s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"0") > + > + else: > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2",nh=3D132)/SCTP()/SCTPChunkData(data=3D"cdxxxx")], iface= =3D"%s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"4") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::3", > dst=3D"2001::4",nh=3D132)/SCTP()/SCTPChunkData(data=3D"cdxxxx")], iface= =3D"%s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"0") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/SCTP()/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac= , > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"9") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.3")/SCTP()/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac= , > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"0") > + > + def test_fdir_for_flexbytes(self): > + > + self.verify(self.nic in ["niantic", "twinville", "sagepond", > "sageville", > + "fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", > "fortpark_TLV"], "%s nic not support fdir flexbytes filter" % self.nic) > + # i40e > + if (self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", "fortpark_TLV"]): > + > + self.dut.send_expect("./%s/app/testpmd -c 0x1ffff -n 4 -w %s > --file-prefix=3Dpf --socket-mem=3D1024,1024 -- -i --rxq=3D16 --txq=3D16 -= - > txqflags=3D0x0 --disable-rss --pkt-filter-mode=3Dperfect" % (self.target, > self.pf_pci), "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # creat the flow rules > + # l2-payload exceeds the max length of raw match is 16bytes > + self.dut.send_expect( > + "flow create 0 ingress pattern eth type is 0x0807 / raw > relative is 1 pattern is abcdefghijklmnopq / end actions queue index 1 / > end", "Exceeds maxmial payload limit") > + # l2-payload equal the max length of raw match is 16bytes > + self.dut.send_expect( > + "flow create 0 ingress pattern eth type is 0x0807 / raw > relative is 1 pattern is abcdefghijklmnop / end actions queue index 1 / > end", "created") > + # ipv4-other the most 3 fields can be matched, and the max > sum bytes of the three fields is 16 bytes. > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 4095 / > ipv4 proto is 255 ttl is 40 / raw relative is 1 offset is 2 pattern is ab > / raw relative is 1 offset is 10 pattern is abcdefghij / raw relative is = 1 > offset is 0 pattern is abcd / end actions queue index 2 / end", "created"= ) > + # ipv4-udp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is 2.2.2.4 > dst is 2.2.2.5 / udp src is 22 dst is 23 / raw relative is 1 offset is 2 > pattern is fhds / end actions queue index 3 / end", "created") > + # ipv4-tcp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is 2.2.2.4 > dst is 2.2.2.5 tos is 4 ttl is 3 / tcp src is 32 dst is 33 / raw relative > is 1 offset is 2 pattern is hijk / end actions queue index 4 / end", > "created") > + # ipv4-sctp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is 2.2.2.4 > dst is 2.2.2.5 / sctp src is 42 / raw relative is 1 offset is 2 pattern i= s > abcd / end actions queue index 5 / end", "created") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s", > type=3D0x0807)/Raw(load=3D"abcdefghijklmnop")], iface=3D"%s")' % (self.pf= _mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"1") > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D4095)/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2", proto=3D255, > ttl=3D40)/Raw(load=3D"xxabxxxxxxxxxxabcdefghijabcdefg")], iface=3D"%s")' = % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"2") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"2.2.2.4", > dst=3D"2.2.2.5")/UDP(sport=3D22,dport=3D23)/Raw(load=3D"fhfhdsdsfwef")], > iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"3") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"2.2.2.4", dst=3D"2.2= .2.5", > tos=3D4, ttl=3D3)/TCP(sport=3D32,dport=3D33)/Raw(load=3D"fhhijk")], iface= =3D"%s")' % > (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"4") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"2.2.2.4", > dst=3D"2.2.2.5")/SCTP(sport=3D42,dport=3D43,tag=3D1)/Raw(load=3D"xxabcdef= ghijklmnopq > rst")], iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"5") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"2.2.2.4", > dst=3D"2.2.2.5")/SCTP(sport=3D42,dport=3D43,tag=3D1)/Raw(load=3D"xxabxxxa= bcddxxabcde > fghijklmn")], iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0") > + > + # check if there are 3 flow rules have been created > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 5) > + # check if one rule destoried with success > + self.dut.send_expect("flow destroy 0 rule 4", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 4) > + # check if all flow rules have been removed with success > + self.dut.send_expect("flow flush 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 0) > + > + self.dut.send_expect("quit", "# ") > + time.sleep(2) > + > + self.dut.send_expect("./%s/app/testpmd -c 0x1ffff -n 4 -w %s > --file-prefix=3Dpf --socket-mem=3D1024,1024 -- -i --rxq=3D16 --txq=3D16 -= - > txqflags=3D0x0 --disable-rss --pkt-filter-mode=3Dperfect" % (self.target, > self.pf_pci), "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # ipv6-tcp > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / vlan tci is 1 / ipv= 6 > src is 2001::1 dst is 2001::2 tc is 3 hop is 30 / tcp src is 32 dst is 33 > / raw relative is 1 offset is 0 pattern is hijk / raw relative is 1 offse= t > is 8 pattern is abcdefgh / end actions queue index 6 / end", "created") > + > + # send the packet and verify the result > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D1)/IPv6(src=3D"20= 01::1", > dst=3D"2001::2", tc=3D3, > hlim=3D30)/TCP(sport=3D32,dport=3D33)/Raw(load=3D"hijkabcdefghabcdefghijk= lmn")], > iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"6") > + > + # ixgbe > + else: > + self.dut.send_expect("./%s/app/testpmd -c ff -n 4 -- -i -- > rxq=3D16 --txq=3D16 --disable-rss --pkt-filter-mode=3Dperfect" % self.tar= get, > "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # ipv4-udp-flexbytes > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.1 dst is 192.168.0.2 / udp src is 24 dst is 25 / raw relative i= s > 0 search is 0 offset is 44 limit is 0 pattern is 86 / end actions queue > index 1 / end", "created") > + > + # send the packet and verify the result > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/UDP(sport=3D24,dport=3D25)/Raw(load=3D"xx86ddef")], > iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"1") > + > + self.dut.send_expect("quit", "# ") > + time.sleep(2) > + > + # the second flexbytes rule should be created after the > testpmd reset, because the flexbytes rule is global bit masks > + self.dut.send_expect("./%s/app/testpmd -c ff -n 4 -- -i -- > rxq=3D16 --txq=3D16 --disable-rss --pkt-filter-mode=3Dperfect" % self.tar= get, > "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # ipv4-tcp-flexbytes spec-mask > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 src is > 192.168.0.3 dst is 192.168.0.4 / tcp src is 22 dst is 23 / raw relative > spec 0 relative mask 1 search spec 0 search mask 1 offset spec 54 offset > mask 0xffffffff limit spec 0 limit mask 0xffff pattern is ab pattern is c= d > / end actions queue index 2 / end", "created") > + > + # send the packet and verify the result > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.3", > dst=3D"192.168.0.4")/TCP(sport=3D22,dport=3D23)/Raw(load=3D"abcdxxx")], > iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0") > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.3", > dst=3D"192.168.0.4")/TCP(sport=3D22,dport=3D23)/Raw(load=3D"cdcdxxx")], > iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"2") > + > + self.dut.send_expect("quit", "# ") > + time.sleep(2) > + > + # signature mode > + self.dut.send_expect("./%s/app/testpmd -c ff -n 4 -- -i -- > rxq=3D16 --txq=3D16 --disable-rss --pkt-filter-mode=3Dsignature" % self.t= arget, > "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # ipv4-sctp-flexbytes > + if (self.nic in ["sagepond", "sageville"]): > + self.dut.send_expect( > + "flow create 0 ingress pattern fuzzy thresh is 6 / > eth / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / sctp src is 24 dst is > 25 / raw relative is 0 search is 0 offset is 48 limit is 0 pattern is ab = / > end actions queue index 3 / end", "created") > + else: > + self.dut.send_expect( > + "flow create 0 ingress pattern fuzzy thresh is 6 / > eth / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / sctp / raw relative is > 0 search is 0 offset is 48 limit is 0 pattern is ab / end actions queue > index 3 / end", "created") > + > + # send the packet and verify the result > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/SCTP(sport=3D24,dport=3D25)/Raw(load=3D"xxabcdef")], > iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"3") > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/SCTP(sport=3D24,dport=3D25)/Raw(load=3D"xxaccdef")], > iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0") > + > + # ipv6-other-flexbytes > + if (self.nic in ["niantic", "twinville"]): > + self.dut.send_expect("quit", "# ") > + time.sleep(2) > + > + self.dut.send_expect("./%s/app/testpmd -c ff -n 4 -- -i = - > -rxq=3D16 --txq=3D16 --disable-rss --pkt-filter-mode=3Dsignature" % self.= target, > "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + self.dut.send_expect( > + "flow create 0 ingress pattern fuzzy thresh is 6 / > ipv6 src is 2001::1 dst is 2001::2 / raw relative is 0 search is 0 offset > is 56 limit is 0 pattern is 86 / end actions queue index 4 / end", > "created") > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/Raw(load=3D"xx86abcd")], iface=3D"%s")' % (self.outer_ma= c, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"4") > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/Raw(load=3D"xxx86abcd")], iface=3D"%s")' % (self.outer_m= ac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3D"0") > + > + def test_flexbytes_filter(self): > + > + self.verify(self.nic in ["bartonhills", "powerville"], "%s nic > not support flexbytes filter" % self.nic) > + > + self.dut.send_expect("./%s/app/testpmd -c 1ffff -n 4 -- -i -- > rxq=3D8 --txq=3D8 --disable-rss" % self.target, "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # create the flow rules > + # l2_payload > + self.dut.send_expect( > + "flow create 0 ingress pattern raw relative is 0 offset is 1= 4 > pattern is fhds / end actions queue index 1 / end", "created") > + # ipv4 packet > + self.dut.send_expect( > + "flow create 0 ingress pattern raw relative is 0 offset is 3= 4 > pattern is ab / end actions queue index 2 / end", "created") > + # ipv6 packet > + self.dut.send_expect( > + "flow create 0 ingress pattern raw relative is 0 offset is 5= 8 > pattern is efgh / end actions queue index 3 / end", "created") > + # 3 fields relative is 0 > + self.dut.send_expect( > + "flow create 0 ingress pattern raw relative is 0 offset is 3= 8 > pattern is ab / raw relative is 0 offset is 34 pattern is cd / raw > relative is 0 offset is 42 pattern is efgh / end actions queue index 4 / > end", "created") > + # 4 fields relative is 0 and 1 > + self.dut.send_expect( > + "flow create 0 ingress pattern raw relative is 0 offset is 4= 8 > pattern is ab / raw relative is 1 offset is 0 pattern is cd / raw relativ= e > is 0 offset is 44 pattern is efgh / raw relative is 1 offset is 10 patter= n > is hijklmnopq / end actions queue index 5 / end", "created") > + # 3 fields offset confilict > + self.dut.send_expect( > + "flow create 0 ingress pattern raw relative is 0 offset is 6= 4 > pattern is ab / raw relative is 1 offset is 4 pattern is cdefgh / raw > relative is 0 offset is 68 pattern is klmn / end actions queue index 6 / > end", "created") > + > + # send the packet and verify the result > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Raw(load=3D"fhdsab")], iface=3D"%s= ")' % > (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"1"= ) > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Raw(load=3D"afhdsb")], iface=3D"%s= ")' % > (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= ) > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/Raw(load=3D"abcdef")], iface=3D"%s")' % (self.outer_= mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"2"= ) > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/Raw(load=3D"xxxxefgh")], iface=3D"%s")' % (self.outer_ma= c, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"3"= ) > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/TCP(sport=3D32,dport=3D33)/Raw(load=3D"abcdefgh")], ifac= e=3D"%s")' % > (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= ) > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/Raw(load=3D"cdxxabxxefghxxxx")], iface=3D"%s")' % > (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"4"= ) > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2", tos=3D4, > ttl=3D3)/UDP(sport=3D32,dport=3D33)/Raw(load=3D"xxefghabcdxxxxxxhijklmnop= qxxxx")], > iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"5"= ) > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/TCP(sport=3D22,dport=3D23)/Raw(load=3D"xxxxxxxxxxabx= xklmnefgh > ")], iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"6"= ) > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/TCP(sport=3D22,dport=3D23)/Raw(load=3D"xxxxxxxxxxabx= xklcdefgh > ")], iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= ) > + > + self.dut.send_expect("flow flush 0", "testpmd> ", 120) > + > + # 1 field 128bytes > + self.dut.send_expect( > + "flow create 0 ingress pattern raw relative is 0 offset is > 128 pattern is ab / end actions queue index 1 / end", "Failed to create > flow") > + self.dut.send_expect( > + "flow create 0 ingress pattern raw relative is 0 offset is > 126 pattern is abcd / end actions queue index 1 / end", "Failed to create > flow") > + self.dut.send_expect( > + "flow create 0 ingress pattern raw relative is 0 offset is > 126 pattern is ab / end actions queue index 1 / end", "created") > + # 2 field 128bytes > + self.dut.send_expect( > + "flow create 0 ingress pattern raw relative is 0 offset is 6= 8 > pattern is ab / raw relative is 1 offset is 58 pattern is cd / end action= s > queue index 2 / end", "Failed to create flow") > + self.dut.send_expect( > + "flow create 0 ingress pattern raw relative is 0 offset is 6= 8 > pattern is ab / raw relative is 1 offset is 56 pattern is cd / end action= s > queue index 2 / end", "created") > + > + # send the packet and verify the result > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/TCP(sport=3D22,dport=3D23)/Raw(load=3D"xxxxxxxxxxxxx= xxxxxxxxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxab")], iface=3D"%s")' % > (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"1"= ) > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/TCP(sport=3D22,dport=3D23)/Raw(load=3D"xxxxxxxxxxxxx= xxxxxxxxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcb")], iface=3D"%s")' % > (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= ) > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/TCP(sport=3D22,dport=3D23)/Raw(load=3D"xxxxxxxxxxxxx= xabxxxxxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcd")], iface=3D"%s")' % > (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"2"= ) > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/TCP(sport=3D22,dport=3D23)/Raw(load=3D"xxxxxxxxxxxxx= xabxxxxxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxce")], iface=3D"%s")' % > (self.outer_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= ) > + > + def test_fdir_for_mac_vlan(self): > + > + self.verify(self.nic in ["twinville", "sagepond", "sageville"], > "%s nic not support fdir flexbytes filter" % self.nic) > + > + self.dut.send_expect("./%s/app/testpmd -c ff -n 4 -- -i --rxq=3D= 16 > --txq=3D16 --disable-rss --pkt-filter-mode=3Dperfect-mac-vlan" % self.tar= get, > "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("vlan set strip off 0", "testpmd> ", 120) > + self.dut.send_expect("vlan set filter off 0", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # creat the flow rules > + self.dut.send_expect( > + "flow create 0 ingress pattern eth dst is %s / vlan tpid is > 0x8100 tci is 1 / end actions queue index 9 / end" % self.pf_mac, > "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth dst is %s / vlan tpid is > 0x8100 tci is 4095 / end actions queue index 10 / end" % self.pf_mac, > "created") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D1)/IP()/TCP()/Raw("x"= * > 20)], iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"9"= ) > + > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D4095)/IP()/UDP()/Raw(= "x" * > 20)], iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"10= ") > + > + def test_fdir_for_vxlan(self): > + > + self.verify(self.nic in ["twinville", "sagepond", "sageville"], > "%s nic not support fdir flexbytes filter" % self.nic) > + > + self.dut.send_expect("./%s/app/testpmd -c ff -n 4 -- -i --rxq=3D= 16 > --txq=3D16 --disable-rss --pkt-filter-mode=3Dperfect-tunnel" % self.targe= t, > "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # creat the flow rules > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni > is 8 / eth dst is %s / vlan tci is 2 tpid is 0x8100 / end actions queue > index 1 / end" % self.inner_mac, "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv6 / udp / vxlan vni > is 9 / eth dst is %s / vlan tci is 4095 tpid is 0x8100 / end actions queu= e > index 2 / end" % self.inner_mac, "created") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Vxlan(vni=3D8)/Ether(dst=3D"%s")/Dot= 1Q(vlan > =3D2)/IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac, self.inne= r_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"1"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IPv6()/UDP()/Vxlan(vni=3D9)/Ether(dst=3D"%s")/D= ot1Q(vl > an=3D4095)/IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac, > self.inner_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"2"= ) > + > + def test_fdir_for_nvgre(self): > + > + self.verify(self.nic in ["twinville", "sagepond", "sageville"], > "%s nic not support fdir flexbytes filter" % self.nic) > + > + self.dut.send_expect("./%s/app/testpmd -c ff -n 4 -- -i --rxq=3D= 16 > --txq=3D16 --disable-rss --pkt-filter-mode=3Dperfect-tunnel" % self.targe= t, > "testpmd>", 120) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + > + # creat the flow rules > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 / nvgre tni is > 0x112244 / eth dst is %s / vlan tci is 20 / end actions queue index 3 / > end" % self.inner_mac, "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv6 / nvgre tni is > 0x112233 / eth dst is %s / vlan tci is 21 / end actions queue index 4 / > end" % self.inner_mac, "created") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D0x112244)/Ether(dst=3D"%s")/Do= t1Q(vla > n=3D20)/IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac, > self.inner_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"3"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IPv6()/NVGRE(TNI=3D0x112233)/Ether(dst=3D"%s")/= Dot1Q(v > lan=3D21)/IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac, > self.inner_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"4"= ) > + > + def test_tunnel_filter_vxlan(self): > + > + self.verify(self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", > "fortpark_TLV"], "%s nic not support tunnel vxlan filter" % self.nic) > + > + self.vf_flag =3D 1 > + self.dut.send_expect("./%s/app/testpmd -c 0x1ffff -n 4 -w %s -- > file-prefix=3Dpf --socket-mem=3D1024,1024 -- -i --rxq=3D16 --txq=3D16 -- > txqflags=3D0x0 --disable-rss" % (self.target, self.pf_pci), "testpmd>", 1= 20) > + self.dut.send_expect("rx_vxlan_port add 4789 0", "testpmd> ", 12= 0) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + self.session_secondary.send_expect("./%s/app/testpmd -c 0x1e0000 > -n 4 --socket-mem 1024,1024 -w %s --file-prefix=3Dvf1 -- -i --rxq=3D4 --t= xq=3D4 > --txqflags=3D0x0 --disable-rss" % (self.target, self.sriov_vfs_port[0].pc= i), > "testpmd>", 120) > + self.session_secondary.send_expect("set fwd rxonly", "testpmd>") > + self.session_secondary.send_expect("set verbose 1", "testpmd>") > + self.session_secondary.send_expect("start", "testpmd>") > + time.sleep(2) > + self.session_third.send_expect("./%s/app/testpmd -c 0x1e000000 -= n > 4 --socket-mem 1024,1024 -w %s --file-prefix=3Dvf2 -- -i --rxq=3D4 --txq= =3D4 -- > txqflags=3D0x0 --disable-rss" % (self.target, self.sriov_vfs_port[1].pci)= , > "testpmd>", 120) > + self.session_third.send_expect("set fwd rxonly", "testpmd>") > + self.session_third.send_expect("set verbose 1", "testpmd>") > + self.session_third.send_expect("start", "testpmd>") > + time.sleep(2) > + > + # create the flow rules > + # inner mac + actions pf > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / et= h > dst is %s / end actions pf / queue index 1 / end" % self.inner_mac, > "created") > + # vni + inner mac + actions pf > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni > is 2 / eth dst is %s / end actions pf / queue index 2 / end" % > self.inner_mac, "created") > + # inner mac + inner vlan +actions pf > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / et= h > dst is %s / vlan tci is 10 / end actions pf / queue index 3 / end" % > self.inner_mac, "created") > + # vni + inner mac + inner vlan + actions pf > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni > is 4 / eth dst is %s / vlan tci is 20 / end actions pf / queue index 4 / > end" % self.inner_mac, "created") > + # inner mac + outer mac + vni + actions pf > + self.dut.send_expect( > + "flow create 0 ingress pattern eth dst is %s / ipv4 / udp / > vxlan vni is 5 / eth dst is %s / end actions pf / queue index 5 / end" % > (self.outer_mac, self.inner_mac), "created") > + # vni + inner mac + inner vlan + actions vf1 > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni > is 6 / eth dst is %s / vlan tci is 30 / end actions vf id 0 / queue index > 1 / end" % self.inner_mac, "created") > + # inner mac + outer mac + vni + actions vf2 > + self.dut.send_expect( > + "flow create 0 ingress pattern eth dst is %s / ipv4 / udp / > vxlan vni is 7 / eth dst is %s / end actions vf id 1 / queue index 3 / > end" % (self.outer_mac, self.inner_mac), "created") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Vxlan()/Ether(dst=3D"%s")/IP()/TCP()= /Raw( > "x" * 20)], iface=3D"%s")' % (self.outer_mac, self.inner_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"1"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Vxlan(vni=3D2)/Ether(dst=3D"%s")/IP(= )/TCP() > /Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, self.inner_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"2"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Vxlan()/Ether(dst=3D"%s")/Dot1Q(vlan= =3D10)/ > IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, self.inner_m= ac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"3"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Vxlan()/Ether(dst=3D"%s")/Dot1Q(vlan= =3D11)/ > IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, self.inner_m= ac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"1"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Vxlan(vni=3D4)/Ether(dst=3D"%s")/Dot= 1Q(vlan > =3D20)/IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, > self.inner_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"4"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Vxlan(vni=3D5)/Ether(dst=3D"%s")/IP(= )/TCP() > /Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, self.inner_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"5"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Vxlan(vni=3D5)/Ether(dst=3D"%s")/IP(= )/TCP() > /Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, self.wrong_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Vxlan(vni=3D6)/Ether(dst=3D"%s")/Dot= 1Q(vlan > =3D30)/IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.wrong_mac, > self.inner_mac, self.tester_itf)) > + self.verify_result("vf1", expect_rxpkts=3D"1", expect_queue=3D"1= ") > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Vxlan(vni=3D6)/Ether(dst=3D"%s")/Dot= 1Q(vlan > =3D30)/IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, > self.wrong_mac, self.tester_itf)) > + self.verify_result("vf1", expect_rxpkts=3D"1", expect_queue=3D"0= ") > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Vxlan(vni=3D7)/Ether(dst=3D"%s")/IP(= )/TCP() > /Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, self.inner_mac, > self.tester_itf)) > + self.verify_result("vf2", expect_rxpkts=3D"1", expect_queue=3D"3= ") > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Vxlan(vni=3D7)/Ether(dst=3D"%s")/IP(= )/TCP() > /Raw("x" * 20)], iface=3D"%s")' % (self.wrong_mac, self.inner_mac, > self.tester_itf)) > + self.verify_result("vf2", expect_rxpkts=3D"0", expect_queue=3D"N= ULL") > + > + # check if there are 3 flow rules have been created > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 7) > + # check if one rule destoried with success > + self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 6) > + # check if all flow rules have been removed with success > + self.dut.send_expect("flow flush 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 0) > + > + def test_tunnel_filter_nvgre(self): > + > + self.verify(self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", > "fortpark_TLV"], "%s nic not support tunnel nvgre filter" % self.nic) > + > + self.vf_flag =3D 1 > + self.dut.send_expect("./%s/app/testpmd -c 0x1ffff -n 4 -w %s -- > file-prefix=3Dpf --socket-mem=3D1024,1024 -- -i --rxq=3D16 --txq=3D16 -- > txqflags=3D0x0 --disable-rss" % (self.target, self.pf_pci), "testpmd>", 1= 20) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) > + self.session_secondary.send_expect("./%s/app/testpmd -c 0x1e0000 > -n 4 --socket-mem 1024,1024 -w %s --file-prefix=3Dvf1 -- -i --rxq=3D4 --t= xq=3D4 > --txqflags=3D0x0 --disable-rss" % (self.target, self.sriov_vfs_port[0].pc= i), > "testpmd>", 120) > + self.session_secondary.send_expect("set fwd rxonly", "testpmd>") > + self.session_secondary.send_expect("set verbose 1", "testpmd>") > + self.session_secondary.send_expect("start", "testpmd>") > + time.sleep(2) > + self.session_third.send_expect("./%s/app/testpmd -c 0x1e000000 -= n > 4 --socket-mem 1024,1024 -w %s --file-prefix=3Dvf2 -- -i --rxq=3D4 --txq= =3D4 -- > txqflags=3D0x0 --disable-rss" % (self.target, self.sriov_vfs_port[1].pci)= , > "testpmd>", 120) > + self.session_third.send_expect("set fwd rxonly", "testpmd>") > + self.session_third.send_expect("set verbose 1", "testpmd>") > + self.session_third.send_expect("start", "testpmd>") > + time.sleep(2) > + > + # create the flow rules > + # inner mac + actions pf > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 / nvgre / eth dst > is %s / end actions pf / queue index 1 / end" % self.inner_mac, "created"= ) > + # tni + inner mac + actions pf > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 / nvgre tni is 2 / > eth dst is %s / end actions pf / queue index 2 / end" % self.inner_mac, > "created") > + # inner mac + inner vlan +actions pf > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 / nvgre / eth dst > is %s / vlan tci is 10 / end actions pf / queue index 3 / end" % > self.inner_mac, "created") > + # tni + inner mac + inner vlan + actions pf > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 / nvgre tni is > 0x112244 / eth dst is %s / vlan tci is 20 / end actions pf / queue index = 4 > / end" % self.inner_mac, "created") > + # inner mac + outer mac + tni + actions pf > + self.dut.send_expect( > + "flow create 0 ingress pattern eth dst is %s / ipv4 / nvgre > tni is 0x112255 / eth dst is %s / end actions pf / queue index 5 / end" = % > (self.outer_mac, self.inner_mac), "created") > + # tni + inner mac + inner vlan + actions vf1 > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv4 / nvgre tni is > 0x112266 / eth dst is %s / vlan tci is 30 / end actions vf id 0 / queue > index 1 / end" % self.inner_mac, "created") > + # inner mac + outer mac + tni + actions vf2 > + self.dut.send_expect( > + "flow create 0 ingress pattern eth dst is %s / ipv4 / nvgre > tni is 0x112277 / eth dst is %s / end actions vf id 1 / queue index 3 / > end" % (self.outer_mac, self.inner_mac), "created") > + > + # send the packets and verify the results > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE()/Ether(dst=3D"%s")/IP()/TCP()/Raw("= x" * > 20)], iface=3D"%s")' % (self.outer_mac, self.inner_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"1"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D2)/Ether(dst=3D"%s")/IP()/TCP(= )/Raw(" > x" * 20)], iface=3D"%s")' % (self.outer_mac, self.inner_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"2"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE()/Ether(dst=3D"%s")/Dot1Q(vlan=3D10)= /IP()/T > CP()/Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, self.inner_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"3"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE()/Ether(dst=3D"%s")/Dot1Q(vlan=3D11)= /IP()/T > CP()/Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, self.inner_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"1"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D0x112244)/Ether(dst=3D"%s")/Do= t1Q(vla > n=3D20)/IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, > self.inner_mac, self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"4"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D0x112255)/Ether(dst=3D"%s")/IP= ()/TCP( > )/Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, self.inner_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"5"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D0x112255)/Ether(dst=3D"%s")/IP= ()/TCP( > )/Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, self.wrong_mac, > self.tester_itf)) > + self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= ) > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D0x112266)/Ether(dst=3D"%s")/Do= t1Q(vla > n=3D30)/IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.wrong_mac, > self.inner_mac, self.tester_itf)) > + self.verify_result("vf1", expect_rxpkts=3D"1", expect_queue=3D"1= ") > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D0x112266)/Ether(dst=3D"%s")/Do= t1Q(vla > n=3D30)/IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, > self.wrong_mac, self.tester_itf)) > + self.verify_result("vf1", expect_rxpkts=3D"1", expect_queue=3D"0= ") > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D0x112277)/Ether(dst=3D"%s")/IP= ()/TCP( > )/Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, self.inner_mac, > self.tester_itf)) > + self.verify_result("vf2", expect_rxpkts=3D"1", expect_queue=3D"3= ") > + > + self.tester.scapy_append( > + > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D0x112277)/Ether(dst=3D"%s")/IP= ()/TCP( > )/Raw("x" * 20)], iface=3D"%s")' % (self.wrong_mac, self.inner_mac, > self.tester_itf)) > + self.verify_result("vf2", expect_rxpkts=3D"0", expect_queue=3D"N= ULL") > + > + # check if there are 3 flow rules have been created > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 7) > + # check if one rule destoried with success > + self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 6) > + # check if all flow rules have been removed with success > + self.dut.send_expect("flow flush 0", "testpmd> ") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ") > + self.get_and_compare_rules_in_memory(out, 0) > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + if self.vf_flag =3D=3D 1: > + self.session_secondary.send_expect("quit", "# ") > + time.sleep(2) > + self.session_third.send_expect("quit", "# ") > + time.sleep(2) > + > + self.dut.send_expect("quit", "# ") > + time.sleep(2) > + > + self.dut.kill_all() > + self.vf_flag =3D 0 > + Please move these functions in tear_down to separated function. The actions= in tear_down should align to set_up function. > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + self.dut.kill_all() > + if(self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", "fortpark_TLV"]): > + self.dut.close_session(self.session_secondary) > + self.dut.close_session(self.session_third) > -- > 2.5.0