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 E8109A2EDB for ; Fri, 6 Sep 2019 11:41:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B64D31F23D; Fri, 6 Sep 2019 11:41:46 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 126F71F20D for ; Fri, 6 Sep 2019 11:41:44 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2019 02:41:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,472,1559545200"; d="scan'208";a="213095681" Received: from unknown (HELO dpdk-wenjielx-dtspatch135.sh.intel.com) ([10.240.176.135]) by fmsmga002.fm.intel.com with ESMTP; 06 Sep 2019 02:41:43 -0700 From: yaobing To: dts@dpdk.org Cc: yaobing Date: Fri, 6 Sep 2019 17:44:15 +0800 Message-Id: <1567763055-14243-1-git-send-email-bingx.y.yao@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dts] [PATCH V1] tests/ip_pipeline:add case pipeline_with_traffic_management 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" add case test_perf_pipeline_with_traffic_management Signed-off-by: yaobing --- tests/TestSuite_ip_pipeline.py | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py index f05b5cd..6aa6aed 100644 --- a/tests/TestSuite_ip_pipeline.py +++ b/tests/TestSuite_ip_pipeline.py @@ -61,6 +61,7 @@ from scapy.packet import bind_layers, Raw from scapy.arch import get_if_hwaddr from scapy.sendrecv import sniff from scapy.sendrecv import sendp +from pktgen import PacketGeneratorHelper class TestIPPipeline(TestCase): @@ -224,6 +225,15 @@ class TestIPPipeline(TestCase): self.verify("Error" not in out, "Compilation error") self.param_flow_dir = self.get_flow_direction_param_of_tcpdump() + # get dts output path + if self.logger.log_path.startswith(os.sep): + self.output_path = self.logger.log_path + else: + cur_path = os.path.dirname( + os.path.dirname(os.path.realpath(__file__))) + self.output_path = os.sep.join([cur_path, self.logger.log_path]) + # create an instance to set stream field setting + self.pktgen_helper = PacketGeneratorHelper() def set_up(self): """ @@ -231,6 +241,56 @@ class TestIPPipeline(TestCase): """ pass + def set_fields(self): + """ + set ip protocol field behavior + """ + fields_config = { + 'ip': { + 'dst': {'range':4096, 'step': 65025, 'action': 'inc'}}, } + return fields_config + + def copy_cli_files_to_dut(self): + """ + Copy traffic_manager.cli from tester to DUT + """ + tar_file = 'ip_pipeline.tar.gz' + src_file = r'./dep/%s' % tar_file + dst = '/root/dpdk/examples/ip_pipeline/examples/' + self.dut.session.copy_file_to(src_file, dst) + self.dut.send_expect("tar -xvf %s/%s" % (dst,tar_file), "#", 30) + self.dut.send_expect("cp ./ip_pipeline/traffic_manager.cli %s" % dst, "#", 30) + + def test_perf_pipeline_with_traffic_management(self): + """ + rss pipeline + """ + self.copy_cli_files_to_dut() + cmd = "sed -i -e 's/0000:07:00.0/%s/' ./examples/ip_pipeline/examples/traffic_manager.cli" % self.dut_p0_pci + self.dut.send_expect(cmd, "# ", 20) + IP_PIPELINE = "./examples/ip_pipeline/build/ip_pipeline" + DUT_PORTS = " -w {0}".format(self.dut_p0_pci) + SCRIPT_FILE = "./examples/ip_pipeline/examples/traffic_manager.cli" + cmd = "{0} -c 0x3 -n 4 {1} -- -s {2}".format(IP_PIPELINE, DUT_PORTS, SCRIPT_FILE) + out = self.dut.send_expect(cmd,"15.255.0.0",60) + self.verify("failed" not in out, "Create rule failed!") + pcap = os.sep.join([self.output_path, "test.pcap"]) + dmac = self.dut.get_mac_address(self.dut_ports[0]) + flow = 'Ether(dst="%s")/IP(src="192.168.0.2",dst="0.0.0.0")' % (dmac) + self.tester.scapy_append('wrpcap("%s", [%s])' % (pcap, flow)) + self.tester.scapy_execute() + tgenInput = [] + port = self.tester.get_local_port(self.dut_ports[0]) + tgenInput.append([port, port, pcap]) + vm_config = self.set_fields() + self.tester.pktgen.clear_streams() + streams = self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 100, vm_config, self.tester.pktgen) + _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams) + self.dut.send_expect("^C","#",20) + strandard_pps =14880000 / 4096 + difference_value = pps - strandard_pps + self.verify( -50 < difference_value < 50, "throughput validation failure") + def test_routing_pipeline(self): """ routing pipeline -- 2.17.2