summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-02-09 16:51:15 +0200
committerHanoh Haim <hhaim@cisco.com>2016-02-09 16:51:15 +0200
commit6ef1947ba7d3e4b5538ba6f33128fe9d58bb9aad (patch)
tree42f439b85c5df454bd51f32e663afbdfb19f47b4
parent09210b41c07fd42e89c63cf5a402d9dcd9a812a5 (diff)
mpls tests
-rw-r--r--scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py8
-rw-r--r--scripts/exp/udp_1pkt_mpls.pcapbin0 -> 1486 bytes
-rw-r--r--scripts/exp/udp_1pkt_mpls_vm.pcapbin0 -> 8624 bytes
-rw-r--r--scripts/stl/profiles/udp_1pkt_mpls.py37
-rw-r--r--scripts/stl/profiles/udp_1pkt_mpls_vm.py42
5 files changed, 85 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 e55fa804..07d72938 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
@@ -152,11 +152,15 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test):
["udp_1pkt_mac.py","-m 1 -l 50",True],
["udp_1pkt.py","-m 1 -l 50",True],
["udp_1pkt_tuple_gen.py","-m 1 -l 50",True],
- ["udp_rand_len_9k.py","-m 1 -l 50",False] # can't do the compare
+ ["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]
];
+ #p=[ ["udp_1pkt_mpls_vm.py","-m 1 ",True] ]
+
for obj in p:
- self.run_py_profile_path (obj[0],obj[1],compare =obj[2], do_no_remove=False)
+ self.run_py_profile_path (obj[0],obj[1],compare =obj[2], do_no_remove=True)
diff --git a/scripts/exp/udp_1pkt_mpls.pcap b/scripts/exp/udp_1pkt_mpls.pcap
new file mode 100644
index 00000000..4b6e0682
--- /dev/null
+++ b/scripts/exp/udp_1pkt_mpls.pcap
Binary files differ
diff --git a/scripts/exp/udp_1pkt_mpls_vm.pcap b/scripts/exp/udp_1pkt_mpls_vm.pcap
new file mode 100644
index 00000000..cfa69421
--- /dev/null
+++ b/scripts/exp/udp_1pkt_mpls_vm.pcap
Binary files differ
diff --git a/scripts/stl/profiles/udp_1pkt_mpls.py b/scripts/stl/profiles/udp_1pkt_mpls.py
new file mode 100644
index 00000000..6e3a7645
--- /dev/null
+++ b/scripts/stl/profiles/udp_1pkt_mpls.py
@@ -0,0 +1,37 @@
+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 scapy.contrib.mpls import * # import from contrib folder of scapy
+from trex_stl_api import *
+
+
+class STLS1(object):
+
+ def __init__ (self):
+ pass;
+
+ def create_stream (self):
+ # 2 MPLS label the internal with s=1 (last one)
+ pkt = Ether()/MPLS(label=17,cos=1,s=0,ttl=255)/MPLS(label=12,cos=1,s=1,ttl=12)/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/('x'*20)
+
+ # burst of 17 packets
+ return STLStream(packet = STLPktBuilder(pkt = pkt ,vm = []),
+ mode = STLTXSingleBurst( pps = 1, total_pkts = 17) )
+
+
+ def get_streams (self, direction = 0):
+ # create 1 stream
+ return [ self.create_stream() ]
+
+def register():
+ return STLS1()
+
+
+
diff --git a/scripts/stl/profiles/udp_1pkt_mpls_vm.py b/scripts/stl/profiles/udp_1pkt_mpls_vm.py
new file mode 100644
index 00000000..b324a88d
--- /dev/null
+++ b/scripts/stl/profiles/udp_1pkt_mpls_vm.py
@@ -0,0 +1,42 @@
+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 scapy.contrib.mpls import * # import from contrib folder of scapy
+from trex_stl_api import *
+
+
+class STLS1(object):
+
+ def __init__ (self):
+ pass;
+
+ def create_stream (self):
+ # 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
+ ]
+ )
+
+ # burst of 100 packets
+ return STLStream(packet = STLPktBuilder(pkt = pkt ,vm = vm),
+ mode = STLTXSingleBurst( pps = 1, total_pkts = 100) )
+
+
+ def get_streams (self, direction = 0):
+ # create 1 stream
+ return [ self.create_stream() ]
+
+def register():
+ return STLS1()
+
+
+