diff options
author | 2016-02-08 06:08:14 -0500 | |
---|---|---|
committer | 2016-02-08 06:08:14 -0500 | |
commit | 995267db77f5554d5228697b8b2a862b51859fe6 (patch) | |
tree | 1a44007a59d8cabacab0690da515a68c3c25e7ac /scripts/api/stl/examples | |
parent | 69e5a5c6b94175ece07b247af1b5ca6c0cfdf0e9 (diff) |
first refactor
Diffstat (limited to 'scripts/api/stl/examples')
-rw-r--r-- | scripts/api/stl/examples/stl_bi_dir_flows.py | 7 | ||||
-rw-r--r-- | scripts/api/stl/examples/stl_imix.py | 19 | ||||
-rw-r--r-- | scripts/api/stl/examples/stl_path.py | 2 | ||||
-rw-r--r-- | scripts/api/stl/examples/stl_run_udp_simple.py | 5 | ||||
-rw-r--r-- | scripts/api/stl/examples/stl_simple_burst.py | 13 |
5 files changed, 20 insertions, 26 deletions
diff --git a/scripts/api/stl/examples/stl_bi_dir_flows.py b/scripts/api/stl/examples/stl_bi_dir_flows.py index 7d090345..46b84c6e 100644 --- a/scripts/api/stl/examples/stl_bi_dir_flows.py +++ b/scripts/api/stl/examples/stl_bi_dir_flows.py @@ -1,8 +1,5 @@ -# include the path of trex_stl_api.py -import sys -sys.path.insert(0, "../") - -from trex_stl_api import * +import stl_path +from trex_control_plane.stl.api import * import time import json diff --git a/scripts/api/stl/examples/stl_imix.py b/scripts/api/stl/examples/stl_imix.py index 01eec9b4..c083a207 100644 --- a/scripts/api/stl/examples/stl_imix.py +++ b/scripts/api/stl/examples/stl_imix.py @@ -1,10 +1,5 @@ -# include the path of trex_stl_api.py -import sys -sys.path.insert(0, "../") - -from trex_stl_api import * -from trex_stl_lib import * -from profiles.imix import STLImix +import stl_path +from trex_control_plane.stl.api import * import time import json @@ -26,9 +21,6 @@ def imix_test (): try: - # base profile - imix - profile = STLImix() - # connect to server c.connect() @@ -42,9 +34,12 @@ def imix_test (): dir_0 = table['dir'][0] dir_1 = table['dir'][1] + # load IMIX profile + streams = c.load_profile('../../../stl/profiles/imix.py') + # add both streams to ports - c.add_streams(profile.get_streams(direction = 0), ports = dir_0) - c.add_streams(profile.get_streams(direction = 1), ports = dir_1) + c.add_streams(streams, ports = dir_0) + c.add_streams(streams, ports = dir_1) # clear the stats before injecting c.clear_stats() diff --git a/scripts/api/stl/examples/stl_path.py b/scripts/api/stl/examples/stl_path.py new file mode 100644 index 00000000..e0056585 --- /dev/null +++ b/scripts/api/stl/examples/stl_path.py @@ -0,0 +1,2 @@ +import sys +sys.path.insert(0, "../../../automation") diff --git a/scripts/api/stl/examples/stl_run_udp_simple.py b/scripts/api/stl/examples/stl_run_udp_simple.py index 88dba5ac..47db1b5a 100644 --- a/scripts/api/stl/examples/stl_run_udp_simple.py +++ b/scripts/api/stl/examples/stl_run_udp_simple.py @@ -10,9 +10,8 @@ Compare Rx-pkts to TX-pkts assuming ports are loopback """ -sys.path.insert(0, "../") - -from trex_stl_api import * +import stl_path +from trex_control_plane.stl.api import * H_VER = "trex-x v0.1 " diff --git a/scripts/api/stl/examples/stl_simple_burst.py b/scripts/api/stl/examples/stl_simple_burst.py index 0de4df89..2ccd01c4 100644 --- a/scripts/api/stl/examples/stl_simple_burst.py +++ b/scripts/api/stl/examples/stl_simple_burst.py @@ -1,8 +1,6 @@ -import sys -sys.path.insert(0, "../") +import stl_path +from trex_control_plane.stl.api import * -from trex_stl_api import * -from scapy.all import * import time def simple_burst (): @@ -13,7 +11,6 @@ def simple_burst (): passed = True try: - pkt = STLPktBuilder(pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/IP()/'a_payload_example') # create two bursts and link them @@ -24,7 +21,11 @@ def simple_burst (): mode = STLTXSingleBurst(total_pkts = 3000), next_stream_id = s1.get_id()) - + STLStream.dump_to_yaml([s1, s2], '1.yaml') + stream_list = STLStream.load_from_yaml('1.yaml') + print s2 + print stream_list[1] + exit(0) # connect to server c.connect() |