summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-03-09 11:04:08 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2016-03-09 11:04:08 +0200
commit3f747bcf1d6cb5654bbd0b0e54fa56bc7ad90e69 (patch)
tree6e22c8b384699666535f23e7cb21d9e74b9be2f5 /scripts/automation/trex_control_plane
parent344df4618f219758a6fd005e2ea3e3d1056b5f4b (diff)
regression: stl updates
Diffstat (limited to 'scripts/automation/trex_control_plane')
-rw-r--r--scripts/automation/trex_control_plane/stl/examples/stl_imix.py22
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_std.py5
2 files changed, 19 insertions, 8 deletions
diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_imix.py b/scripts/automation/trex_control_plane/stl/examples/stl_imix.py
index cc7691a3..94165614 100644
--- a/scripts/automation/trex_control_plane/stl/examples/stl_imix.py
+++ b/scripts/automation/trex_control_plane/stl/examples/stl_imix.py
@@ -4,6 +4,7 @@ from trex_stl_lib.api import *
import time
import json
from pprint import pprint
+import argparse
# IMIX test
# it maps the ports to sides
@@ -11,11 +12,11 @@ from pprint import pprint
# and attach it to both sides and inject
# at a certain rate for some time
# finally it checks that all packets arrived
-def imix_test ():
+def imix_test (server):
# create client
- c = STLClient()
+ c = STLClient(server = server)
passed = True
@@ -48,7 +49,7 @@ def imix_test ():
# choose rate and start traffic for 10 seconds on 5 mpps
duration = 10
- mult = "5mpps"
+ mult = "30%"
print "Injecting {0} <--> {1} on total rate of '{2}' for {3} seconds".format(dir_0, dir_1, mult, duration)
c.start(ports = (dir_0 + dir_1), mult = mult, duration = duration, total = True)
@@ -78,9 +79,9 @@ def imix_test ():
print "Packets injected from {0}: {1:,}".format(dir_1, dir_1_opackets)
print "\npackets lost from {0} --> {1}: {2:,} pkts".format(dir_0, dir_0, lost_0)
- print "packets lost from {0} --> {1}: {2:,} pkts".format(dir_0, dir_0, lost_0)
+ print "packets lost from {0} --> {1}: {2:,} pkts".format(dir_1, dir_1, lost_1)
- if (lost_0 == 0) and (lost_0 == 0):
+ if (lost_0 <= 0) and (lost_1 <= 0): # less or equal because we might have incoming arps etc.
passed = True
else:
passed = False
@@ -95,10 +96,19 @@ def imix_test ():
if passed:
print "\nTest has passed :-)\n"
+ sys.exit(0)
else:
print "\nTest has failed :-(\n"
+ sys.exit(-1)
+parser = argparse.ArgumentParser(description="Example for TRex Stateless, sending IMIX traffic")
+parser.add_argument('-s', '--server',
+ dest='server',
+ help='Remote trex address',
+ default='127.0.0.1',
+ type = str)
+args = parser.parse_args()
# run the tests
-imix_test()
+imix_test(args.server)
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 e0b25b1d..c4cb5d01 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
@@ -48,7 +48,6 @@ def stl_map_ports (client, ports = None):
tx_port = tx_pkts[pkts]
table['map'][port] = tx_port
-
unmapped = list(ports)
while len(unmapped) > 0:
port_a = unmapped.pop(0)
@@ -57,7 +56,9 @@ def stl_map_ports (client, ports = None):
# if unknown - add to the unknown list
if port_b == None:
table['unknown'].append(port_a)
-
+ # self-loop, due to bug?
+ elif port_a == port_b:
+ continue
# bi-directional ports
elif (table['map'][port_b] == port_a):
unmapped.remove(port_b)