fix the new profiles
authorHanoh Haim <[email protected]>
Wed, 10 Feb 2016 09:16:42 +0000 (11:16 +0200)
committerHanoh Haim <[email protected]>
Wed, 10 Feb 2016 09:16:42 +0000 (11:16 +0200)
17 files changed:
scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py
scripts/automation/trex_control_plane/stl/trex_stl_lib/api.py
scripts/stl/imix.py
scripts/stl/udp_1pkt_1mac.py [moved from scripts/stl/profiles/udp_1pkt_1mac.py with 80% similarity]
scripts/stl/udp_1pkt_1mac.pyc [new file with mode: 0644]
scripts/stl/udp_1pkt_1mac_override.py [moved from scripts/stl/profiles/udp_1pkt_1mac_override.py with 87% similarity]
scripts/stl/udp_1pkt_1mac_override.pyc [new file with mode: 0644]
scripts/stl/udp_1pkt_mac.py [moved from scripts/stl/profiles/udp_1pkt_mac.py with 80% similarity]
scripts/stl/udp_1pkt_mac.pyc [new file with mode: 0644]
scripts/stl/udp_1pkt_mpls.py [moved from scripts/stl/profiles/udp_1pkt_mpls.py with 73% similarity]
scripts/stl/udp_1pkt_mpls.pyc [new file with mode: 0644]
scripts/stl/udp_1pkt_mpls_vm.py [moved from scripts/stl/profiles/udp_1pkt_mpls_vm.py with 55% similarity]
scripts/stl/udp_1pkt_mpls_vm.pyc [new file with mode: 0644]
scripts/stl/udp_1pkt_tuple_gen.py
scripts/stl/udp_1pkt_tuple_gen.pyc [new file with mode: 0644]
scripts/stl/udp_inc_len_9k.py [moved from scripts/stl/profiles/udp_inc_len_9k.py with 51% similarity]
scripts/stl/udp_rand_len_9k.py

index 7d17d0e..28f5b04 100644 (file)
@@ -119,7 +119,7 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test):
 
     def run_py_profile_path (self, profile, options,silent = False, do_no_remove=False,compare =True):
         output_cap = "a.pcap"
-        input_file =  os.path.join('stl/profiles/', profile)
+        input_file =  os.path.join('stl/', profile)
         golden_file = os.path.join('exp',os.path.basename(profile).split('.')[0]+'.pcap');
         try:
             rc = self.run_sim(input_file, output_cap, options, silent)
index a9e9917..9ce9f7f 100644 (file)
@@ -15,10 +15,11 @@ STLPktBuilder          = CScapyTRexPktBuilder
 
 # VM
 STLVmFlowVar           = CTRexVmDescFlowVar
-STLVmWriteFlowVar      = CTRexVmDescWrFlowVar
+STLVmWrFlowVar         = CTRexVmDescWrFlowVar
 STLVmFixIpv4           = CTRexVmDescFixIpv4
 STLVmTrimPktSize       = CTRexVmDescTrimPktSize
 STLVmTupleGen          = CTRexVmDescTupleGen
+STLVmTrimPktSize       = CTRexVmDescTrimPktSize
 
 
 # simulator
index 875f254..144bb3f 100644 (file)
@@ -44,11 +44,11 @@ class STLImix(object):
         vm =[
             # src
             STLVmFlowVar(name="src",min_value=src['start'],max_value=src['end'],size=4,op="inc"),
-            STLVmWriteFlowVar(fv_name="src",pkt_offset= "IP.src"),
+            STLVmWrFlowVar(fv_name="src",pkt_offset= "IP.src"),
 
             # dst
             STLVmFlowVar(name="dst",min_value=dst['start'],max_value=dst['end'],size=4,op="inc"),
-            STLVmWriteFlowVar(fv_name="dst",pkt_offset= "IP.dst"),
+            STLVmWrFlowVar(fv_name="dst",pkt_offset= "IP.dst"),
 
             # checksum
             STLVmFixIpv4(offset = "IP")
similarity index 80%
rename from scripts/stl/profiles/udp_1pkt_1mac.py
rename to scripts/stl/udp_1pkt_1mac.py
index 4e666ad..f12f8b0 100644 (file)
@@ -1,14 +1,4 @@
-import sys
-import os
-
-# Should be removed 
-# TBD fix this 
-CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
-API_PATH     = os.path.join(CURRENT_PATH, "../../api/stl")
-sys.path.insert(0, API_PATH)
-
-from scapy.all import *
-from trex_stl_api import *
+from trex_stl_lib.api import *
 
 # 1 clients MAC override the LSB of destination
 class STLS1(object):
diff --git a/scripts/stl/udp_1pkt_1mac.pyc b/scripts/stl/udp_1pkt_1mac.pyc
new file mode 100644 (file)
index 0000000..9fd5442
Binary files /dev/null and b/scripts/stl/udp_1pkt_1mac.pyc differ
similarity index 87%
rename from scripts/stl/profiles/udp_1pkt_1mac_override.py
rename to scripts/stl/udp_1pkt_1mac_override.py
index 38f10d9..fab4ce9 100644 (file)
@@ -1,14 +1,4 @@
-import sys
-import os
-
-# Should be removed 
-# TBD fix this 
-CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
-API_PATH     = os.path.join(CURRENT_PATH, "../../api/stl")
-sys.path.insert(0, API_PATH)
-
-from scapy.all import *
-from trex_stl_api import *
+from trex_stl_lib.api import *
 
 # 1 clients MAC override the LSB of destination
 # overide the destination mac  00:bb::12:34:56:01 -00:bb::12:34:56:0a
diff --git a/scripts/stl/udp_1pkt_1mac_override.pyc b/scripts/stl/udp_1pkt_1mac_override.pyc
new file mode 100644 (file)
index 0000000..6656968
Binary files /dev/null and b/scripts/stl/udp_1pkt_1mac_override.pyc differ
similarity index 80%
rename from scripts/stl/profiles/udp_1pkt_mac.py
rename to scripts/stl/udp_1pkt_mac.py
index 760bca1..375c4a5 100644 (file)
@@ -1,14 +1,5 @@
-import sys
-import os
+from trex_stl_lib.api import *
 
-# Should be removed 
-# TBD fix this 
-CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
-API_PATH     = os.path.join(CURRENT_PATH, "../../api/stl")
-sys.path.insert(0, API_PATH)
-
-from scapy.all import *
-from trex_stl_api import *
 
 # 10 clients override the LSB of destination
 class STLS1(object):
diff --git a/scripts/stl/udp_1pkt_mac.pyc b/scripts/stl/udp_1pkt_mac.pyc
new file mode 100644 (file)
index 0000000..61ae691
Binary files /dev/null and b/scripts/stl/udp_1pkt_mac.pyc differ
similarity index 73%
rename from scripts/stl/profiles/udp_1pkt_mpls.py
rename to scripts/stl/udp_1pkt_mpls.py
index 6e3a764..83093db 100644 (file)
@@ -1,15 +1,5 @@
-import sys
-import os
-
-# Should be removed 
-# TBD fix this 
-CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
-API_PATH     = os.path.join(CURRENT_PATH, "../../api/stl")
-sys.path.insert(0, API_PATH)
-
-from scapy.all import *
+from trex_stl_lib.api import *
 from scapy.contrib.mpls import * # import from contrib folder of scapy 
-from trex_stl_api import *
 
 
 class STLS1(object):
diff --git a/scripts/stl/udp_1pkt_mpls.pyc b/scripts/stl/udp_1pkt_mpls.pyc
new file mode 100644 (file)
index 0000000..34b7150
Binary files /dev/null and b/scripts/stl/udp_1pkt_mpls.pyc differ
similarity index 55%
rename from scripts/stl/profiles/udp_1pkt_mpls_vm.py
rename to scripts/stl/udp_1pkt_mpls_vm.py
index b324a88..262a662 100644 (file)
@@ -1,15 +1,5 @@
-import sys
-import os
-
-# Should be removed 
-# TBD fix this 
-CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
-API_PATH     = os.path.join(CURRENT_PATH, "../../api/stl")
-sys.path.insert(0, API_PATH)
-
-from scapy.all import *
+from trex_stl_lib.api import *
 from scapy.contrib.mpls import * # import from contrib folder of scapy 
-from trex_stl_api import *
 
 
 class STLS1(object):
@@ -21,8 +11,8 @@ class STLS1(object):
         # 2 MPLS label the internal with  s=1 (last one)
         pkt =  Ether()/MPLS(label=17,cos=1,s=0,ttl=255)/MPLS(label=0,cos=1,s=1,ttl=12)/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/('x'*20)
 
-        vm = CTRexScRaw( [ CTRexVmDescFlowVar(name="mlabel", min_value=1, max_value=2000, size=2, op="inc"), # 2 bytes var
-                           CTRexVmDescWrFlowVar(fv_name="mlabel", pkt_offset= "MPLS:1.label")                # LABEL is 20 bits expected is val*8 as 3 LSB are off, 16,32,64 .. using new instruction it will be possible to write to any bits
+        vm = CTRexScRaw( [ STLVmFlowVar(name="mlabel", min_value=1, max_value=2000, size=2, op="inc"), # 2 bytes var
+                           STLVmWrFlowVar(fv_name="mlabel", pkt_offset= "MPLS:1.label")                # LABEL is 20 bits expected is val*8 as 3 LSB are off, 16,32,64 .. using new instruction it will be possible to write to any bits
                           ]
                        )
 
diff --git a/scripts/stl/udp_1pkt_mpls_vm.pyc b/scripts/stl/udp_1pkt_mpls_vm.pyc
new file mode 100644 (file)
index 0000000..4aada90
Binary files /dev/null and b/scripts/stl/udp_1pkt_mpls_vm.pyc differ
index 33915cc..08732f4 100644 (file)
@@ -12,14 +12,14 @@ class STLS1(object):
         base_pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)
 
         pad = max(0, size - len(base_pkt)) * 'x'
-
-        vm = CTRexScRaw( [   CTRexVmDescTupleGen ( ip_min="16.0.0.1", ip_max="16.0.0.2", 
+                             
+        vm = CTRexScRaw( [   STLVmTupleGen ( ip_min="16.0.0.1", ip_max="16.0.0.2", 
                                                    port_min=1025, port_max=65535,
                                                     name="tuple"), # define tuple gen 
 
-                             CTRexVmDescWrFlowVar (fv_name="tuple.ip", pkt_offset= "IP.src" ), # write ip to packet IP.src
-                             CTRexVmDescFixIpv4(offset = "IP"),                                # fix checksum
-                             CTRexVmDescWrFlowVar (fv_name="tuple.port", pkt_offset= "UDP.sport" )  #write udp.port
+                             STLVmWrFlowVar (fv_name="tuple.ip", pkt_offset= "IP.src" ), # write ip to packet IP.src
+                             STLVmFixIpv4(offset = "IP"),                                # fix checksum
+                             STLVmWrFlowVar (fv_name="tuple.port", pkt_offset= "UDP.sport" )  #write udp.port
                                   ]
                               );
 
diff --git a/scripts/stl/udp_1pkt_tuple_gen.pyc b/scripts/stl/udp_1pkt_tuple_gen.pyc
new file mode 100644 (file)
index 0000000..6a824dc
Binary files /dev/null and b/scripts/stl/udp_1pkt_tuple_gen.pyc differ
similarity index 51%
rename from scripts/stl/profiles/udp_inc_len_9k.py
rename to scripts/stl/udp_inc_len_9k.py
index fc22e29..09df305 100644 (file)
@@ -1,14 +1,4 @@
-import sys
-import os
-
-# Should be removed 
-# TBD fix this 
-CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
-API_PATH     = os.path.join(CURRENT_PATH, "../../api/stl")
-sys.path.insert(0, API_PATH)
-
-from scapy.all import *
-from trex_stl_api import *
+from trex_stl_lib.api import *
 
 class STLS1(object):
 
@@ -28,11 +18,11 @@ class STLS1(object):
 
 
         # vm
-        vm = CTRexScRaw( [ CTRexVmDescFlowVar(name="fv_rand", min_value=64, max_value=len(base_pkt), size=2, op="inc"),
-                           CTRexVmDescTrimPktSize("fv_rand"), # total packet size
-                           CTRexVmDescWrFlowVar(fv_name="fv_rand", pkt_offset= "IP.len", add_val=l3_len_fix), # fix ip len 
-                           CTRexVmDescFixIpv4(offset = "IP"),                                # fix checksum
-                           CTRexVmDescWrFlowVar(fv_name="fv_rand", pkt_offset= "UDP.len", add_val=l4_len_fix) # fix udp len  
+        vm = CTRexScRaw( [ STLVmFlowVar(name="fv_rand", min_value=64, max_value=len(base_pkt), size=2, op="inc"),
+                           STLVmTrimPktSize("fv_rand"), # total packet size
+                           STLVmWrFlowVar(fv_name="fv_rand", pkt_offset= "IP.len", add_val=l3_len_fix), # fix ip len 
+                           STLVmFixIpv4(offset = "IP"),                                # fix checksum
+                           STLVmWrFlowVar(fv_name="fv_rand", pkt_offset= "UDP.len", add_val=l4_len_fix) # fix udp len  
                           ]
                        )
 
index ea348fe..cf78b1c 100644 (file)
@@ -1,4 +1,3 @@
-
 from trex_stl_lib.api import *
 
 class STLS1(object):
@@ -19,11 +18,11 @@ class STLS1(object):
 
 
         # vm
-        vm = CTRexScRaw( [ CTRexVmDescFlowVar(name="fv_rand", min_value=64, max_value=len(base_pkt), size=2, op="random"),
-                           CTRexVmDescTrimPktSize("fv_rand"), # total packet size
-                           CTRexVmDescWrFlowVar(fv_name="fv_rand", pkt_offset= "IP.len", add_val=l3_len_fix), # fix ip len 
-                           CTRexVmDescFixIpv4(offset = "IP"),                                # fix checksum
-                           CTRexVmDescWrFlowVar(fv_name="fv_rand", pkt_offset= "UDP.len", add_val=l4_len_fix) # fix udp len  
+        vm = CTRexScRaw( [ STLVmFlowVar(name="fv_rand", min_value=64, max_value=len(base_pkt), size=2, op="random"),
+                           STLVmTrimPktSize("fv_rand"), # total packet size
+                           STLVmWrFlowVar(fv_name="fv_rand", pkt_offset= "IP.len", add_val=l3_len_fix), # fix ip len 
+                           STLVmFixIpv4(offset = "IP"),                                # fix checksum
+                           STLVmWrFlowVar(fv_name="fv_rand", pkt_offset= "UDP.len", add_val=l4_len_fix) # fix udp len  
                           ]
                        )