test suite reviews and discussions
 help / color / Atom feed
* [dts] [PATCH V2] tests/ip_pipeline:add case pipeline_with_traffic_management
@ 2019-09-10  8:09 yaobing
  2019-09-11  8:34 ` Peng, Yuan
  0 siblings, 1 reply; 3+ messages in thread
From: yaobing @ 2019-09-10  8:09 UTC (permalink / raw)
  To: dts; +Cc: yaobing

V1:add case

V2:change copy cli file method and set vm config method

Signed-off-by: yaobing <bingx.y.yao@intel.com>
---
 tests/TestSuite_ip_pipeline.py | 62 ++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py
index f05b5cd..8893ad2 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,58 @@ class TestIPPipeline(TestCase):
         """
         pass
 
+    def set_fields(self):
+        """
+        set ip protocol field behavior
+        """
+        fields_config = {
+            'ip': {
+                'dst': {'range':1, '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 = '/tmp'
+        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 ./examples/ip_pipeline/examples/", "#", 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])
+        pkts = 'Ether(dst="%s")/IP(src="192.168.0.2",dst="0.%s.0.0")'
+        strandard_pps =14880000 / 4096
+        for  i in range(0,15):
+            flow = pkts % (dmac, i)
+            self.tester.scapy_append('wrpcap("%s", [%s])' % (pcap, flow))
+            tgenInput = []
+            port = self.tester.get_local_port(self.dut_ports[0])
+            vm_config = self.set_fields()
+            tgenInput.append([port, port, pcap])
+            self.tester.scapy_execute()
+            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)
+            difference_value = pps - strandard_pps
+            self.verify( -100 < difference_value < 100, "throughput validation failure")
+        self.dut.send_expect("^C","#",20)
+
     def test_routing_pipeline(self):
         """
         routing pipeline
-- 
2.17.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dts] [PATCH V2] tests/ip_pipeline:add case pipeline_with_traffic_management
  2019-09-10  8:09 [dts] [PATCH V2] tests/ip_pipeline:add case pipeline_with_traffic_management yaobing
@ 2019-09-11  8:34 ` Peng, Yuan
  2019-09-11  8:57   ` Li, WenjieX A
  0 siblings, 1 reply; 3+ messages in thread
From: Peng, Yuan @ 2019-09-11  8:34 UTC (permalink / raw)
  To: Yao, BingX Y, dts

Acked-by Peng, Yuan <yuan.peng@intel.com>

-----Original Message-----
From: Yao, BingX Y 
Sent: Tuesday, September 10, 2019 4:10 PM
To: dts@dpdk.org
Cc: Yao, BingX Y <bingx.y.yao@intel.com>
Subject: [dts][PATCH V2] tests/ip_pipeline:add case pipeline_with_traffic_management

V1:add case

V2:change copy cli file method and set vm config method

Signed-off-by: yaobing <bingx.y.yao@intel.com>
---
 tests/TestSuite_ip_pipeline.py | 62 ++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py index f05b5cd..8893ad2 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,58 @@ class TestIPPipeline(TestCase):
         """
         pass
 
+    def set_fields(self):
+        """
+        set ip protocol field behavior
+        """
+        fields_config = {
+            'ip': {
+                'dst': {'range':1, '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 = '/tmp'
+        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 
+ ./examples/ip_pipeline/examples/", "#", 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])
+        pkts = 'Ether(dst="%s")/IP(src="192.168.0.2",dst="0.%s.0.0")'
+        strandard_pps =14880000 / 4096
+        for  i in range(0,15):
+            flow = pkts % (dmac, i)
+            self.tester.scapy_append('wrpcap("%s", [%s])' % (pcap, flow))
+            tgenInput = []
+            port = self.tester.get_local_port(self.dut_ports[0])
+            vm_config = self.set_fields()
+            tgenInput.append([port, port, pcap])
+            self.tester.scapy_execute()
+            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)
+            difference_value = pps - strandard_pps
+            self.verify( -100 < difference_value < 100, "throughput validation failure")
+        self.dut.send_expect("^C","#",20)
+
     def test_routing_pipeline(self):
         """
         routing pipeline
--
2.17.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dts] [PATCH V2] tests/ip_pipeline:add case pipeline_with_traffic_management
  2019-09-11  8:34 ` Peng, Yuan
@ 2019-09-11  8:57   ` Li, WenjieX A
  0 siblings, 0 replies; 3+ messages in thread
From: Li, WenjieX A @ 2019-09-11  8:57 UTC (permalink / raw)
  To: Peng, Yuan, Yao, BingX Y, dts; +Cc: Li, WenjieX A

[-- Attachment #1: Type: text/plain, Size: 4929 bytes --]

Tested-by: Li, WenjieX A <wenjiex.a.li@intel.com>

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Peng, Yuan
> Sent: Wednesday, September 11, 2019 4:34 PM
> To: Yao, BingX Y <bingx.y.yao@intel.com>; dts@dpdk.org
> Subject: Re: [dts] [PATCH V2] tests/ip_pipeline:add case
> pipeline_with_traffic_management
> 
> Acked-by Peng, Yuan <yuan.peng@intel.com>
> 
> -----Original Message-----
> From: Yao, BingX Y
> Sent: Tuesday, September 10, 2019 4:10 PM
> To: dts@dpdk.org
> Cc: Yao, BingX Y <bingx.y.yao@intel.com>
> Subject: [dts][PATCH V2] tests/ip_pipeline:add case
> pipeline_with_traffic_management
> 
> V1:add case
> 
> V2:change copy cli file method and set vm config method
> 
> Signed-off-by: yaobing <bingx.y.yao@intel.com>
> ---
>  tests/TestSuite_ip_pipeline.py | 62 ++++++++++++++++++++++++++++++++++
>  1 file changed, 62 insertions(+)
> 
> diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py index
> f05b5cd..8893ad2 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,58 @@ class TestIPPipeline(TestCase):
>          """
>          pass
> 
> +    def set_fields(self):
> +        """
> +        set ip protocol field behavior
> +        """
> +        fields_config = {
> +            'ip': {
> +                'dst': {'range':1, '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 = '/tmp'
> +        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
> + ./examples/ip_pipeline/examples/", "#", 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])
> +        pkts = 'Ether(dst="%s")/IP(src="192.168.0.2",dst="0.%s.0.0")'
> +        strandard_pps =14880000 / 4096
> +        for  i in range(0,15):
> +            flow = pkts % (dmac, i)
> +            self.tester.scapy_append('wrpcap("%s", [%s])' % (pcap, flow))
> +            tgenInput = []
> +            port = self.tester.get_local_port(self.dut_ports[0])
> +            vm_config = self.set_fields()
> +            tgenInput.append([port, port, pcap])
> +            self.tester.scapy_execute()
> +            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)
> +            difference_value = pps - strandard_pps
> +            self.verify( -100 < difference_value < 100, "throughput validation failure")
> +        self.dut.send_expect("^C","#",20)
> +
>      def test_routing_pipeline(self):
>          """
>          routing pipeline
> --
> 2.17.2


[-- Attachment #2: TestIPPipeline.log --]
[-- Type: application/octet-stream, Size: 547262 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10  8:09 [dts] [PATCH V2] tests/ip_pipeline:add case pipeline_with_traffic_management yaobing
2019-09-11  8:34 ` Peng, Yuan
2019-09-11  8:57   ` Li, WenjieX A

test suite reviews and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ http://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/ public-inbox