summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/examples
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-03-30 11:29:11 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-03-30 11:29:11 +0300
commitb91c216db1aa10ca7cc81b8c74b04ab79df251fe (patch)
treebd2184c2ea54c2e8d6554e082dd0b37e99a1e0e7 /scripts/automation/trex_control_plane/stl/examples
parent935b711d82845514c30249b8cdd2e9ed6aa11526 (diff)
add to run_functional_tests --python2 and --python3 flags
make stateful tree similar to stl : stf/trex_stf_lib and stf/examples change trex_client package: add profiles, use full stl dir. stl examples: now use stl_path.STL_PROFILES_PATH variable regression: add higher timeout to rsync.
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/examples')
-rw-r--r--scripts/automation/trex_control_plane/stl/examples/stl_imix.py15
-rw-r--r--scripts/automation/trex_control_plane/stl/examples/stl_imix_bidir.py9
-rw-r--r--scripts/automation/trex_control_plane/stl/examples/stl_path.py5
-rw-r--r--scripts/automation/trex_control_plane/stl/examples/stl_profile.py3
-rw-r--r--scripts/automation/trex_control_plane/stl/examples/stl_simple_console_like.py3
5 files changed, 22 insertions, 13 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 56fd3cfd..7e43488b 100644
--- a/scripts/automation/trex_control_plane/stl/examples/stl_imix.py
+++ b/scripts/automation/trex_control_plane/stl/examples/stl_imix.py
@@ -12,7 +12,7 @@ import argparse
# 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 (server):
+def imix_test (server, mult):
# create client
@@ -37,7 +37,8 @@ def imix_test (server):
print("Mapped ports to sides {0} <--> {1}".format(dir_0, dir_1))
# load IMIX profile
- profile = STLProfile.load_py('../../../../stl/imix.py')
+ profile_file = os.path.join(stl_path.STL_PROFILES_PATH, 'imix.py')
+ profile = STLProfile.load_py(profile_file)
streams = profile.get_streams()
# add both streams to ports
@@ -47,9 +48,8 @@ def imix_test (server):
# clear the stats before injecting
c.clear_stats()
- # choose rate and start traffic for 10 seconds on 5 mpps
+ # choose rate and start traffic for 10 seconds
duration = 10
- 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)
@@ -107,8 +107,13 @@ parser.add_argument('-s', '--server',
help='Remote trex address',
default='127.0.0.1',
type = str)
+parser.add_argument('-m', '--mult',
+ dest='mult',
+ help='Multiplier of traffic, see Stateless help for more info',
+ default='30%',
+ type = str)
args = parser.parse_args()
# run the tests
-imix_test(args.server)
+imix_test(args.server, args.mult)
diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_imix_bidir.py b/scripts/automation/trex_control_plane/stl/examples/stl_imix_bidir.py
index 05a8777b..05615aeb 100644
--- a/scripts/automation/trex_control_plane/stl/examples/stl_imix_bidir.py
+++ b/scripts/automation/trex_control_plane/stl/examples/stl_imix_bidir.py
@@ -29,14 +29,15 @@ def imix_test (server):
# take all the ports
c.reset()
- dir_0 = [0]
- dir_1 = [1]
+ dir_0 = [0]
+ dir_1 = [1]
print "Mapped ports to sides {0} <--> {1}".format(dir_0, dir_1)
# load IMIX profile
- profile1 = STLProfile.load_py('../../../../stl/imix.py', direction=0)
- profile2 = STLProfile.load_py('../../../../stl/imix.py', direction=1)
+ profile_file = os.path.join(stl_path.STL_PROFILES_PATH, 'imix.py')
+ profile1 = STLProfile.load_py(profile_file, direction=0)
+ profile2 = STLProfile.load_py(profile_file, direction=1)
stream1 = profile1.get_streams()
stream2 = profile2.get_streams()
diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_path.py b/scripts/automation/trex_control_plane/stl/examples/stl_path.py
index 8f400d23..f1592571 100644
--- a/scripts/automation/trex_control_plane/stl/examples/stl_path.py
+++ b/scripts/automation/trex_control_plane/stl/examples/stl_path.py
@@ -1,4 +1,7 @@
-import sys
+import sys, os
# FIXME to the write path for trex_stl_lib
sys.path.insert(0, "../")
+
+STL_PROFILES_PATH = os.path.join(os.pardir, os.pardir, os.pardir, os.pardir, 'stl')
+
diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_profile.py b/scripts/automation/trex_control_plane/stl/examples/stl_profile.py
index 3ae5f855..16d5238e 100644
--- a/scripts/automation/trex_control_plane/stl/examples/stl_profile.py
+++ b/scripts/automation/trex_control_plane/stl/examples/stl_profile.py
@@ -18,8 +18,7 @@ def simple ():
# prepare our ports
c.reset(ports = my_ports)
-
- profile_file = "../../../../stl/udp_1pkt_simple.py"
+ profile_file = os.path.join(stl_path.STL_PROFILES_PATH, 'hlt', 'udp_1pkt_simple.py')
try:
profile = STLProfile.load(profile_file)
diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_simple_console_like.py b/scripts/automation/trex_control_plane/stl/examples/stl_simple_console_like.py
index 03909e65..1d4ef250 100644
--- a/scripts/automation/trex_control_plane/stl/examples/stl_simple_console_like.py
+++ b/scripts/automation/trex_control_plane/stl/examples/stl_simple_console_like.py
@@ -29,9 +29,10 @@ def simple ():
print(c.get_port_info(my_ports))
c.ping()
+ profile_file = os.path.join(stl_path.STL_PROFILES_PATH, 'udp_1pkt_simple.py')
print("start")
- c.start_line (" -f ../../../../stl/udp_1pkt_simple.py -m 10mpps --port 0 1 ")
+ c.start_line (" -f %s -m 10mpps --port 0 1 " % profile_file)
time.sleep(2);
c.pause_line("--port 0 1");
time.sleep(2);