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 C90A4A2EFC for ; Wed, 18 Sep 2019 12:48:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8FA081C24B; Wed, 18 Sep 2019 12:48:49 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id C4EB31C23C for ; Wed, 18 Sep 2019 12:48:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2019 03:48:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,520,1559545200"; d="scan'208";a="211817428" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga004.fm.intel.com with ESMTP; 18 Sep 2019 03:48:46 -0700 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 18 Sep 2019 03:48:45 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 18 Sep 2019 03:48:45 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.92]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.140]) with mapi id 14.03.0439.000; Wed, 18 Sep 2019 18:48:43 +0800 From: "Tu, Lijuan" To: "Wu, ChangqingX" , "dts@dpdk.org" CC: "Wu, ChangqingX" Thread-Topic: [dts] [PATCH V1] test:add test suite about multicast Thread-Index: AQHVXYFIgTdqFFeM0kmhFFhDpNgQwacxYjrg Date: Wed, 18 Sep 2019 10:48:43 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB23E15@SHSMSX101.ccr.corp.intel.com> References: <1566984035-79983-1-git-send-email-changqingx.wu@intel.com> In-Reply-To: <1566984035-79983-1-git-send-email-changqingx.wu@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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDYwYTg0MTktYjBhYi00YTQzLTkxMjUtNTFiNjE4ZTBiZmY5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTlVQRk5ISjNQRVM5RzArbU8wOE1KbzF0cDdoTzhHcUFoYUt4b01oZUZBRk41VjhUOFdFMDZidno4ZzVtMkROVSJ9 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] test:add test suite about multicast 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 changqingxwu > Sent: Wednesday, August 28, 2019 5:21 PM > To: dts@dpdk.org > Cc: Wu, ChangqingX > Subject: [dts] [PATCH V1] test:add test suite about multicast >=20 > Signed-off-by: changqingxwu > --- > tests/TestSuite_multicast.py | 147 +++++++++++++++++++++++++++++++++++ > 1 file changed, 147 insertions(+) > create mode 100644 tests/TestSuite_multicast.py >=20 > diff --git a/tests/TestSuite_multicast.py b/tests/TestSuite_multicast.py = new > file mode 100644 index 0000000..bcdb0bc > --- /dev/null > +++ b/tests/TestSuite_multicast.py > @@ -0,0 +1,147 @@ > +# > + > +""" > +DPDK Test suite. > + > +multicast test script. > +""" > + > +import time > +from test_case import TestCase > +import utils > + > +routeTbl =3D [ > + ["224.0.0.101", "P1"], ["224.0.0.102", "P2"], > + ["224.0.0.103", "P1,P2"], ["224.0.0.104", "P3"], > + ["224.0.0.105", "P1,P3"], ["224.0.0.106", "P2,P3"], > + ["224.0.0.107", "P1,P2,P3"], ["224.0.0.108", "P4"], > + ["224.0.0.109", "P1,P4"], ["224.0.0.110", "P2,P4"], > + ["224.0.0.111", "P1,P2,P4"], ["224.0.0.112", "P3,P4"], > + ["224.0.0.113", "P1,P3,P4"], ["224.0.0.114", "P2,P3,P4"], > + ["224.0.0.115", "P1,P2,P3,P4"] > +] > + > +trafficFlow =3D { > + "F1": ["TG0", "TG0", "10.100.0.1", "224.0.0.101"], > + "F2": ["TG0", "TG1", "10.100.0.2", "224.0.0.104"], > + "F3": ["TG0", "TG0,TG1", "10.100.0.3", "224.0.0.105"], > + "F4": ["TG1", "TG1", "11.100.0.1", "224.0.0.104"], > + "F5": ["TG1", "TG0", "11.100.0.2", "224.0.0.101"], > + "F6": ["TG1", "TG0,TG1", "11.100.0.3", "224.0.0.105"] } > + > +measureTarget =3D [ > + ["1S/1C/1T", "F1,F4", "ipv4_multicast -c %s -n 3 -- -p %s -q 2"], > + ["1S/1C/2T", "F1,F4", "ipv4_multicast -c %s -n 3 -- -p %s -q 1"], > + ["1S/2C/1T", "F1,F4", "ipv4_multicast -c %s -n 3 -- -p %s -q 1"], > + ["1S/1C/1T", "F2,F5", "ipv4_multicast -c %s -n 3 -- -p %s -q 2"], > + ["1S/1C/2T", "F2,F5", "ipv4_multicast -c %s -n 3 -- -p %s -q 1"], > + ["1S/2C/1T", "F2,F5", "ipv4_multicast -c %s -n 3 -- -p %s -q 1"], > + ["1S/1C/1T", "F3,F6", "ipv4_multicast -c %s -n 3 -- -p %s -q 2"], > + ["1S/1C/2T", "F3,F6", "ipv4_multicast -c %s -n 3 -- -p %s -q 1"], > + ["1S/2C/1T", "F3,F6", "ipv4_multicast -c %s -n 3 -- -p %s -q 1"] ] > + > + > +class TestMulticast(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + Multicast Prerequisites > + """ > + global dutPorts > + # Based on h/w type, choose how many ports to use > + dutPorts =3D self.dut.get_ports(self.nic) > + # Verify that enough ports are available > + self.verify(len(dutPorts) >=3D 4, "Insufficient ports for > + testing") > + > + # Verify that enough threads are available > + cores =3D self.dut.get_core_list("1S/2C/2T") > + self.verify(cores is not None, "Insufficient cores for speed > + testing") > + > + global P1, P3, TG0, TG1, TGs > + # prepare port mapping TG0<=3D>P1, TG1<=3D>P3 > + P1 =3D dutPorts[0] > + P2 =3D dutPorts[1] > + P3 =3D dutPorts[2] > + P4 =3D dutPorts[3] > + TGs =3D [P1, P3] > + TG0 =3D self.tester.get_local_port(TGs[0]) > + TG1 =3D self.tester.get_local_port(TGs[1]) > + > + # Prepare multicast route table, replace P(x) port pattern > + repStr =3D "static struct mcast_group_params mcast_group_table[]= =3D > {\\\n" > + for [ip, ports] in routeTbl: > + mask =3D 0 > + for _ in ports.split(','): > + mask =3D mask | (1 << eval(_)) > + entry =3D '{' + 'RTE_IPV4(' + ip.replace('.', ',') + '),' + = str(mask) + '}' > + repStr =3D repStr + ' ' * 4 + entry + ",\\\n" > + repStr =3D repStr + "};" > + > + self.dut.send_expect(r"sed -i > + '/mcast_group_table\[\].*{/,/^\}\;/c\\%s' > + examples/ipv4_multicast/main.c" % repStr, "# ") > + > + # make application > + out =3D self.dut.send_expect("make -C examples/ipv4_multicast", = "#") > + self.verify("Error" not in out, "compilation error 1") > + self.verify("No such file" not in out, "compilation error 2") > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + pass > + > + def test_multicast_forwarding(self): > + """ > + IP4 Multicast Forwarding F1~F6 > + """ > + cores =3D self.dut.get_core_list("1S/2C/1T") > + coremask =3D utils.create_mask(cores) > + payload =3D "ABCDEFGHIJKLMNOPQRSTUVWXYZ" > + self.dut.send_expect("examples/ipv4_multicast/build/ipv4_multica= st - > c %s -n 4 -- -p %s -q 2" % ( > + coremask, '0x5'), "IPv4_MULTICAST:", 60) > + > + for flow in trafficFlow.keys(): > + for tx_port in trafficFlow[flow][0].split(","): > + for rx_port in trafficFlow[flow][1].split(","): > + sniff_src =3D "not 00:00:00:00:00:00" > + > + inst =3D > self.tester.tcpdump_sniff_packets(intf=3Dself.tester.get_interface(eval(r= x_port)), > timeout=3D5, > + count=3D1, filters=3D[{"layer": "ether", "config= ": {"src": sniff_src}}] ) > + dmac =3D > + self.dut.get_mac_address(TGs[int(trafficFlow[flow][0][2])]) > + > + self.tester.scapy_append('sendp([Ether(src=3D"00:00:= 00:00:00:00", > dst=3D"%s")/IP(dst=3D"%s",src=3D"%s")\ > + /Raw(load=3D"%s")], iface=3D"%s")' % ( > + dmac, trafficFlow[flow][3], trafficFlow[flow= ][2], payload, > self.tester.get_interface(eval(tx_port)))) > + self.tester.scapy_execute() > + time.sleep(5) # Wait for the sniffer to finish. > + > + pkts =3D self.tester.load_tcpdump_sniff_packets(inst= ) > + for packet in pkts: > + result =3D str(packet.pktgen.pkt.show) > + > + print result > + self.verify("Ether" in result, "No packet receiv= ed") > + self.verify("src=3D" + trafficFlow[flow][2] + " = dst=3D" + > trafficFlow[flow][3] in result, > + "Wrong IP address") > + self.verify("load=3D'%s'" % payload in result, "= Wrong payload") > + splitIP =3D trafficFlow[flow][3].rsplit(".") > + expectedMac =3D "01:00:5e:%s:%s:%s" % (str(int(s= plitIP[1], 8) & > 0b01111111).zfill(2), > + str(int(splitIP[2], 8)).zfill(2), str(int(sp= litIP[3], 8)).zfill(2)) > + self.verify("dst=3D%s" % expectedMac in result, > + "Wrong MAC address") > + > + self.dut.send_expect("^C", "#") > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.send_expect("^C", "#") > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + self.dut.kill_all() > -- > 2.17.2