summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_std.py
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-03-14 13:48:40 +0200
committerHanoh Haim <hhaim@cisco.com>2016-03-14 13:48:40 +0200
commit22f33006471cfed556e6987f88d3d9f7e532687a (patch)
treed82c114419afa32076cb2edb687a1137aa3967f7 /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_std.py
parentd82201e2da3beb0e81e0c8ba30600d87f1b8276f (diff)
parent22e06f3c3532890ad336341c279012afc0710a9d (diff)
merge cleanup
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_std.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_std.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_std.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_std.py
index 8596bbfe..20600791 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_std.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_std.py
@@ -5,26 +5,15 @@ from trex_stl_packet_builder_scapy import *
# will destroy all streams/data on the ports
def stl_map_ports (client, ports = None):
# by default use all ports
- if ports == None:
+ if ports is None:
ports = client.get_all_ports()
- # reset the ports
- client.reset(ports)
-
- # generate streams
- base_pkt = STLPktBuilder(pkt = Ether()/IP())
-
- # send something initial to calm down switches with arps etc.
- stream = STLStream(packet = base_pkt,
- mode = STLTXSingleBurst(pps = 100000, total_pkts = 1))
- client.add_streams(stream, ports)
-
- client.start(ports, mult = "50%")
- client.wait_on_traffic(ports)
- client.reset(ports)
+ stl_send_3_pkts(client, ports)
tx_pkts = {}
pkts = 1
+ base_pkt = STLPktBuilder(pkt = Ether()/IP())
+
for port in ports:
tx_pkts[pkts] = port
stream = STLStream(packet = base_pkt,
@@ -75,3 +64,15 @@ def stl_map_ports (client, ports = None):
return table
+# reset ports and send 3 packets from each acquired port
+def stl_send_3_pkts(client, ports = None):
+
+ base_pkt = STLPktBuilder(pkt = Ether()/IP())
+ stream = STLStream(packet = base_pkt,
+ mode = STLTXSingleBurst(pps = 100000, total_pkts = 3))
+
+ client.reset(ports)
+ client.add_streams(stream, ports)
+ client.start(ports, mult = "50%")
+ client.wait_on_traffic(ports)
+ client.reset(ports)