From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9AEA2A0AB5 for ; Sun, 28 Apr 2019 04:46:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7C37E1B4F9; Sun, 28 Apr 2019 04:46:07 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 72A1C4C93 for ; Sun, 28 Apr 2019 04:46:06 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Apr 2019 19:46:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,403,1549958400"; d="scan'208";a="227345474" Received: from meijuan2.sh.intel.com ([10.67.119.112]) by orsmga001.jf.intel.com with ESMTP; 27 Apr 2019 19:46:05 -0700 From: zhaomeijuan To: dts@dpdk.org Cc: zhaomeijuan Date: Sun, 28 Apr 2019 10:47:13 +0000 Message-Id: <20190428104718.9143-2-meijuanx.zhao@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190428104718.9143-1-meijuanx.zhao@intel.com> References: <20190428104718.9143-1-meijuanx.zhao@intel.com> Subject: [dts] [next][PATCH V1 2/7] tests/distributor 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" *.remove old or unused module and code which replace it with pktgen API *.overwrite ip method Signed-off-by: zhaomeijuan --- tests/TestSuite_distributor.py | 60 +++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/tests/TestSuite_distributor.py b/tests/TestSuite_distributor.py index a900f5e..30d5d76 100644 --- a/tests/TestSuite_distributor.py +++ b/tests/TestSuite_distributor.py @@ -34,20 +34,21 @@ DPDK Test suite. """ import re import utils +import os from test_case import TestCase -from etgen import IxiaPacketGenerator +from pktgen import PacketGeneratorHelper +class TestDistributor(TestCase): -class TestDistributor(TestCase, IxiaPacketGenerator): def set_up_all(self): """ Run at the start of each test suite. """ self.tester.extend_external_packet_generator(TestDistributor, self) - out = self.dut.send_expect("make -C test -j", "#") - self.verify("Error" not in out, "Compilation error") - self.verify("No such" not in out, "Compilation error") + #out = self.dut.send_expect("make -C test -j", "#") + #self.verify("Error" not in out, "Compilation error") + #self.verify("No such" not in out, "Compilation error") # reduce tx queues for enable many workers self.dut.send_expect("sed -i -e 's/.*txRings = .*/\\tconst uint16_t rxRings = 1, txRings = 1;/' ./examples/distributor/main.c", "#") @@ -57,6 +58,15 @@ class TestDistributor(TestCase, IxiaPacketGenerator): self.dut_ports = self.dut.get_ports() self.app = "./examples/distributor/build/distributor_app" + # 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): """ @@ -106,13 +116,16 @@ class TestDistributor(TestCase, IxiaPacketGenerator): # output port is calculated from overall ports number cmd_fmt = "%s -c %s -n %d -w %s -- -p 0x1" socket = self.dut.get_numa_id(self.dut_ports[0]) - - self.tester.scapy_append('wrpcap("distributor.pcap", [Ether()/IP()/("X"*26)])') + + pcap = os.sep.join([self.output_path, "distributor.pcap"]) + self.tester.scapy_append('wrpcap("%s", [Ether()/IP()/("X"*26)])' % pcap) self.tester.scapy_execute() tgen_input = [] rx_port = self.tester.get_local_port(self.dut_ports[0]) tx_port = self.tester.get_local_port(self.dut_ports[0]) - tgen_input.append((tx_port, rx_port, "distributor.pcap")) + + pcap = os.sep.join([self.output_path, "distributor.pcap"]) + tgen_input.append((tx_port, rx_port, pcap)) self.result_table_create(table_header) for worker_num in workers: @@ -128,8 +141,14 @@ class TestDistributor(TestCase, IxiaPacketGenerator): self.dut.send_expect(cmd, "doing packet RX", timeout=30) - self.tester.ixia_packet_gen.hook_transmission_func = self.hook_transmission_func - _, pps = self.tester.traffic_generator_throughput(tgen_input, delay=2) + self.app_output = self.dut.session.get_session_before(timeout=2) + + # clear streams before add new streams + self.tester.pktgen.clear_streams() + # run packet generator + streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, + None, self.tester.pktgen) + _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams) self.dut.send_expect("^C", "#") @@ -255,19 +274,14 @@ class TestDistributor(TestCase, IxiaPacketGenerator): cycles = lines[2].split()[3] return int(cycles) - def ip(self, port, frag, src, proto, tos, dst, chksum, len, options, version, flags, ihl, ttl, id): - self.add_tcl_cmd("protocol config -name ip") - self.add_tcl_cmd('ip config -sourceIpAddr "%s"' % src) - self.add_tcl_cmd("ip config -sourceIpAddrMode ipIdle") - self.add_tcl_cmd('ip config -destIpAddr "%s"' % dst) - self.add_tcl_cmd("ip config -destIpAddrMode ipRandom") - self.add_tcl_cmd("ip config -ttl %d" % ttl) - self.add_tcl_cmd("ip config -totalLength %d" % len) - self.add_tcl_cmd("ip config -fragment %d" % frag) - self.add_tcl_cmd("ip config -ipProtocol ipV4ProtocolReserved255") - self.add_tcl_cmd("ip config -identifier %d" % id) - self.add_tcl_cmd("stream config -framesize %d" % (len + 18)) - self.add_tcl_cmd("ip set %d %d %d" % (self.chasId, port['card'], port['port'])) + def set_fields(self): + ''' set ip protocol field behavior ''' + fields_config = { + 'ip': { + 'dst': {'mask': '255.240.0.0', 'action': 'inc'} + },} + + return fields_config def tear_down(self): """ -- 2.17.1