summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py5
-rw-r--r--scripts/exp/udp_inc_len_9k.pcapbin0 -> 12974 bytes
-rw-r--r--scripts/stl/profiles/udp_inc_len_9k.py57
3 files changed, 60 insertions, 2 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 99287c01..ae4d821f 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
@@ -155,10 +155,11 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test):
["udp_rand_len_9k.py","-m 1 -l 50",False], # can't do the compare
["udp_1pkt_mpls.py","-m 1 -l 50",True],
["udp_1pkt_mpls_vm.py","-m 1 ",True],
- ["imix.py","-m 1 -l 100",True]
+ ["imix.py","-m 1 -l 100",True],
+ ["udp_inc_len_9k.py","-m 1 -l 100",True]
];
- #p=[ ["imix.py","-m 1 -l 100",True] ]
+ #p=[ ["udp_inc_len_9k.py","-m 1 -l 100",True] ]
for obj in p:
self.run_py_profile_path (obj[0],obj[1],compare =obj[2], do_no_remove=False)
diff --git a/scripts/exp/udp_inc_len_9k.pcap b/scripts/exp/udp_inc_len_9k.pcap
new file mode 100644
index 00000000..bf367953
--- /dev/null
+++ b/scripts/exp/udp_inc_len_9k.pcap
Binary files differ
diff --git a/scripts/stl/profiles/udp_inc_len_9k.py b/scripts/stl/profiles/udp_inc_len_9k.py
new file mode 100644
index 00000000..fc22e295
--- /dev/null
+++ b/scripts/stl/profiles/udp_inc_len_9k.py
@@ -0,0 +1,57 @@
+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 *
+
+class STLS1(object):
+
+ def __init__ (self):
+ self.max_pkt_size_l3 =9*1024;
+
+ def create_stream (self):
+ # pkt
+ p_l2 = Ether();
+ p_l3 = IP(src="16.0.0.1",dst="48.0.0.1")
+ p_l4 = UDP(dport=12,sport=1025)
+ pyld_size = max(0, self.max_pkt_size_l3 - len(p_l3/p_l4));
+ base_pkt = p_l2/p_l3/p_l4/('\x55'*(pyld_size))
+
+ l3_len_fix =-(len(p_l2));
+ l4_len_fix =-(len(p_l2/p_l3));
+
+
+ # 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
+ ]
+ )
+
+ pkt = STLPktBuilder(pkt = base_pkt,
+ vm = vm)
+
+ return STLStream(packet = pkt,
+ mode = STLTXCont())
+
+
+
+ def get_streams (self, direction = 0):
+ # create 1 stream
+ return [ self.create_stream() ]
+
+
+# dynamic load - used for trex console or simulator
+def register():
+ return STLS1()
+
+
+