test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V2] tests:add GTP function process to cover scapy 2.3 and 2.4 for advance rss feature
@ 2020-01-03 15:18 zhiwei.he
  0 siblings, 0 replies; only message in thread
From: zhiwei.he @ 2020-01-03 15:18 UTC (permalink / raw)
  To: dts; +Cc: zhiwei.he

From: "zhiwei.he" <zhiwei.he@intel.com>

Signed-off-by: zhiwei.he <zhiwei.he@intel.com>
---
 tests/TestSuite_cvl_advanced_rss.py | 70 ++++++++++++++++++++++---------------
 1 file changed, 41 insertions(+), 29 deletions(-)

diff --git a/tests/TestSuite_cvl_advanced_rss.py b/tests/TestSuite_cvl_advanced_rss.py
index 4364b56..077b6ed 100644
--- a/tests/TestSuite_cvl_advanced_rss.py
+++ b/tests/TestSuite_cvl_advanced_rss.py
@@ -2,7 +2,8 @@ import json
 import time
 import re
 import packet
-
+import os
+from scapy.contrib.gtp import *
 from test_case import TestCase
 from pmd_output import PmdOutput
 from utils import BLUE, RED
@@ -18,6 +19,16 @@ from scapy.layers.l2 import Dot1Q
 from scapy.layers.sctp import SCTP, SCTPChunkData
 from nvgre import NVGRE
 
+out = os.popen("pip list|grep scapy ")
+version_result =out.read()
+p=re.compile('scapy\s+2\.3\.\d+')
+m=p.search(version_result)
+
+if not m:
+   GTP_TEID= "teid"
+else:
+   GTP_TEID= "TEID"
+
 tv_mac_ipv4_l3_src_only = {
     "name":"tv_mac_ipv4_l3_src_only",
     "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / end actions rss types ipv4 l3-src-only end key_len 0 queues end / end",
@@ -356,34 +367,56 @@ tv_mac_ipv4_pppoe_icmp= {
     "check_func_param": {"expect_port":0}
 }
 
+
+pkt_str=[]
+pkt = ['Ether(dst="68:05:ca:a3:28:94")/IP()/UDP(dport=2152)/GTP_U_Header(GTP_TEID=0x123456)/IP(src="192.168.0.%d")/ICMP()/("X"*480)' %i for i in range(0,100)]
+for i in pkt:
+    pkt_str.append(i.replace('GTP_TEID', GTP_TEID))
+
 tv_mac_ipv4_gtpu_icmp= {
     "name":"tv_mac_ipv4_gtpu_icmp",
     "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp / gtpu / gtp_psc / ipv4 / end actions rss types ipv4 l3-src-only end key_len 0 queues end / end",
-    "scapy_str":['Ether(dst="68:05:ca:a3:28:94")/IP()/UDP(dport=2152)/GTP_U_Header(teid=0x123456)/IP(src="192.168.0.%d")/ICMP()/("X"*480)' %i for i in range(0,100)],
+    "scapy_str":pkt_str,
     "check_func": rfc.check_packets_of_each_queue,
     "check_func_param": {"expect_port":0}
 }
 
+pkt_str=[]
+pkt = ['Ether(dst="68:05:ca:a3:28:94")/IP()/UDP(dport=2152)/GTP_U_Header(GTP_TEID=0x123456)/IP(src="192.168.0.%d", frag=6)/UDP(dport=%d)/("X"*480)' %(i, i+10) for i in range(0,100)]
+for i in pkt:
+    pkt_str.append(i.replace('GTP_TEID', GTP_TEID)) 
+
+
 tv_mac_ipv4_gtpu_udp_frag= {
     "name":"tv_mac_ipv4_gtpu_udp_frag",
     "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp / gtpu / gtp_psc / ipv4 / udp / end actions rss types ipv4 end key_len 0 queues end / end",
-    "scapy_str":['Ether(dst="68:05:ca:a3:28:94")/IP()/UDP(dport=2152)/GTP_U_Header(teid=0x123456)/IP(src="192.168.0.%d", frag=6)/UDP(dport=%d)/("X"*480)' %(i, i+10) for i in range(0,100)],
+    "scapy_str":pkt_str,
     "check_func": rfc.check_packets_of_each_queue,
     "check_func_param": {"expect_port":0}
 }
 
+pkt_str=[]
+pkt = ['Ether(dst="68:05:ca:a3:28:94")/IP()/UDP(dport=2152)/GTP_U_Header(GTP_TEID=0x123456)/IP(src="192.168.0.%d", frag=6)/("X"*480)' %i for i in range(0,100)]
+for i in pkt:
+    pkt_str.append(i.replace('GTP_TEID', GTP_TEID)) 
+
 tv_mac_ipv4_gtpu_ipv4_frag= {
     "name":"tv_mac_ipv4_gtpu_ipv4_frag",
     "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp / gtpu / gtp_psc / ipv4 / end actions rss types ipv4 l3-src-only end key_len 0 queues end / end",
-    "scapy_str":['Ether(dst="68:05:ca:a3:28:94")/IP()/UDP(dport=2152)/GTP_U_Header(teid=0x123456)/IP(src="192.168.0.%d", frag=6)/("X"*480)' %i for i in range(0,100)],
+    "scapy_str":pkt_str,
     "check_func": rfc.check_packets_of_each_queue,
     "check_func_param": {"expect_port":0}
 }
 
+pkt_str=[]
+pkt =['Ether(dst="68:05:ca:a3:28:94")/IP()/UDP(dport=2152)/GTP_U_Header(GTP_TEID=0x123456)/IP(src="192.168.0.%d", frag=6)/TCP(dport=%d)/("X"*480)' %(i, i+10) for i in range(0,100)]
+for i in pkt:
+    pkt_str.append(i.replace('GTP_TEID', GTP_TEID)) 
+
 tv_mac_ipv4_gtpu_tcp= {
     "name":"tv_mac_ipv4_gtpu_tcp",
     "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp / gtpu / gtp_psc / ipv4 / tcp / end actions rss types ipv4 l3-src-only end key_len 0 queues end / end",
-    "scapy_str":['Ether(dst="68:05:ca:a3:28:94")/IP()/UDP(dport=2152)/GTP_U_Header(teid=0x123456)/IP(src="192.168.0.%d", frag=6)/TCP(dport=%d)/("X"*480)' %(i, i+10) for i in range(0,100)],
+    "scapy_str":pkt_str,
     "check_func": rfc.check_packets_of_each_queue,
     "check_func_param": {"expect_port":0}
 }
@@ -799,7 +832,9 @@ class AdvancedRSSTest(TestCase):
         self.pf_mac = self.dut.get_mac_address(0)
         self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
         self.verify(self.nic in ["columbiaville_25g","columbiaville_100g"], "%s nic not support ethertype filter" % self.nic)
-    
+
+
+
     def set_up(self):
         """
         Run before each test case.
@@ -830,28 +865,6 @@ class AdvancedRSSTest(TestCase):
         command = "./%s/app/testpmd %s  -- -i %s" % (self.dut.target, all_eal_param, "--rxq=64 --txq=64")
         return command
 
-
-    def create_testpmd_command_pipeline_mode(self):
-        """
-        Create testpmd command for pipeline mode
-        """
-        #Prepare testpmd EAL and parameters   
-        all_eal_param = self.dut.create_eal_parameters(ports=[0], port_options={0:"pipeline-mode-support=1"})
-        print all_eal_param   #print eal parameters
-        command = "./%s/app/testpmd %s  -- -i %s" % (self.dut.target, all_eal_param, "--rxq=64 --txq=64")
-        return command
-
-
-    def get_rule_number(self,outstring):
-        """
-        get the rule number.
-        """
-        result_scanner = r'Flow rule #(\d+) created'
-        scanner = re.compile(result_scanner, re.DOTALL)
-        m = scanner.search(outstring)
-        rule_num = int(m.group(1))
-        return rule_num
-
     def _rte_flow_validate_pattern(self, test_vectors, command, is_vxlan):
 
         global test_results
@@ -951,4 +964,3 @@ class AdvancedRSSTest(TestCase):
          command = self.create_testpmd_command()
          self._rte_flow_validate_pattern(tvs_mac_rss_simple_xor, command, is_vxlan = True)   
 
-
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-03 15:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-03 15:18 [dts] [PATCH V2] tests:add GTP function process to cover scapy 2.3 and 2.4 for advance rss feature zhiwei.he

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).