summaryrefslogtreecommitdiffstats
path: root/scripts/stl
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-02-15 18:01:09 +0200
committerHanoh Haim <hhaim@cisco.com>2016-02-15 18:01:09 +0200
commit1e98c58d91673ae56d4eb0943d619ddb77a21a33 (patch)
treefdc78e2ea1121ecbd5c5626414e0ae5016ebb2f0 /scripts/stl
parent0c28aadfe1490c0ec44c94690f4c6d64f2e76e41 (diff)
add scapy layer for default mac
Diffstat (limited to 'scripts/stl')
-rw-r--r--scripts/stl/udp_1pkt_simple_mac_dst.py22
-rw-r--r--scripts/stl/udp_1pkt_simple_mac_dst_src.py22
-rw-r--r--scripts/stl/udp_1pkt_simple_mac_src.py22
3 files changed, 66 insertions, 0 deletions
diff --git a/scripts/stl/udp_1pkt_simple_mac_dst.py b/scripts/stl/udp_1pkt_simple_mac_dst.py
new file mode 100644
index 00000000..6b728881
--- /dev/null
+++ b/scripts/stl/udp_1pkt_simple_mac_dst.py
@@ -0,0 +1,22 @@
+from trex_stl_lib.api import *
+
+# stream will be sent with src MAC addrees dst="60:60:60:60:60:60" and not from default of trex_cfg.yaml port src mac
+class STLS1(object):
+
+ def create_stream (self):
+ return STLStream( packet = STLPktBuilder(pkt = Ether(dst="60:60:60:60:60:60")/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/(10*'x')),
+ mode = STLTXCont(),
+ #mac_dst_override_mode=STLStreamDstMAC_PKT # another way to explictly take it
+ )
+
+ 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()
+
+
+
diff --git a/scripts/stl/udp_1pkt_simple_mac_dst_src.py b/scripts/stl/udp_1pkt_simple_mac_dst_src.py
new file mode 100644
index 00000000..e3df0d0d
--- /dev/null
+++ b/scripts/stl/udp_1pkt_simple_mac_dst_src.py
@@ -0,0 +1,22 @@
+from trex_stl_lib.api import *
+
+# stream will be sent with src MAC addrees dst="60:60:60:60:60:60" and not from default of trex_cfg.yaml port src mac
+class STLS1(object):
+
+ def create_stream (self):
+ return STLStream( packet = STLPktBuilder(pkt = Ether(src="61:61:61:61:61:61",dst="60:60:60:60:60:60")/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/(10*'x')),
+ mode = STLTXCont(),
+ #mac_dst_override_mode=STLStreamDstMAC_PKT # another way to explictly take it
+ )
+
+ 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()
+
+
+
diff --git a/scripts/stl/udp_1pkt_simple_mac_src.py b/scripts/stl/udp_1pkt_simple_mac_src.py
new file mode 100644
index 00000000..fe5a2a80
--- /dev/null
+++ b/scripts/stl/udp_1pkt_simple_mac_src.py
@@ -0,0 +1,22 @@
+from trex_stl_lib.api import *
+
+# stream will be sent with src MAC addrees src="60:60:60:60:60:60" and not from default of trex_cfg.yaml port src mac
+class STLS1(object):
+
+ def create_stream (self):
+ return STLStream( packet = STLPktBuilder(pkt = Ether(src="60:60:60:60:60:60")/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/(10*'x')),
+ mode = STLTXCont(),
+ #mac_src_override_by_pkt=True # another way to explictly take it
+ )
+
+ 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()
+
+
+