From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E6B87A3160 for ; Sat, 12 Oct 2019 07:31:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D49FB1EB93; Sat, 12 Oct 2019 07:31:10 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id DFCB31EB3F for ; Sat, 12 Oct 2019 07:31:06 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2019 22:31:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,286,1566889200"; d="scan'208";a="369622014" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga005.jf.intel.com with ESMTP; 11 Oct 2019 22:31:04 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 11 Oct 2019 22:31:03 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 11 Oct 2019 22:31:02 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.96]) by SHSMSX152.ccr.corp.intel.com ([10.239.6.52]) with mapi id 14.03.0439.000; Sat, 12 Oct 2019 13:31:00 +0800 From: "Tu, Lijuan" To: "Xiao, QimaiX" , "dts@dpdk.org" CC: "Xiao, QimaiX" Thread-Topic: [dts] [PATCH V1] tests/: update cases related to new framework Thread-Index: AQHVdRtwBymYRvPw8EukmBJI0xCsXKdWkjRw Date: Sat, 12 Oct 2019 05:30:59 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB3E9EC@SHSMSX101.ccr.corp.intel.com> References: <20190927180539.2344-1-qimaix.xiao@intel.com> In-Reply-To: <20190927180539.2344-1-qimaix.xiao@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.2.0.6 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiN2FkNjZkNTMtZDMxYS00ZWFhLWJiMGEtNDUyZGY4NDlkYjc0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNFM0UERYTHErdHJ1Y0FJUkFrc0k2QWJDOE9OdThNUzhxeHRvd05HSXp3UzBSRWVUYXVaOFwvVmZqWFg2RjB4UkIifQ== 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/: update cases related to new framework 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Qimai Xiao > Sent: Saturday, September 28, 2019 2:06 AM > To: dts@dpdk.org > Cc: Xiao, QimaiX > Subject: [dts] [PATCH V1] tests/: update cases related to new framework >=20 > update testsuits related to new framework api >=20 > Signed-off-by: Qimai Xiao > --- > tests/TestSuite_checksum_offload.py | 35 +- > tests/TestSuite_cloud_filter.py | 13 +- > tests/TestSuite_ddp_mpls.py | 3 +- > tests/TestSuite_dynamic_queue.py | 12 +- > tests/TestSuite_etag.py | 2 +- > tests/TestSuite_eventdev_pipeline.py | 14 +- > tests/TestSuite_floating_veb.py | 4 +- > tests/TestSuite_flow_classify_softnic.py | 2 +- > tests/TestSuite_generic_flow_api.py | 528 ++++++++++-------- > tests/TestSuite_hotplug.py | 2 +- > tests/TestSuite_iavf.py | 2 +- > tests/TestSuite_ieee1588.py | 9 +- > tests/TestSuite_ipfrag.py | 30 +- > tests/TestSuite_ipgre.py | 80 +-- > tests/TestSuite_ipsec_gw_cryptodev_func.py | 29 +- > tests/TestSuite_jumboframes.py | 2 +- > tests/TestSuite_kernelpf_iavf.py | 4 +- > tests/TestSuite_l2fwd_cryptodev_func.py | 11 +- > tests/TestSuite_l3fwdacl.py | 39 +- > tests/TestSuite_link_flowctrl.py | 1 + > tests/TestSuite_link_status_interrupt.py | 2 +- > tests/TestSuite_loadbalancer.py | 14 +- > tests/TestSuite_mac_filter.py | 2 +- > tests/TestSuite_netmap_compat.py | 6 +- > tests/TestSuite_packet_capture.py | 222 +++----- > tests/TestSuite_ptype_mapping.py | 2 +- > .../TestSuite_pvp_multi_paths_performance.py | 4 +- > ...lti_paths_vhost_single_core_performance.py | 4 +- > ...ti_paths_virtio_single_core_performance.py | 4 +- > ...Suite_pvp_qemu_multi_paths_port_restart.py | 13 +- > tests/TestSuite_pvp_vhost_user_reconnect.py | 13 +- > tests/TestSuite_pvp_virtio_bonding.py | 9 +- > tests/TestSuite_pvp_virtio_user_4k_pages.py | 5 +- > tests/TestSuite_queue_region.py | 4 +- > tests/TestSuite_queue_start_stop.py | 4 +- > tests/TestSuite_quota_watermark.py | 2 +- > tests/TestSuite_runtime_vf_queue_number.py | 13 +- > ...estSuite_runtime_vf_queue_number_kernel.py | 23 +- > tests/TestSuite_rxtx_callbacks.py | 4 +- > tests/TestSuite_scatter.py | 4 +- > tests/TestSuite_short_live.py | 4 +- > tests/TestSuite_skeleton.py | 4 +- > tests/TestSuite_sriov_kvm.py | 11 +- > tests/TestSuite_uni_pkt.py | 9 +- > tests/TestSuite_userspace_ethtool.py | 34 +- > tests/TestSuite_veb_switch.py | 4 +- > tests/TestSuite_vf_daemon.py | 21 +- > tests/TestSuite_vf_interrupt_pmd.py | 2 +- > tests/TestSuite_vf_jumboframe.py | 2 +- > tests/TestSuite_vf_kernel.py | 13 +- > tests/TestSuite_vf_macfilter.py | 9 +- > tests/TestSuite_vf_offload.py | 4 +- > tests/TestSuite_vf_packet_rxtx.py | 19 +- > tests/TestSuite_vf_port_start_stop.py | 86 +-- > tests/TestSuite_vf_rss.py | 3 +- > tests/TestSuite_vf_vlan.py | 12 +- > tests/TestSuite_vhost_enqueue_interrupt.py | 1 + > tests/TestSuite_vhost_multi_queue_qemu.py | 15 +- > tests/TestSuite_vhost_pmd_xstats.py | 2 +- > tests/TestSuite_vhost_virtio_pmd_interrupt.py | 4 +- > .../TestSuite_virtio_ipsec_cryptodev_func.py | 12 +- > tests/TestSuite_vlan.py | 6 +- > tests/TestSuite_vm2vm_virtio_pmd.py | 9 +- > tests/TestSuite_vxlan.py | 143 ++--- > tests/TestSuite_vxlan_sample.py | 38 +- > 65 files changed, 759 insertions(+), 884 deletions(-) >=20 > diff --git a/tests/TestSuite_checksum_offload.py > b/tests/TestSuite_checksum_offload.py > index 7176cb9..c890671 100644 > --- a/tests/TestSuite_checksum_offload.py > +++ b/tests/TestSuite_checksum_offload.py > @@ -46,6 +46,7 @@ from test_case import TestCase > from pmd_output import PmdOutput > from test_capabilities import DRIVER_TEST_LACK_CAPA > from pktgen import PacketGeneratorHelper > +import packet >=20 >=20 > class TestChecksumOffload(TestCase): > @@ -110,7 +111,7 @@ class TestChecksumOffload(TestCase): >=20 > for packet_type in packets_expected.keys(): > self.tester.send_expect("p =3D %s" % packets_expected[packet= _type], > ">>>") > - out =3D self.tester.send_expect("p.show2()", ">>>") > + out =3D self.tester.send_command("p.show2()", timeout=3D1) > chksums =3D checksum_pattern.findall(out) > chksum[packet_type] =3D chksums >=20 > @@ -122,15 +123,11 @@ class TestChecksumOffload(TestCase): > """ > Sends packets and check the checksum valid-flags. > """ > - self.tester.scapy_foreground() > self.dut.send_expect("start", "testpmd>") > - mac =3D self.dut.get_mac_address(self.dut_ports[0]) > tx_interface =3D > self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) > - self.tester.scapy_foreground() > - > for packet_type in packets_sent.keys(): > - self.tester.scapy_append('sendp([%s], iface=3D"%s", count=3D= 4)' % > (packets_sent[packet_type], tx_interface)) > - self.tester.scapy_execute() > + self.pkt =3D packet.Packet(pkt_str=3Dpackets_sent[packet_typ= e]) > + self.pkt.send_pkt(self.tester, tx_interface, count=3D4) > out =3D self.dut.get_session_output(timeout=3D1) > lines =3D out.split("\r\n") >=20 > @@ -173,33 +170,21 @@ class TestChecksumOffload(TestCase): > rx_interface =3D > self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) >=20 > sniff_src =3D self.dut.get_mac_address(self.dut_ports[0]) > - checksum_pattern =3D re.compile("chksum.*=3D.*(0x[0-9a-z]+)") > - > - chksum =3D dict() > result =3D dict() >=20 > - self.tester.send_expect("scapy", ">>> ") > - > - for packet_type in packets_expected.keys(): > - self.tester.send_expect("p =3D %s" % packets_expected[packet= _type], > ">>>") > - out =3D self.tester.send_expect("p.show2()", ">>>") > - chksums =3D checksum_pattern.findall(out) > - chksum[packet_type] =3D chksums > - > - self.tester.send_expect("exit()", "#") > + chksum =3D self.get_chksum_values(packets_expected) >=20 > inst =3D self.tester.tcpdump_sniff_packets(intf=3Drx_interface, > count=3Dlen(packets_sent)*4, > filters=3D[{'layer': 'ether', 'config': {'src': sniff_sr= c}}]) >=20 > + self.pkt =3D packet.Packet() > for packet_type in packets_sent.keys(): > - self.tester.scapy_append('sendp([%s], iface=3D"%s", count=3D= 4)' % > (packets_sent[packet_type], tx_interface)) > + self.pkt.append_pkt(packets_sent[packet_type]) > + self.pkt.send_pkt(crb=3Dself.tester, tx_port=3Dtx_interface, cou= nt=3D4) >=20 > - self.tester.scapy_execute() > p =3D self.tester.load_tcpdump_sniff_packets(inst) > nr_packets =3D len(p) > - reslist =3D > [p[i].pktgen.pkt.sprintf("%IP.chksum%;%TCP.chksum%;%UDP.chksum%;%SCT > P.chksum%") for i in range(nr_packets)] > - out =3D string.join(reslist, ",") > - packets_received =3D out.split(',') > + packets_received =3D > [p[i].sprintf("%IP.chksum%;%TCP.chksum%;%UDP.chksum%;%SCTP.chksum% > ") for i in range(nr_packets)] > self.verify(len(packets_sent)*4 =3D=3D len(packets_received), "U= nexpected > Packets Drop") >=20 > for packet_received in packets_received: > @@ -272,8 +257,6 @@ class TestChecksumOffload(TestCase): > 'IPv6/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::1")/UDP()/("X"*46)' % mac, > 'IPv6/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::1")/TCP()/("X"*46)' % mac} >=20 > - result =3D dict() > - > self.checksum_enablehw(self.dut_ports[0]) >=20 > # get the packet checksum value > diff --git a/tests/TestSuite_cloud_filter.py b/tests/TestSuite_cloud_filt= er.py > index 74b3be7..51647ef 100644 > --- a/tests/TestSuite_cloud_filter.py > +++ b/tests/TestSuite_cloud_filter.py > @@ -12,7 +12,7 @@ import os > from test_case import TestCase > from pmd_output import PmdOutput > from settings import HEADER_SIZE > -from packet import Packet, load_pcapfile > +from packet import Packet >=20 > from scapy.layers.inet import UDP, IP > from scapy.packet import split_layers, bind_layers > @@ -195,7 +195,7 @@ class CloudFilterConfig(object): >=20 > self.pkt.config_layer('ether', ether_cfg) > self.pkt.config_layer('raw', {'payload': ['01'] * 18}) > - self.pkt.send_pkt(tx_port=3Dself.case.tester_intf) > + self.pkt.send_pkt(crb=3Dself.case.tester, tx_port=3Dself.case.te= ster_intf) >=20 >=20 > class TestCloudFilter(TestCase): > @@ -311,7 +311,6 @@ class TestCloudFilter(TestCase): > if dpdk: > cloud_cfg.transmit_packet() > out =3D self.pmdout.get_output() > - print out > queue =3D cloud_cfg.cf_rule['queue'] > self.verify("queue %d" % > queue in out, "Vxlan not received in queue %d" %= queue) > @@ -341,11 +340,11 @@ class TestCloudFilter(TestCase): > time.sleep(2) > # copy pcap to tester and then analyze > self.dut.session.copy_file_from(tmp_file) > - pkts =3D load_pcapfile( > - filename=3D"cloud_filter_%s.pcap" % self.vf_intf) > + pkt =3D Packet() > + pkt.read_pcapfile(filename=3D"cloud_filter_%s.pcap" % self.v= f_intf) > self.verify( > - len(pkts) =3D=3D 1, "%d packet recevied on kernel VF" % = len(pkts)) > - cap_pkt =3D pkts[0].pktgen.pkt > + len(pkt) =3D=3D 1, "%d packet recevied on kernel VF" % l= en(pkt)) > + cap_pkt =3D pkt[0] > try: > dport =3D cap_pkt[UDP].dport > self.verify(dport =3D=3D CLOUD_PORT, > diff --git a/tests/TestSuite_ddp_mpls.py b/tests/TestSuite_ddp_mpls.py > index 547e1c9..599e5cd 100644 > --- a/tests/TestSuite_ddp_mpls.py > +++ b/tests/TestSuite_ddp_mpls.py > @@ -95,11 +95,10 @@ class Testddp_mpls(TestCase): > self.vm0_dut_ports =3D self.vm0_dut.get_ports('any') > self.vm0_testpmd =3D PmdOutput(self.vm0_dut) > self.env_done =3D True > - eal_param =3D '-b %(vf0)s' % {'vf0': self.sriov_vfs_port[0].pci} >=20 > self.dut_testpmd.start_testpmd( > "Default","--port-topology=3Dchained --txq=3D%s --rxq=3D%s" > - % (PF_MAX_QUEUE, PF_MAX_QUEUE), eal_param=3Deal_param) > + % (PF_MAX_QUEUE, PF_MAX_QUEUE)) > self.vm0_testpmd.start_testpmd( > VM_CORES_MASK,"--port-topology=3Dchained --txq=3D%s --rxq=3D= %s" > % (VF_MAX_QUEUE, VF_MAX_QUEUE)) > diff --git a/tests/TestSuite_dynamic_queue.py > b/tests/TestSuite_dynamic_queue.py > index dd05eab..1f86d1f 100644 > --- a/tests/TestSuite_dynamic_queue.py > +++ b/tests/TestSuite_dynamic_queue.py > @@ -63,14 +63,10 @@ class TestDynamicQueue(TestCase): > Generate packets and send them to dut > """ > mac =3D self.dut.get_mac_address(0) > - for i in range(self.PF_QUEUE * 4): > - j =3D i /256 > - k =3D i % 256 > - pkt =3D Packet(pkt_type=3D'IP_RAW') > - pkt.config_layer('ether', {'dst': mac}) > - pkt.config_layer( > - 'ipv4', {'dst': '192.168.%d.%d' % (j, k), 'src': '191.16= 8.0.1'}) > - pkt.send_pkt(tx_port=3Dself.tester_intf) > + pktnum =3D self.PF_QUEUE * 4 > + pkt =3D Packet() > + pkt.generate_random_pkts(mac, pktnum=3Dpktnum, > random_type=3D['IP_RAW']) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_intf) >=20 > def rxq_setup_test(self, chgflag=3D0): > """ > diff --git a/tests/TestSuite_etag.py b/tests/TestSuite_etag.py > index 45c5163..8a67222 100644 > --- a/tests/TestSuite_etag.py > +++ b/tests/TestSuite_etag.py > @@ -160,7 +160,7 @@ class TestEtag(TestCase): > if pkt_configs: > for layer in pkt_configs.keys(): > pkt.config_layer(layer, pkt_configs[layer]) > - pkt.send_pkt(tx_port=3Dself.src_intf) > + pkt.send_pkt(self.tester, tx_port=3Dself.src_intf) >=20 > # check vm testpmd packet received information > if 'vm' in pkt_types[pkt_type].keys(): > diff --git a/tests/TestSuite_eventdev_pipeline.py > b/tests/TestSuite_eventdev_pipeline.py > index cee636a..9f723cd 100644 > --- a/tests/TestSuite_eventdev_pipeline.py > +++ b/tests/TestSuite_eventdev_pipeline.py > @@ -113,8 +113,8 @@ class TestEventdevPipeline(TestCase): > pkts =3D self.tester.load_tcpdump_sniff_packets(inst) > i =3D 0 > while len(pkts) !=3D 0 and i <=3D len(pkts) - 1: > - if pkts[i].pktgen.pkt.haslayer('DHCP'): > - pkts.remove(pkts[i]) > + if pkts[i].haslayer('DHCP'): > + pkts.pktgen.pkts.pop(i) > i =3D i - 1 > i =3D i + 1 > return pkts > @@ -152,7 +152,7 @@ class TestEventdevPipeline(TestCase): > time.sleep(5) >=20 > filt =3D [{'layer': 'ether', 'config': {'src': '%s' % self.s_mac= }}] > - inst =3D self.tester.tcpdump_sniff_packets(self.rx_interface, ti= meout=3D15, > filters=3Dfilt) > + inst =3D self.tester.tcpdump_sniff_packets(self.rx_interface, fi= lters=3Dfilt) > self.tester.scapy_append('pkt=3Drdpcap("pipeline.pcap")') > self.tester.scapy_append('sendp(pkt, iface=3D"%s")' % self.tx_in= terface) > self.tester.scapy_execute() > @@ -169,13 +169,13 @@ class TestEventdevPipeline(TestCase): > packet_index =3D 0 > for i in range(len(self.pkts)): > pay_load =3D "0000%.2d" % (packet_index) > - if self.pkts[i].pktgen.pkt['IP'].src =3D=3D src_ip: > - print self.pkts[i].pktgen.pkt.show > + if self.pkts[i]['IP'].src =3D=3D src_ip: > + print(self.pkts[i].show) > # get the start index load info of each queue > if packet_index =3D=3D 0: > - packet_index =3D int(self.pkts[i].pktgen.pkt['Ra= w'].load[-2:]) > + packet_index =3D int(self.pkts[i]['Raw'].load[-2= :]) > pay_load =3D "0000%.2d" % (packet_index) > - self.verify(self.pkts[i].pktgen.pkt['Raw'].load =3D= =3D pay_load, > + self.verify(self.pkts[i]['Raw'].load =3D=3D pay_load= , > "The packets not ordered") > packet_index =3D packet_index + 1 >=20 > diff --git a/tests/TestSuite_floating_veb.py b/tests/TestSuite_floating_v= eb.py > index 40b0ce2..350d8fa 100644 > --- a/tests/TestSuite_floating_veb.py > +++ b/tests/TestSuite_floating_veb.py > @@ -120,12 +120,12 @@ class TestFloatingVEBSwitching(TestCase): > pkt =3D Packet(pkt_type=3D'VLAN_UDP') > pkt.config_layer('ether', {'dst': vf_mac}) > pkt.config_layer('vlan', {'vlan': 1}) > - pkt.send_pkt(tx_port=3Ditf) > + pkt.send_pkt(self.tester, tx_port=3Ditf) > time.sleep(.5) > else: > pkt =3D Packet(pkt_type=3D'UDP') > pkt.config_layer('ether', {'dst': vf_mac}) > - pkt.send_pkt(tx_port=3Ditf) > + pkt.send_pkt(self.tester, tx_port=3Ditf) > time.sleep(.5) >=20 > # Test cases. > diff --git a/tests/TestSuite_flow_classify_softnic.py > b/tests/TestSuite_flow_classify_softnic.py > index 33f701e..a649a44 100644 > --- a/tests/TestSuite_flow_classify_softnic.py > +++ b/tests/TestSuite_flow_classify_softnic.py > @@ -72,7 +72,7 @@ class TestFlowClassifySoftnic(TestCase): > file =3D 'flow_classify_softnic.tar.gz' > src_file =3D r'./dep/%s' % file > dst1 =3D '/tmp' > - dst2 =3D os.path.join(self.dut.base_dir, 'drivers/net/softnic') > + dst2 =3D '/root/dpdk/drivers/net/softnic' > self.dut.session.copy_file_to(src_file, dst1) > self.dut.send_expect("tar xf %s/%s -C %s" % (dst1, file, dst2), = "#", 30) >=20 > diff --git a/tests/TestSuite_generic_flow_api.py > b/tests/TestSuite_generic_flow_api.py > index 61af86c..e0a4aa6 100644 > --- a/tests/TestSuite_generic_flow_api.py > +++ b/tests/TestSuite_generic_flow_api.py > @@ -49,7 +49,7 @@ from crb import Crb > from virt_dut import VirtDut > from project_dpdk import DPDKdut > from dut import Dut > -from packet import Packet > +import packet >=20 > import os > import random > @@ -99,6 +99,7 @@ class TestGeneric_flow_api(TestCase): > 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 > + self.pkt_obj =3D packet.Packet() >=20 > def set_up(self): > """ > @@ -162,8 +163,8 @@ class TestGeneric_flow_api(TestCase): > """ > verify the packet to the expected queue or be dropped > """ > - self.tester.scapy_execute() > - time.sleep(2) > + # self.tester.scapy_execute() > + # time.sleep(2) > verify_mac =3D verify_mac.upper() >=20 > if self.vf_flag =3D=3D 1: > @@ -207,7 +208,7 @@ class TestGeneric_flow_api(TestCase): > queue_index =3D 0 > find_index =3D False > for i in range(len(m)): > - cur =3D out_info.find(m[i], all_queue_index[i-1] + len(m= [i-1]) if i > 0 > else 0) > + cur =3D out_info.find(m[i], all_queue_index[i - 1] + len= (m[i - 1]) if i > 0 > else 0) > if cur > mac_index: > queue_index =3D i - 1 > find_index =3D True > @@ -255,8 +256,8 @@ class TestGeneric_flow_api(TestCase): > # caculate the rule number created. > rule_created =3D self.flow_test_process(flow_process, flow_a= ction) > if rule_created: > - rule_num +=3D 1 > - extra_packet.append(flow_process['extrapacket']) > + rule_num +=3D 1 > + extra_packet.append(flow_process['extrapacket']) > # Configure a return value. > extrapkt_rulenum =3D {'extrapacket': extra_packet, 'rulenum': ru= le_num, > 'queue': expected_queue} >=20 > @@ -286,26 +287,34 @@ class TestGeneric_flow_api(TestCase): > if "validate" in flow_cmd: > # ethertype invalid or queue id exceeds max queue number. > if "86dd" in flow_cmd or "0800" in flow_cmd or "index %s" % > str(MAX_QUEUE + 1) in flow_cmd: > - if self.nic in ["fortville_eagle", "fortville_spirit", > "fortville_spirit_single", "fortpark_TLV", "niantic", "kawela_4", "kawela= ", > "bartonhills", "twinville", "sagepond", "sageville", "powerville"]: > + if self.nic in ["fortville_eagle", "fortville_spirit", > "fortville_spirit_single", "fortpark_TLV", > + "niantic", "kawela_4", "kawela", "barton= hills", "twinville", > "sagepond", "sageville", > + "powerville"]: > self.dut.send_expect(flow_cmd, "error") > elif "type is 0x8100" in flow_cmd: > if self.nic in ["fortville_eagle", "fortville_spirit", > "fortville_spirit_single", "fortpark_TLV"]: > self.dut.send_expect(flow_cmd, "error") > # vf queue id exceeds max vf queue number. > - elif (("vf0" in flow_action['flows']) or ("vf1" in flow_acti= on['flows']) or > ("vf0" in flow_action['actions']) or ("vf1" in flow_action['actions'])) a= nd > (("index %s" % str(MAX_VFQUEUE + 1)) in flow_cmd): > + elif (("vf0" in flow_action['flows']) or ("vf1" in flow_acti= on['flows']) or > ( > + "vf0" in flow_action['actions']) or ("vf1" in flow_a= ction['actions'])) > and ( > + ("index %s" % str(MAX_VFQUEUE + 1)) in flow_cmd): > self.dut.send_expect(flow_cmd, "error") > else: > self.dut.send_expect(flow_cmd, "validated") > elif "create" in flow_cmd: > # ethertype invalid or queue id exceeds max queue number. > if "86dd" in flow_cmd or "0800" in flow_cmd or "index %s" % > str(MAX_QUEUE + 1) in flow_cmd: > - if self.nic in ["fortville_eagle", "fortville_spirit", > "fortville_spirit_single", "fortpark_TLV", "niantic", "kawela_4", "kawela= ", > "bartonhills", "twinville", "sagepond", "sageville", "powerville"]: > + if self.nic in ["fortville_eagle", "fortville_spirit", > "fortville_spirit_single", "fortpark_TLV", > + "niantic", "kawela_4", "kawela", "barton= hills", "twinville", > "sagepond", "sageville", > + "powerville"]: > self.dut.send_expect(flow_cmd, "error") > elif "type is 0x8100" in flow_cmd: > if self.nic in ["fortville_eagle", "fortville_spirit", > "fortville_spirit_single", "fortpark_TLV"]: > self.dut.send_expect(flow_cmd, "error") > # vf queue id exceeds max vf queue number. > - elif (("vf0" in flow_action['flows']) or ("vf1" in flow_acti= on['flows']) or > ("vf0" in flow_action['actions']) or ("vf1" in flow_action['actions'])) a= nd > (("index %s" % str(MAX_VFQUEUE + 1)) in flow_cmd): > + elif (("vf0" in flow_action['flows']) or ("vf1" in flow_acti= on['flows']) or > ( > + "vf0" in flow_action['actions']) or ("vf1" in flow_a= ction['actions'])) > and ( > + ("index %s" % str(MAX_VFQUEUE + 1)) in flow_cmd): > self.dut.send_expect(flow_cmd, "error") > else: > self.dut.send_expect(flow_cmd, "created") > @@ -318,7 +327,7 @@ class TestGeneric_flow_api(TestCase): > self.load_module("nvgre") >=20 > # The rule is created successfully, so send the consiste= nt packet. > - self.tester.scapy_append('sendp(%s, iface=3D"%s")' % (fl= ow_pkt, > self.tester_itf)) > + self.sendpkt(pktstr=3Dflow_pkt) > cur_mac =3D re.search("dst=3D'(\S\S:\S\S:\S\S:\S\S:\S\S:= \S\S)'", > flow_pkt) > cur_mac =3D cur_mac.group(1) > if ("queue" in flow_action['actions']) or ("passthru" in > flow_action['actions']): > @@ -353,7 +362,7 @@ class TestGeneric_flow_api(TestCase): > if is_ipv4 =3D=3D True: > return '.'.join('%s' % random.randint(0, 255) for i in range= (4)) > else: > - return ':'.join('{:x}'.format(random.randint(0, 2**16 - 1)) = for i in > range(8)) > + return ':'.join('{:x}'.format(random.randint(0, 2 ** 16 - 1)= ) for i in > range(8)) >=20 > def generate_random_int(self, minimum, maximum): > return random.randint(minimum, maximum) > @@ -376,7 +385,9 @@ class TestGeneric_flow_api(TestCase): > cmd_fmt =3D "flow %(create)s 0 ingress pattern %(flow)s / en= d > actions %(action)s end" > # Record the elements of the rule, ready for the configuration > # of packets inconsistent to the rule. > - extrapacket =3D {'vlan': '', 'etag': '', 'ipv4': '', 'ipv6': '',= 'sip': '', 'dip': '', 'proto': > '', 'tos': '', 'ttl': '', 'tcp': '', 'udp': '', 'sctp': '', 'sport': '', = 'dport': '', 'vni': '', 'tni': '', > 'ineth': '', 'invlan': ''} > + extrapacket =3D {'vlan': '', 'etag': '', 'ipv4': '', 'ipv6': '',= 'sip': '', 'dip': '', > 'proto': '', 'tos': '', > + 'ttl': '', 'tcp': '', 'udp': '', 'sctp': '', 'spo= rt': '', 'dport': '', 'vni': '', 'tni': > '', > + 'ineth': '', 'invlan': ''} > # Define the packet string, which is consistent to the flow rule= . > if ('vf0' in flows) or ('vf1' in flows) or ('vf0' in actions) or= ('vf1' in actions): > pkt =3D "Ether(dst=3D'%s')" % self.wrong_mac > @@ -630,14 +641,24 @@ class TestGeneric_flow_api(TestCase): > elif action =3D=3D "mark": > act_str +=3D "mark id 3 / " > # Configure the whole flow rule. > - command =3D cmd_fmt % { "create": create, > - "flow": flow_str, > - "action": act_str} > + command =3D cmd_fmt % {"create": create, > + "flow": flow_str, > + "action": act_str} > # Configure the return value. > flow_process =3D {'cmd': command, 'pkt': pkt, 'queue': index, 'e= xtrapacket': > extrapacket} >=20 > return flow_process >=20 > + def sendpkt(self, pktstr, count=3D1): > + import sys > + py_version =3D sys.version > + if py_version.startswith('3.'): > + self.pkt_obj.pktgen.pkts.clear() > + else: > + del self.pkt_obj.pktgen.pkts[:] > + self.pkt_obj.append_pkt(pktstr) > + self.pkt_obj.send_pkt(self.tester, tx_port=3Dself.tester_itf, co= unt=3Dcount) > + > def test_syn_filter(self): > """ > Only supported by ixgbe and igb. > @@ -653,14 +674,13 @@ class TestGeneric_flow_api(TestCase): >=20 > # create the flow rules > self.dut.send_expect( > - "flow create 0 ingress pattern eth / ipv4 / tcp flags spec 0= x02 flags > mask 0x02 / end actions queue index 3 / end", "created") > + "flow create 0 ingress pattern eth / ipv4 / tcp flags spec 0= x02 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"= , > verify_mac=3Dself.pf_mac) > + self.sendpkt(pktstr=3D'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)' % self.pf= _mac) >=20 > - 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"3"= , > verify_mac=3Dself.pf_mac) > + self.sendpkt(pktstr=3D'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)' % self.p= f_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.pf_mac) >=20 > # the ipv6 rule is conflicted with ipv4 rule. > @@ -668,14 +688,13 @@ class TestGeneric_flow_api(TestCase): >=20 > # create the flow rules > self.dut.send_expect( > - "flow create 0 ingress pattern eth / ipv6 / tcp flags spec 0= x02 flags > mask 0x02 / end actions queue index 4 / end", "created") > + "flow create 0 ingress pattern eth / ipv6 / tcp flags spec 0= x02 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.sendpkt(pktstr=3D'Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/TCP(dport=3D80,flags=3D"S")/Raw("x" * 20)' % self.pf_mac= ) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"4"= , > verify_mac=3Dself.pf_mac) >=20 > - 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.sendpkt(pktstr=3D'Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/TCP(dport=3D80,flags=3D"PA")/Raw("x" * 20)' % self.pf_ma= c) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.pf_mac) >=20 > self.verify_rulenum(1) > @@ -695,21 +714,24 @@ class TestGeneric_flow_api(TestCase): > # create the flow rules > basic_flow_actions =3D [ > {'create': 'create', 'flows': ['ipv4', 'sip', 'dip'], 'actio= ns': ['queue']}, > - {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'proto'= , 'udp', 'sport', > 'dport'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'proto'= , 'tcp', 'sport', > 'dport'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'proto'= , 'sctp', 'sport', > 'dport'], 'actions': ['queue']} > + {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'proto'= , 'udp', 'sport', > 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'proto'= , 'tcp', 'sport', > 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'proto'= , 'sctp', 'sport', > 'dport'], > + 'actions': ['queue']} > ] > extrapkt_rulenum =3D self.all_flows_process(basic_flow_actions) > extra_packet =3D extrapkt_rulenum['extrapacket'] > # send the packets inconsistent to the rules. > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/IP(src=3D"%s", dst=3D"%s")/Raw("x"= * 20)], > iface=3D"%s")' % (self.pf_mac, extra_packet[0]['dip'], extra_packet[0]['s= ip'], > self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/IP(src=3D"%s", dst=3D"%s")/Raw("= x" * 20)' % > (self.pf_mac, extra_packet[0]['dip'], extra_packet[0]['sip'])) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/IP(src=3D"%s", > dst=3D"%s")/SCTP(sport=3D%s,dport=3D%s)/Raw("x" * 20)], iface=3D"%s")' % > (self.pf_mac, extra_packet[3]['dip'], extra_packet[3]['sip'], > extra_packet[3]['sport'], extra_packet[3]['dport'], self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/IP(src=3D"%s", > dst=3D"%s")/SCTP(sport=3D%s,dport=3D%s)/Raw("x" * 20)' % ( > + self.pf_mac, extra_packet[3]['dip'], extra_packet[3]['sip'], > extra_packet[3]['sport'], > + extra_packet[3]['dport'])) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/IP(src=3D"%s", > dst=3D"%s")/SCTP(sport=3D%s,dport=3D%s)/Raw("x" * 20)], iface=3D"%s")' % > (self.pf_mac, extra_packet[0]['sip'], extra_packet[0]['dip'], > extra_packet[3]['sport'], extra_packet[3]['dport'], self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/IP(src=3D"%s", > dst=3D"%s")/SCTP(sport=3D%s,dport=3D%s)/Raw("x" * 20)' % (self.pf_mac, > extra_packet[0]['sip'], extra_packet[0]['dip'], extra_packet[3]['sport'], > + extra_packet[3]['dport'])) > self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3Dextrapkt_rulenum['queue'][0], verify_mac=3Dself.pf_mac) >=20 > rule_num =3D extrapkt_rulenum['rulenum'] > @@ -736,11 +758,10 @@ class TestGeneric_flow_api(TestCase): > extrapkt_rulenum =3D self.all_flows_process(basic_flow_actions) > extra_packet =3D extrapkt_rulenum['extrapacket'] > # send the packets inconsistent to the rules. > - 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.sendpkt('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)' % self.pf_= mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.pf_mac) > - 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.sendpkt( > + '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)' % self.pf_= mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.pf_mac) > rule_num =3D extrapkt_rulenum['rulenum'] > self.verify_rulenum(rule_num) > @@ -792,8 +813,8 @@ class TestGeneric_flow_api(TestCase): > {'create': 'create', 'flows': ['ether', 'lldp'], 'action= s': ['queue']}, > ] > extrapkt_rulenum =3D self.all_flows_process(basic_flow_actio= ns) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s",type=3D0x88E5)/Raw("x" * 20)], = iface=3D"%s")' % > (self.pf_mac, self.tester_itf)) > + self.sendpkt(pktstr=3D'Ether(dst=3D"%s",type=3D"0x88E5")/Raw= ("x" * 20)' % > self.pf_mac) > + > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0", > verify_mac=3Dself.pf_mac) > rule_num =3D extrapkt_rulenum['rulenum'] > self.verify_rulenum(rule_num) > @@ -837,8 +858,7 @@ class TestGeneric_flow_api(TestCase): > ] > extrapkt_rulenum =3D self.all_flows_process(basic_flow_actions) > extra_packet =3D extrapkt_rulenum['extrapacket'] > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1BR(GRP=3D0x2, ECIDbase=3D%s)/R= aw("x" * > 20)], iface=3D"%s")' % (self.pf_mac, extra_packet[0]['etag'], self.tester= _itf)) > + self.sendpkt('Ether(dst=3D"%s")/Dot1BR(GRP=3D0x2, > ECIDbase=3D%s)/Raw("x" * 20)' % (self.pf_mac, extra_packet[0]['etag'])) > self.verify_result("pf", expect_rxpkts=3D"0", expect_queue=3D"NU= LL", > verify_mac=3Dself.pf_mac) > rule_num =3D extrapkt_rulenum['rulenum'] > self.verify_rulenum(rule_num) > @@ -911,47 +931,45 @@ class TestGeneric_flow_api(TestCase): > extrapkt_rulenum =3D self.all_flows_process(basic_flow_actions) > extra_packet =3D extrapkt_rulenum['extrapacket'] > # send the packets with dst/src ip and dst/src port. > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=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, > extra_packet[0]['vlan'], self.tester_itf)) > + > self.sendpkt(pktstr=3D'Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"192.1= 68.0.1", > dst=3D"192.168.0.2", proto=3D3)/Raw("x" * 20)' % (self.pf_mac, > extra_packet[0]['vlan'])) > self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3Dextrapkt_rulenum['queue'][0], verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"192.168= .0.1", > dst=3D"192.168.0.2", tos=3D3)/UDP()/Raw("x" * 20)], iface=3D"%s")' % (sel= f.pf_mac, > extra_packet[1]['vlan'], self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"192.1= 68.0.1", > dst=3D"192.168.0.2", tos=3D3)/UDP()/Raw("x" * 20)' % (self.pf_mac, > extra_packet[1]['vlan'])) > self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3Dextrapkt_rulenum['queue'][1], verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"192.168= .0.1", > dst=3D"192.168.0.2", ttl=3D3)/TCP()/Raw("x" * 20)], iface=3D"%s")' % (sel= f.pf_mac, > extra_packet[2]['vlan'], self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"192.1= 68.0.1", > dst=3D"192.168.0.2", ttl=3D3)/TCP()/Raw("x" * 20)' % (self.pf_mac, > extra_packet[2]['vlan'])) > self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3Dextrapkt_rulenum['queue'][2], verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"192.168= .0.1", > dst=3D"192.168.0.2", tos=3D3, ttl=3D3)/SCTP()/Raw("x" * 20)], iface=3D"%s= ")' % > (self.pf_mac, extra_packet[3]['vlan'], self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"192.1= 68.0.1", > dst=3D"192.168.0.2", tos=3D3, ttl=3D3)/SCTP()/Raw("x" * 20)' % (self.pf_m= ac, > extra_packet[3]['vlan'])) > self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3Dextrapkt_rulenum['queue'][3], verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"192.168= .0.1", > dst=3D"192.168.0.2", ttl=3D3)/TCP()/Raw("x" * 20)], iface=3D"%s")' % (sel= f.pf_mac, > extra_packet[3]['vlan'], self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"192.1= 68.0.1", > dst=3D"192.168.0.2", ttl=3D3)/TCP()/Raw("x" * 20)' % (self.pf_mac, > extra_packet[3]['vlan'])) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP()/UDP()/Raw("x= " * 20)], > iface=3D"%s")' % (self.pf_mac, extra_packet[2]['vlan'], self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP()/UDP()/Raw(= "x" * > 20)' % (self.pf_mac, extra_packet[2]['vlan'])) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"192.168= .0.5", > dst=3D"192.168.0.6", tos=3D3, ttl=3D3)/SCTP(sport=3D44,dport=3D45,tag=3D1= )/Raw("x" * > 20)], iface=3D"%s")' % (self.pf_mac, extra_packet[6]['vlan'], self.tester= _itf)) > + self.sendpkt('Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"192.1= 68.0.5", > dst=3D"192.168.0.6", tos=3D3, ttl=3D3)/SCTP(sport=3D44,dport=3D45,tag=3D1= )/Raw("x" * > 20)' % (self.pf_mac, extra_packet[6]['vlan'])) > self.verify_result("pf", expect_rxpkts=3D"0", expect_queue=3D"NU= LL", > verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"192.168= .0.5", > dst=3D"192.168.0.6", tos=3D3, > ttl=3D3)/UDP(sport=3D44,dport=3D45)/SCTPChunkData(data=3D"X" * 20)], ifac= e=3D"%s")' % > (self.outer_mac, extra_packet[7]['vlan'], self.tester_itf)) > + self.sendpkt( > + 'Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"192.168.0.5", > dst=3D"192.168.0.6", tos=3D3, > ttl=3D3)/UDP(sport=3D44,dport=3D45)/SCTPChunkData(data=3D"X" * 20)' % ( > + self.outer_mac, extra_packet[7]['vlan'])) > self.verify_result("vf1", expect_rxpkts=3D"0", expect_queue=3D"N= ULL", > verify_mac=3Dself.outer_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D"2001:= :1", > dst=3D"2001::2", tc=3D1, nh=3D5, hlim=3D10)/Raw("x" * 20)], iface=3D"%s")= ' % > (self.pf_mac, extra_packet[8]['vlan'], self.tester_itf)) > + self.sendpkt( > + 'Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D"2001::1", ds= t=3D"2001::2", > tc=3D1, nh=3D5, hlim=3D10)/Raw("x" * 20)' % ( > + self.pf_mac, extra_packet[8]['vlan'])) > self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3Dextrapkt_rulenum['queue'][8], verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D"2001:= :1", > dst=3D"2001::2", tc=3D2, hlim=3D20)/UDP(sport=3D22,dport=3D23)/Raw("x" * = 20)], > iface=3D"%s")' % (self.pf_mac, extra_packet[9]['vlan'], self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D"200= 1::1", > dst=3D"2001::2", tc=3D2, hlim=3D20)/UDP(sport=3D22,dport=3D23)/Raw("x" * = 20)' % > (self.pf_mac, extra_packet[9]['vlan'])) > self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3Dextrapkt_rulenum['queue'][9], verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D"2001:= :1", > dst=3D"2001::2", tc=3D2, hlim=3D20)/TCP(sport=3D32,dport=3D33)/Raw("x" * = 20)], > iface=3D"%s")' % (self.pf_mac, extra_packet[10]['vlan'], self.tester_itf)= ) > + self.sendpkt( > + 'Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D"2001::1", ds= t=3D"2001::2", > tc=3D2, hlim=3D20)/TCP(sport=3D32,dport=3D33)/Raw("x" * 20)' % ( > + self.pf_mac, extra_packet[10]['vlan'])) > self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3Dextrapkt_rulenum['queue'][10], verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D"2001:= :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, extra_packet[11]['vlan'], self.tester_itf)= ) > + self.sendpkt( > + 'Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D"2001::1", ds= t=3D"2001::2", > tc=3D4, nh=3D132, > hlim=3D40)/SCTP(sport=3D44,dport=3D45,tag=3D1)/SCTPChunkData(data=3D"X" *= 20)' % ( > + self.pf_mac, extra_packet[11]['vlan'])) > self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3Dextrapkt_rulenum['queue'][11], verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D"2001:= :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, extra_packet[14]['vlan'], self.tester_itf)= ) > + self.sendpkt( > + 'Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D"2001::1", ds= t=3D"2001::2", > tc=3D4, nh=3D132, > hlim=3D40)/SCTP(sport=3D44,dport=3D45,tag=3D1)/SCTPChunkData(data=3D"X" *= 20)' % ( > + self.pf_mac, extra_packet[14]['vlan'])) > self.verify_result("pf", expect_rxpkts=3D"0", expect_queue=3D"NU= LL", > verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D"2001:= :1", > dst=3D"2001::2", tc=3D2, hlim=3D20)/TCP(sport=3D32,dport=3D33)/Raw("x" * = 20)], > iface=3D"%s")' % (self.outer_mac, extra_packet[15]['vlan'], self.tester_i= tf)) > + self.sendpkt( > + 'Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D"2001::1", ds= t=3D"2001::2", > tc=3D2, hlim=3D20)/TCP(sport=3D32,dport=3D33)/Raw("x" * 20)' % ( > + self.outer_mac, extra_packet[15]['vlan'])) > self.verify_result("vf1", expect_rxpkts=3D"0", expect_queue=3D"N= ULL", > verify_mac=3Dself.outer_mac) >=20 > rule_num =3D extrapkt_rulenum['rulenum'] > @@ -963,7 +981,8 @@ class TestGeneric_flow_api(TestCase): > """ > self.verify(self.nic in ["niantic", "twinville", "sagepond", "sa= geville", > "fortville_eagle", "fortville_spirit", > - "fortville_spirit_single", "fortpark_TL= V"], "%s nic not > support fdir ipv4 filter" % self.nic) > + "fortville_spirit_single", "fortpark_TL= V"], > + "%s nic not support fdir ipv4 filter" % self.nic) > # i40e > if (self.nic in ["fortville_eagle", "fortville_spirit", > "fortville_spirit_single", "fortpark_TLV"]): > @@ -990,22 +1009,33 @@ class TestGeneric_flow_api(TestCase): > # create the flow rules > basic_flow_actions =3D [ > {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'pr= oto'], 'actions': > ['queue']}, > - {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'tt= l', 'udp', 'sport', > 'dport'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'to= s', 'tcp', 'sport', > 'dport'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['vlan', 'ipv4', 'sip', 'd= ip', 'tos', 'ttl', 'sctp', > 'sport', 'dport', 'tag'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['vlan', 'ipv4', 'sip', 'd= ip', 'tos', 'ttl', 'sctp', > 'sport', 'dport', 'tag'], 'actions': ['drop']}, > + {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'tt= l', 'udp', 'sport', > 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'to= s', 'tcp', 'sport', > 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', > + 'flows': ['vlan', 'ipv4', 'sip', 'dip', 'tos', 'ttl', '= sctp', 'sport', 'dport', > 'tag'], > + 'actions': ['queue']}, > + {'create': 'create', > + 'flows': ['vlan', 'ipv4', 'sip', 'dip', 'tos', 'ttl', '= sctp', 'sport', 'dport', > 'tag'], > + 'actions': ['drop']}, > {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'pr= oto', 'vf0'], 'actions': > ['invalid']}, > {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'pr= oto', 'vf0'], 'actions': > ['queue']}, > - {'create': 'create', 'flows': ['vlan', 'ipv4', 'sip', 'd= ip', 'tos', 'ttl', 'sctp', > 'sport', 'dport', 'tag', 'vf1'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['vlan', 'ipv4', 'sip', 'd= ip', 'tos', 'ttl', 'sctp', > 'sport', 'dport', 'tag'], 'actions': ['passthru', 'flag']}, > - {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'tt= l', 'udp', 'sport', > 'dport'], 'actions': ['queue', 'flag']}, > - {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'to= s', 'tcp', 'sport', > 'dport'], 'actions': ['queue', 'mark']}, > + {'create': 'create', > + 'flows': ['vlan', 'ipv4', 'sip', 'dip', 'tos', 'ttl', '= sctp', 'sport', 'dport', > 'tag', 'vf1'], > + 'actions': ['queue']}, > + {'create': 'create', > + 'flows': ['vlan', 'ipv4', 'sip', 'dip', 'tos', 'ttl', '= sctp', 'sport', 'dport', > 'tag'], > + 'actions': ['passthru', 'flag']}, > + {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'tt= l', 'udp', 'sport', > 'dport'], > + 'actions': ['queue', 'flag']}, > + {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'to= s', 'tcp', 'sport', > 'dport'], > + 'actions': ['queue', 'mark']}, > {'create': 'create', 'flows': ['ipv4', 'sip', 'dip', 'pr= oto'], 'actions': > ['passthru', 'mark']} > ] > extrapkt_rulenum =3D self.all_flows_process(basic_flow_actio= ns) > extra_packet =3D extrapkt_rulenum['extrapacket'] > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.3", dst=3D= "192.168.0.4", > proto=3D%s)/Raw("x" * 20)], iface=3D"%s")' % (self.pf_mac, > extra_packet[0]['proto'], self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/IP(src=3D"192.168.0.3", > dst=3D"192.168.0.4", proto=3D%s)/Raw("x" * 20)' % (self.pf_mac, > extra_packet[0]['proto'])) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0", > verify_mac=3Dself.pf_mac) > rule_num =3D extrapkt_rulenum['rulenum'] > self.verify_rulenum(rule_num) > @@ -1021,29 +1051,35 @@ class TestGeneric_flow_api(TestCase): > if (self.nic in ["sagepond", "sageville"]): > # create the flow rules > basic_flow_actions =3D [ > - {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'udp', 'sport', 'dport'], > 'actions': ['queue']}, > - {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'tcp', 'sport', 'dport'], > 'actions': ['queue']}, > - {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'sctp', 'sport', 'dport'], > 'actions': ['queue']}, > - {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'sctp', 'sport', 'dport'], > 'actions': ['drop']}, > + {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'udp', 'sport', 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'tcp', 'sport', 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'sctp', 'sport', 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'sctp', 'sport', 'dport'], > + 'actions': ['drop']}, > ] > extrapkt_rulenum =3D self.all_flows_process(basic_flow_a= ctions) > extra_packet =3D extrapkt_rulenum['extrapacket'] > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/IP(src=3D"%s", > dst=3D"%s")/SCTP(sport=3D%s,dport=3D%s)/Raw("x" * 20)], iface=3D"%s")' % > (self.pf_mac, extra_packet[2]['sip'], extra_packet[2]['dip'], > extra_packet[2]['dport'], extra_packet[2]['sport'], self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/IP(src=3D"%s", > dst=3D"%s")/SCTP(sport=3D%s,dport=3D%s)/Raw("x" * 20)'% ( > + self.pf_mac, extra_packet[2]['sip'], extra_packet[2]= ['dip'], > extra_packet[2]['dport'], > + extra_packet[2]['sport'])) > self.verify_result("pf", expect_rxpkts=3D"1", expect_que= ue=3D"0", > verify_mac=3Dself.pf_mac) > rule_num =3D extrapkt_rulenum['rulenum'] > self.verify_rulenum(rule_num) > else: > basic_flow_actions =3D [ > - {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'udp', 'sport', 'dport'], > 'actions': ['queue']}, > - {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'tcp', 'sport', 'dport'], > 'actions': ['queue']}, > + {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'udp', 'sport', 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'tcp', 'sport', 'dport'], > + 'actions': ['queue']}, > {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'sctp'], 'actions': > ['queue']}, > {'create': 'create', 'flows': ['ipv4', 'sip', 'dip',= 'sctp'], 'actions': > ['drop']}, > ] > extrapkt_rulenum =3D self.all_flows_process(basic_flow_a= ctions) > extra_packet =3D extrapkt_rulenum['extrapacket'] > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/IP(src=3D"%s", dst=3D"%s")= /SCTP()/Raw("x" > * 20)], iface=3D"%s")' % (self.pf_mac, extra_packet[2]['dip'], > extra_packet[2]['sip'], self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/IP(src=3D"%s", > dst=3D"%s")/SCTP()/Raw("x" * 20)' % (self.pf_mac, extra_packet[2]['dip'], > extra_packet[2]['sip'])) > self.verify_result("pf", expect_rxpkts=3D"1", expect_que= ue=3D"0", > verify_mac=3Dself.pf_mac) > rule_num =3D extrapkt_rulenum['rulenum'] > self.verify_rulenum(rule_num) > @@ -1054,7 +1090,8 @@ class TestGeneric_flow_api(TestCase): > """ > self.verify(self.nic in ["niantic", "twinville", "sagepond", "sa= geville", > "fortville_eagle", "fortville_spirit", > - "fortville_spirit_single", "fortpark_TL= V"], "%s nic not > support fdir ipv6 filter" % self.nic) > + "fortville_spirit_single", "fortpark_TL= V"], > + "%s nic not support fdir ipv6 filter" % self.nic) > # i40e > if (self.nic in ["fortville_eagle", "fortville_spirit", > "fortville_spirit_single", "fortpark_TLV"]): > @@ -1077,19 +1114,30 @@ class TestGeneric_flow_api(TestCase): >=20 > # create the flow rules > basic_flow_actions =3D [ > - {'create': 'create', 'flows': ['vlan', 'ipv6', 'sip', 'd= ip', 'proto', 'tc', 'hop'], > 'actions': ['queue']}, > - {'create': 'create', 'flows': ['vlan', 'ipv6', 'sip', 'd= ip', 'tc', 'hop', 'udp', > 'sport', 'dport'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['vlan', 'ipv6', 'sip', 'd= ip', 'tc', 'hop', 'tcp', > 'sport', 'dport'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['vlan', 'ipv6', 'sip', 'd= ip', 'tc', 'hop', 'sctp', > 'sport', 'dport', 'tag'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['vlan', 'ipv6', 'sip', 'd= ip', 'proto', 'tc', 'hop', > 'vf0'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['vlan', 'ipv6', 'sip', 'd= ip', 'tc', 'hop', 'tcp', > 'sport', 'dport', 'vf1'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['vlan', 'ipv6', 'sip', 'd= ip', 'tc', 'hop', 'sctp', > 'sport', 'dport', 'tag'], 'actions': ['drop']}, > - {'create': 'create', 'flows': ['vlan', 'ipv6', 'sip', 'd= ip', 'tc', 'hop', 'tcp', > 'sport', 'dport', 'vf1'], 'actions': ['drop']}, > + {'create': 'create', 'flows': ['vlan', 'ipv6', 'sip', 'd= ip', 'proto', 'tc', > 'hop'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['vlan', 'ipv6', 'sip', 'd= ip', 'tc', 'hop', 'udp', > 'sport', 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['vlan', 'ipv6', 'sip', 'd= ip', 'tc', 'hop', 'tcp', > 'sport', 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', > + 'flows': ['vlan', 'ipv6', 'sip', 'dip', 'tc', 'hop', 's= ctp', 'sport', 'dport', > 'tag'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['vlan', 'ipv6', 'sip', 'd= ip', 'proto', 'tc', 'hop', > 'vf0'], > + 'actions': ['queue']}, > + {'create': 'create', > + 'flows': ['vlan', 'ipv6', 'sip', 'dip', 'tc', 'hop', 't= cp', 'sport', 'dport', > 'vf1'], > + 'actions': ['queue']}, > + {'create': 'create', > + 'flows': ['vlan', 'ipv6', 'sip', 'dip', 'tc', 'hop', 's= ctp', 'sport', 'dport', > 'tag'], > + 'actions': ['drop']}, > + {'create': 'create', > + 'flows': ['vlan', 'ipv6', 'sip', 'dip', 'tc', 'hop', 't= cp', 'sport', 'dport', > 'vf1'], > + 'actions': ['drop']}, > ] > extrapkt_rulenum =3D self.all_flows_process(basic_flow_actio= ns) > extra_packet =3D extrapkt_rulenum['extrapacket'] > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D"2= 001::1", > dst=3D"2001::2", tc=3D2, hlim=3D20)/UDP(sport=3D22,dport=3D23)/Raw("x" * = 20)], > iface=3D"%s")' % (self.pf_mac, extra_packet[1]['vlan'], self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IPv6(src=3D= "2001::1", > dst=3D"2001::2", tc=3D2, hlim=3D20)/UDP(sport=3D22,dport=3D23)/Raw("x" * = 20)' % > (self.pf_mac, extra_packet[1]['vlan'])) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0", > verify_mac=3Dself.pf_mac) > rule_num =3D extrapkt_rulenum['rulenum'] > self.verify_rulenum(rule_num) > @@ -1106,51 +1154,55 @@ class TestGeneric_flow_api(TestCase): > basic_flow_actions =3D [ > {'create': 'create', 'flows': ['fuzzy', 'ipv6', 'sip= ', 'dip'], 'actions': > ['queue']}, > {'create': 'create', 'flows': ['fuzzy', 'ipv4', 'sip= ', 'dip'], 'actions': > ['queue']}, > - {'create': 'create', 'flows': ['fuzzy', 'ipv4', 'sip= ', 'dip', 'udp', 'sport', > 'dport'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['fuzzy', 'ipv6', 'sip= ', 'dip', 'tcp', 'sport', > 'dport'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['fuzzy', 'ipv4', 'sip= ', 'dip', 'tcp', 'sport', > 'dport'], 'actions': ['queue']}, > + {'create': 'create', 'flows': ['fuzzy', 'ipv4', 'sip= ', 'dip', 'udp', 'sport', > 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['fuzzy', 'ipv6', 'sip= ', 'dip', 'tcp', 'sport', > 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['fuzzy', 'ipv4', 'sip= ', 'dip', 'tcp', 'sport', > 'dport'], > + 'actions': ['queue']}, > {'create': 'create', 'flows': ['fuzzy', 'ipv6', 'sip= ', 'dip', 'sctp'], > 'actions': ['queue']}, > {'create': 'create', 'flows': ['fuzzy', 'ipv4', 'sip= ', 'dip', 'sctp'], > 'actions': ['queue']}, > ] > extrapkt_rulenum =3D self.all_flows_process(basic_flow_a= ctions) > self.dut.send_expect( > - "flow create 0 ingress pattern fuzzy thresh spec 2 t= hresh 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 1 / end", "created") > + "flow create 0 ingress pattern fuzzy thresh spec 2 t= hresh 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 1 / end", > + "created") > extra_packet =3D extrapkt_rulenum['extrapacket'] > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2",nh=3D132)/SCTP()/Raw("x" * 20)], iface=3D"%s")' % (self.p= f_mac, > self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2",nh=3D132)/SCTP()/Raw("x" * 20)' % self.pf_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_que= ue=3D"0", > verify_mac=3Dself.pf_mac) > - 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.sendpkt('Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/SCTP()/Raw("x" * 20)' % self.pf_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_que= ue=3D"0", > verify_mac=3Dself.pf_mac) > - 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.sendpkt('Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/UDP(sport=3D22,dport=3D23)/Raw("x" * 20)' % self.pf_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_que= ue=3D"1", > verify_mac=3Dself.pf_mac) > rule_num =3D extrapkt_rulenum['rulenum'] > - self.verify_rulenum(rule_num+1) > + self.verify_rulenum(rule_num + 1) > elif (self.nic in ["sagepond", "sageville"]): > # create the flow rules > basic_flow_actions =3D [ > - {'create': 'create', 'flows': ['fuzzy', 'ipv4', 'sip= ', 'dip', 'udp', 'sport', > 'dport'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['fuzzy', 'ipv6', 'sip= ', 'dip', 'tcp', 'sport', > 'dport'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['fuzzy', 'ipv4', 'sip= ', 'dip', 'tcp', 'sport', > 'dport'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['fuzzy', 'ipv6', 'sip= ', 'dip', 'sctp', 'sport', > 'dport'], 'actions': ['queue']}, > - {'create': 'create', 'flows': ['fuzzy', 'ipv4', 'sip= ', 'dip', 'sctp', 'sport', > 'dport'], 'actions': ['queue']}, > + {'create': 'create', 'flows': ['fuzzy', 'ipv4', 'sip= ', 'dip', 'udp', 'sport', > 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['fuzzy', 'ipv6', 'sip= ', 'dip', 'tcp', 'sport', > 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['fuzzy', 'ipv4', 'sip= ', 'dip', 'tcp', 'sport', > 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['fuzzy', 'ipv6', 'sip= ', 'dip', 'sctp', 'sport', > 'dport'], > + 'actions': ['queue']}, > + {'create': 'create', 'flows': ['fuzzy', 'ipv4', 'sip= ', 'dip', 'sctp', 'sport', > 'dport'], > + 'actions': ['queue']}, > ] > extrapkt_rulenum =3D self.all_flows_process(basic_flow_a= ctions) > self.dut.send_expect( > - "flow create 0 ingress pattern fuzzy thresh spec 2 t= hresh 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 1 / end", "created") > + "flow create 0 ingress pattern fuzzy thresh spec 2 t= hresh 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 1 / end", > + "created") > extra_packet =3D extrapkt_rulenum['extrapacket'] > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/IPv6(src=3D"%s", dst=3D"%s= ", > nh=3D132)/SCTP(sport=3D32,dport=3D33,tag=3D1)/Raw("x" * 20)], iface=3D"%s= ")' % > (self.pf_mac, extra_packet[3]['sip'], extra_packet[3]['dip'], self.tester= _itf)) > + self.sendpkt('Ether(dst=3D"%s")/IPv6(src=3D"%s", dst=3D"= %s", > nh=3D132)/SCTP(sport=3D32,dport=3D33,tag=3D1)/Raw("x" * 20)' % (self.pf_m= ac, > extra_packet[3]['sip'], extra_packet[3]['dip'])) > self.verify_result("pf", expect_rxpkts=3D"1", expect_que= ue=3D"0", > verify_mac=3Dself.pf_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/IP(src=3D"%s", dst=3D"%s", > proto=3D132)/SCTP(sport=3D32,dport=3D33)/Raw("x" * 20)], iface=3D"%s")' % > (self.pf_mac, extra_packet[4]['dip'], extra_packet[4]['sip'], self.tester= _itf)) > + self.sendpkt('Ether(dst=3D"%s")/IP(src=3D"%s", dst=3D"%s= ", > proto=3D132)/SCTP(sport=3D32,dport=3D33)/Raw("x" * 20)' % (self.pf_mac, > extra_packet[4]['dip'], extra_packet[4]['sip'])) > self.verify_result("pf", expect_rxpkts=3D"1", expect_que= ue=3D"0", > verify_mac=3Dself.pf_mac) > - 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.sendpkt('Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/UDP(sport=3D22,dport=3D23)/Raw("x" * 20)' % self.pf_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_que= ue=3D"1", > verify_mac=3Dself.pf_mac) > rule_num =3D extrapkt_rulenum['rulenum'] > - self.verify_rulenum(rule_num+1) > + self.verify_rulenum(rule_num + 1) >=20 > def test_fdir_for_flexbytes(self): > """ > @@ -1158,7 +1210,8 @@ class TestGeneric_flow_api(TestCase): > """ > self.verify(self.nic in ["niantic", "twinville", "sagepond", "sa= geville", > "fortville_eagle", "fortville_spirit", > - "fortville_spirit_single", "fortpark_TL= V"], "%s nic not > support fdir flexbytes filter" % self.nic) > + "fortville_spirit_single", "fortpark_TL= V"], > + "%s nic not support fdir flexbytes filter" % self.ni= c) > # i40e > if (self.nic in ["fortville_eagle", "fortville_spirit", > "fortville_spirit_single", "fortpark_TLV"]): > @@ -1171,46 +1224,47 @@ class TestGeneric_flow_api(TestCase): > # 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") > + "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"= ) > + "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 s= um 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 relativ= e is 1 offset > is 10 pattern is abcdefghij / raw relative is 1 offset is 0 pattern is ab= cd / end > actions queue index 2 / end", "created") > + "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 relativ= e is 1 offset > is 10 pattern is abcdefghij / raw relative is 1 offset is 0 pattern is ab= cd / 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") > + "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") > + "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 is abcd / end acti= ons queue > index 5 / end", "created") > + "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 is abcd / end acti= ons queue > index 5 / end", > + "created") >=20 > # 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.sendpkt('Ether(dst=3D"%s", > type=3D0x0807)/Raw(load=3D"abcdefghijklmnop")' % self.pf_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"1", > verify_mac=3Dself.pf_mac) >=20 > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D4095)/IP(src=3D"1= 92.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.sendpkt('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")' % self.pf_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"2", > verify_mac=3Dself.pf_mac) >=20 > - 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.sendpkt('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")' % > self.pf_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"3", > verify_mac=3Dself.pf_mac) >=20 > - 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.sendpkt( > + '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")' % self.pf_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"4", > verify_mac=3Dself.pf_mac) > - > - 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= ghijklmn > opqrst")], iface=3D"%s")' % (self.pf_mac, self.tester_itf)) > + self.sendpkt( > + '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= ghijklmn > opqrst")' % self.pf_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"5", > verify_mac=3Dself.pf_mac) > - > - 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= bcddxxa > bcdefghijklmn")], iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.sendpkt( > + '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= bcddxxa > bcdefghijklmn")' % self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0", > verify_mac=3Dself.outer_mac) >=20 > self.verify_rulenum(5) > @@ -1226,11 +1280,12 @@ class TestGeneric_flow_api(TestCase): >=20 > # 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 offset is 8 pattern is abcdefgh / e= nd actions > queue index 6 / end", "created") > + "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 offset is 8 pattern is abcdefgh / e= nd actions > queue index 6 / end", > + "created") >=20 > # 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.sendpkt( > + 'Ether(dst=3D"%s")/Dot1Q(vlan=3D1)/IPv6(src=3D"2001::1",= dst=3D"2001::2", > tc=3D3, > hlim=3D30)/TCP(sport=3D32,dport=3D33)/Raw(load=3D"hijkabcdefghabcdefghijk= lmn")' % > self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"6", > verify_mac=3Dself.outer_mac) >=20 > # ixgbe > @@ -1243,11 +1298,12 @@ class TestGeneric_flow_api(TestCase): >=20 > # 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 is 0 search is 0 off= set is 44 > limit is 0 pattern is 86 / end actions queue index 1 / end", "created") > + "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 is 0 search is 0 off= set is 44 > limit is 0 pattern is 86 / end actions queue index 1 / end", > + "created") >=20 > # 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.sendpkt( > + '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")' % > self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"1", > verify_mac=3Dself.outer_mac) >=20 > self.dut.send_expect("quit", "# ") > @@ -1262,15 +1318,15 @@ class TestGeneric_flow_api(TestCase): >=20 > # 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 l= imit > mask 0xffff pattern is ab pattern is cd / end actions queue index 2 / end= ", > "created") > + "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 l= imit > mask 0xffff pattern is ab pattern is cd / end actions queue index 2 / end= ", > + "created") >=20 > # 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.sendpkt( > + '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")' % > self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0", > verify_mac=3Dself.outer_mac) > - > - 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.sendpkt( > + '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")' % > self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"2", > verify_mac=3Dself.outer_mac) >=20 > self.dut.send_expect("quit", "# ") > @@ -1286,17 +1342,19 @@ class TestGeneric_flow_api(TestCase): > # ipv4-sctp-flexbytes > if (self.nic in ["sagepond", "sageville"]): > self.dut.send_expect( > - "flow create 0 ingress pattern fuzzy thresh is 6 / e= th / 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 ind= ex 3 / > end", "created") > + "flow create 0 ingress pattern fuzzy thresh is 6 / e= th / 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 ind= ex 3 / > end", > + "created") > else: > self.dut.send_expect( > - "flow create 0 ingress pattern fuzzy thresh is 6 / e= th / ipv4 src is > 192.168.0.1 dst is 192.168.0.2 / sctp / raw relative is 0 search is 0 off= set is 48 > limit is 0 pattern is ab / end actions queue index 3 / end", "created") > + "flow create 0 ingress pattern fuzzy thresh is 6 / e= th / ipv4 src is > 192.168.0.1 dst is 192.168.0.2 / sctp / raw relative is 0 search is 0 off= set is 48 > limit is 0 pattern is ab / end actions queue index 3 / end", > + "created") >=20 > # 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.sendpkt( > + '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")' = % > self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"3", > verify_mac=3Dself.outer_mac) > - 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.sendpkt( > + '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")' = % > self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue= =3D"0", > verify_mac=3Dself.outer_mac) >=20 > # ipv6-other-flexbytes > @@ -1311,12 +1369,13 @@ class TestGeneric_flow_api(TestCase): > time.sleep(2) >=20 > self.dut.send_expect( > - "flow create 0 ingress pattern fuzzy thresh is 6 / i= pv6 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)) > + "flow create 0 ingress pattern fuzzy thresh is 6 / i= pv6 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.sendpkt( > + 'Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/Raw(load=3D"xx86abcd")' % self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_que= ue=3D"4", > verify_mac=3Dself.outer_mac) > - 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.sendpkt( > + 'Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/Raw(load=3D"xxx86abcd")' % self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_que= ue=3D"0", > verify_mac=3Dself.outer_mac) >=20 > def test_flexbytes_filter(self): > @@ -1334,79 +1393,77 @@ class TestGeneric_flow_api(TestCase): > # 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") > + "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") > + "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") > + "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 off= set is 42 > pattern is efgh / end actions queue index 4 / end", "created") > + "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 off= set 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 relative is 0 offs= et is 44 > pattern is efgh / raw relative is 1 offset is 10 pattern is hijklmnopq / = end > actions queue index 5 / end", "created") > + "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 relative is 0 offs= et is 44 > pattern is efgh / raw relative is 1 offset is 10 pattern 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") > + "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") >=20 > # 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.sendpkt('Ether(dst=3D"%s")/Raw(load=3D"fhdsab")' % self.out= er_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"1"= , > verify_mac=3Dself.outer_mac) > - self.tester.scapy_append( > - 'sendp([Ether(dst=3D"%s")/Raw(load=3D"afhdsb")], iface=3D"%s= ")' % > (self.outer_mac, self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/Raw(load=3D"afhdsb")' % self.out= er_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.outer_mac) > - 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.sendpkt('Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/Raw(load=3D"abcdef")' % self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"2"= , > verify_mac=3Dself.outer_mac) > - 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.sendpkt('Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/Raw(load=3D"xxxxefgh")' % self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"3"= , > verify_mac=3Dself.outer_mac) > - 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")], > iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.sendpkt('Ether(dst=3D"%s")/IPv6(src=3D"2001::1", > dst=3D"2001::2")/TCP(sport=3D32,dport=3D33)/Raw(load=3D"abcdefgh")' % > self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.outer_mac) > - 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.sendpkt('Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/Raw(load=3D"cdxxabxxefghxxxx")' % self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"4"= , > verify_mac=3Dself.outer_mac) > - 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.sendpkt('Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", dst=3D"1= 92.168.0.2", > tos=3D4, > ttl=3D3)/UDP(sport=3D32,dport=3D33)/Raw(load=3D"xxefghabcdxxxxxxhijklmnop= qxxxx > ")' % self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"5"= , > verify_mac=3Dself.outer_mac) > - 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= xklmn > efgh")], iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.sendpkt('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= xklmn > efgh")' % self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"6"= , > verify_mac=3Dself.outer_mac) > - 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= xklcde > fgh")], iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.sendpkt('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= xklcde > fgh")' % self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.outer_mac) >=20 > self.dut.send_expect("flow flush 0", "testpmd> ", 120) >=20 > # 1 field 128bytes > self.dut.send_expect( > - "flow create 0 ingress pattern raw relative is 0 offset is 1= 28 pattern is > ab / end actions queue index 1 / end", "Failed to create flow") > + "flow create 0 ingress pattern raw relative is 0 offset is 1= 28 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 1= 26 pattern is > abcd / end actions queue index 1 / end", "Failed to create flow") > + "flow create 0 ingress pattern raw relative is 0 offset is 1= 26 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 1= 26 pattern is > ab / end actions queue index 1 / end", "created") > + "flow create 0 ingress pattern raw relative is 0 offset is 1= 26 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 actions queue ind= ex 2 / > end", "Failed to create flow") > + "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 actions queue ind= ex 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 actions queue ind= ex 2 / > end", "created") > + "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 actions queue ind= ex 2 / > end", > + "created") >=20 > # 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= xxxxxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxab")], iface=3D"%s")= ' % > (self.outer_mac, self.tester_itf)) > + self.sendpkt('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= xxxxxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxab")' % > self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"1"= , > verify_mac=3Dself.outer_mac) > - 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= xxxxxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcb")], iface=3D"%s")= ' % > (self.outer_mac, self.tester_itf)) > + self.sendpkt('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= xxxxxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcb")' % > self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.outer_mac) > - 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= xabxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcd")], > iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.sendpkt('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= xabxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcd")' % > self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"2"= , > verify_mac=3Dself.outer_mac) > - 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= xabxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxce")], > iface=3D"%s")' % (self.outer_mac, self.tester_itf)) > + self.sendpkt('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= xabxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxce")' % > self.outer_mac) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.outer_mac) >=20 > self.verify_rulenum(2) > @@ -1481,7 +1538,8 @@ class TestGeneric_flow_api(TestCase): > only supported by i40e > """ > self.verify(self.nic in ["fortville_eagle", "fortville_spirit", > - "fortville_spirit_single", "fortpark_TL= V"], "%s nic not > support tunnel vxlan filter" % self.nic) > + "fortville_spirit_single", "fortpark_TL= V"], > + "%s nic not support tunnel vxlan filter" % self.nic) >=20 > self.setup_env() > self.pmdout.start_testpmd("%s" % self.pf_cores, "--disable-rss -= -rxq=3D%d > --txq=3D%d" % (MAX_QUEUE+1, MAX_QUEUE+1), "-w %s --file-prefix=3Dpf -- > socket-mem 1024,1024 --legacy-mem" % self.pf_pci) > @@ -1506,32 +1564,35 @@ class TestGeneric_flow_api(TestCase): > {'create': 'create', 'flows': ['ipv4', 'udp', 'vxlan', 'inet= h'], 'actions': ['pf', > 'queue']}, > {'create': 'create', 'flows': ['ipv4', 'udp', 'vxlan', 'vni'= , 'ineth'], 'actions': > ['pf', 'queue']}, > {'create': 'create', 'flows': ['ipv4', 'udp', 'vxlan', 'inet= h', 'invlan'], > 'actions': ['pf', 'queue']}, > - {'create': 'create', 'flows': ['ipv4', 'udp', 'vxlan', 'vni'= , 'ineth', 'invlan'], > 'actions': ['pf', 'queue']}, > - {'create': 'create', 'flows': ['dst_mac', 'ipv4', 'udp', 'vx= lan', 'vni', 'ineth'], > 'actions': ['pf', 'queue']}, > - {'create': 'create', 'flows': ['ipv4', 'udp', 'vxlan', 'vni'= , 'ineth', 'invlan'], > 'actions': ['vf0', 'queue']}, > - {'create': 'create', 'flows': ['dst_mac', 'ipv4', 'udp', 'vx= lan', 'vni', 'ineth'], > 'actions': ['vf1', 'queue']}, > + {'create': 'create', 'flows': ['ipv4', 'udp', 'vxlan', 'vni'= , 'ineth', 'invlan'], > + 'actions': ['pf', 'queue']}, > + {'create': 'create', 'flows': ['dst_mac', 'ipv4', 'udp', 'vx= lan', 'vni', > 'ineth'], > + 'actions': ['pf', 'queue']}, > + {'create': 'create', 'flows': ['ipv4', 'udp', 'vxlan', 'vni'= , 'ineth', 'invlan'], > + 'actions': ['vf0', 'queue']}, > + {'create': 'create', 'flows': ['dst_mac', 'ipv4', 'udp', 'vx= lan', 'vni', > 'ineth'], > + 'actions': ['vf1', 'queue']}, > ] > extrapkt_rulenum =3D self.all_flows_process(basic_flow_actions) > extra_packet =3D extrapkt_rulenum['extrapacket'] >=20 > self.load_module("vxlan") > - 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= _mac, > self.tester_itf)) > - self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3Dextrapkt_rulenum['queue'][0], verify_mac=3Dself.outer_mac) > + > self.sendpkt('Ether(dst=3D"%s")/IP()/UDP()/VXLAN()/Ether(dst=3D"%s")/Dot1= Q(vl > an=3D11)/IP()/TCP()/Raw("x" * 20)' % (self.outer_mac, self.inner_mac)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3Dextrapkt_rulenum['queue'][0], > + verify_mac=3Dself.outer_mac) >=20 > self.load_module("vxlan") > - 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.sendpkt('Ether(dst=3D"%s")/IP()/UDP()/VXLAN(vni=3D5)/Ether(dst=3D"%s= ")/IP()/ > TCP()/Raw("x" * 20)' % (self.outer_mac, self.wrong_mac)) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.outer_mac) >=20 > self.load_module("vxlan") > - self.tester.scapy_append( > - > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/VXLAN(vni=3D%s)/Ether(dst=3D"%s")/Do= t1Q( > vlan=3D%s)/IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, > extra_packet[5]['vni'], self.wrong_mac, extra_packet[5]['invlan'], > self.tester_itf)) > + > self.sendpkt('Ether(dst=3D"%s")/IP()/UDP()/VXLAN(vni=3D%s)/Ether(dst=3D"%= s")/Do > t1Q(vlan=3D%s)/IP()/TCP()/Raw("x" * 20)' % ( > + self.outer_mac, extra_packet[5]['vni'], self.wrong_mac, > extra_packet[5]['invlan'])) > self.verify_result("vf0", expect_rxpkts=3D"1", expect_queue=3D"0= ", > verify_mac=3Dself.outer_mac) >=20 > self.load_module("vxlan") > - self.tester.scapy_append( > - > 'sendp([Ether(dst=3D"%s")/IP()/UDP()/VXLAN(vni=3D%s)/Ether(dst=3D"%s")/IP= ()/TCP > ()/Raw("x" * 20)], iface=3D"%s")' % (self.wrong_mac, extra_packet[6]['vni= '], > self.inner_mac, self.tester_itf)) > + > self.sendpkt('Ether(dst=3D"%s")/IP()/UDP()/VXLAN(vni=3D%s)/Ether(dst=3D"%= s")/IP( > )/TCP()/Raw("x" * 20)' % ( > + self.wrong_mac, extra_packet[6]['vni'], self.inner_mac)) > self.verify_result("vf1", expect_rxpkts=3D"0", expect_queue=3D"N= ULL", > verify_mac=3Dself.wrong_mac) > rule_num =3D extrapkt_rulenum['rulenum'] > self.verify_rulenum(rule_num) > @@ -1541,7 +1602,8 @@ class TestGeneric_flow_api(TestCase): > only supported by i40e > """ > self.verify(self.nic in ["fortville_eagle", "fortville_spirit", > - "fortville_spirit_single", "fortpark_TL= V"], "%s nic not > support tunnel nvgre filter" % self.nic) > + "fortville_spirit_single", "fortpark_TL= V"], > + "%s nic not support tunnel nvgre filter" % self.nic) >=20 > self.setup_env() > self.pmdout.start_testpmd("%s" % self.pf_cores, "--disable-rss -= -rxq=3D%d > --txq=3D%d" % (MAX_QUEUE+1, MAX_QUEUE+1), "-w %s --file-prefix=3Dpf -- > socket-mem 1024,1024 --legacy-mem" % self.pf_pci) > @@ -1574,23 +1636,23 @@ class TestGeneric_flow_api(TestCase): > extra_packet =3D extrapkt_rulenum['extrapacket'] >=20 > self.load_module("nvgre") > - self.tester.scapy_append( > - > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE()/Ether(dst=3D"%s")/Dot1Q(vlan=3D1)/= 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=3Dextrapkt_rulenum['queue'][0], verify_mac=3Dself.outer_mac) > + > self.sendpkt('Ether(dst=3D"%s")/IP()/NVGRE()/Ether(dst=3D"%s")/Dot1Q(vlan= =3D1)/ > IP()/TCP()/Raw("x" * 20)' % (self.outer_mac, self.inner_mac)) > + self.verify_result("pf", expect_rxpkts=3D"1", > expect_queue=3Dextrapkt_rulenum['queue'][0], > + verify_mac=3Dself.outer_mac) >=20 > self.load_module("nvgre") > - self.tester.scapy_append( > - > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D%s)/Ether(dst=3D"%s")/IP()/TCP= ()/Ra > w("x" * 20)], iface=3D"%s")' % (self.outer_mac, extra_packet[4]['tni'], > self.wrong_mac, self.tester_itf)) > + > self.sendpkt('Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D%s)/Ether(dst=3D"%s")/IP= ()/TCP > ()/Raw("x" * 20)' % ( > + self.outer_mac, extra_packet[4]['tni'], self.wrong_mac)) > self.verify_result("pf", expect_rxpkts=3D"1", expect_queue=3D"0"= , > verify_mac=3Dself.outer_mac) >=20 > self.load_module("nvgre") > - self.tester.scapy_append( > - > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D%s)/Ether(dst=3D"%s")/Dot1Q(vl= an=3D > %s)/IP()/TCP()/Raw("x" * 20)], iface=3D"%s")' % (self.outer_mac, > extra_packet[5]['tni'], self.wrong_mac, extra_packet[5]['invlan'], > self.tester_itf)) > + > self.sendpkt('Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D%s)/Ether(dst=3D"%s")/Do= t1Q(v > lan=3D%s)/IP()/TCP()/Raw("x" * 20)' % ( > + self.outer_mac, extra_packet[5]['tni'], self.wrong_mac, > extra_packet[5]['invlan'])) > self.verify_result("vf0", expect_rxpkts=3D"1", expect_queue=3D"0= ", > verify_mac=3Dself.outer_mac) >=20 > self.load_module("nvgre") > - self.tester.scapy_append( > - > 'sendp([Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D%s)/Ether(dst=3D"%s")/IP()/TCP= ()/Ra > w("x" * 20)], iface=3D"%s")' % (self.wrong_mac, extra_packet[6]['tni'], > self.inner_mac, self.tester_itf)) > + > self.sendpkt('Ether(dst=3D"%s")/IP()/NVGRE(TNI=3D%s)/Ether(dst=3D"%s")/IP= ()/TCP > ()/Raw("x" * 20)' % ( > + self.wrong_mac, extra_packet[6]['tni'], self.inner_mac)) > self.verify_result("vf1", expect_rxpkts=3D"0", expect_queue=3D"N= ULL", > verify_mac=3Dself.wrong_mac) > rule_num =3D extrapkt_rulenum['rulenum'] > self.verify_rulenum(rule_num) > diff --git a/tests/TestSuite_hotplug.py b/tests/TestSuite_hotplug.py > index a94967a..a7a7228 100644 > --- a/tests/TestSuite_hotplug.py > +++ b/tests/TestSuite_hotplug.py > @@ -121,7 +121,7 @@ class TestPortHotPlug(TestCase): > self.txItf =3D self.tester.get_interface(txport) > pkt =3D Packet(pkt_type=3D'UDP') > pkt.config_layer('ether', {'dst': self.dmac,}) > - pkt.send_pkt(tx_port=3Dself.txItf) > + pkt.send_pkt(self.tester, tx_port=3Dself.txItf) >=20 > def test_before_attach(self): > """ > diff --git a/tests/TestSuite_iavf.py b/tests/TestSuite_iavf.py > index 9395555..af8c747 100644 > --- a/tests/TestSuite_iavf.py > +++ b/tests/TestSuite_iavf.py > @@ -588,7 +588,7 @@ class TestIavf(TestCase): > self.tester.scapy_execute() > rec_pkt =3D self.tester.load_tcpdump_sniff_packets(inst) > # collect checksum values for received packet > - chksum =3D > rec_pkt[0].pktgen.pkt.sprintf("%IP.chksum%;%TCP.chksum%;%UDP.chksum% > ;%SCTP.chksum%").split(";") > + chksum =3D > rec_pkt[0].sprintf("%IP.chksum%;%TCP.chksum%;%UDP.chksum%;%SCTP.chk > sum%").split(";") > chksum =3D list(set(chksum)) > chksum.remove("??") > corrected_checksum_values[packet] =3D chksum > diff --git a/tests/TestSuite_ieee1588.py b/tests/TestSuite_ieee1588.py > index 0dd3d6e..f3fea42 100644 > --- a/tests/TestSuite_ieee1588.py > +++ b/tests/TestSuite_ieee1588.py > @@ -91,12 +91,13 @@ class TestIeee1588(TestCase): >=20 > self.tester.send_expect( > "tcpdump -i %s -e ether src %s" % (itf, mac), "tcpdump", 20) > - > + self.send_session =3D self.tester.create_session('send_session') > + setattr(self.send_session, 'tmp_file', self.tester.tmp_file) > pkt =3D Packet(pkt_type=3D'TIMESYNC') > - pkt.config_layer('ether', {'dst': mac, }) > - pkt.send_pkt(tx_port=3Ditf) > - > + pkt.config_layer('ether', {'dst': mac}) > + pkt.send_pkt(self.send_session, tx_port=3Ditf) > time.sleep(1) > + self.send_session.close() > out =3D self.tester.get_session_output(timeout=3D20) >=20 > self.tester.send_expect("^C", "# ", 20) > diff --git a/tests/TestSuite_ipfrag.py b/tests/TestSuite_ipfrag.py > index f6d0373..5edd6c4 100644 > --- a/tests/TestSuite_ipfrag.py > +++ b/tests/TestSuite_ipfrag.py > @@ -168,37 +168,36 @@ l3fwd_ipv4_route_array[] =3D {\\\n" > expPkts =3D 1 > val =3D 2 >=20 > - inst =3D self.tester.tcpdump_sniff_packets(intf=3Dself.rxItf= , timeout=3D5) > + inst =3D self.tester.tcpdump_sniff_packets(intf=3Dself.rxItf= ) > # send packet > for times in range(burst): > pkt_size =3D pkt_sizes[pkt_sizes.index(size) + times] > pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dpkt_size) > - pkt.config_layer('ether', {'dst': self.dmac}) > + pkt.config_layer('ether', {'dst': '%s' % self.dmac}) > pkt.config_layer('ipv4', {'dst': '100.10.0.1', 'src': '1= .2.3.4', 'flags': val}) > - pkt.send_pkt(tx_port=3Dself.txItf) > + pkt.send_pkt(self.tester, tx_port=3Dself.txItf) >=20 > # verify normal packet just by number, verify fragment packe= t by all > elements > pkts =3D self.tester.load_tcpdump_sniff_packets(inst) > self.verify(len(pkts) =3D=3D expPkts, "in functional_check_i= pv4(): failed on > forward packet size " + str(size)) > if flag =3D=3D 'frag': > idx =3D 1 > - for pkt in pkts: > - # packet index should be same > - pkt_id =3D pkt.strip_element_layer3("id") > + for i in range(len(pkts)): > + pkt_id =3D pkts.strip_element_layer3('id', p_index= =3Di) > if idx =3D=3D 1: > prev_idx =3D pkt_id > self.verify(prev_idx =3D=3D pkt_id, "Fragmented pack= ets index not > match") > prev_idx =3D pkt_id >=20 > # last flags should be 0 > - flags =3D pkt.strip_element_layer3("flags") > + flags =3D pkts.strip_element_layer3("flags", p_index= =3Di) > if idx =3D=3D expPkts: > self.verify(flags =3D=3D 0, "Fragmented last pac= ket flags not match") > else: > self.verify(flags =3D=3D 1, "Fragmented packets = flags not match") >=20 > # fragment offset should be correct > - frag =3D pkt.strip_element_layer3("frag") > + frag =3D pkts.strip_element_layer3("frag", p_index= =3Di) > self.verify((frag =3D=3D ((idx - 1) * 185)), "Fragme= nt packet frag not > match") > idx +=3D 1 >=20 > @@ -218,37 +217,36 @@ l3fwd_ipv4_route_array[] =3D {\\\n" > expPkts =3D 1 > val =3D 2 >=20 > - inst =3D self.tester.tcpdump_sniff_packets(intf=3Dself.rxItf= , timeout=3D5) > + inst =3D self.tester.tcpdump_sniff_packets(intf=3Dself.rxItf= ) > # send packet > for times in range(burst): > pkt_size =3D pkt_sizes[pkt_sizes.index(size) + times] > pkt =3D Packet(pkt_type=3D'IPv6_UDP', pkt_len=3Dpkt_size= ) > - pkt.config_layer('ether', {'dst': self.dmac}) > + pkt.config_layer('ether', {'dst': '%s' % self.dmac}) > pkt.config_layer('ipv6', {'dst': '101:101:101:101:101:10= 1:101:101', > 'src': 'ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80'}) > - pkt.send_pkt(tx_port=3Dself.txItf) > + pkt.send_pkt(self.tester, tx_port=3Dself.txItf) >=20 > # verify normal packet just by number, verify fragment packe= t by all > elements > pkts =3D self.tester.load_tcpdump_sniff_packets(inst) > self.verify(len(pkts) =3D=3D expPkts, "In functional_check_i= pv6(): failed on > forward packet size " + str(size)) > if flag =3D=3D 'frag': > idx =3D 1 > - for pkt in pkts: > - # packet index should be same > - pkt_id =3D pkt.strip_element_layer4("id") > + for i in range(len(pkts)): > + pkt_id =3D pkts.strip_element_layer4('id', p_index= =3Di) > if idx =3D=3D 1: > prev_idx =3D pkt_id > self.verify(prev_idx =3D=3D pkt_id, "Fragmented pack= ets index not > match") > prev_idx =3D pkt_id >=20 > # last flags should be 0 > - flags =3D pkt.strip_element_layer4("m") > + flags =3D pkts.strip_element_layer4("m", p_index=3Di= ) > if idx =3D=3D expPkts: > self.verify(flags =3D=3D 0, "Fragmented last pac= ket flags not match") > else: > self.verify(flags =3D=3D 1, "Fragmented packets = flags not match") >=20 > # fragment offset should be correct > - frag =3D pkt.strip_element_layer4("offset") > + frag =3D pkts.strip_element_layer4("offset", p_index= =3Di) > self.verify((frag =3D=3D int((idx - 1) * 181)), "Fra= gment packet frag not > match") > idx +=3D 1 >=20 > diff --git a/tests/TestSuite_ipgre.py b/tests/TestSuite_ipgre.py > index d08a933..7258db5 100644 > --- a/tests/TestSuite_ipgre.py > +++ b/tests/TestSuite_ipgre.py > @@ -100,11 +100,11 @@ class TestIpgre(TestCase): > if layer_configs: > for layer in layer_configs.keys(): > pkt.config_layer(layer, layer_configs[layer]) > - inst =3D self.tester.tcpdump_sniff_packets(self.tester_iface= , count=3D1, > timeout=3D8) > - pkt.send_pkt(tx_port=3Dself.tester_iface, count =3D 4) > + inst =3D self.tester.tcpdump_sniff_packets(self.tester_iface= , count=3D1) > + pkt.send_pkt(crb=3Dself.tester, tx_port=3Dself.tester_iface,= count=3D4) > out =3D self.dut.get_session_output(timeout=3D2) > time.sleep(1) > - self.tester.load_tcpdump_sniff_packets(inst) > + pkt =3D self.tester.load_tcpdump_sniff_packets(inst) > if self.printFlag: # debug output > print out > for pkt_layer_name in pkt_names: > @@ -116,7 +116,7 @@ class TestIpgre(TestCase): > raise VerifyFailure("Failed to detect %s" % pkt_= layer_name) > else: > print utils.GREEN("Detected %s successfully" % pkt_type) > - time.sleep(1) > + time.sleep(1) > if queue =3D=3D None: # no filter > pass > else: > @@ -124,6 +124,7 @@ class TestIpgre(TestCase): > self.verify(("Receive queue=3D0x%s" % queue) in out,= "Failed to > enter the right queue.") > else: > self.verify(("Receive queue=3D0x%s" % queue) not in = out, "Failed to > enter the right queue.") > + return pkt >=20 >=20 > def save_ref_packet(self, pkt_types, layer_configs=3DNone): > @@ -146,13 +147,16 @@ class TestIpgre(TestCase): > Skip outer udp for it will be calculated by software > """ > chk_sums =3D {} > - pkts =3D rdpcap(pcap) > + if isinstance(pcap, str): > + pkts =3D rdpcap(pcap) > + else: > + pkts =3D pcap.pktgen.pkts > for number in range(len(pkts)): > if pkts[number].guess_payload_class(pkts[number]).name =3D= =3D "gre": > payload =3D pkts[number][GRE] > else: > payload =3D pkts[number] > - > + > if payload.guess_payload_class(payload).name =3D=3D "IP": > chk_sums['outer_ip'] =3D hex(payload[IP].chksum) >=20 > @@ -170,9 +174,9 @@ class TestIpgre(TestCase): >=20 > return chk_sums >=20 > - def compare_checksum(self): > - chksums_ref =3D self.get_chksums('/tmp/ref_pkt.pcap') > - chksums =3D > self.get_chksums('/tmp/sniff_{0}.pcap'.format(self.tester_iface)) > + def compare_checksum(self, pkt): > + chksums_ref =3D self.get_chksums('/tmp/ref_pkt.pcap') > + chksums =3D self.get_chksums(pcap=3Dpkt) > self.logger.info("chksums_ref :: %s"%chksums_ref) > self.logger.info("chksums :: %s"%chksums) > # verify saved pcap checksum same to expected checksum > @@ -197,8 +201,8 @@ class TestIpgre(TestCase): > 'ipv4': {'proto': 'gre'}} > # Start testpmd and enable rxonly forwarding mode > testpmd_cmd =3D "./%s/app/testpmd -c ffff -n 4 -- -i --enable-rx= -cksum" % > self.target > - self.dut.send_expect( testpmd_cmd, > - "testpmd>", > + self.dut.send_expect( testpmd_cmd, > + "testpmd>", > 20) > self.dut.send_expect("set fwd rxonly", "testpmd>") > self.dut.send_expect("set verbose 1", "testpmd>") > @@ -233,7 +237,7 @@ class TestIpgre(TestCase): > "MAC_IPv6_GRE_IPv6-TUNNEL_SCTP_PKT": ["TUNNEL_GRENAT"= , > "INNER_L4_SCTP"], > "MAC_VLAN_IPv6_GRE_IPv6-TUNNEL_SCTP_PKT": > ["TUNNEL_GRENAT", "INNER_L4_SCTP", "PKT_RX_VLAN"] > } > - > + > # Start testpmd and enable rxonly forwarding mode > testpmd_cmd =3D "./%s/app/testpmd -c ffff -n 4 -- -i --enable-rx= -cksum -- > enable-hw-vlan" % self.target > self.dut.send_expect(testpmd_cmd, "testpmd>", 20) > @@ -258,7 +262,7 @@ class TestIpgre(TestCase): > config_layers =3D {'ether': {'src': self.outer_mac_src}, > 'ipv6': {'nh': 47}, > 'gre': {'proto': 0x86dd}, > - 'inner_ipv6': {'nh': 132}, > + 'inner_ipv6': {'nh': 132}, > 'raw': {'payload':['78']*40}} > self.check_packet_transmission(pkt_types_ipv6_ipv6_SCTP, > config_layers) > self.dut.send_expect("quit", "#") > @@ -271,7 +275,7 @@ class TestIpgre(TestCase): > """ > outer_mac =3D self.tester_iface_mac > inner_mac =3D "10:00:00:00:00:00" > - > + > # Start testpmd with multi queues > #testpmd_cmd =3D "./%s/app/testpmd -c ff -n 3 -- -i --rxq=3D4 -= -txq=3D4" % > self.target > testpmd_cmd =3D "./%s/app/testpmd -c ff -n 3 -- -i --enable-rx-c= ksum -- > rxq=3D4 --txq=3D4" % self.target > @@ -284,7 +288,7 @@ class TestIpgre(TestCase): > # Add GRE filter that forward inner ip address 0.0.0.0 to queue = 3 > cmd =3D "tunnel_filter add 0 %s %s 0.0.0.0 1 ipingre iip 0 3"%(o= uter_mac, > inner_mac) > self.dut.send_expect( cmd, "testpmd>") > - > + > # Send packet inner ip address matched and check packet received= by > queue 3 > pkt_types =3D {"MAC_IP_GRE_IPv4-TUNNEL_UDP_PKT": > ["TUNNEL_GRENAT", "INNER_L4_UDP"]} > config_layers =3D {'ether': {'src': self.outer_mac_src}, > @@ -298,7 +302,7 @@ class TestIpgre(TestCase): > cmd =3D "tunnel_filter rm 0 %s %s 0.0.0.0 1 ipingre iip 0 3"%(ou= ter_mac, > inner_mac) > self.dut.send_expect( cmd, "testpmd>") > self.check_packet_transmission(pkt_types, config_layers, "3") > - > + > # Add GRE filter that forward outer ip address 0.0.0.0 to queue = 3 > cmd =3D "tunnel_filter add 0 %s %s 0.0.0.0 1 ipingre oip 0 3"%(o= uter_mac, > inner_mac) > self.dut.send_expect( cmd, "testpmd>") > @@ -341,7 +345,7 @@ class TestIpgre(TestCase): >=20 > # Send packet with wrong outer IP checksum and check forwarded > packet IP checksum is correct > pkt_types =3D { "MAC_IP_GRE_IPv4-TUNNEL_TCP_PKT": > ["PKT_TX_IP_CKSUM"]} > - config_layers =3D {'ether': {'src': self.outer_mac_src, > + config_layers =3D {'ether': {'src': self.outer_mac_src, > 'dst': self.outer_mac_dst}, > 'ipv4': {'proto': 'gre', > 'src': self.outer_ip_src, > @@ -349,7 +353,7 @@ class TestIpgre(TestCase): > 'inner_ipv4':{'src':self.inner_ip_src, > 'dst':self.inner_ip_dst}} > self.save_ref_packet(pkt_types, config_layers) > - config_layers =3D {'ether': {'src': self.outer_mac_src, > + config_layers =3D {'ether': {'src': self.outer_mac_src, > 'dst': self.outer_mac_dst}, > 'ipv4': {'proto': 'gre', > 'src': self.outer_ip_src, > @@ -357,12 +361,12 @@ class TestIpgre(TestCase): > 'inner_ipv4':{'src':self.inner_ip_src, > 'dst':self.inner_ip_dst, > 'chksum': 0x0}} > - self.check_packet_transmission(pkt_types, config_layers) > - self.compare_checksum() > + pkt =3D self.check_packet_transmission(pkt_types, config_layers) > + self.compare_checksum(pkt) >=20 > # Send packet with wrong inner IP checksum and check forwarded > packet IP checksum is correct > pkt_types =3D { "MAC_IP_GRE_IPv4-TUNNEL_TCP_PKT": > ["PKT_TX_IP_CKSUM"]} > - config_layers =3D {'ether': {'src': self.outer_mac_src, > + config_layers =3D {'ether': {'src': self.outer_mac_src, > 'dst': self.outer_mac_dst}, > 'ipv4': {'proto': 'gre', > 'src': self.outer_ip_src, > @@ -370,7 +374,7 @@ class TestIpgre(TestCase): > 'inner_ipv4':{'src':self.inner_ip_src, > 'dst':self.inner_ip_dst}} > self.save_ref_packet(pkt_types, config_layers) > - config_layers =3D {'ether': {'src': self.outer_mac_src, > + config_layers =3D {'ether': {'src': self.outer_mac_src, > 'dst': self.outer_mac_dst}, > 'ipv4': {'proto': 'gre', > 'src': self.outer_ip_src, > @@ -378,22 +382,22 @@ class TestIpgre(TestCase): > 'chksum': 0x0}, > 'inner_ipv4':{'src':self.inner_ip_src, > 'dst':self.inner_ip_dst}} > - self.check_packet_transmission(pkt_types, config_layers) > - self.compare_checksum() > - > + pkt =3D self.check_packet_transmission(pkt_types, config_layers) > + self.compare_checksum(pkt) > + > # Send packet with wrong inner TCP checksum and check forwarded > packet TCP checksum is correct > pkt_types =3D { "MAC_IP_GRE_IPv4-TUNNEL_TCP_PKT": > ["PKT_TX_TCP_CKSUM"]} > - config_layers =3D {'ether': {'src': self.outer_mac_src, > + config_layers =3D {'ether': {'src': self.outer_mac_src, > 'dst': self.outer_mac_dst}, > 'ipv4': {'proto': 'gre', > 'src': self.outer_ip_src, > 'dst': self.outer_ip_dst}, > 'inner_ipv4':{'src':self.inner_ip_src, > 'dst':self.inner_ip_dst}, > - 'tcp': {'src': 53, > + 'tcp': {'src': 53, > 'dst': 53}} > self.save_ref_packet(pkt_types, config_layers) > - config_layers =3D {'ether': {'src': self.outer_mac_src, > + config_layers =3D {'ether': {'src': self.outer_mac_src, > 'dst': self.outer_mac_dst}, > 'ipv4': {'proto': 'gre', > 'src': self.outer_ip_src, > @@ -401,12 +405,12 @@ class TestIpgre(TestCase): > 'inner_ipv4':{'src':self.inner_ip_src, > 'dst':self.inner_ip_dst}, > 'tcp': {'chksum': 0x0}} > - self.check_packet_transmission(pkt_types, config_layers) > - self.compare_checksum() > + pkt =3D self.check_packet_transmission(pkt_types, config_layers) > + self.compare_checksum(pkt) >=20 > # Send packet with wrong inner UDP checksum and check forwarded > packet UDP checksum is correct > pkt_types =3D { "MAC_IP_GRE_IPv4-TUNNEL_UDP_PKT": > ["PKT_TX_UDP_CKSUM"]} > - config_layers =3D {'ether': {'src': self.outer_mac_src, > + config_layers =3D {'ether': {'src': self.outer_mac_src, > 'dst': self.outer_mac_dst}, > 'ipv4': {'proto': 'gre', > 'src': self.outer_ip_src, > @@ -414,7 +418,7 @@ class TestIpgre(TestCase): > 'inner_ipv4':{'src':self.inner_ip_src, > 'dst':self.inner_ip_dst}} > self.save_ref_packet(pkt_types, config_layers) > - config_layers =3D {'ether': {'src': self.outer_mac_src, > + config_layers =3D {'ether': {'src': self.outer_mac_src, > 'dst': self.outer_mac_dst}, > 'ipv4': {'proto': 'gre', > 'src': self.outer_ip_src, > @@ -422,8 +426,8 @@ class TestIpgre(TestCase): > 'inner_ipv4':{'src':self.inner_ip_src, > 'dst':self.inner_ip_dst}, > 'udp': {'chksum': 0xffff}} > - self.check_packet_transmission(pkt_types, config_layers) > - self.compare_checksum() > + pkt =3D self.check_packet_transmission(pkt_types, config_layers) > + self.compare_checksum(pkt) > if self.nic !=3D "cavium_a063": > # Send packet with wrong inner SCTP checksum and check forwa= rded > packet SCTP checksum is correct > pkt_types =3D { "MAC_IP_GRE_IPv4-TUNNEL_SCTP_PKT": > ["PKT_TX_SCTP_CKSUM"]} > @@ -445,20 +449,22 @@ class TestIpgre(TestCase): > 'inner_ipv4':{'src':self.inner_ip_src, > 'dst':self.inner_ip_dst}, > 'sctp': {'chksum': 0x0}} > - self.check_packet_transmission(pkt_types, config_layers) > - self.compare_checksum() > + pkt =3D self.check_packet_transmission(pkt_types, config_lay= ers) > + self.compare_checksum(pkt) >=20 > self.dut.send_expect("quit", "#") >=20 > def tear_down(self): > """ > Run after each test case. > + Nothing to do. > """ > - self.dut.kill_all() > + pass >=20 > def tear_down_all(self): > """ > Run after each test suite. > Nothing to do. > """ > + self.dut.kill_all() > pass > diff --git a/tests/TestSuite_ipsec_gw_cryptodev_func.py > b/tests/TestSuite_ipsec_gw_cryptodev_func.py > index 5b815ad..9800886 100644 > --- a/tests/TestSuite_ipsec_gw_cryptodev_func.py > +++ b/tests/TestSuite_ipsec_gw_cryptodev_func.py > @@ -35,7 +35,7 @@ import binascii > import time > import utils > from test_case import TestCase > -from packet import Packet, save_packets > +import packet >=20 > from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, > modes > from cryptography.hazmat.primitives.ciphers.aead import AESCCM, > AESGCM > @@ -723,7 +723,7 @@ class TestIPsecGW(TestCase): > self.logger.info("IPsec-gw cmd: " + cmd_str) > self.dut.send_expect(cmd_str, "IPSEC:", 30) > time.sleep(3) > - inst =3D self.tester.tcpdump_sniff_packets(self.rx_interface, ti= meout=3D25) > + inst =3D self.tester.tcpdump_sniff_packets(self.rx_interface) >=20 > PACKET_COUNT =3D 65 > payload =3D 256 * ['11'] > @@ -735,7 +735,7 @@ class TestIPsecGW(TestCase): > expected_src_ip =3D case_cfgs["expected_src_ip"] > expected_spi =3D case_cfgs["expected_spi"] >=20 > - pkt =3D Packet() > + pkt =3D packet.Packet() > if len(dst_ip)<=3D15: > pkt.assign_layers(["ether", "ipv4", "udp", "raw"]) > pkt.config_layer("ether", {"src": "52:00:00:00:00:00", "dst"= : > "52:00:00:00:00:01"}) > @@ -746,38 +746,37 @@ class TestIPsecGW(TestCase): > pkt.config_layer("ipv6", {"src": src_ip, "dst": dst_ip}) > pkt.config_layer("udp", {"dst": 0}) > pkt.config_layer("raw", {"payload": payload}) > - pkt.send_pkt(tx_port=3Dself.tx_interface, count=3DPACKET_COUNT) > + pkt.send_pkt(crb=3Dself.tester, tx_port=3Dself.tx_interface, > count=3DPACKET_COUNT) >=20 > pkt_rec =3D self.tester.load_tcpdump_sniff_packets(inst) >=20 > - pcap_filename =3D "output/{0}.pcap".format(self.pcap_filename) > - self.logger.info("Save pkts to {0}".format(pcap_filename)) > - save_packets(pkt_rec, pcap_filename) > + pcap_filename =3D "{0}.pcap".format(self.pcap_filename) > + self.logger.info("Save pkts to {0}".format(packet.TMP_PATH + > pcap_filename)) > + pkt_rec.save_pcapfile(self.tester, pcap_filename) > self._pcap_idx =3D self._pcap_idx + 1 >=20 > if len(pkt_rec) =3D=3D 0: > self.logger.error("IPsec forwarding failed") > result =3D False > - > - for pkt_r in pkt_rec: > - pkt_src_ip =3D pkt_r.pktgen.strip_layer3("src") > + for i in range(len(pkt_rec)): > + pkt_src_ip =3D pkt_rec.pktgen.strip_layer3("src", p_index=3D= i) > if pkt_src_ip !=3D expected_src_ip: > - pkt_r.pktgen.pkt.show() > + pkt_rec[i].show() > self.logger.error("SRC IP does not match. Pkt:{0}, > Expected:{1}".format( > pkt_src_ip, expected_src_ip)) > result =3D False > break >=20 > - pkt_dst_ip =3D pkt_r.pktgen.strip_layer3("dst") > + pkt_dst_ip =3D pkt_rec.pktgen.strip_layer3("dst", p_index=3D= i) > self.logger.debug(pkt_dst_ip) > if pkt_dst_ip !=3D expected_dst_ip: > - pkt_r.pktgen.pkt.show() > + pkt_rec[i].show() > self.logger.error("DST IP does not match. Pkt:{0}, > Expected:{1}".format( > pkt_dst_ip, expected_dst_ip)) > result =3D False > break >=20 > - packet_hex =3D pkt_r.pktgen.pkt["ESP"].getfieldval("data") > + packet_hex =3D pkt_rec[i]["ESP"].getfieldval("data") > if packet_hex is None: > self.logger.error("NO Payload !") > result =3D False > @@ -785,7 +784,7 @@ class TestIPsecGW(TestCase): > payload_str =3D binascii.b2a_hex(packet_hex) > self.logger.debug(payload_str) >=20 > - pkt_spi =3D hex(pkt_r.pktgen.pkt["ESP"].getfieldval("spi")) > + pkt_spi =3D hex(pkt_rec[i]["ESP"].getfieldval("spi")) > self.logger.debug(pkt_spi) > if pkt_spi !=3D expected_spi: > self.logger.error("SPI does not match. Pkt:{0}, Expected= :{1}".format( > diff --git a/tests/TestSuite_jumboframes.py > b/tests/TestSuite_jumboframes.py > index 1b5aab5..a883e3e 100644 > --- a/tests/TestSuite_jumboframes.py > +++ b/tests/TestSuite_jumboframes.py > @@ -229,7 +229,7 @@ class TestJumboframes(TestCase): > """ > Run after each test case. > """ > - pass > + self.dut.kill_all() >=20 > def tear_down_all(self): > """ > diff --git a/tests/TestSuite_kernelpf_iavf.py > b/tests/TestSuite_kernelpf_iavf.py > index 476b899..4424ae2 100644 > --- a/tests/TestSuite_kernelpf_iavf.py > +++ b/tests/TestSuite_kernelpf_iavf.py > @@ -423,7 +423,7 @@ class TestKernelpfIavf(TestCase): > pkt.config_layer('vlan', {'vlan': vlan}) > pkt.config_layer('ether', {'dst': self.vf_mac}) >=20 > - pkt.send_pkt(tx_port=3Dself.tester_intf) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_intf) > out =3D self.vm_dut.get_session_output(timeout=3D2) >=20 > return out > @@ -546,7 +546,7 @@ class TestKernelpfIavf(TestCase): > pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dpktsize) > pkt.config_layer('ether', {'dst': self.vf_mac, 'src': self.teste= r_mac}) > self.vm_testpmd.execute_cmd("clear port stats all") > - pkt.send_pkt(tx_port=3Dself.tester_intf) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_intf) >=20 > time.sleep(1) >=20 > diff --git a/tests/TestSuite_l2fwd_cryptodev_func.py > b/tests/TestSuite_l2fwd_cryptodev_func.py > index 7e785dd..e0f0b5b 100644 > --- a/tests/TestSuite_l2fwd_cryptodev_func.py > +++ b/tests/TestSuite_l2fwd_cryptodev_func.py > @@ -760,7 +760,6 @@ class TestL2fwdCrypto(TestCase): > payload =3D self.__format_hex_to_list(test_vector["input"]) >=20 > inst =3D self.tester.tcpdump_sniff_packets(self.rx_interface= , > - timeout=3D5, > filters=3D[{'layer'= : 'ether', > 'config': {'dst': '= 52:00:00:00:00:01'}}]) >=20 > @@ -770,12 +769,12 @@ class TestL2fwdCrypto(TestCase): > pkt.config_layer("ether", {"src": "52:00:00:00:00:00", > "dst":"52:00:00:00:00:01"}) > pkt.config_layer("ipv4", {"src": "192.168.1.1", "dst": "192.= 168.1.2"}) > pkt.config_layer("raw", {"payload": payload}) > - pkt.send_pkt(tx_port=3Dself.tx_interface, count=3DPACKET_COU= NT) > + pkt.send_pkt(self.tester, tx_port=3Dself.tx_interface, > count=3DPACKET_COUNT) >=20 > pkt_rec =3D self.tester.load_tcpdump_sniff_packets(inst) > self.logger.info("Receive pkgs: {}".format(len(pkt_rec))) > - for pkt_r in pkt_rec: > - packet_hex =3D pkt_r.pktgen.pkt["Raw"].getfieldval("load= ") > + for i in range(len(pkt_rec)): > + packet_hex =3D pkt_rec[i]["Raw"].getfieldval("load") > if packet_hex =3D=3D None: > result =3D False > self.logger.info("no payload !") > @@ -796,9 +795,9 @@ class TestL2fwdCrypto(TestCase): > hash_length =3D len(test_vector["output_hash"])/2 > if hash_length !=3D 0: > if test_vector["auth_algo"] =3D=3D "null": > - hash_text =3D > binascii.b2a_hex(pkt_r.pktgen.pkt["Raw"].getfieldval("load")) > + hash_text =3D > binascii.b2a_hex(pkt_rec[i]["Raw"].getfieldval("load")) > else: > - hash_text =3D > binascii.b2a_hex(pkt_r.pktgen.pkt["Padding"].getfieldval("load")) > + hash_text =3D > binascii.b2a_hex(pkt_rec[i]["Padding"].getfieldval("load")) > if str.lower(hash_text) =3D=3D str.lower(test_vector= ["output_hash"]): > self.logger.info("Hash Matched") > else: > diff --git a/tests/TestSuite_l3fwdacl.py b/tests/TestSuite_l3fwdacl.py > index 9d1c41e..dce37de 100644 > --- a/tests/TestSuite_l3fwdacl.py > +++ b/tests/TestSuite_l3fwdacl.py > @@ -38,6 +38,7 @@ import re > import utils > import time > from test_case import TestCase > +import packet >=20 > class TestL3fwdacl(TestCase): >=20 > @@ -268,10 +269,10 @@ class TestL3fwdacl(TestCase): >=20 > dst_filter =3D {'layer': 'ether', 'config': {'dst': 'not ff:ff:f= f:ff:ff:ff'}} > filters =3D [dst_filter] > - inst =3D self.tester.tcpdump_sniff_packets(rx_interface, timeout= =3D5, > filters=3Dfilters) > - > - self.tester.scapy_append('sendp([%s],iface=3D"%s")' % (ethernet_= str, > tx_interface)) > - self.tester.scapy_execute() > + inst =3D self.tester.tcpdump_sniff_packets(rx_interface, filters= =3Dfilters) > + pkt =3D packet.Packet() > + pkt.append_pkt(ethernet_str) > + pkt.send_pkt(crb=3Dself.tester, tx_port=3Dtx_interface) > out =3D self.remove_dhcp_from_revpackets(inst) > return len(out) >=20 > @@ -298,11 +299,11 @@ class TestL3fwdacl(TestCase): > ethernet_str =3D self.create_ipv6_rule_string(rule, "Ether") >=20 > fil =3D [{'layer': 'ether', 'config': {'dst': 'not ff:ff:ff:ff:f= f:ff'}}] > - inst =3D self.tester.tcpdump_sniff_packets(rx_interface, timeout= =3D5, > filters=3Dfil) > + inst =3D self.tester.tcpdump_sniff_packets(rx_interface, filters= =3Dfil) > + pkt =3D packet.Packet() > + pkt.append_pkt(ethernet_str) > + pkt.send_pkt(crb=3Dself.tester, tx_port=3Dtx_interface) >=20 > - self.tester.scapy_append('sendp([%s],iface=3D"%s")' % (ethernet_= str, > tx_interface)) > - self.tester.scapy_execute() > - time.sleep(3) > out =3D self.remove_dhcp_from_revpackets(inst) > return len(out) >=20 > @@ -316,10 +317,10 @@ class TestL3fwdacl(TestCase): >=20 > dst_filter =3D {'layer': 'ether', 'config': {'dst': 'not ff:ff:f= f:ff:ff:ff'}} > filters =3D [dst_filter] > - inst =3D self.tester.tcpdump_sniff_packets(rx_interface, timeout= =3D5, > filters=3Dfilters) > - self.tester.scapy_append('sendp([%s],iface=3D"%s")' % (etherStr, > tx_interface)) > - self.tester.scapy_execute() > - > + inst =3D self.tester.tcpdump_sniff_packets(rx_interface, filters= =3Dfilters) > + pkt =3D packet.Packet() > + pkt.append_pkt(etherStr) > + pkt.send_pkt(crb=3Dself.tester, tx_port=3Dtx_interface) > out =3D self.remove_dhcp_from_revpackets(inst) > return len(out) >=20 > @@ -332,20 +333,20 @@ class TestL3fwdacl(TestCase): > etherStr =3D self.create_ipv6_rule_string(rule, "Ether") >=20 > fil =3D [{'layer': 'ether', 'config': {'dst': 'not ff:ff:ff:ff:f= f:ff'}}] > - inst =3D self.tester.tcpdump_sniff_packets(rx_interface, timeout= =3D5, > filters=3Dfil) > - > - self.tester.scapy_append('sendp([%s],iface=3D"%s")' % (etherStr, > tx_interface)) > - self.tester.scapy_execute() > - time.sleep(3) > + inst =3D self.tester.tcpdump_sniff_packets(rx_interface, filters= =3Dfil) > + pkt =3D packet.Packet() > + pkt.append_pkt(etherStr) > + pkt.send_pkt(crb=3Dself.tester, tx_port=3Dtx_interface) >=20 > out =3D self.remove_dhcp_from_revpackets(inst) > return len(out) >=20 > def remove_dhcp_from_revpackets(self, inst): > - pkts =3D self.tester.load_tcpdump_sniff_packets(inst) > + p =3D self.tester.load_tcpdump_sniff_packets(inst) > + pkts =3D p.pktgen.pkts > i =3D 0 > while len(pkts) !=3D 0 and i <=3D len(pkts) - 1: > - if pkts[i].pktgen.pkt.haslayer('DHCP'): > + if pkts[i].haslayer('DHCP'): > pkts.remove(pkts[i]) > i =3D i - 1 > i =3D i + 1 > diff --git a/tests/TestSuite_link_flowctrl.py b/tests/TestSuite_link_flow= ctrl.py > index 4229aa4..ed89162 100644 > --- a/tests/TestSuite_link_flowctrl.py > +++ b/tests/TestSuite_link_flowctrl.py > @@ -453,4 +453,5 @@ class TestLinkFlowctrl(TestCase): > """ > Run after each test case. > """ > + self.dut.kill_all() > self.dut.send_expect("quit", "# ") > diff --git a/tests/TestSuite_link_status_interrupt.py > b/tests/TestSuite_link_status_interrupt.py > index 1d7e67e..3208d71 100644 > --- a/tests/TestSuite_link_status_interrupt.py > +++ b/tests/TestSuite_link_status_interrupt.py > @@ -175,7 +175,7 @@ class TestLinkStatusInterrupt(TestCase): > self.txItf =3D self.tester.get_interface(txport) > pkt =3D Packet(pkt_type=3D'UDP') > pkt.config_layer('ether', {'dst': self.dmac}) > - pkt.send_pkt(tx_port=3Dself.txItf, count=3Dnum) > + pkt.send_pkt(self.tester, tx_port=3Dself.txItf, count=3Dnum) >=20 > def tear_down(self): > """ > diff --git a/tests/TestSuite_loadbalancer.py > b/tests/TestSuite_loadbalancer.py > index 9152c6c..934e291 100644 > --- a/tests/TestSuite_loadbalancer.py > +++ b/tests/TestSuite_loadbalancer.py > @@ -90,13 +90,13 @@ class TestLoadbalancer(TestCase): > for i in range(len(dutPorts)): > dstport =3D self.tester.get_local_port(dutPorts[i]) > pkt_count =3D 10 > - inst =3D > self.tester.tcpdump_sniff_packets(intf=3Dself.tester.get_interface(rx_por= t), > timeout=3D10, count=3Dpkt_count) > + inst =3D > self.tester.tcpdump_sniff_packets(intf=3Dself.tester.get_interface(rx_por= t), > count=3Dpkt_count) >=20 > - pkt =3D Packet() > + pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3D64) > dst_mac =3D self.dut.get_mac_address(dutPorts[i]) > - pkt.config_layer('ether', {'dst': dst_mac}) > - pkt.config_layer('ipv4', {'src': "0.0.0.1", 'dst': traff= icFlow[flow][1]}) > - pkt.send_pkt(tx_port=3Dself.tester.get_interface(dstport= ), count=3D10) > + pkt.config_layer('ether', {'dst': '%s' % dst_mac}) > + pkt.config_layer('ipv4', {'src': "0.0.0.1", 'dst': '%s' = % > (trafficFlow[flow][1])}) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester.get_inte= rface(dstport), > count=3D10) > # Wait for the sniffer to finish. > time.sleep(5) >=20 > @@ -104,8 +104,8 @@ class TestLoadbalancer(TestCase): > len_pkts =3D len(pkts) >=20 > self.verify(len_pkts =3D=3D pkt_count, "Packet number is= wrong") > - for packet in pkts: > - result =3D str(packet.pktgen.pkt.show) > + for i in range(len_pkts): > + result =3D str(pkts[i].show) > self.verify("Ether" in result, "No packet received") > self.verify("src=3D0.0.0.1" + " dst=3D" + trafficFlo= w[flow][1] in result, > "Wrong IP address") > self.verify("dst=3D%s" % dst_mac in result, "No pack= et received or > packet missed") > diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.p= y > index 7b5eb43..19d250b 100644 > --- a/tests/TestSuite_mac_filter.py > +++ b/tests/TestSuite_mac_filter.py > @@ -88,7 +88,7 @@ class TestMacFilter(TestCase): > itf =3D self.tester.get_interface(self.tester.get_local_port(por= tid)) > pkt =3D Packet(pkt_type=3D'UDP') > pkt.config_layer('ether', {'src': '52:00:00:00:00:00', 'dst': de= stMac}) > - pkt.send_pkt(tx_port=3Ditf, count=3D4) > + pkt.send_pkt(self.tester, tx_port=3Ditf, count=3D4) >=20 > def test_add_remove_mac_address(self): > """ > diff --git a/tests/TestSuite_netmap_compat.py > b/tests/TestSuite_netmap_compat.py > index 2f8171c..a7a97ca 100644 > --- a/tests/TestSuite_netmap_compat.py > +++ b/tests/TestSuite_netmap_compat.py > @@ -114,9 +114,9 @@ class TestNetmapCompat(TestCase): >=20 > def get_tcpdump_package(self): > pkts =3D self.tester.load_tcpdump_sniff_packets(self.inst) > - dsts =3D [] > - for packet in pkts: > - dst =3D packet.strip_element_layer2("dst") > + dsts =3D [] > + for i in range(len(pkts)): > + dst =3D pkts.strip_element_layer2("dst", p_index=3Di) > dsts.append(dst) > return dsts >=20 > diff --git a/tests/TestSuite_packet_capture.py > b/tests/TestSuite_packet_capture.py > index 6e5b98f..fdaa0d0 100644 > --- a/tests/TestSuite_packet_capture.py > +++ b/tests/TestSuite_packet_capture.py > @@ -39,8 +39,6 @@ import time > import re > import signal > import subprocess > -import shutil > -import socket > from pprint import pformat >=20 > from scapy.utils import rdpcap > @@ -188,37 +186,19 @@ class parsePacket(object): >=20 > class TestPacketCapture(TestCase): >=20 > - def get_dts_node_ip(self): > - ip_addr =3D None > - try: > - socket_inst =3D socket.socket(socket.AF_INET, socket.SOCK_DG= RAM) > - socket_inst.connect(('8.8.8.8', 80)) > - ip_addr =3D socket_inst.getsockname()[0] > - except Exception as e: > - msg =3D "Can't get dts running node ip address" > - self.logger.warning(msg) > - return ip_addr > - return ip_addr > - > - @property > - def is_dts_on_tester(self): > - if not self.dts_ip: > - return False > - # get tester ip to check if dts run on tester > - tester_ip =3D self.tester.get_ip_address() > - return self.dts_ip =3D=3D tester_ip > - > - @property > - def is_dts_on_dut(self): > - if not self.dts_ip: > - return False > - # get dut ip to check if dts run on dut > - dut_ip =3D self.dut.get_ip_address() > - return self.dts_ip =3D=3D dut_ip > + def is_existed_on_crb(self, check_path, crb=3D'dut'): > + alt_session =3D self.dut.alt_session \ > + if crb =3D=3D 'dut' else \ > + self.tester.alt_session > + alt_session.send_expect("ls %s" % check_path, "# ") > + cmd =3D "echo $?" > + output =3D alt_session.send_expect(cmd, "# ") > + ret =3D True if output and output.strip() =3D=3D "0" else False > + return ret >=20 > @property > def is_dut_on_tester(self): > - # get dut/tester ip to check if they are in one platform > + # get dut/tester ip to check if they are in a platform > tester_ip =3D self.tester.get_ip_address() > dut_ip =3D self.dut.get_ip_address() > return tester_ip =3D=3D dut_ip > @@ -231,42 +211,6 @@ class TestPacketCapture(TestCase): > self.dut.base_dir > return target_dir >=20 > - def __create_log_dir(self, log_dir): > - # create a log directory on dts running node > - if not os.path.exists(log_dir): > - os.makedirs(log_dir) > - # create a log directory on dut node > - if not self.is_dts_on_dut and \ > - not self.is_existed_on_crb(log_dir): > - cmd =3D "mkdir -p {0}".format(log_dir) > - self.dut.alt_session.send_expect(cmd, "# ") > - # create a log directory on tester node > - if not self.is_dts_on_tester and \ > - not self.is_existed_on_crb(log_dir, crb=3D'tester'): > - cmd =3D "mkdir -p {0}".format(log_dir) > - self.tester.alt_session.send_expect(cmd, "# ") > - > - def __clear_log_dir(self, log_dir): > - if os.path.exists(log_dir): > - shutil.rmtree(log_dir) > - os.makedirs(log_dir) > - if not self.is_dts_on_dut: > - self.dut.alt_session.send_expect( > - "rm -fr {0}/*".format(log_dir), "# ", 10) > - if not self.is_dts_on_tester: > - self.tester.alt_session.send_expect( > - "rm -fr {0}/*".format(log_dir), "# ", 10) > - > - def is_existed_on_crb(self, check_path, crb=3D'dut'): > - alt_session =3D self.dut.alt_session \ > - if crb =3D=3D 'dut' else \ > - self.tester.alt_session > - alt_session.send_expect("ls %s > /dev/null 2>&1" % check_path, "= # ") > - cmd =3D "echo $?" > - output =3D alt_session.send_expect(cmd, "# ") > - ret =3D True if output and output.strip() =3D=3D "0" else False > - return ret > - > def get_dut_iface_with_kernel_driver(self): > # only physical nic support PROMISC > cmd =3D "ip link show | grep BROADCAST,MULTICAST | awk {'print $= 2'}" > @@ -500,6 +444,11 @@ class TestPacketCapture(TestCase): > time.sleep(4) >=20 > def start_testpmd(self): > + self.dut.alt_session.send_expect( > + "rm -fr {0}/*".format(self.pdump_log), "# ", 10) > + if not self.is_dut_on_tester: > + self.tester.alt_session.send_expect( > + "rm -fr {0}/*".format(self.pdump_log), "# ", 10) > param_opt =3D "--port-topology=3Dchained" > eal_param =3D '--file-prefix=3Dtest' > self.testpmd.start_testpmd("Default", param=3Dparam_opt, > @@ -516,14 +465,23 @@ class TestPacketCapture(TestCase): > def start_tcpdump_iface(self, option): > if option["rx"][0] is not None and option["tx"][0] is not None a= nd \ > option["rx"][0] =3D=3D option["tx"][0]: > + if self.is_existed_on_crb(self.rxtx_pcap): > + self.dut.alt_session.send_expect( > + "rm -f %s" % self.rxtx_pcap, "# ") > cmd =3D self.tcpdump.format(self.rxtx_iface, self.rxtx_pcap) > self.session_ex.send_expect(cmd, "# ") > else: > if option["rx"][0] is not None: > + if self.is_existed_on_crb(self.rx_pcap): > + self.dut.alt_session.send_expect( > + "rm -f %s" % self.rx_pcap, "# ") > cmd =3D self.tcpdump.format(self.rx_iface, self.rx_pcap) > self.session_ex.send_expect(cmd, "# ") >=20 > if option["tx"][0] is not None: > + if self.is_existed_on_crb(self.tx_pcap): > + self.dut.alt_session.send_expect( > + "rm -f %s" % self.tx_pcap, "# ") > cmd =3D self.tcpdump.format(self.tx_iface, self.tx_pcap) > self.session_ex.send_expect(cmd, "# ") > time.sleep(4) > @@ -537,6 +495,11 @@ class TestPacketCapture(TestCase): > msg =3D ('pdump option string length should be less than {}' > ).format(length_limit) > self.verify(len(option) < length_limit, msg) > + self.dut.alt_session.send_expect( > + "rm -fr {0}/*".format(self.pdump_log), "# ", 20) > + if not self.is_dut_on_tester: > + self.tester.alt_session.send_expect( > + "rm -fr {0}/*".format(self.pdump_log), "# ", 20) > cmd =3D ';'.join([ > "cd %s" % self.target_dir, > self.dpdk_pdump + " '%s' >/dev/null 2>&1 &" % (option[0])]) > @@ -572,13 +535,18 @@ class TestPacketCapture(TestCase): > # check send tx packet by port 0 > # send packet to dut and compare dpdk-pdump dump pcap with > # scapy pcap file > - if self.is_dts_on_tester: > - intf =3D self.tester.get_interface(self.tester.get_local_por= t(port_1)) > - # prepare to catch replay packet in out port > - recPkt =3D os.path.join('/tmp', "sniff_%s.pcap" % intf) > - if os.path.exists(recPkt): > - os.remove(recPkt) > - index =3D sniff_packets(intf, count=3D1, timeout=3D20, pcap= =3DrecPkt) > + intf =3D self.tester.get_interface(self.tester.get_local_port(po= rt_1)) > + # prepare to catch replay packet in out port > + recPkt =3D os.path.join('/tmp', "sniff_%s.pcap" % intf) > + if os.path.exists(recPkt): > + os.remove(recPkt) > + if pkt_type =3D=3D 'LLDP': > + index =3D self.tester.tcpdump_sniff_packets(intf=3Dintf, cou= nt=3D1, > lldp_forbid=3DFalse) > + else: > + index =3D self.tester.tcpdump_sniff_packets(intf=3Dintf, cou= nt=3D1) > + filename =3D '{}sniff_{}.pcap'.format(self.tester.tmp_file, intf= ) > + self.tester.session.copy_file_from(filename, recPkt) > + # index =3D sniff_packets(intf, count=3D1, timeout=3D20, pcap=3D= recPkt) > pkt =3D Packet(pkt_type=3Dpkt_type) > if pkt_type =3D=3D 'VLAN_UDP': > pkt.config_layer('dot1q', {'vlan': 20}) > @@ -588,33 +556,34 @@ class TestPacketCapture(TestCase): > refPkt =3D self.send_pcap % (pkt_type, "rx", number) > if os.path.exists(refPkt): > os.remove(refPkt) > - pkt.pktgen.write_pcap(refPkt) > + > + pkt.save_pcapfile(filename=3DrefPkt) > # send out test packet > tester_port =3D self.tester.get_local_port(port_0) > intf =3D self.tester.get_interface(tester_port) > - pkt.send_pkt( > - crb=3D None if self.is_dts_on_tester else self.tester, > - tx_port=3Dintf) > + pkt.send_pkt(self.tester, tx_port=3Dintf) > # load pcap file caught by out port > time.sleep(1) > - # when dts doesn't run on tester, ignore this testing content > - if self.is_dts_on_tester: > - load_sniff_packets(index) > - # compare pcap file received by out port with scapy referenc= e > - # packet pcap file > - warning =3D self.compare_pkts(refPkt, recPkt, pkt_type) > - msg =3D "tcpdump rx Receive Packet error: {0}".format(warnin= g) > - self.verify(not warning, msg) > + pkts =3D self.tester.load_tcpdump_sniff_packets(index) > + pkts.save_pcapfile(filename=3DrecPkt) > + # load_sniff_packets(index) > + # compare pcap file received by out port with scapy reference > + # packet pcap file > + warning =3D self.compare_pkts(refPkt, recPkt, pkt_type) > + msg =3D "tcpdump rx Receive Packet error: {0}".format(warning) > + self.verify(not warning, msg) > # check send tx packet by port 1 > # send packet to dut and compare dpdk-pdump dump pcap > # with scapy pcap file > - if self.is_dts_on_tester: > - intf =3D self.tester.get_interface(self.tester.get_local_por= t(port_0)) > - # prepare to catch replay packet in out port > - recPkt =3D os.path.join('/tmp', "sniff_%s.pcap" % intf) > - if os.path.exists(recPkt): > - os.remove(recPkt) > - index =3D sniff_packets(intf, count=3D1, timeout=3D20, pcap= =3DrecPkt) > + intf =3D self.tester.get_interface(self.tester.get_local_port(po= rt_0)) > + # prepare to catch replay packet in out port > + recPkt =3D os.path.join('/tmp', "sniff_%s.pcap" % intf) > + if os.path.exists(recPkt): > + os.remove(recPkt) > + if pkt_type =3D=3D 'LLDP': > + index =3D self.tester.tcpdump_sniff_packets(intf=3Dintf, cou= nt=3D1, > lldp_forbid=3DFalse) > + else: > + index =3D self.tester.tcpdump_sniff_packets(intf=3Dintf, cou= nt=3D1) > pkt =3D Packet(pkt_type=3Dpkt_type) > if pkt_type =3D=3D 'VLAN_UDP': > pkt.config_layer('dot1q', {'vlan': 20}) > @@ -624,23 +593,21 @@ class TestPacketCapture(TestCase): > refPkt =3D self.send_pcap % (pkt_type, "tx", number) > if os.path.exists(refPkt): > os.remove(refPkt) > - pkt.pktgen.write_pcap(refPkt) > + pkt.save_pcapfile(filename=3DrefPkt) > + # pkt.pktgen.write_pcap(refPkt) > # send out test packet > tester_port =3D self.tester.get_local_port(port_1) > intf =3D self.tester.get_interface(tester_port) > - pkt.send_pkt( > - crb=3D None if self.is_dts_on_tester else self.tester, > - tx_port=3Dintf) > + pkt.send_pkt(self.tester, tx_port=3Dintf) > # load pcap file caught by out port > time.sleep(1) > - # when dts doesn't run on tester, ignore this testing content > - if self.is_dts_on_tester: > - load_sniff_packets(index) > - # compare pcap file received by out port > - # with scapy reference packet pcap file > - warning =3D self.compare_pkts(refPkt, recPkt, pkt_type) > - msg =3D "tcpdump tx Receive Packet error: {0}".format(warnin= g) > - self.verify(not warning, msg) > + pkts =3D self.tester.load_tcpdump_sniff_packets(index) > + pkts.save_pcapfile(filename=3DrecPkt) > + # compare pcap file received by out port > + # with scapy reference packet pcap file > + warning =3D self.compare_pkts(refPkt, recPkt, pkt_type) > + msg =3D "tcpdump tx Receive Packet error: {0}".format(warning) > + self.verify(not warning, msg) >=20 > def check_pdump_pcaps(self, pkt_type, number, **kwargs): > rx_dump_pcap =3D kwargs["rx"][0] > @@ -686,23 +653,8 @@ class TestPacketCapture(TestCase): > msg =3D "pdump tx {0} packet content is correct".format(pkt_= type) > self.logger.info(msg) >=20 > - def sync_dut_dump_file(self): > - if self.is_dts_on_dut: > - return > - # copy rx pdump data from dut > - if os.path.exists(self.rx_pcap): > - os.remove(self.rx_pcap) > - if self.is_existed_on_crb(self.rx_pcap): > - self.dut.session.copy_file_from(self.rx_pcap, self.rx_pcap) > - # copy tx pdump data from dut > - if os.path.exists(self.tx_pcap): > - os.remove(self.tx_pcap) > - if self.is_existed_on_crb(self.tx_pcap): > - self.dut.session.copy_file_from(self.tx_pcap, self.tx_pcap) > - > def packet_capture_test_packets(self, option): > self.clear_ASLR() > - self.__clear_log_dir(self.pdump_log) > self.start_testpmd() > self.start_dpdk_pdump(option) > if self.dev_iface_flag: > @@ -713,7 +665,17 @@ class TestPacketCapture(TestCase): > time.sleep(2) > if self.dev_iface_flag: > self.stop_tcpdump_iface() > - self.sync_dut_dump_file() > + if not self.is_dut_on_tester: > + # copy rx pdump data from dut > + if self.is_existed_on_crb(self.rx_pcap): > + if os.path.exists(self.rx_pcap): > + os.remove(self.rx_pcap) > + self.dut.session.copy_file_from(self.rx_pcap, self.rx_pc= ap) > + # copy tx pdump data from dut > + if self.is_existed_on_crb(self.tx_pcap): > + if os.path.exists(self.tx_pcap): > + os.remove(self.tx_pcap) > + self.dut.session.copy_file_from(self.tx_pcap, self.tx_pc= ap) > self.stop_dpdk_pdump() > self.stop_testpmd() > self.reset_ASLR() > @@ -838,8 +800,6 @@ class TestPacketCapture(TestCase): > ''' > Run at the start of each test suite. > ''' > - # get dts running node ip address > - self.dts_ip =3D self.get_dts_node_ip() > self.verify(self.target =3D=3D "x86_64-native-linuxapp-gcc", > "only support x86_64-native-linuxapp-gcc") > self.dut_ports =3D self.dut.get_ports() > @@ -851,7 +811,13 @@ class TestPacketCapture(TestCase): > self.dut_skip_compile =3D self.dut.skip_setup > # used for save log > self.pdump_log =3D os.sep.join(["/tmp", 'pdumpLog']) > - self.__create_log_dir(self.pdump_log) > + if not self.is_existed_on_crb(self.pdump_log): > + cmd =3D "mkdir -p {0}".format(self.pdump_log) > + self.dut.alt_session.send_expect(cmd, "# ") > + if not self.is_dut_on_tester and \ > + not self.is_existed_on_crb(self.pdump_log, crb=3D'tester'): > + cmd =3D "mkdir -p {0}".format(self.pdump_log) > + self.tester.alt_session.send_expect(cmd, "# ") > self.pcap_SW =3D "CONFIG_RTE_LIBRTE_PMD_PCAP" > self.SW_file =3D os.path.join(self.target_dir, 'config/common_ba= se') > if not (self.dut_skip_compile and self.check_pcap_lib()): > @@ -861,19 +827,17 @@ class TestPacketCapture(TestCase): > self.dut.skip_setup =3D False > self.dut.build_install_dpdk(self.target) > # secondary process (dpdk-pdump) > - self.pdump_dir =3D os.sep.join([ > - self.target_dir, > - "%s/build/app/pdump/" % self.target]) > + self.pdump_dir =3D self.target_dir + os.sep + \ > + "%s/build/app/pdump/" % self.target > cmd =3D "ls {0} -F | grep '*'".format(self.pdump_dir) > exe_files =3D self.dut.alt_session.send_expect(cmd, "# ").splitl= ines() > if len(exe_files) =3D=3D 1: > self.tool_name =3D exe_files[0][:-1] > else: > self.verify(False, "tool name exception !") > - self.dut_dpdk_pdump_dir =3D os.sep.join([ > - self.target_dir, > - "%s/app/%s" % (self.target, self.tool_name)]) > self.session_ex =3D self.dut.new_session(self.tool_name) > + self.dut_dpdk_pdump_dir =3D self.target_dir + os.sep + \ > + "%s/app/%s" % (self.target, self.tool_name) > self.dpdk_pdump =3D self.dut_dpdk_pdump_dir + \ > " -v --file-prefix=3Dtest -- --pdump " > self.send_pcap =3D os.sep.join([self.pdump_log, > "scapy_%s_%s_%d.pcap"]) > diff --git a/tests/TestSuite_ptype_mapping.py > b/tests/TestSuite_ptype_mapping.py > index b0dc70a..b352724 100644 > --- a/tests/TestSuite_ptype_mapping.py > +++ b/tests/TestSuite_ptype_mapping.py > @@ -85,7 +85,7 @@ class TestPtype_Mapping(TestCase): > else: > pkt_names =3D pkt_types[pkt_type] > pkt =3D Packet(pkt_type=3Dpkt_type) > - pkt.send_pkt(tx_port=3Dself.tester_iface,count=3D4) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_iface,count= =3D4) > out =3D self.dut.get_session_output(timeout=3D2) > if sw_ptype !=3D None: > self.verify(sw_ptype in out, > diff --git a/tests/TestSuite_pvp_multi_paths_performance.py > b/tests/TestSuite_pvp_multi_paths_performance.py > index b633b98..65c785a 100644 > --- a/tests/TestSuite_pvp_multi_paths_performance.py > +++ b/tests/TestSuite_pvp_multi_paths_performance.py > @@ -36,7 +36,7 @@ Test PVP performance using virtio_user on 8 tx/rx path. >=20 > import utils > from test_case import TestCase > -from packet import Packet, save_packets > +from packet import Packet > from pktgen import PacketGeneratorHelper >=20 >=20 > @@ -98,7 +98,7 @@ class TestPVPMultiPathPerformance(TestCase): >=20 > pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dframe_size) > pkt.config_layer('ether', {'dst': '%s' % destination_mac}) > - save_packets([pkt], "%s/multi_path_%d.pcap" % (self.out_path= , port)) > + pkt.save_pcapfile(self.tester, "%s/multi_path_%d.pcap" % > (self.out_path, port)) > tgen_input.append((tx_port, rx_port, "%s/multi_path_%d.pcap"= % > (self.out_path, port))) >=20 > self.tester.pktgen.clear_streams() > diff --git > a/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py > b/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py > index fcaadf2..29d87c2 100644 > --- a/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py > +++ b/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py > @@ -36,7 +36,7 @@ Test PVP vhost single core performance using > virtio_user on 8 tx/rx path. >=20 > import utils > from test_case import TestCase > -from packet import Packet, save_packets > +from packet import Packet > from pktgen import PacketGeneratorHelper >=20 >=20 > @@ -95,7 +95,7 @@ class TestPVPMultiPathVhostPerformance(TestCase): >=20 > pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dframe_size) > pkt.config_layer('ether', {'dst': '%s' % destination_mac}) > - save_packets([pkt], "%s/multi_path_%d.pcap" % (self.out_path= , port)) > + pkt.save_pcapfile(self.tester, "%s/multi_path_%d.pcap" % > (self.out_path, port)) > tgen_input.append((tx_port, rx_port, "%s/multi_path_%d.pcap"= % > (self.out_path, port))) >=20 > self.tester.pktgen.clear_streams() > diff --git > a/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py > b/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py > index 6cd3a6d..e8807a7 100644 > --- a/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py > +++ b/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py > @@ -36,7 +36,7 @@ Test PVP virtio single core performance using > virtio_user on 8 tx/rx path. >=20 > import utils > from test_case import TestCase > -from packet import Packet, save_packets > +from packet import Packet > from pktgen import PacketGeneratorHelper >=20 >=20 > @@ -98,7 +98,7 @@ class TestPVPMultiPathVirtioPerformance(TestCase): >=20 > pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dframe_size) > pkt.config_layer('ether', {'dst': '%s' % destination_mac}) > - save_packets([pkt], "%s/multi_path_%d.pcap" % (self.out_path= , port)) > + pkt.save_pcapfile(self.tester, "%s/multi_path_%d.pcap" % > (self.out_path, port)) >=20 > tgen_input.append((tx_port, rx_port, "%s/multi_path_%d.pcap"= % > (self.out_path, port))) >=20 > diff --git a/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py > b/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py > index 0095ce2..ea2e1cd 100644 > --- a/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py > +++ b/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py > @@ -43,7 +43,7 @@ import time > import re > from virt_common import VM > from test_case import TestCase > -from packet import Packet, save_packets > +from packet import Packet > from pktgen import PacketGeneratorHelper >=20 >=20 > @@ -72,7 +72,6 @@ class TestPVPQemuMultiPathPortRestart(TestCase): > self.tester.send_expect('mkdir -p %s' % self.out_path, '# ') > # create an instance to set stream field setting > self.pktgen_helper =3D PacketGeneratorHelper() > - self.base_dir =3D self.dut.base_dir.replace('~', '/root') >=20 > def set_up(self): > """ > @@ -94,14 +93,14 @@ class TestPVPQemuMultiPathPortRestart(TestCase): > start testpmd on vhost > """ > self.dut.send_expect("killall -s INT testpmd", "#") > - self.dut.send_expect("rm -rf %s/vhost-net*" % self.base_dir, "#"= ) > + self.dut.send_expect("rm -rf ./vhost-net*", "#") > command_client =3D self.dut.target + "/app/testpmd " + \ > " -n %d -c %s --socket-mem 1024,1024 " + \ > " --legacy-mem --file-prefix=3Dvhost " + \ > - " --vdev 'net_vhost0,iface=3D%s/vhost-net,queue= s=3D1' " + \ > + " --vdev 'net_vhost0,iface=3Dvhost-net,queues= =3D1' " + \ > " -- -i --nb-cores=3D1 --txd=3D1024 --rxd=3D102= 4" > command_line_client =3D command_client % ( > - self.dut.get_memory_channels(), self.core_mask, self.base_di= r) > + self.dut.get_memory_channels(), self.core_mask) > self.vhost.send_expect(command_line_client, "testpmd> ", 120) > self.vhost.send_expect("set fwd mac", "testpmd> ", 120) > self.vhost.send_expect("start", "testpmd> ", 120) > @@ -134,7 +133,7 @@ class TestPVPQemuMultiPathPortRestart(TestCase): > self.vm =3D VM(self.dut, 'vm0', 'vhost_sample') > vm_params =3D {} > vm_params['driver'] =3D 'vhost-user' > - vm_params['opt_path'] =3D '%s/vhost-net' % self.base_dir > + vm_params['opt_path'] =3D './vhost-net' > vm_params['opt_mac'] =3D self.virtio1_mac > if modem =3D=3D 1 and mergeable =3D=3D 0: > vm_params['opt_settings'] =3D "disable- > modern=3Dfalse,mrg_rxbuf=3Doff,rx_queue_size=3D1024,tx_queue_size=3D1024" > @@ -206,7 +205,7 @@ class TestPVPQemuMultiPathPortRestart(TestCase): > """ > pkt =3D Packet(pkt_type=3D'IP_RAW', pkt_len=3Dframe_size) > pkt.config_layer('ether', {'dst': '%s' % self.dst_mac}) > - save_packets([pkt], "%s/pvp_multipath.pcap" % (self.out_path)) > + pkt.save_pcapfile(self.tester, "%s/pvp_multipath.pcap" % > (self.out_path)) >=20 > tgenInput =3D [] > port =3D self.tester.get_local_port(self.dut_ports[0]) > diff --git a/tests/TestSuite_pvp_vhost_user_reconnect.py > b/tests/TestSuite_pvp_vhost_user_reconnect.py > index c5c7b96..16a93b0 100644 > --- a/tests/TestSuite_pvp_vhost_user_reconnect.py > +++ b/tests/TestSuite_pvp_vhost_user_reconnect.py > @@ -41,7 +41,7 @@ import utils > import time > from test_case import TestCase > from virt_common import VM > -from packet import Packet, save_packets > +from packet import Packet > from pktgen import PacketGeneratorHelper >=20 >=20 > @@ -83,7 +83,6 @@ class TestPVPVhostUserReconnect(TestCase): > self.tester.send_expect('mkdir -p %s' % self.out_path, '# ') > # create an instance to set stream field setting > self.pktgen_helper =3D PacketGeneratorHelper() > - self.base_dir =3D self.dut.base_dir.replace('~', '/root') >=20 > def set_up(self): > """ > @@ -92,7 +91,7 @@ class TestPVPVhostUserReconnect(TestCase): > """ > self.dut.send_expect("killall -s INT testpmd", "# ") > self.dut.send_expect("killall -s INT qemu-system-x86_64", "# ") > - self.dut.send_expect("rm -rf %s/vhost-net*" % self.base_dir, "# = ") > + self.dut.send_expect("rm -rf ./vhost-net*", "# ") > self.vhost_user =3D self.dut.new_session(suite=3D"vhost-user") >=20 > def launch_testpmd_as_vhost_user(self): > @@ -101,7 +100,7 @@ class TestPVPVhostUserReconnect(TestCase): > """ > vdev_info =3D "" > for i in range(self.vm_num): > - vdev_info +=3D "--vdev 'net_vhost%d,iface=3D%s/vhost- > net%d,client=3D1,queues=3D1' " % (i, self.base_dir, i) > + vdev_info +=3D "--vdev 'net_vhost%d,iface=3Dvhost- > net%d,client=3D1,queues=3D1' " % (i, i) > self.vhostapp_testcmd =3D self.dut.base_dir + \ > "/%s/app/testpmd -c %s -n %d --socket-mem %s --legac= y-mem" + > \ > " --file-prefix=3Dvhost %s" + \ > @@ -120,7 +119,7 @@ class TestPVPVhostUserReconnect(TestCase): > """ > vdev_info =3D "" > for i in range(self.vm_num): > - vdev_info +=3D "--vdev 'net_vhost%d,iface=3D%s/vhost- > net%d,client=3D1,queues=3D1' " % (i, self.base_dir, i) > + vdev_info +=3D "--vdev 'net_vhost%d,iface=3Dvhost- > net%d,client=3D1,queues=3D1' " % (i, i) > self.vhostapp_testcmd =3D self.dut.base_dir + \ > "/%s/app/testpmd -c %s -n %d --socket-mem %s --legac= y-mem" + > \ > " --no-pci --file-prefix=3Dvhost %s" + \ > @@ -181,7 +180,7 @@ class TestPVPVhostUserReconnect(TestCase): > vm_info =3D VM(self.dut, 'vm%d' % i, 'vhost_sample') > vm_params =3D {} > vm_params['driver'] =3D 'vhost-user' > - vm_params['opt_path'] =3D '%s/vhost-net%d' % (self.base_dir,= i) > + vm_params['opt_path'] =3D './vhost-net%d' % (i) > vm_params['opt_mac'] =3D '52:54:00:00:00:0%d' % (i+1) > vm_params['opt_server'] =3D 'server' > vm_params['opt_settings'] =3D > 'mrg_rxbuf=3Don,rx_queue_size=3D1024,tx_queue_size=3D1024' > @@ -273,7 +272,7 @@ class TestPVPVhostUserReconnect(TestCase): > pkt =3D Packet(pkt_type =3D 'UDP', pkt_len =3D frame_size) > pkt.config_layers([('ether', {'dst': '%s' % self.dst_mac}), > ('ipv4', {'dst': '%s' % self.dst1, 'src': '%= s' % self.src1})]) > - save_packets([pkt], "%s/reconnect.pcap" % self.out_path) > + pkt.save_pcapfile(self.tester, "%s/reconnect.pcap" % self.ou= t_path) >=20 > tgenInput =3D [] > port =3D self.tester.get_local_port(self.pf) > diff --git a/tests/TestSuite_pvp_virtio_bonding.py > b/tests/TestSuite_pvp_virtio_bonding.py > index 4fb94f2..874c058 100644 > --- a/tests/TestSuite_pvp_virtio_bonding.py > +++ b/tests/TestSuite_pvp_virtio_bonding.py > @@ -40,7 +40,7 @@ import utils > from test_case import TestCase > from virt_common import VM > from pmd_output import PmdOutput > -from packet import Packet, save_packets > +from packet import Packet > from pktgen import PacketGeneratorHelper >=20 >=20 > @@ -69,7 +69,6 @@ class TestPVPVirtIOBonding(TestCase): > self.tester.send_expect('mkdir -p %s' % self.out_path, '# ') > # create an instance to set stream field setting > self.pktgen_helper =3D PacketGeneratorHelper() > - self.base_dir =3D self.dut.base_dir.replace('~', '/root') >=20 > def set_up(self): > """ > @@ -87,7 +86,7 @@ class TestPVPVirtIOBonding(TestCase): > """ > vdev_info =3D "" > for i in range(self.queues): > - vdev_info +=3D "--vdev 'net_vhost%d,iface=3D%s/vhost- > net%d,client=3D1,queues=3D1' " % (i, self.base_dir, i) > + vdev_info +=3D "--vdev 'net_vhost%d,iface=3Dvhost- > net%d,client=3D1,queues=3D1' " % (i, i) > params =3D "--port-topology=3Dchained --nb-cores=3D4 --txd=3D102= 4 --rxd=3D1024" > eal_param =3D "--socket-mem 2048,2048 --legacy-mem --file- > prefix=3Dvhost %s " % vdev_info > self.vhost_testpmd =3D PmdOutput(self.dut) > @@ -168,7 +167,7 @@ class TestPVPVirtIOBonding(TestCase): > tx_port =3D self.tester.get_local_port(self.dut_ports[0]) > pkt =3D Packet(pkt_type=3D'UDP') > pkt.config_layer('ether', {'dst': '%s' % self.dst_mac}) > - save_packets([pkt], "%s/bonding.pcap" % self.out_path) > + pkt.save_pcapfile(self.tester, "%s/bonding.pcap" % self.out_path= ) > tgen_input.append((tx_port, rx_port, "%s/bonding.pcap" % > self.out_path)) > self.tester.pktgen.clear_streams() > streams =3D self.pktgen_helper.prepare_stream_from_tginput(tgen_= input, > 100, None, self.tester.pktgen) > @@ -196,7 +195,7 @@ class TestPVPVirtIOBonding(TestCase): > for i in range(self.queues): > vm_params['opt_server'] =3D 'server' > vm_params['driver'] =3D 'vhost-user' > - vm_params['opt_path'] =3D '%s/vhost-net%d' % (self.base_dir,= i) > + vm_params['opt_path'] =3D './vhost-net%d' % i > vm_params['opt_mac'] =3D "%s%d" % (virtio_mac, i+1) > self.vm.set_vm_device(**vm_params) > self.set_vm_vcpu() > diff --git a/tests/TestSuite_pvp_virtio_user_4k_pages.py > b/tests/TestSuite_pvp_virtio_user_4k_pages.py > index d2b8df7..95b5494 100644 > --- a/tests/TestSuite_pvp_virtio_user_4k_pages.py > +++ b/tests/TestSuite_pvp_virtio_user_4k_pages.py > @@ -37,7 +37,7 @@ vhost/virtio-user pvp with 4K pages. > import utils > import time > from test_case import TestCase > -from packet import Packet, save_packets > +from packet import Packet > from pktgen import PacketGeneratorHelper >=20 >=20 > @@ -108,7 +108,7 @@ class TestPvpVirtioUser4kPages(TestCase): > tx_port =3D self.tester.get_local_port(self.dut_ports[0]) > pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dframe_size) > pkt.config_layer('ether', {'dst': '%s' % self.dst_mac}) > - save_packets([pkt], "%s/vhost.pcap" % self.out_path) > + pkt.save_pcapfile(self.tester, "%s/vhost.pcap" % self.out_pa= th) > tgen_input.append((tx_port, rx_port, "%s/vhost.pcap" % > self.out_path)) >=20 > self.tester.pktgen.clear_streams() > @@ -138,7 +138,6 @@ class TestPvpVirtioUser4kPages(TestCase): > command_line_client =3D command_line_client % (self.target, > self.core_mask_vhost_user, self.mem_channels= , > self.ports_socket) > self.vhost_user.send_expect(command_line_client, "testpmd> ", 12= 0) > - self.vhost_user.send_expect("set fwd mac", "testpmd> ", 120) > self.vhost_user.send_expect("start", "testpmd> ", 120) >=20 > def start_testpmd_as_virtio(self): > diff --git a/tests/TestSuite_queue_region.py > b/tests/TestSuite_queue_region.py > index a4d9bf7..eea873e 100644 > --- a/tests/TestSuite_queue_region.py > +++ b/tests/TestSuite_queue_region.py > @@ -148,7 +148,7 @@ class TestQueue_region(TestCase): > pkt =3D Packet() > pkt.assign_layers(['ether', 'raw']) > pkt.config_layer('ether', {'dst': mac, 'src': self.tester_ma= c, 'type': > ethertype}) > - pkt.send_pkt(tx_port=3Dself.tester_intf) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_intf) >=20 > def send_packet_up(self, mac, pkt_type=3D"udp", prio=3D0): > """ > @@ -173,7 +173,7 @@ class TestQueue_region(TestCase): > pkt.assign_layers(['ether', 'vlan', 'ipv6', 'udp', 'raw']) > pkt.config_layer('ether', {'dst': mac, 'src': self.tester_ma= c}) > pkt.config_layer('vlan', {'vlan': 0, 'prio': prio}) > - pkt.send_pkt(tx_port=3Dself.tester_intf) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_intf) >=20 > def get_and_compare_rules(self, out, QueueRegion_num, FlowType_num, > UP_num): > """ > diff --git a/tests/TestSuite_queue_start_stop.py > b/tests/TestSuite_queue_start_stop.py > index e91ea91..48f9c1a 100644 > --- a/tests/TestSuite_queue_start_stop.py > +++ b/tests/TestSuite_queue_start_stop.py > @@ -101,11 +101,11 @@ class TestQueueStartStop(TestCase): > pkt =3D Packet(pkt_type=3D"UDP", pkt_len=3DpktSize) > inst =3D self.tester.tcpdump_sniff_packets(rxitf) > pkt.config_layer('ether', {'dst': dmac}) > - pkt.send_pkt(tx_port=3Dtxitf, count=3D4) > + pkt.send_pkt(self.tester, tx_port=3Dtxitf, count=3D4) > sniff_pkts =3D self.tester.load_tcpdump_sniff_packets(inst) >=20 > if received: > - res =3D strip_pktload(sniff_pkts[0], layer=3D"L4") > + res =3D strip_pktload(sniff_pkts, layer=3D"L4") > self.verify("58 58 58 58 58 58 58 58" in res, "receive queue= not work as > expected") > else: > self.verify(len(sniff_pkts) =3D=3D 0, "stop queue not work a= s expected") > diff --git a/tests/TestSuite_quota_watermark.py > b/tests/TestSuite_quota_watermark.py > index ad4ec3b..0541eef 100644 > --- a/tests/TestSuite_quota_watermark.py > +++ b/tests/TestSuite_quota_watermark.py > @@ -310,7 +310,7 @@ class TestQuotaWatermark(TestCase, > IxiaPacketGenerator): > rx_intf =3D self.tester.get_interface(rev_port) > tx_intf =3D self.tester.get_interface(send_port) > # send and sniff packet > - rx_inst =3D self.tester.tcpdump_sniff_packets(rx_intf, timeout= =3D5) > + rx_inst =3D self.tester.tcpdump_sniff_packets(rx_intf) > self.send_pcap_pkt_by_scapy(self.tester, tgen_input[0][2], tx_in= tf) > pkts =3D self.tester.load_tcpdump_sniff_packets(rx_inst) > self.verify(len(pkts) =3D=3D pkt_cnt, "Packet not forwarded as e= xpected") > diff --git a/tests/TestSuite_runtime_vf_queue_number.py > b/tests/TestSuite_runtime_vf_queue_number.py > index 63a5e18..227d815 100644 > --- a/tests/TestSuite_runtime_vf_queue_number.py > +++ b/tests/TestSuite_runtime_vf_queue_number.py > @@ -39,6 +39,7 @@ import re > from qemu_kvm import QEMUKvm > from test_case import TestCase > from pmd_output import PmdOutput > +from packet import Packet >=20 > RSS_KEY =3D > '6EA6A420D5138E712433B813AE45B3C4BECB2B405F31AD6C331835372D15E > 2D5E49566EE0ED1962AFA1B7932F3549520FD71C75E' > PACKET_COUNT =3D 100 > @@ -128,15 +129,9 @@ class TestRuntimeVfQn(TestCase): > """ > Sends packets. > """ > - self.tester.scapy_foreground() > - time.sleep(2) > - for i in range(integer): > - quotient =3D i // 254 > - remainder =3D i % 254 > - packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/IP(src=3D"10.0.0.1", dst=3D"192.168.%d.%d")], > iface=3D"%s")' % (vf_mac, itf, quotient, remainder + 1, itf) > - self.tester.scapy_append(packet) > - self.tester.scapy_execute() > - time.sleep(2) > + pkt =3D Packet() > + pkt.generate_random_pkts(vf_mac, pktnum=3Dinteger, > random_type=3D['IP_RAW']) > + pkt.send_pkt(self.tester, tx_port=3Ditf) >=20 > def verify_queue_number(self, outstring, qn, pkt_count): > total_rx =3D [] > diff --git a/tests/TestSuite_runtime_vf_queue_number_kernel.py > b/tests/TestSuite_runtime_vf_queue_number_kernel.py > index 9416f13..73d40c2 100644 > --- a/tests/TestSuite_runtime_vf_queue_number_kernel.py > +++ b/tests/TestSuite_runtime_vf_queue_number_kernel.py > @@ -41,6 +41,7 @@ import utils > from pmd_output import PmdOutput > from test_case import TestCase > from virt_common import VM > +from packet import Packet >=20 > VM_CORES_MASK =3D 'all' >=20 > @@ -75,6 +76,7 @@ class TestRuntimeVfQueueNumberKernel(TestCase): >=20 > def set_up(self): > pass > + > def setup_1pf_2vf_1vm_env(self,driver=3D"default"): >=20 > self.used_dut_port =3D self.dut_ports[0] > @@ -90,9 +92,7 @@ class TestRuntimeVfQueueNumberKernel(TestCase): > if driver =3D=3D 'igb_uio': > # start testpmd without the two VFs on the host > self.host_testpmd =3D PmdOutput(self.dut) > - eal_param =3D '-b %(vf0)s -b %(vf1)s' % {'vf0': > self.sriov_vfs_port[0].pci, > - 'vf1': self.sriov= _vfs_port[1].pci} > - self.host_testpmd.start_testpmd("Default", eal_param=3De= al_param) > + self.host_testpmd.start_testpmd("Default") > # set up VM0 ENV > self.vm0 =3D VM(self.dut, 'vm0', 'runtime_vf_queue_number_ke= rnel') > self.vm0.set_vm_device(driver=3Dself.vf_assign_method, **vf0= _prop) > @@ -131,15 +131,11 @@ class > TestRuntimeVfQueueNumberKernel(TestCase): >=20 > self.setup_1pf_2vf_1vm_env_flag =3D 0 >=20 > - def send_packet2different_queue(self, dts, src, iface, count): > - self.tester.scapy_foreground() > - for i in range(1,count+1): > - j =3D (i//255)%255 > - k =3D i%255 > - pkt =3D 'sendp([Ether(dst=3D"%s", > src=3D"%s")/IP(src=3D"192.168.%d.%d",dst=3D"192.168.13.%d")/("test"*10)],= iface=3D" > %s")' % ( > - dts, src, j,k,k, iface) > - self.tester.scapy_append(pkt) > - self.tester.scapy_execute() > + def send_packet2different_queue(self, dst, src, iface, count): > + pkt =3D Packet() > + pkt.generate_random_pkts(pktnum=3Dcount, random_type=3D['IP_RAW'= ], > + options=3D{'layers_config': [('ether', = {'dst': '%s' % dst, 'src': > '%s' % src})]}) > + pkt.send_pkt(self.tester, tx_port=3Diface) >=20 > def check_result(self, nr_queue, out, out2, pkts_num, count, misc): > if nr_queue =3D=3D 1: > @@ -189,7 +185,7 @@ class TestRuntimeVfQueueNumberKernel(TestCase): >=20 > self.vm0_testpmd.execute_cmd('set verbose 1') > self.vm0_testpmd.execute_cmd('set promisc all off') > - #set rss-hash-key to a fixed value instead of default random value > on vf > + #set rss-hash-key to a fixed value instead of default random val= ue on vf > self.vm0_testpmd.execute_cmd('port config 0 rss-hash-key ipv4 > 6EA6A420D5138E712433B813AE45B3C4BECB2B405F31AD6C331835372D15E > 2D5E49566EE0ED1962AFA1B7932F3549520FD71C75E') > time.sleep(1) > self.vm0_testpmd.execute_cmd('set fwd mac') > @@ -297,6 +293,7 @@ class TestRuntimeVfQueueNumberKernel(TestCase): >=20 > def tear_down(self): > self.vm0_testpmd.execute_cmd('quit', '# ') > + self.dut.kill_all() >=20 > def tear_down_all(self): > self.logger.info("tear_down_all") > diff --git a/tests/TestSuite_rxtx_callbacks.py > b/tests/TestSuite_rxtx_callbacks.py > index 76ad70f..a2da0d9 100644 > --- a/tests/TestSuite_rxtx_callbacks.py > +++ b/tests/TestSuite_rxtx_callbacks.py > @@ -90,8 +90,8 @@ class TestRxtxCallbacks(TestCase): > def get_tcpdump_package(self,inst): > pkts =3D self.tester.load_tcpdump_sniff_packets(inst) > dsts =3D [] > - for packet in pkts: > - dst =3D packet.strip_element_layer2("dst") > + for i in range(len(pkts)): > + dst =3D pkts.strip_element_layer2("dst", p_index=3Di) > dsts.append(dst) > return dsts >=20 > diff --git a/tests/TestSuite_scatter.py b/tests/TestSuite_scatter.py > index cc441df..6802f52 100644 > --- a/tests/TestSuite_scatter.py > +++ b/tests/TestSuite_scatter.py > @@ -85,12 +85,12 @@ class TestScatter(TestCase): > inst =3D self.tester.tcpdump_sniff_packets(self.intf) > pkt =3D Packet(pkt_type=3D"IP_RAW", pkt_len=3Dpktsize) > pkt.config_layer('ether', {'dst': dmac}) > - pkt.send_pkt(tx_port=3Dself.intf) > + pkt.send_pkt(self.tester, tx_port=3Dself.intf) > sniff_pkts =3D self.tester.load_tcpdump_sniff_packets(inst) >=20 > res =3D "" > if len(sniff_pkts): > - res =3D strip_pktload(sniff_pkts[0], layer=3D"L4") > + res =3D strip_pktload(sniff_pkts, layer=3D"L4") > return res >=20 > def set_up(self): > diff --git a/tests/TestSuite_short_live.py b/tests/TestSuite_short_live.p= y > index 93ec587..4e1ee15 100644 > --- a/tests/TestSuite_short_live.py > +++ b/tests/TestSuite_short_live.py > @@ -102,7 +102,7 @@ class TestShortLiveApp(TestCase): > if (txPort =3D=3D rxPort): > count =3D 2 >=20 > - inst =3D self.tester.tcpdump_sniff_packets(rxitf, count=3Dcount,= timeout=3D5) > + inst =3D self.tester.tcpdump_sniff_packets(rxitf, count=3Dcount) >=20 > pktlen =3D pktSize - 14 > padding =3D pktlen - 20 > @@ -112,7 +112,7 @@ class TestShortLiveApp(TestCase): > time.sleep(3) >=20 > pkts =3D self.tester.load_tcpdump_sniff_packets(inst) > - out =3D str(pkts[0].pktgen.pkt.show) > + out =3D str(pkts[0].show) > self.logger.info('SCAPY Result:\n' + out + '\n\n\n') > if received: > self.verify(('PPP' in out) and 'src=3D%s'% Dut_tx_mac in out= , "Receive > test failed") > diff --git a/tests/TestSuite_skeleton.py b/tests/TestSuite_skeleton.py > index 91cf9c4..38bc523 100644 > --- a/tests/TestSuite_skeleton.py > +++ b/tests/TestSuite_skeleton.py > @@ -93,8 +93,8 @@ class TestSkeleton(TestCase): > def get_tcpdump_package(self,inst): > pkts =3D self.tester.load_tcpdump_sniff_packets(inst) > dsts =3D [] > - for packet in pkts: > - dst =3D packet.strip_element_layer2("dst") > + for i in range(len(pkts)): > + dst =3D pkts.strip_element_layer2("dst", p_index=3Di) > dsts.append(dst) > return dsts >=20 > diff --git a/tests/TestSuite_sriov_kvm.py b/tests/TestSuite_sriov_kvm.py > index 3518f8f..6a28129 100644 > --- a/tests/TestSuite_sriov_kvm.py > +++ b/tests/TestSuite_sriov_kvm.py > @@ -359,10 +359,8 @@ class TestSriovKvm(TestCase): > if driver =3D=3D 'igb_uio': > # start testpmd with the two VFs on the host > self.host_testpmd =3D PmdOutput(self.dut) > - eal_param =3D '-b %(vf0)s -b %(vf1)s' % {'vf0': > self.sriov_vfs_port[0].pci, > - 'vf1': self.sriov= _vfs_port[1].pci} > self.host_testpmd.start_testpmd( > - "1S/2C/2T", "--rxq=3D4 --txq=3D4", eal_param=3Deal_p= aram) > + "1S/2C/2T", "--rxq=3D4 --txq=3D4") > self.host_testpmd.execute_cmd('set fwd rxonly') > self.host_testpmd.execute_cmd('start') >=20 > @@ -439,13 +437,8 @@ class TestSriovKvm(TestCase): > if driver =3D=3D 'igb_uio': > # start testpmd with the four VFs on the host > self.host_testpmd =3D PmdOutput(self.dut) > - eal_param =3D '-b %(vf0) -b %(vf1)s -b %(vf2)s -b %(vf3)= s' % \ > - {'vf0': self.sriov_vfs_pci[0], > - 'vf1': self.sriov_vfs_pci[1], > - 'vf2': self.sriov_vfs_pci[2], > - 'vf3': self.sriov_vfs_pci[3]} > self.host_testpmd.start_testpmd( > - "1S/2C/2T", eal_param=3Deal_param) > + "1S/2C/2T") >=20 > self.vm0 =3D VM(self.dut, 'vm0', 'sriov_kvm') > self.vm0.set_vm_device(driver=3Dself.vf_assign_method, **vf0= _prop) > diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py > index 9a75061..0310e04 100644 > --- a/tests/TestSuite_uni_pkt.py > +++ b/tests/TestSuite_uni_pkt.py > @@ -81,7 +81,7 @@ class TestUniPacket(TestCase): > for pkt_type in pkt_types.keys(): > pkt_names =3D pkt_types[pkt_type] > pkt =3D Packet(pkt_type=3Dpkt_type) > - pkt.send_pkt(tx_port=3Dself.tester_iface, count=3D4) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_iface, count= =3D4) > out =3D self.dut.get_session_output(timeout=3D2) > for pkt_layer_name in pkt_names: > if pkt_layer_name not in out: > @@ -111,10 +111,10 @@ class TestUniPacket(TestCase): > for l2_type in self.L2_types.keys(): > pkt_name =3D self.L2_types[l2_type] > pkt =3D Packet(pkt_type=3Dl2_type) > - pkt.send_pkt(tx_port=3Dself.tester_iface) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_iface) > out =3D self.dut.get_session_output(timeout=3D2) > if pkt_name in out: > - print utils.GREEN("Detected L2 %s successfully" % l2_typ= e) > + print(utils.GREEN("Detected L2 %s successfully" % l2_typ= e)) > else: > raise VerifyFailure("Failed to detect L2 %s" % l2_type) >=20 > @@ -347,7 +347,7 @@ class TestUniPacket(TestCase): > pkt.config_layers([('ipv6',{'nh':47}), ('inner_ipv6', {'= nh': 58})]) > else: > pkt.config_layers([('ipv6',{'nh':47}),('inner_ipv6', {'n= h': 132})]) > - pkt.send_pkt(tx_port=3Dself.tester_iface) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_iface) > out =3D self.dut.get_session_output(timeout=3D2) > for pkt_layer_name in pkts[1]: > if pkt_layer_name not in out: > @@ -445,7 +445,6 @@ class TestUniPacket(TestCase): >=20 > for packet in nsh_packets: > self.tester.scapy_foreground() > - self.tester.scapy_append("from scapy.contrib.nsh import *") > self.tester.scapy_append("sendp([%s],iface=3D'%s')" % > (nsh_packets[packet], self.tester_iface)) > self.tester.scapy_execute() > out =3D self.dut.get_session_output(timeout=3D2) > diff --git a/tests/TestSuite_userspace_ethtool.py > b/tests/TestSuite_userspace_ethtool.py > index 0a4b772..116fd3a 100644 > --- a/tests/TestSuite_userspace_ethtool.py > +++ b/tests/TestSuite_userspace_ethtool.py > @@ -297,7 +297,7 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > tester_port =3D self.tester.get_local_port(port) > intf =3D self.tester.get_interface(tester_port) > ori_rx_pkts, ori_tx_pkts =3D self.strip_portstats(port) > - pkt.send_pkt(tx_port=3Dintf, count=3D4) > + pkt.send_pkt(self.tester, tx_port=3Dintf, count=3D4) > time.sleep(1) > rx_pkts, tx_pkts =3D self.strip_portstats(port) > self.verify((rx_pkts =3D=3D (ori_rx_pkts + 4)), "Failed to r= ecord Rx/Tx > packets") > @@ -406,10 +406,10 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > rx_ring, _, tx_ring, _ =3D self.strip_ringparam(index) > self.verify(rx_ring =3D=3D rx_max, "Userspace tool failed to= set Rx ring > parameter") > self.verify(tx_ring =3D=3D tx_max, "Userspace tool failed to= set Tx ring > parameter") > - pkt =3D Packet() > + pkt =3D Packet(pkt_type=3D'UDP') > tester_port =3D self.tester.get_local_port(port) > intf =3D self.tester.get_interface(tester_port) > - pkt.send_pkt(tx_port=3Dintf, count=3D4) > + pkt.send_pkt(self.tester, tx_port=3Dintf, count=3D4) > rx_pkts, tx_pkts =3D self.strip_portstats(index) > self.verify(rx_pkts =3D=3D ori_rx_pkts + 4, "Failed to forwa= rd after ring > parameter changed") > self.dut.send_expect("quit", "# ") > @@ -441,7 +441,7 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > pkt.config_layer('vlan', {'vlan': vlan}) > tester_port =3D self.tester.get_local_port(port) > intf =3D self.tester.get_interface(tester_port) > - pkt.send_pkt(tx_port=3Dintf, count=3D4) > + pkt.send_pkt(self.tester, tx_port=3Dintf, count=3D4) > rx_pkts, tx_pkts =3D self.strip_portstats(port) > self.verify(rx_pkts =3D=3D ori_rx_pkts + 4, "Failed to Rx vl= an packet") > self.verify(tx_pkts =3D=3D ori_tx_pkts + 4, "Failed to Tx vl= an packet") > @@ -449,7 +449,7 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > # send incorrect vlan packet to port > wrong_vlan =3D (vlan + 1) % 4096 > pkt.config_layer('vlan', {'vlan': wrong_vlan}) > - pkt.send_pkt(tx_port=3Dintf, count=3D4) > + pkt.send_pkt(self.tester, tx_port=3Dintf, count=3D4) > time.sleep(2) > rx_pkts_wrong, tx_pkts_wrong =3D self.strip_portstats(port) > self.verify(tx_pkts_wrong =3D=3D rx_pkts, "Failed to filter = Rx vlan packet") > @@ -458,7 +458,7 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > self.dut.send_expect("vlan %d del %d" % (index, vlan), "EthA= pp>") > # send same packet and make sure not received > pkt.config_layer('vlan', {'vlan': vlan}) > - pkt.send_pkt(tx_port=3Dintf, count=3D4) > + pkt.send_pkt(self.tester, tx_port=3Dintf, count=3D4) > time.sleep(2) > rx_pkts_del, tx_pkts_del =3D self.strip_portstats(port) > self.verify(tx_pkts_del =3D=3D rx_pkts, "Failed to remove Rx= vlan filter") > @@ -483,15 +483,15 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > dump_mac =3D self.strip_mac(index) > self.verify(dump_mac =3D=3D valid_mac, "Userspace tool faile= d to set > mac") > # check forwarded mac has been changed > - pkt =3D Packet() > + pkt =3D Packet(pkt_type=3D'UDP') > tester_port =3D self.tester.get_local_port(port) > intf =3D self.tester.get_interface(tester_port) > # send and sniff packet > - inst =3D self.tester.tcpdump_sniff_packets(intf, timeout=3D5= ) > - pkt.send_pkt(tx_port=3Dintf, count=3D4) > + inst =3D self.tester.tcpdump_sniff_packets(intf) > + pkt.send_pkt(self.tester, tx_port=3Dintf, count=3D4) > pkts =3D self.tester.load_tcpdump_sniff_packets(inst) > self.verify(len(pkts) =3D=3D 4, "Packet not forwarded as exp= ected") > - src_mac =3D pkts[0].strip_layer_element("layer2", "src") > + src_mac =3D pkts.strip_layer_element("layer2", "src", p_inde= x=3D0) > self.verify(src_mac =3D=3D valid_mac, "Forwarded packet not = match > default mac") >=20 > # check multicast will not be valid mac > @@ -519,10 +519,10 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > self.dut.send_expect("stop %d" % index, "EthApp>") > time.sleep(10) > # check packet not forwarded when port is stop > - pkt =3D Packet() > + pkt =3D Packet(pkt_type=3D'UDP') > tester_port =3D self.tester.get_local_port(port) > intf =3D self.tester.get_interface(tester_port) > - pkt.send_pkt(tx_port=3Dintf, count=3D4) > + pkt.send_pkt(self.tester, tx_port=3Dintf, count=3D4) > rx_pkts, tx_pkts =3D self.strip_portstats(index) > self.verify(rx_pkts =3D=3D ori_rx_pkts, "Failed to stop port= ") > # restart port and check packet can normally forwarded > @@ -531,7 +531,7 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > # wait few time for port ready > rx_pkts, tx_pkts =3D self.strip_portstats(index) > time.sleep(2) > - pkt.send_pkt(tx_port=3Dintf, count=3D4) > + pkt.send_pkt(self.tester, tx_port=3Dintf, count=3D4) > rx_pkts_open, tx_pkts_open =3D self.strip_portstats(index) > self.verify(rx_pkts_open =3D=3D rx_pkts + 4, "Failed to reop= en port rx") > self.verify(tx_pkts_open =3D=3D tx_pkts + 4, "Failed to reop= en port tx") > @@ -568,12 +568,12 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > time.sleep(5) > ori_rx_pkts, _ =3D self.strip_portstats(index) > pkt_size =3D mtu + HEADER_SIZE['eth'] + offset > - pkt =3D Packet(pkt_len=3Dpkt_size) > - pkt.send_pkt(tx_port=3Dintf, count=3D4) > + pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dpkt_size) > + pkt.send_pkt(self.tester, tx_port=3Dintf, count=3D4) > rx_pkts, _ =3D self.strip_portstats(index) > self.verify(rx_pkts =3D=3D ori_rx_pkts + 4, "Packet matc= h mtu not > forwarded as expected") > - pkt =3D Packet(pkt_len=3Dmtu + 1 + HEADER_SIZE['eth'] + = offset) > - pkt.send_pkt(tx_port=3Dintf, count=3D4) > + pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dmtu + 1 + HEA= DER_SIZE['eth'] > + offset) > + pkt.send_pkt(self.tester, tx_port=3Dintf, count=3D4) > rx_pkts_over, _ =3D self.strip_portstats(index) > self.verify(rx_pkts =3D=3D rx_pkts_over, "Packet over mt= u should not be > forwarded") >=20 > diff --git a/tests/TestSuite_veb_switch.py b/tests/TestSuite_veb_switch.p= y > index 78fcbbd..e60a618 100644 > --- a/tests/TestSuite_veb_switch.py > +++ b/tests/TestSuite_veb_switch.py > @@ -120,12 +120,12 @@ class TestVEBSwitching(TestCase): > pkt =3D Packet(pkt_type=3D'VLAN_UDP') > pkt.config_layer('ether', {'dst': vf_mac}) > pkt.config_layer('vlan', {'vlan': 1}) > - pkt.send_pkt(tx_port=3Ditf) > + pkt.send_pkt(self.tester, tx_port=3Ditf) > time.sleep(.5) > else: > pkt =3D Packet(pkt_type=3D'UDP') > pkt.config_layer('ether', {'dst': vf_mac}) > - pkt.send_pkt(tx_port=3Ditf) > + pkt.send_pkt(self.tester, tx_port=3Ditf) > time.sleep(.5) >=20 > def count_packet(self, out, mac): > diff --git a/tests/TestSuite_vf_daemon.py b/tests/TestSuite_vf_daemon.py > index fcbf5b8..5b738c7 100644 > --- a/tests/TestSuite_vf_daemon.py > +++ b/tests/TestSuite_vf_daemon.py > @@ -90,12 +90,9 @@ class TestVfDaemon(TestCase): > for port in self.sriov_vfs_port: > port.bind_driver(self.vf_driver) > time.sleep(1) > - eal_param =3D '-b %(vf0)s -b %(vf1)s' % {'vf0': self.sriov_vfs_p= ort[0].pci, > - 'vf1': self.sriov_vfs_por= t[1].pci} > - > self.dut_testpmd =3D PmdOutput(self.dut) > self.dut_testpmd.start_testpmd( > - "Default", "--rxq=3D4 --txq=3D4 --port-topology=3Dchained", > eal_param=3Deal_param) > + "Default", "--rxq=3D4 --txq=3D4 --port-topology=3Dchained") > self.dut_testpmd.execute_cmd("start") > time.sleep(5) >=20 > @@ -166,8 +163,8 @@ class TestVfDaemon(TestCase): > pkt.config_layer('vlan', {'vlan': vlan_id}) > pkt.config_layer('ether', {'dst': dst_mac}) >=20 > - inst =3D self.tester.tcpdump_sniff_packets(self.tester_intf, tim= eout=3D30) > - pkt.send_pkt(tx_port=3Dself.tester_intf, count=3Dnum) > + inst =3D self.tester.tcpdump_sniff_packets(self.tester_intf) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_intf, count=3Dnu= m) > return inst >=20 > def strip_mac(self, inst, element =3D "src"): > @@ -176,8 +173,8 @@ class TestVfDaemon(TestCase): > """ > pkts =3D self.tester.load_tcpdump_sniff_packets(inst) > macs =3D [] > - for pkt in pkts: > - mac =3D pkt.strip_element_layer2(element) > + for i in range(len(pkts)): > + mac =3D pkts.strip_element_layer2(element, p_index=3Di) > macs.append(mac) > return macs >=20 > @@ -187,8 +184,8 @@ class TestVfDaemon(TestCase): > """ > pkts =3D self.tester.load_tcpdump_sniff_packets(inst) > vlans =3D [] > - for pkt in pkts: > - vlan =3D pkt.strip_element_vlan("vlan") > + for i in range(len(pkts)): > + vlan =3D pkts.strip_element_vlan("vlan", p_index=3Di) > vlans.append(vlan) > return vlans >=20 > @@ -434,7 +431,7 @@ class TestVfDaemon(TestCase): > self.dut_testpmd.execute_cmd('set tx loopback 0 off') > time.sleep(5) >=20 > - inst =3D self.tester.tcpdump_sniff_packets(self.tester_intf, tim= eout=3D10) > + inst =3D self.tester.tcpdump_sniff_packets(self.tester_intf) >=20 > self.vm1_testpmd.execute_cmd('set burst 5') > self.vm1_testpmd.execute_cmd('start tx_first') > @@ -450,7 +447,7 @@ class TestVfDaemon(TestCase): > self.dut_testpmd.execute_cmd('set tx loopback 0 on') > time.sleep(3) >=20 > - inst =3D self.tester.tcpdump_sniff_packets(self.tester_intf, tim= eout=3D10) > + inst =3D self.tester.tcpdump_sniff_packets(self.tester_intf) >=20 > self.vm1_testpmd.execute_cmd('stop') > self.vm1_testpmd.execute_cmd('start tx_first') > diff --git a/tests/TestSuite_vf_interrupt_pmd.py > b/tests/TestSuite_vf_interrupt_pmd.py > index cc15ac6..0b1f858 100644 > --- a/tests/TestSuite_vf_interrupt_pmd.py > +++ b/tests/TestSuite_vf_interrupt_pmd.py > @@ -108,7 +108,7 @@ class TestVfInterruptPmd(TestCase): > """ > pkt =3D Packet(pkt_type=3D'UDP') > pkt.config_layer('ether', {'dst': mac, 'src': self.tester_mac}) > - pkt.send_pkt(tx_port=3Dtestinterface) > + pkt.send_pkt(self.tester, tx_port=3Dtestinterface) >=20 > self.out2 =3D use_dut.get_session_output(timeout=3D2) >=20 > diff --git a/tests/TestSuite_vf_jumboframe.py > b/tests/TestSuite_vf_jumboframe.py > index f082cec..dd728d9 100644 > --- a/tests/TestSuite_vf_jumboframe.py > +++ b/tests/TestSuite_vf_jumboframe.py > @@ -174,7 +174,7 @@ class TestVfJumboFrame(TestCase): >=20 > pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dpktsize) > pkt.config_layer('ether', {'dst': mac}) > - pkt.send_pkt(tx_port=3Dself.tester_intf) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_intf) >=20 > time.sleep(1) >=20 > diff --git a/tests/TestSuite_vf_kernel.py b/tests/TestSuite_vf_kernel.py > index bee30a0..9a280b1 100644 > --- a/tests/TestSuite_vf_kernel.py > +++ b/tests/TestSuite_vf_kernel.py > @@ -119,12 +119,8 @@ class TestVfKernel(TestCase): > time.sleep(1) >=20 > self.dut_testpmd =3D PmdOutput(self.dut) > - eal_param =3D '' > - for sriov_vf in self.sriov_vfs_port: > - eal_param +=3D " -b %s" % sriov_vf.pci > self.dut_testpmd.start_testpmd( > - "Default", "--rxq=3D4 --txq=3D4 --port-topology=3Dchained", > - eal_param=3Deal_param) > + "Default", "--rxq=3D4 --txq=3D4 --port-topology=3Dchained") > # dpdk-2208 > # since there is no forward engine on DPDK PF to forward or drop > packet in packet pool, > # so finally the pool will be full, then no more packet will be > @@ -412,12 +408,12 @@ class TestVfKernel(TestCase): > if vlan_id =3D=3D '': > pkt =3D Packet(pkt_type=3D'TCP', pkt_len=3Dpkt_lens) > pkt.config_layer('ether', {'dst': mac, 'src': self.tester_ma= c}) > - pkt.send_pkt(tx_port=3Dself.tester_intf, count=3Dnum) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_intf, count= =3Dnum) > else: > pkt =3D Packet(pkt_type=3D'VLAN_UDP', pkt_len=3Dpkt_lens) > pkt.config_layer('ether', {'dst': mac, 'src': self.tester_ma= c}) > pkt.config_layer('vlan', {'vlan': vlan_id}) > - pkt.send_pkt(tx_port=3Dself.tester_intf, count=3Dnum) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_intf, count= =3Dnum) >=20 > def test_vlan(self): > """ > @@ -873,8 +869,7 @@ class TestVfKernel(TestCase): >=20 > # Link down DPDK VF0 and expect no impact on other VFs > self.vm0_testpmd.quit() > - eal_param =3D '-b %(vf0)s' % ({'vf0': self.vm0_dut.ports_info[0]= ['pci']}) > - self.vm0_testpmd.start_testpmd("Default", eal_param=3Deal_param) > + self.vm0_testpmd.start_testpmd("Default") > self.vm0_testpmd.execute_cmd('set promisc all on') > self.vm0_testpmd.execute_cmd('set fwd rxonly') > self.vm0_testpmd.execute_cmd('set verbose 1') > diff --git a/tests/TestSuite_vf_macfilter.py b/tests/TestSuite_vf_macfilt= er.py > index f7bba1a..01da9b4 100644 > --- a/tests/TestSuite_vf_macfilter.py > +++ b/tests/TestSuite_vf_macfilter.py > @@ -67,12 +67,10 @@ class TestVfMacFilter(TestCase): > if driver =3D=3D 'igb_uio': > # start testpmd without the two VFs on the host > self.host_testpmd =3D PmdOutput(self.dut) > - eal_param =3D '-b %(vf0)s -b %(vf1)s' % {'vf0': > self.sriov_vfs_port_0[0].pci, > - 'vf1': self.sriov= _vfs_port_1[0].pci} > if (self.nic in ["niantic", "sageville", "sagepond"]): > - self.host_testpmd.start_testpmd("1S/9C/1T", "--txq= =3D4 --rxq=3D4 ", > eal_param=3Deal_param) > + self.host_testpmd.start_testpmd("1S/9C/1T", "--txq= =3D4 --rxq=3D4 ") > else: > - self.host_testpmd.start_testpmd("1S/2C/2T", > eal_param=3Deal_param) > + self.host_testpmd.start_testpmd("1S/2C/2T") >=20 > # set up VM0 ENV > self.vm0 =3D VM(self.dut, 'vm0', 'vf_macfilter') > @@ -158,7 +156,7 @@ class TestVfMacFilter(TestCase): >=20 > print "\nfirst send packets to the PF set MAC, expected result i= s RX > packets=3DTX packets\n" > result1 =3D self.tester.check_random_pkts(tgen_ports, pktnum=3D1= 00, > allow_miss=3DFalse, params=3Dpkt_param) > - print "\nshow port stats in testpmd for double check: \n", > self.vm0_testpmd.execute_cmd('show port stats all') > + print "\nshow port stats in testpmd for double check: \n", > self.vm0_testpmd.execute_cmd('show port stats all') > self.verify(result1 !=3D False, "VF0 failed to forward packets t= o VF1") >=20 > print "\nSecondly, negative test, send packets to a wrong MAC, > expected result is RX packets=3D0\n" > @@ -259,6 +257,7 @@ class TestVfMacFilter(TestCase): >=20 > if self.setup_2pf_2vf_1vm_env_flag =3D=3D 1: > self.destroy_2pf_2vf_1vm_env() > + self.dut.kill_all() >=20 > def tear_down_all(self): >=20 > diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.p= y > index dc5cb30..421d9c4 100644 > --- a/tests/TestSuite_vf_offload.py > +++ b/tests/TestSuite_vf_offload.py > @@ -71,9 +71,7 @@ class TestVfOffload(TestCase): > if driver =3D=3D 'igb_uio': > # start testpmd without the two VFs on the host > self.host_testpmd =3D PmdOutput(self.dut) > - eal_param =3D '-b %(vf0)s -b %(vf1)s' % {'vf0': > self.sriov_vfs_port_0[0].pci, > - 'vf1': self.sriov= _vfs_port_1[0].pci} > - self.host_testpmd.start_testpmd("1S/2C/2T", > eal_param=3Deal_param) > + self.host_testpmd.start_testpmd("1S/2C/2T") >=20 > # set up VM0 ENV > self.vm0 =3D VM(self.dut, 'vm0', 'vf_offload') > diff --git a/tests/TestSuite_vf_packet_rxtx.py > b/tests/TestSuite_vf_packet_rxtx.py > index 8a8816d..c111c9e 100644 > --- a/tests/TestSuite_vf_packet_rxtx.py > +++ b/tests/TestSuite_vf_packet_rxtx.py > @@ -6,6 +6,7 @@ import time > from virt_common import VM > from test_case import TestCase > from pmd_output import PmdOutput > +from packet import Packet >=20 > VM_CORES_MASK =3D 'all' >=20 > @@ -64,12 +65,10 @@ class TestVfPacketRxtx(TestCase): > if driver =3D=3D 'igb_uio': > # start testpmd without the two VFs on the host > self.host_testpmd =3D PmdOutput(self.dut) > - eal_param =3D '-b %(vf0)s -b %(vf1)s' % {'vf0': > self.sriov_vfs_port_0[0].pci, > - 'vf1': self.sriov= _vfs_port_1[0].pci} > if (self.nic in ["niantic", "sageville", "sagepond"]): > - self.host_testpmd.start_testpmd("1S/9C/1T", "--txq= =3D4 --rxq=3D4 ", > eal_param=3Deal_param) > + self.host_testpmd.start_testpmd("1S/9C/1T", "--txq= =3D4 --rxq=3D4 ") > else: > - self.host_testpmd.start_testpmd("1S/5C/1T", "", > eal_param=3Deal_param) > + self.host_testpmd.start_testpmd("1S/5C/1T") >=20 > # set up VM0 ENV > self.vm0 =3D VM(self.dut, 'vm0', 'vf_packet_rxtx') > @@ -189,13 +188,10 @@ class TestVfPacketRxtx(TestCase): >=20 > if driver =3D=3D 'igb_uio': > self.host_testpmd =3D PmdOutput(self.dut) > - eal_param =3D '-b %(vf0)s -b %(vf1)s -b %(vf2)s' % {'vf0= ': > self.sriov_vfs_port[0].pci, > - 'vf1':= self.sriov_vfs_port[1].pci, > - 'vf2':= self.sriov_vfs_port[2].pci} > if (self.nic in ["niantic", "sageville", "sagepond"]): > - self.host_testpmd.start_testpmd("1S/9C/1T", "--txq= =3D4 --rxq=3D4 ", > eal_param=3Deal_param) > + self.host_testpmd.start_testpmd("1S/9C/1T", "--txq= =3D4 --rxq=3D4 ") > else: > - self.host_testpmd.start_testpmd("1S/2C/2T", > eal_param=3Deal_param) > + self.host_testpmd.start_testpmd("1S/2C/2T") >=20 > # set up VM0 ENV > self.vm0 =3D VM(self.dut, 'vm0', 'vf_packet_rxtx') > @@ -290,7 +286,8 @@ class TestVfPacketRxtx(TestCase): >=20 > dst_mac =3D pmd0_vf0_mac > self.vm0_testpmd.execute_cmd('clear port stats all') > - self.tester.sendpkt_bg(tx_port, dst_mac) > + pkt =3D Packet("Ether(dst=3D'%s', src=3D'%s')/IP(len=3D46)" % (d= st_mac, > self.tester.get_mac(tx_port))) > + filename =3D pkt.send_pkt_bg(crb=3Dself.tester, > tx_port=3Dself.tester.get_interface(tx_port), loop=3D1) >=20 > #vf port stop/start can trigger reset action > for num in range(1000): > @@ -299,7 +296,7 @@ class TestVfPacketRxtx(TestCase): > self.vm1_testpmd.execute_cmd('port start all') > time.sleep(0.1) >=20 > - self.tester.stop_sendpkt_bg() > + pkt.stop_send_pkt_bg(self.tester, filename) >=20 > pmd0_vf0_stats =3D self.vm0_testpmd.get_pmd_stats(port_id_0) > pmd0_vf1_stats =3D self.vm0_testpmd.get_pmd_stats(port_id_1) > diff --git a/tests/TestSuite_vf_port_start_stop.py > b/tests/TestSuite_vf_port_start_stop.py > index 2ff2d1c..dcd799b 100644 > --- a/tests/TestSuite_vf_port_start_stop.py > +++ b/tests/TestSuite_vf_port_start_stop.py > @@ -10,6 +10,7 @@ from utils import RED, GREEN > from net_device import NetDevice > from crb import Crb > from scapy.all import * > +from scapy.layers.sctp import SCTP, SCTPChunkData > VM_CORES_MASK =3D 'all' >=20 > class TestVfPortStartStop(TestCase): > @@ -22,7 +23,9 @@ class TestVfPortStartStop(TestCase): > self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports") > self.vm0 =3D None > self.filename =3D "/tmp/vf.pcap" > - > + self.tester_tx_port =3D self.tester.get_local_port(self.dut_port= s[0]) > + self.tester_tintf =3D self.tester.get_interface(self.tester_tx_p= ort) > + self.send_pks_session =3D None > # set vf assign method and vf driver > self.vf_driver =3D self.get_suite_cfg()['vf_driver'] > if self.vf_driver is None: > @@ -38,71 +41,23 @@ class TestVfPortStartStop(TestCase): >=20 > self.setup_1pf_2vf_1vm_env_flag =3D 0 >=20 > - def pktgen_prerequisites(self): > - """ > - igb_uio.ko should be put in ~ before you using pktgen > - """ > - out =3D self.tester.send_expect("ls", "#") > - self.verify("igb_uio.ko" in out, "No file igb_uio.ko, please add= it in ~") > - self.tester.send_expect("modprobe uio", "#", 70) > - out =3D self.tester.send_expect("lsmod | grep igb_uio", "#") > - if "igb_uio" in out: > - self.tester.send_expect("rmmod -f igb_uio", "#", 70) > - self.tester.send_expect("insmod ~/igb_uio.ko", "#", 60) > - out =3D self.tester.send_expect("lsmod | grep igb_uio", "#") > - assert ("igb_uio" in out), "Failed to insmod igb_uio" > - > - total_huge_pages =3D self.tester.get_total_huge_pages() > - if total_huge_pages =3D=3D 0: > - self.tester.mount_huge_pages() > - self.tester.set_huge_pages(2048) > - > - def pktgen_kill(self): > - """ > - Kill all pktgen on tester. > - """ > - pids =3D [] > - pid_reg =3D r'p(\d+)' > - out =3D self.tester.alt_session.send_expect("lsof -Fp /var/run/.= pg_config", > "#", 20) > - if len(out): > - lines =3D out.split('\r\n') > - for line in lines: > - m =3D re.match(pid_reg, line) > - if m: > - pids.append(m.group(1)) > - for pid in pids: > - self.tester.alt_session.send_expect('kill -9 %s' % pid, '# '= , 20) > - > def send_and_verify(self, dst_mac, testpmd): > """ > Generates packets by pktgen > """ > self.testpmd_reset_status(testpmd) >=20 > - self.pktgen_prerequisites() > - # bind ports > - self.tester_tx_port =3D self.tester.get_local_port(self.dut_port= s[0]) > - self.tester_tx_pci =3D self.tester.ports_info[self.tester_tx_por= t]['pci'] > - port =3D self.tester.ports_info[self.tester_tx_port]['port'] > - self.tester_port_driver =3D port.get_nic_driver() > - self.tester.send_expect("./dpdk-devbind.py --force --bind=3Digb_= uio %s" % > self.tester_tx_pci, "#") > - > - src_mac =3D self.tester.get_mac(self.tester_tx_port) > + src_mac =3D self.tester.get_mac(self.tester_tx_port) > if src_mac =3D=3D 'N/A': > src_mac =3D "02:00:00:00:01" > - > - self.create_pcap_file(self.filename, dst_mac, src_mac) > - > - self.tester.send_expect("./pktgen -c 0x1f -n 2 --proc-type auto= --socket- > mem 128,128 --file-prefix pg -- -P -T -m '1.0' -s 0:%s" % self.filename, > "Pktgen >", 100) > - time.sleep(1) > - self.tester.send_expect("start all", "Pktgen>") > + self.send_pkts(self.filename, dst_mac, src_mac) > time.sleep(1) > self.check_port_start_stop(testpmd) > - # quit pktgen > - self.tester.send_expect("stop all", "Pktgen>") > - self.tester.send_expect("quit", "# ") > + self.tester.send_expect('killall -s INT scapy', '# ') > + self.tester.destroy_session(self.send_pks_session) > + self.send_pks_session =3D None >=20 > - def create_pcap_file(self, filename, dst_mac, src_mac): > + def send_pkts(self, filename, dst_mac, src_mac): > """ > Generates a valid PCAP file with the given configuration. > """ > @@ -115,9 +70,14 @@ class TestVfPortStartStop(TestCase): > pkts =3D [] > for key in def_pkts.keys(): > pkts.append(def_pkts[key]) > - > wrpcap(filename, pkts) >=20 > + sendp_fmt =3D "sendp(pk, iface=3D'%s', loop=3D1)" % (self.tester= _tintf) > + self.send_pks_session =3D self.tester.create_session("scapy1") > + self.send_pks_session.send_expect("scapy", ">>>") > + self.send_pks_session.send_expect("pk=3Drdpcap('%s')" % filename= , > ">>>") > + self.send_pks_session.send_command(sendp_fmt) > + > def testpmd_reset_status(self, testpmd): > """ > Reset testpmd :stop forward & stop port > @@ -175,9 +135,7 @@ class TestVfPortStartStop(TestCase): > if driver =3D=3D 'igb_uio': > # start testpmd without the two VFs on the host > self.host_testpmd =3D PmdOutput(self.dut) > - eal_param =3D '-b %(vf0)s -b %(vf1)s' % {'vf0': > self.sriov_vfs_port[0].pci, > - 'vf1': self.sriov= _vfs_port[1].pci} > - self.host_testpmd.start_testpmd("1S/2C/2T", > eal_param=3Deal_param) > + self.host_testpmd.start_testpmd("1S/2C/2T") >=20 > # set up VM0 ENV > self.vm0 =3D VM(self.dut, 'vm0', 'vf_port_start_stop') > @@ -242,13 +200,9 @@ class TestVfPortStartStop(TestCase): >=20 > def tear_down_all(self): >=20 > - self.pktgen_kill() > - if getattr(self, 'tester_port_driver', None) and \ > - getattr(self, 'tester_tx_pci', None): > - self.tester.send_expect("./dpdk-devbind.py --bind=3D%s %s" \ > - %(self.tester_port_driver, self.tester_tx_pci), "#") > - tx_interface =3D self.tester.get_interface(self.tester_tx_po= rt) > - self.tester.send_expect("ifconfig %s up" % tx_interface, "#"= ) > + if self.send_pks_session: > + self.tester.send_expect('killall -s INT scapy', '# ') > + self.tester.destroy_session(self.send_pks_session) >=20 > if getattr(self, 'vm0', None): > self.vm0.stop() > diff --git a/tests/TestSuite_vf_rss.py b/tests/TestSuite_vf_rss.py > index 8220926..95d13cd 100644 > --- a/tests/TestSuite_vf_rss.py > +++ b/tests/TestSuite_vf_rss.py > @@ -277,8 +277,7 @@ class TestVfRss(TestCase): > if driver =3D=3D 'igb_uio': > # start testpmd without the two VFs on the host > self.host_testpmd =3D PmdOutput(self.dut) > - eal_param =3D '-b %(vf0)s ' % {'vf0': self.sriov_vfs_por= t_0[0].pci} > - self.host_testpmd.start_testpmd("1S/2C/2T", > eal_param=3Deal_param) > + self.host_testpmd.start_testpmd("1S/2C/2T") >=20 > # set up VM0 ENV > self.vm0 =3D VM(self.dut, 'vm0', 'vf_rss') > diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py > index f50a7e5..7f46aa6 100644 > --- a/tests/TestSuite_vf_vlan.py > +++ b/tests/TestSuite_vf_vlan.py > @@ -173,8 +173,8 @@ class TestVfVlan(TestCase): >=20 > pkt =3D Packet(pkt_type=3D'UDP') > pkt.config_layer('ether', {'dst': self.vf1_mac}) > - inst =3D self.tester.tcpdump_sniff_packets(self.tester_intf0, ti= meout=3D5) > - pkt.send_pkt(tx_port=3Dself.tester_intf1) > + inst =3D self.tester.tcpdump_sniff_packets(self.tester_intf0) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_intf1) > pkts =3D self.tester.load_tcpdump_sniff_packets(inst) >=20 > self.verify(len(pkts), "Not receive expected packet") > @@ -194,7 +194,7 @@ class TestVfVlan(TestCase): > pkt.config_layer('vlan', {'vlan': vlan}) > pkt.config_layer('ether', {'dst': self.vf0_mac}) >=20 > - pkt.send_pkt(tx_port=3Dself.tester_intf0) > + pkt.send_pkt(self.tester, tx_port=3Dself.tester_intf0) > out =3D self.vm_dut_0.get_session_output(timeout=3D2) >=20 > return out > @@ -258,7 +258,7 @@ class TestVfVlan(TestCase): > "ip link set %s vf 0 vlan 0" % (self.host_intf0), "# ") >=20 > def tx_and_check(self, tx_vlan=3D1): > - inst =3D self.tester.tcpdump_sniff_packets(self.tester_intf0, ti= meout=3D5) > + inst =3D self.tester.tcpdump_sniff_packets(self.tester_intf0) > self.vm0_testpmd.execute_cmd('set burst 1') > self.vm0_testpmd.execute_cmd('start tx_first') > self.vm0_testpmd.execute_cmd('stop') > @@ -266,8 +266,8 @@ class TestVfVlan(TestCase): > # strip sniffered vlans > pkts =3D self.tester.load_tcpdump_sniff_packets(inst) > vlans =3D [] > - for pkt in pkts: > - vlan =3D pkt.strip_element_vlan("vlan") > + for i in range(len(pkts)): > + vlan =3D pkts.strip_element_vlan("vlan", p_index=3Di) > vlans.append(vlan) >=20 > self.verify( > diff --git a/tests/TestSuite_vhost_enqueue_interrupt.py > b/tests/TestSuite_vhost_enqueue_interrupt.py > index 428cf36..5c4c1df 100644 > --- a/tests/TestSuite_vhost_enqueue_interrupt.py > +++ b/tests/TestSuite_vhost_enqueue_interrupt.py > @@ -192,6 +192,7 @@ class TestVhostEnqueueInterrupt(TestCase): > self.close_testpmd_and_session() > self.dut.send_expect("killall -s INT l3fwd-power", "#") > self.dut.send_expect("killall -s INT testpmd", "#") > + self.dut.kill_all() >=20 > def tear_down_all(self): > """ > diff --git a/tests/TestSuite_vhost_multi_queue_qemu.py > b/tests/TestSuite_vhost_multi_queue_qemu.py > index f0dbb90..d31eb57 100644 > --- a/tests/TestSuite_vhost_multi_queue_qemu.py > +++ b/tests/TestSuite_vhost_multi_queue_qemu.py > @@ -40,7 +40,7 @@ import utils > from test_case import TestCase > from settings import HEADER_SIZE > from virt_common import VM > -from packet import Packet, send_packets, save_packets > +from packet import Packet > from pmd_output import PmdOutput > from pktgen import PacketGeneratorHelper >=20 > @@ -154,8 +154,7 @@ class TestVhostMultiQueueQemu(TestCase): > pkt1.config_layers([('ether', {'dst': '%s' % self.virtio1_ma= c}), ('ipv4', > {'dst': '1.1.1.1'}), > ('raw', {'payload': ['01'] * int('%d' % p= ayload_size)})]) >=20 > - pkt =3D [pkt1] > - save_packets(pkt, "%s/multiqueue.pcap" % self.out_path) > + pkt1.save_pcapfile(self.tester, "%s/multiqueue.pcap" % self.= out_path) >=20 > port =3D self.tester.get_local_port(self.pf) > tgenInput.append((port, port, "%s/multiqueue.pcap" % > self.out_path)) > @@ -185,7 +184,7 @@ class TestVhostMultiQueueQemu(TestCase): > self.logger.info(info) > self.dut.send_expect("clear port stats all", "testpmd> ", 12= 0) > payload_size =3D frame_size - HEADER_SIZE['eth'] - HEADER_SI= ZE['ip'] - > HEADER_SIZE['udp'] > - > + pkts =3D Packet() > pkt1 =3D Packet() > pkt1.assign_layers(['ether', 'ipv4', 'udp', 'raw']) > pkt1.config_layers([('ether', {'dst': '%s' % self.virtio1_ma= c}), ('ipv4', > {'dst': '1.1.1.1'}), > @@ -203,11 +202,13 @@ class TestVhostMultiQueueQemu(TestCase): > pkt4.config_layers([('ether', {'dst': '%s' % self.virtio1_ma= c}), ('ipv4', > {'dst': '1.1.1.8'}), > ('udp', {'src': 4789, 'dst': 4789}), ('ra= w', {'payload': ['01'] * > int('%d' % payload_size)})]) >=20 > - pkt =3D [pkt1, pkt2, pkt3, pkt4] * 10 > - send_packets(self.tx_interface, pkt) > + pkt =3D [pkt1, pkt2, pkt3, pkt4] > + for i in pkt: > + pkts.pktgen.pkts.append(i.pktgen.pkt) > + pkts.send_pkt(self.tester, tx_port=3Dself.tx_interface, coun= t=3D10) >=20 > out =3D self.dut.send_expect("show port stats 0", "testpmd> = ", 120) > - print out > + print(out) > rx_packet =3D re.search("RX-packets:\s*(\d*)", out) > rx_num =3D int(rx_packet.group(1)) > tx_packet =3D re.search("TX-packets:\s*(\d*)", out) > diff --git a/tests/TestSuite_vhost_pmd_xstats.py > b/tests/TestSuite_vhost_pmd_xstats.py > index a58c107..1e1a323 100755 > --- a/tests/TestSuite_vhost_pmd_xstats.py > +++ b/tests/TestSuite_vhost_pmd_xstats.py > @@ -126,7 +126,7 @@ class TestVhostPmdXstats(TestCase): > self.scapy_num +=3D 1 > pkt =3D Packet(pkt_type=3D'TCP', pkt_len=3Dpktsize) > pkt.config_layer('ether', {'dst': dmac, }) > - pkt.send_pkt(tx_port=3Dself.txItf, count=3Dnum) > + pkt.send_pkt(self.tester, tx_port=3Dself.txItf, count=3Dnum) >=20 > def send_verify(self, scope, mun): > """ > diff --git a/tests/TestSuite_vhost_virtio_pmd_interrupt.py > b/tests/TestSuite_vhost_virtio_pmd_interrupt.py > index d31122b..0eeb42e 100644 > --- a/tests/TestSuite_vhost_virtio_pmd_interrupt.py > +++ b/tests/TestSuite_vhost_virtio_pmd_interrupt.py > @@ -38,7 +38,7 @@ import utils > import time > from virt_common import VM > from test_case import TestCase > -from packet import Packet, save_packets > +from packet import Packet > from pktgen import PacketGeneratorHelper >=20 >=20 > @@ -234,7 +234,7 @@ class TestVhostVirtioPmdInterrupt(TestCase): > else: > pkt =3D Packet(pkt_type=3D'IP_RAW') > pkt.config_layer('ether', {'dst': '%s' % self.dst_mac}) > - save_packets([pkt], "%s/interrupt.pcap" % self.out_path) > + pkt.save_pcapfile(self.tester, "%s/interrupt.pcap" % self.out_pa= th) > tgen_input.append((self.tx_port, self.tx_port, "%s/interrupt.pca= p" % > self.out_path)) > self.tester.pktgen.clear_streams() > vm_config =3D self.set_fields() > diff --git a/tests/TestSuite_virtio_ipsec_cryptodev_func.py > b/tests/TestSuite_virtio_ipsec_cryptodev_func.py > index d89a93d..6f6aa19 100644 > --- a/tests/TestSuite_virtio_ipsec_cryptodev_func.py > +++ b/tests/TestSuite_virtio_ipsec_cryptodev_func.py > @@ -247,7 +247,7 @@ class VirtioCryptodevIpsecTest(TestCase): > def send_and_dump_pkg(self): > status =3D True >=20 > - inst =3D self.tester.tcpdump_sniff_packets(self.rx_interface, ti= meout=3D25) > + inst =3D self.tester.tcpdump_sniff_packets(self.rx_interface) >=20 > PACKET_COUNT =3D 65 > payload =3D 256 * ['11'] > @@ -261,21 +261,19 @@ class VirtioCryptodevIpsecTest(TestCase): > pkt.config_layer("ipv4", {"src": src_ip, "dst": dst_ip}) > pkt.config_layer("udp", {"dst": 0}) > pkt.config_layer("raw", {"payload": payload}) > - pkt.send_pkt(tx_port=3Dself.tx_interface, count=3DPACKET_COUNT) > + pkt.send_pkt(self.tester, tx_port=3Dself.tx_interface, > count=3DPACKET_COUNT) >=20 > pkt_rec =3D self.tester.load_tcpdump_sniff_packets(inst) > self.logger.info("dump: {} packets".format(len(pkt_rec))) > if len(pkt_rec) !=3D PACKET_COUNT: > self.logger.info("dump pkg: {}, the num of pkg dumped is > incorrtct!".format(len(pkt_rec))) > status =3D False > - > - for pkt_r in pkt_rec: > - #pkt_r.pktgen.pkt.show() > - if src_ip !=3D pkt_r.pktgen.strip_layer3("src") or dst_ip != =3D > pkt_r.pktgen.strip_layer3("dst"): > + for i in range(len(pkt_rec)): > + if src_ip !=3D pkt_rec.pktgen.strip_layer3("src", p_index=3D= i) or dst_ip !=3D > pkt_rec.pktgen.strip_layer3("dst", p_index=3Di): > self.logger.info("the ip of pkg dumped is incorrtct!") > status =3D False >=20 > - dump_text =3D > binascii.b2a_hex(pkt_r.pktgen.pkt["Raw"].getfieldval("load")) > + dump_text =3D binascii.b2a_hex(pkt_rec[i]["Raw"].getfieldval= ("load")) > if dump_text !=3D ''.join(payload): > self.logger.info("the text of pkg dumped is incorrtct!") > status =3D False > diff --git a/tests/TestSuite_vlan.py b/tests/TestSuite_vlan.py > index 9c58b0c..77c33d0 100644 > --- a/tests/TestSuite_vlan.py > +++ b/tests/TestSuite_vlan.py > @@ -86,8 +86,8 @@ class TestVlan(TestCase): > def get_tcpdump_package(self): > pkts =3D self.tester.load_tcpdump_sniff_packets(self.inst) > vlans =3D [] > - for packet in pkts: > - vlan =3D packet.strip_element_vlan("vlan") > + for i in range(len(pkts)): > + vlan =3D pkts.strip_element_vlan("vlan", p_index=3Di) > vlans.append(vlan) > return vlans >=20 > @@ -116,7 +116,7 @@ class TestVlan(TestCase): > pkt.config_layer('ether', {'dst': self.dmac, 'src': self.sma= c}) > pkt.config_layer('vlan', {'vlan': vid}) >=20 > - pkt.send_pkt(tx_port=3Dself.txItf, count=3D4) > + pkt.send_pkt(self.tester, tx_port=3Dself.txItf, count=3D4) >=20 > def set_up(self): > """ > diff --git a/tests/TestSuite_vm2vm_virtio_pmd.py > b/tests/TestSuite_vm2vm_virtio_pmd.py > index 2db020f..da8f939 100644 > --- a/tests/TestSuite_vm2vm_virtio_pmd.py > +++ b/tests/TestSuite_vm2vm_virtio_pmd.py > @@ -42,7 +42,7 @@ import time > import utils > from virt_common import VM > from test_case import TestCase > -from packet import load_pcapfile > +from packet import Packet >=20 >=20 > class TestVM2VMVirtioPMD(TestCase): > @@ -211,11 +211,12 @@ class TestVM2VMVirtioPMD(TestCase): > vm_dut.send_expect('quit', '#', 60) > time.sleep(2) > vm_dut.session.copy_file_from(src=3D"%s" % self.dump_pcap, dst= =3D"%s" % > self.dump_pcap) > - pkts =3D load_pcapfile(self.dump_pcap) > + pkt =3D Packet() > + pkts =3D pkt.read_pcapfile(self.dump_pcap) > self.verify(len(pkts) =3D=3D 10, "The vm0 do not capture all the= packets") > - data =3D str(pkts[0].pktgen.pkt['Raw']) > + data =3D str(pkts[0]['Raw']) > for i in range(1, 10): > - value =3D str(pkts[i].pktgen.pkt['Raw']) > + value =3D str(pkts[i]['Raw']) > self.verify(data =3D=3D value, "the payload in receive packe= ts has been > changed") >=20 > def stop_all_apps(self): > diff --git a/tests/TestSuite_vxlan.py b/tests/TestSuite_vxlan.py > index 2be5741..2046abe 100644 > --- a/tests/TestSuite_vxlan.py > +++ b/tests/TestSuite_vxlan.py > @@ -26,6 +26,7 @@ from scapy.route import * > from test_case import TestCase > from settings import HEADER_SIZE, FOLDERS > from etgen import IxiaPacketGenerator > +import packet >=20 > # > # > @@ -48,6 +49,7 @@ class VxlanTestConfig(object): > self.init() > for name in kwargs: > setattr(self, name, kwargs[name]) > + self.pkt_obj =3D packet.Packet() >=20 > def init(self): > self.packets_config() > @@ -56,8 +58,8 @@ class VxlanTestConfig(object): > """ > Default vxlan packet format > """ > - self.pcap_file =3D '/root/vxlan.pcap' > - self.capture_file =3D '/root/vxlan_capture.pcap' > + self.pcap_file =3D packet.TMP_PATH + 'vxlan.pcap' > + self.capture_file =3D packet.TMP_PATH + 'vxlan_capture.pcap' > self.outer_mac_src =3D '00:00:10:00:00:00' > self.outer_mac_dst =3D '11:22:33:44:55:66' > self.outer_vlan =3D 'N/A' > @@ -186,29 +188,28 @@ class VxlanTestConfig(object): >=20 > return self.pkt >=20 > - def get_chksums(self, pcap=3DNone): > + def get_chksums(self, pkt=3DNone): > """ > get chksum values of Outer and Inner packet L3&L4 > Skip outer udp for it will be calculated by software > """ > chk_sums =3D {} > - if pcap is None: > - pkts =3D rdpcap(self.pcap_file) > + if pkt is None: > + pkt =3D rdpcap(self.pcap_file) > else: > - pkts =3D rdpcap(pcap) > + pkt =3D pkt.pktgen.pkt >=20 > time.sleep(1) > - > - if pkts[0].guess_payload_class(pkts[0]).name =3D=3D "802.1Q": > - payload =3D pkts[0][Dot1Q] > + if pkt[0].guess_payload_class(pkt[0]).name =3D=3D "802.1Q": > + payload =3D pkt[0][Dot1Q] > else: > - payload =3D pkts[0] > + payload =3D pkt[0] >=20 > if payload.guess_payload_class(payload).name =3D=3D "IP": > chk_sums['outer_ip'] =3D hex(payload[IP].chksum) >=20 > - if pkts[0].haslayer('VXLAN') =3D=3D 1: > - inner =3D pkts[0]['VXLAN'] > + if pkt[0].haslayer('VXLAN') =3D=3D 1: > + inner =3D pkt[0]['VXLAN'] > if inner.haslayer(IP) =3D=3D 1: > chk_sums['inner_ip'] =3D hex(inner[IP].chksum) > if inner[IP].proto =3D=3D 6: > @@ -236,16 +237,10 @@ class VxlanTestConfig(object): > """ > Send vxlan pcap file by iface > """ > - # load vxlan module to scapy > - cwd =3D os.getcwd() > - dir_vxlan_module =3D cwd + r'/' + FOLDERS['Depends'] > - self.test_case.tester.scapy_append("sys.path.append('%s')" % > dir_vxlan_module) > - self.test_case.tester.scapy_append("from vxlan import VXLAN") > - self.test_case.tester.scapy_append( > - 'pcap =3D rdpcap("%s")' % self.pcap_file) > - self.test_case.tester.scapy_append( > - 'sendp(pcap, iface=3D"%s")' % iface) > - self.test_case.tester.scapy_execute() > + del self.pkt_obj.pktgen.pkts[:] > + self.pkt_obj.pktgen.assign_pkt(self.pkt) > + self.pkt_obj.pktgen.update_pkts() > + self.pkt_obj.send_pkt(crb=3Dself.test_case.tester, tx_port=3Difa= ce) >=20 > def pcap_len(self): > """ > @@ -262,12 +257,10 @@ class TestVxlan(TestCase, IxiaPacketGenerator): > vxlan Prerequisites > """ > # this feature only enable in FVL now > - if self.nic in ["fortville_eagle", "fortville_spirit", "fortvill= e_spirit_single", > "fortville_25g", "fortpark_TLV", "carlsville"]: > + if self.nic in ["fortville_eagle", "fortville_spirit", "fortvill= e_spirit_single", > "fortville_25g", "fortpark_TLV"]: > self.compile_switch =3D 'CONFIG_RTE_LIBRTE_I40E_INC_VECTOR' > elif self.nic in ["sageville", "sagepond"]: > self.compile_switch =3D 'CONFIG_RTE_IXGBE_INC_VECTOR' > - elif self.nic in ["columbiaville_25g","columbiaville_100g"]: > - print "CVL support default none VECTOR" > else: > self.verify(False, "%s not support this vxlan" % self.nic) > # Based on h/w type, choose how many ports to use > @@ -448,20 +441,14 @@ class TestVxlan(TestCase, IxiaPacketGenerator): > config.outer_mac_dst =3D self.dut_port_mac > config.create_pcap() >=20 > - # remove tempory files > - config.capture_file =3D "/tmp/sniff_%s.pcap" % self.recv_iface > - self.tester.send_expect("rm -rf %s" % config.capture_file, "# ") > # save the capture packet into pcap format > - self.tester.scapy_background() > - > - inst =3D self.tester.tcpdump_sniff_packets(self.recv_iface, time= out=3D5) > + inst =3D self.tester.tcpdump_sniff_packets(self.recv_iface) > config.send_pcap(self.tester_iface) > - self.tester.load_tcpdump_sniff_packets(inst) > + pkt =3D self.tester.load_tcpdump_sniff_packets(inst) > time.sleep(5) >=20 > # extract the checksum offload from saved pcap file > - chksums =3D config.get_chksums(pcap=3Dconfig.capture_file) > - os.remove(config.capture_file) > + chksums =3D config.get_chksums(pkt=3Dpkt) > self.logger.info("chksums" + str(chksums)) >=20 > out =3D self.dut.send_expect("stop", "testpmd>", 10) > @@ -535,19 +522,14 @@ class TestVxlan(TestCase, IxiaPacketGenerator): > """ > verify vxlan packet detection > """ > - if self.nic in ["columbiaville_25g","columbiaville_100g"]: > - print "CVL support default none VECTOR" > - src_vec_model =3D 'n' > - else: > - out =3D self.dut.send_expect("cat config/common_base", "]# ",= 10) > - src_vec_model =3D re.findall("%s=3D." % self.compile_switch, = out)[0][-1] > - if src_vec_model =3D=3D 'y': > - self.dut.send_expect("sed -i -e 's/%s=3D.*$/" % self.compi= le_switch > - + "%s=3Dn/' config/common_base" % self= .compile_switch, > "# ", 30) > - self.dut.skip_setup =3D False > - self.dut.build_install_dpdk(self.target) > + out =3D self.dut.send_expect("cat config/common_base", "]# ", 10= ) > + src_vec_model =3D re.search("%s=3D." % self.compile_switch, out)= .group()[- > 1] > + if src_vec_model =3D=3D 'y': > + self.dut.send_expect("sed -i -e 's/%s=3D.*$/" % self.compile= _switch > + + "%s=3Dn/' config/common_base" % self.c= ompile_switch, > "# ", 30) > + self.dut.skip_setup =3D False > + self.dut.build_install_dpdk(self.target) >=20 > - > pmd_temp =3D "./%(TARGET)s/app/testpmd -c %(COREMASK)s -n " + \ > "%(CHANNEL)d -- -i --disable-rss --rxq=3D4 --txq=3D4" + \ > " --nb-cores=3D4 --portmask=3D%(PORT)s" > @@ -561,8 +543,6 @@ class TestVxlan(TestCase, IxiaPacketGenerator): > self.dut.send_expect("set verbose 1", "testpmd>", 10) > self.enable_vxlan(self.dut_port) > self.enable_vxlan(self.recv_port) > - res =3D self.pmdout.wait_link_status_up("all") > - self.verify(res is True, "link is donw") >=20 > # check normal packet > self.send_and_detect(outer_udp_dst=3D1234) > @@ -579,33 +559,26 @@ class TestVxlan(TestCase, IxiaPacketGenerator): >=20 > out =3D self.dut.send_expect("stop", "testpmd>", 10) > self.dut.send_expect("quit", "#", 10) > - if self.nic in ["columbiaville_25g","columbiaville_100g"]: > - print "CVL support default none VECTOR" > - src_vec_model =3D 'n' > - else: > - out =3D self.dut.send_expect("cat config/common_base", "]# ",= 10) > - dst_vec_model =3D re.findall("%s=3D." % self.compile_switch, = out)[0][-1] > - if src_vec_model !=3D dst_vec_model: > - self.dut.send_expect("sed -i -e 's/%s=3D.*$/" % self.compi= le_switch > - + "%s=3D%s/' config/common_base" % (se= lf.compile_switch, > src_vec_model), "# ", 30) > - self.dut.skip_setup =3D False > - self.dut.build_install_dpdk(self.target) > + > + out =3D self.dut.send_expect("cat config/common_base", "]# ", 10= ) > + dst_vec_model =3D re.findall("%s=3D." % self.compile_switch, out= )[0][-1] > + if src_vec_model !=3D dst_vec_model: > + self.dut.send_expect("sed -i -e 's/%s=3D.*$/" % self.compile= _switch > + + "%s=3D%s/' config/common_base" % (self= .compile_switch, > src_vec_model), "# ", 30) > + self.dut.skip_setup =3D False > + self.dut.build_install_dpdk(self.target) >=20 > def test_vxlan_ipv6_detect(self): > """ > verify vxlan packet detection with ipv6 header > """ > - if self.nic in ["columbiaville_25g","columbiaville_100g"]: > - print "CVL support default none VECTOR" > - src_vec_model =3D 'n' > - else: > - out =3D self.dut.send_expect("cat config/common_base", "]# ",= 10) > - src_vec_model =3D re.findall("%s=3D." % self.compile_switch, = out)[0][-1] > - if src_vec_model =3D=3D 'y': > - self.dut.send_expect("sed -i -e 's/%s=3D.*$/" % self.compi= le_switch > - + "%s=3Dn/' config/common_base" % self= .compile_switch, > "# ", 30) > - self.dut.skip_setup =3D False > - self.dut.build_install_dpdk(self.target) > + out =3D self.dut.send_expect("cat config/common_base", "]# ", 10= ) > + src_vec_model =3D re.search("%s=3D." % self.compile_switch, out)= .group()[- > 1] > + if src_vec_model =3D=3D 'y': > + self.dut.send_expect("sed -i -e 's/%s=3D.*$/" % self.compile= _switch > + + "%s=3Dn/' config/common_base" % self.c= ompile_switch, > "# ", 30) > + self.dut.skip_setup =3D False > + self.dut.build_install_dpdk(self.target) >=20 > pmd_temp =3D "./%(TARGET)s/app/testpmd -c %(COREMASK)s -n " + \ > "%(CHANNEL)d -- -i --disable-rss --rxq=3D4 --txq=3D4" + \ > @@ -620,8 +593,6 @@ class TestVxlan(TestCase, IxiaPacketGenerator): > self.dut.send_expect("set verbose 1", "testpmd>", 10) > self.enable_vxlan(self.dut_port) > self.enable_vxlan(self.recv_port) > - res =3D self.pmdout.wait_link_status_up("all") > - self.verify(res is True, "link is donw") >=20 > # check normal ipv6 packet > self.send_and_detect(outer_ip6_src=3D"FE80:0:0:0:0:0:0:0", > @@ -642,17 +613,14 @@ class TestVxlan(TestCase, IxiaPacketGenerator): >=20 > out =3D self.dut.send_expect("stop", "testpmd>", 10) > self.dut.send_expect("quit", "#", 10) > - if self.nic in ["columbiaville_25g","columbiaville_100g"]: > - print "CVL support default none VECTOR" > - src_vec_model =3D 'n' > - else: > - out =3D self.dut.send_expect("cat config/common_base", "]# ",= 10) > - dst_vec_model =3D re.findall("%s=3D." % self.compile_switch, = out)[0][-1] > - if src_vec_model !=3D dst_vec_model: > - self.dut.send_expect("sed -i -e 's/%s=3D.*$/" % self.compi= le_switch > - + "%s=3D%s/' config/common_base" % (se= lf.compile_switch, > src_vec_model), "# ", 30) > - self.dut.skip_setup =3D False > - self.dut.build_install_dpdk(self.target) > + > + out =3D self.dut.send_expect("cat config/common_base", "]# ", 10= ) > + dst_vec_model =3D re.findall("%s=3D." % self.compile_switch, out= )[0][-1] > + if src_vec_model !=3D dst_vec_model: > + self.dut.send_expect("sed -i -e 's/%s=3D.*$/" % self.compile= _switch > + + "%s=3D%s/' config/common_base" % (self= .compile_switch, > src_vec_model), "# ", 30) > + self.dut.skip_setup =3D False > + self.dut.build_install_dpdk(self.target) >=20 > def test_vxlan_ipv4_checksum_offload(self): > """ > @@ -682,9 +650,6 @@ class TestVxlan(TestCase, IxiaPacketGenerator): > self.dut.send_expect("port start all", "testpmd>") > self.dut.send_expect("csum parse-tunnel on %d" % > self.recv_port, "testpmd>", 10) > - res =3D self.pmdout.wait_link_status_up("all") > - self.verify(res is True, "link is donw") > - >=20 > self.enable_vxlan(self.dut_port) > self.enable_vxlan(self.recv_port) > @@ -759,7 +724,6 @@ class TestVxlan(TestCase, IxiaPacketGenerator): >=20 > self.enable_vxlan(self.dut_port) > self.enable_vxlan(self.recv_port) > - time.sleep(10) #lwj >=20 > # check normal ipv6 packet > self.send_and_check(outer_ip6_src=3D"FE80:0:0:0:0:0:0:0", > @@ -1169,8 +1133,6 @@ class TestVxlan(TestCase, IxiaPacketGenerator): > self.dut.send_expect("port start all", "testpmd>") > self.verify("Bad arguments" not in out, "Failed to set vxlan csu= m") > self.verify("error" not in out, "Failed to set vxlan csum") > - res =3D self.pmdout.wait_link_status_up("all") > - self.verify(res is True, "link is donw") >=20 > def csum_set_sw(self, proto, port): > self.dut.send_expect("port stop all", "testpmd>") > @@ -1179,9 +1141,6 @@ class TestVxlan(TestCase, IxiaPacketGenerator): > self.dut.send_expect("port start all", "testpmd>") > self.verify("Bad arguments" not in out, "Failed to set vxlan csu= m") > self.verify("error" not in out, "Failed to set vxlan csum") > - res =3D self.pmdout.wait_link_status_up("all") > - self.verify(res is True, "link is donw") > - >=20 > def tunnel_filter_add(self, *args): > # tunnel_filter add port_id outer_mac inner_mac ip inner_vlan > diff --git a/tests/TestSuite_vxlan_sample.py > b/tests/TestSuite_vxlan_sample.py > index 5bc9269..df7bbcf 100644 > --- a/tests/TestSuite_vxlan_sample.py > +++ b/tests/TestSuite_vxlan_sample.py > @@ -48,7 +48,7 @@ from etgen import IxiaPacketGenerator > from qemu_kvm import QEMUKvm > from TestSuite_vxlan import VxlanTestConfig > from pmd_output import PmdOutput > -from packet import IncreaseIP, IncreaseIPv6 > +from packet import Packet >=20 > from scapy.utils import wrpcap, rdpcap > from scapy.layers.inet import Ether, IP, TCP, UDP > @@ -106,7 +106,6 @@ class TestVxlanSample(TestCase): >=20 > # params for tep_termination > self.cores =3D self.dut.get_core_list("1S/4C/1T", socket=3Dself.= socket) > - self.capture_file =3D "/tmp/vxlan_cap.pcap" > self.def_mss =3D 256 >=20 > # performance measurement, checksum based on encap > @@ -266,32 +265,18 @@ class TestVxlanSample(TestCase): > self.send_and_verify(vm_id=3D0, vf_id=3D0, pkt_type=3D"vxlan_tcp= _tso") >=20 > def start_capture(self, itf, pkt_smac=3D"", pkt_dmac=3D"", count=3D1= ): > - self.tester.send_expect("rm -f %s" % self.capture_file, "# ") > - self.tester.scapy_background() > + self.inst =3D None > + filter_param =3D [] > if pkt_smac !=3D "": > - self.tester.scapy_append( > - 'p =3D sniff(filter=3D"ether src %s",' % pkt_smac + > - 'iface=3D"%s", count=3D%d, timeout=3D5)' % (itf, count)) > - if pkt_dmac !=3D "": > - self.tester.scapy_append( > - 'p =3D sniff(filter=3D"ether dst %s",' % pkt_dmac + > - 'iface=3D"%s", count=3D%d, timeout=3D5)' % (itf, count)) > - self.tester.scapy_append( > - 'wrpcap(\"%s\", p)' % self.capture_file) > - self.tester.scapy_foreground() > + filter_param =3D [{'layer': 'ether', 'config': {'src': '%s' = % pkt_smac}}] > + if pkt_dmac !=3D "": > + filter_param =3D [{'layer': 'ether', 'config': {'dst': '%s' = % pkt_dmac}}] > + self.inst =3D self.tester.tcpdump_sniff_packets(itf, count, > filters=3Dfilter_param) >=20 > def transfer_capture_file(self): > # copy capture file from tester > - if os.path.isfile('vxlan_cap.pcap'): > - os.remove('vxlan_cap.pcap') > - self.tester.session.copy_file_from(self.capture_file) > - > - if os.path.isfile('vxlan_cap.pcap'): > - self.verify(os.path.getsize('vxlan_cap.pcap') !=3D 0, "Packe= ts receive > error") > - pkts =3D rdpcap('vxlan_cap.pcap') > - else: > - pkts =3D [] > - return pkts > + pkts =3D self.tester.load_tcpdump_sniff_packets(self.inst) > + return pkts.pktgen.pkts >=20 > def send_and_verify(self, vm_id, vf_id, pkt_type): > params =3D {} > @@ -430,7 +415,10 @@ class TestVxlanSample(TestCase): > self.verify(len(pkts) >=3D 1, "Failed to capture packets") > self.verify(pkts[0].haslayer('VXLAN') =3D=3D 1, > "Packet not encapsulated") > - chksums =3D vxlan_pkt.get_chksums(pcap=3D'vxlan_cap.pcap') > + pk_new =3D Packet() > + pk_new.pktgen.assign_pkt(pkts) > + pk_new.pktgen.update_pkts() > + chksums =3D vxlan_pkt.get_chksums(pk_new) > print utils.GREEN("Checksum : %s" % chksums) > for key in chksums_ref: > if 'inner' in key: # only check inner packet chksum > -- > 2.17.1