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 BB4C1A2EEB for ; Wed, 11 Sep 2019 07:33:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A13E51EACD; Wed, 11 Sep 2019 07:33:16 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 041481EAAE for ; Wed, 11 Sep 2019 07:33:14 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Sep 2019 22:33:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,492,1559545200"; d="scan'208";a="185722899" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga007.fm.intel.com with ESMTP; 10 Sep 2019 22:33:13 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 10 Sep 2019 22:33:13 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 10 Sep 2019 22:33:13 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.113]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.53]) with mapi id 14.03.0439.000; Wed, 11 Sep 2019 13:33:11 +0800 From: "Zhang, Yuwei1" To: "Wu, ChangqingX" , "dts@dpdk.org" CC: "Wu, ChangqingX" Thread-Topic: [dts] [PATCH V1] test:add test suite about multicast Thread-Index: AQHVXYFI5vhnjAVu5keAqJoXqj0b5acmCcAA Date: Wed, 11 Sep 2019 05:33:10 +0000 Message-ID: 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: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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" Acked-by: Yuwei Zhang -----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 Signed-off-by: changqingxwu --- tests/TestSuite_multicast.py | 147 +++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 tests/TestSuite_multicast.py diff --git a/tests/TestSuite_multicast.py b/tests/TestSuite_multicast.py ne= w 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=20 + 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=20 + 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('.', ',') + '),' + st= r(mask) + '}' + repStr =3D repStr + ' ' * 4 + entry + ",\\\n" + repStr =3D repStr + "};" + + self.dut.send_expect(r"sed -i=20 + '/mcast_group_table\[\].*{/,/^\}\;/c\\%s'=20 + 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_multicast= -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(rx_port)), timeout=3D5, + count=3D1, filters=3D[{"layer": "ether", "config":= {"src": sniff_src}}] ) + dmac =3D=20 + 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 received= ") + self.verify("src=3D" + trafficFlow[flow][2] + " ds= t=3D" + trafficFlow[flow][3] in result, + "Wrong IP address") + self.verify("load=3D'%s'" % payload in result, "Wr= ong payload") + splitIP =3D trafficFlow[flow][3].rsplit(".") + expectedMac =3D "01:00:5e:%s:%s:%s" % (str(int(spl= itIP[1], 8) & 0b01111111).zfill(2), + str(int(splitIP[2], 8)).zfill(2), str(int(spli= tIP[3], 8)).zfill(2)) + self.verify("dst=3D%s" % expectedMac in result,=20 + "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