diff options
author | 2016-02-10 11:16:42 +0200 | |
---|---|---|
committer | 2016-02-10 11:16:42 +0200 | |
commit | 44fad7adb1bda65f2735284c5ccf83ab9b81e539 (patch) | |
tree | b8c477c3333f6250910f23cd72b2ae70651c979d | |
parent | d673fcc4f798ac260f467abb8848d3d39fc861aa (diff) |
fix the new profiles
-rw-r--r-- | scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py | 2 | ||||
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/api.py | 3 | ||||
-rw-r--r-- | scripts/stl/imix.py | 4 | ||||
-rw-r--r-- | scripts/stl/udp_1pkt_1mac.py (renamed from scripts/stl/profiles/udp_1pkt_1mac.py) | 12 | ||||
-rw-r--r-- | scripts/stl/udp_1pkt_1mac.pyc | bin | 0 -> 1531 bytes | |||
-rw-r--r-- | scripts/stl/udp_1pkt_1mac_override.py (renamed from scripts/stl/profiles/udp_1pkt_1mac_override.py) | 12 | ||||
-rw-r--r-- | scripts/stl/udp_1pkt_1mac_override.pyc | bin | 0 -> 1776 bytes | |||
-rw-r--r-- | scripts/stl/udp_1pkt_mac.py (renamed from scripts/stl/profiles/udp_1pkt_mac.py) | 11 | ||||
-rw-r--r-- | scripts/stl/udp_1pkt_mac.pyc | bin | 0 -> 1525 bytes | |||
-rw-r--r-- | scripts/stl/udp_1pkt_mpls.py (renamed from scripts/stl/profiles/udp_1pkt_mpls.py) | 12 | ||||
-rw-r--r-- | scripts/stl/udp_1pkt_mpls.pyc | bin | 0 -> 1372 bytes | |||
-rw-r--r-- | scripts/stl/udp_1pkt_mpls_vm.py (renamed from scripts/stl/profiles/udp_1pkt_mpls_vm.py) | 16 | ||||
-rw-r--r-- | scripts/stl/udp_1pkt_mpls_vm.pyc | bin | 0 -> 1647 bytes | |||
-rw-r--r-- | scripts/stl/udp_1pkt_tuple_gen.py | 10 | ||||
-rw-r--r-- | scripts/stl/udp_1pkt_tuple_gen.pyc | bin | 0 -> 1676 bytes | |||
-rw-r--r-- | scripts/stl/udp_inc_len_9k.py (renamed from scripts/stl/profiles/udp_inc_len_9k.py) | 22 | ||||
-rw-r--r-- | scripts/stl/udp_rand_len_9k.py | 11 |
17 files changed, 28 insertions, 87 deletions
diff --git a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py index 7d17d0e2..28f5b041 100644 --- a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py +++ b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py @@ -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) diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/api.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/api.py index a9e99178..9ce9f7f1 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/api.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/api.py @@ -15,10 +15,11 @@ STLPktBuilder = CScapyTRexPktBuilder # VM STLVmFlowVar = CTRexVmDescFlowVar -STLVmWriteFlowVar = CTRexVmDescWrFlowVar +STLVmWrFlowVar = CTRexVmDescWrFlowVar STLVmFixIpv4 = CTRexVmDescFixIpv4 STLVmTrimPktSize = CTRexVmDescTrimPktSize STLVmTupleGen = CTRexVmDescTupleGen +STLVmTrimPktSize = CTRexVmDescTrimPktSize # simulator diff --git a/scripts/stl/imix.py b/scripts/stl/imix.py index 875f2544..144bb3f8 100644 --- a/scripts/stl/imix.py +++ b/scripts/stl/imix.py @@ -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") diff --git a/scripts/stl/profiles/udp_1pkt_1mac.py b/scripts/stl/udp_1pkt_1mac.py index 4e666ad7..f12f8b01 100644 --- a/scripts/stl/profiles/udp_1pkt_1mac.py +++ b/scripts/stl/udp_1pkt_1mac.py @@ -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 Binary files differnew file mode 100644 index 00000000..9fd5442f --- /dev/null +++ b/scripts/stl/udp_1pkt_1mac.pyc diff --git a/scripts/stl/profiles/udp_1pkt_1mac_override.py b/scripts/stl/udp_1pkt_1mac_override.py index 38f10d9a..fab4ce99 100644 --- a/scripts/stl/profiles/udp_1pkt_1mac_override.py +++ b/scripts/stl/udp_1pkt_1mac_override.py @@ -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 Binary files differnew file mode 100644 index 00000000..6656968d --- /dev/null +++ b/scripts/stl/udp_1pkt_1mac_override.pyc diff --git a/scripts/stl/profiles/udp_1pkt_mac.py b/scripts/stl/udp_1pkt_mac.py index 760bca12..375c4a59 100644 --- a/scripts/stl/profiles/udp_1pkt_mac.py +++ b/scripts/stl/udp_1pkt_mac.py @@ -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 Binary files differnew file mode 100644 index 00000000..61ae6914 --- /dev/null +++ b/scripts/stl/udp_1pkt_mac.pyc diff --git a/scripts/stl/profiles/udp_1pkt_mpls.py b/scripts/stl/udp_1pkt_mpls.py index 6e3a7645..83093dbd 100644 --- a/scripts/stl/profiles/udp_1pkt_mpls.py +++ b/scripts/stl/udp_1pkt_mpls.py @@ -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 Binary files differnew file mode 100644 index 00000000..34b71507 --- /dev/null +++ b/scripts/stl/udp_1pkt_mpls.pyc diff --git a/scripts/stl/profiles/udp_1pkt_mpls_vm.py b/scripts/stl/udp_1pkt_mpls_vm.py index b324a88d..262a662f 100644 --- a/scripts/stl/profiles/udp_1pkt_mpls_vm.py +++ b/scripts/stl/udp_1pkt_mpls_vm.py @@ -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 Binary files differnew file mode 100644 index 00000000..4aada90a --- /dev/null +++ b/scripts/stl/udp_1pkt_mpls_vm.pyc diff --git a/scripts/stl/udp_1pkt_tuple_gen.py b/scripts/stl/udp_1pkt_tuple_gen.py index 33915cc0..08732f4c 100644 --- a/scripts/stl/udp_1pkt_tuple_gen.py +++ b/scripts/stl/udp_1pkt_tuple_gen.py @@ -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 Binary files differnew file mode 100644 index 00000000..6a824dc3 --- /dev/null +++ b/scripts/stl/udp_1pkt_tuple_gen.pyc diff --git a/scripts/stl/profiles/udp_inc_len_9k.py b/scripts/stl/udp_inc_len_9k.py index fc22e295..09df305a 100644 --- a/scripts/stl/profiles/udp_inc_len_9k.py +++ b/scripts/stl/udp_inc_len_9k.py @@ -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 ] ) diff --git a/scripts/stl/udp_rand_len_9k.py b/scripts/stl/udp_rand_len_9k.py index ea348fe5..cf78b1c9 100644 --- a/scripts/stl/udp_rand_len_9k.py +++ b/scripts/stl/udp_rand_len_9k.py @@ -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 ] ) |