diff options
author | imarom <imarom@cisco.com> | 2016-01-18 11:27:10 -0500 |
---|---|---|
committer | imarom <imarom@cisco.com> | 2016-01-21 10:11:55 -0500 |
commit | 2d9d5e147b8f15a8308dad46711390f3b168ec56 (patch) | |
tree | 875264814e580405bf6464eb1ee4b7798f64309c /scripts/stl_test_example.py | |
parent | 9932ff8dcf4f8b6b6f3986832f8a1a8f8461c743 (diff) |
highly draft - just backing up
Diffstat (limited to 'scripts/stl_test_example.py')
-rw-r--r-- | scripts/stl_test_example.py | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/scripts/stl_test_example.py b/scripts/stl_test_example.py index 7974758d..e9202ca6 100644 --- a/scripts/stl_test_example.py +++ b/scripts/stl_test_example.py @@ -1,42 +1,21 @@ +import os +import sys -# simple test that uses simple API with stateless TRex -#from stl_test_api import BasicTestAPI api_path = os.path.dirname(os.path.abspath(__file__)) -sys.path.insert(0, os.path.join(api_path, '../automation/trex_control_plane/client/')) +sys.path.insert(0, os.path.join(api_path, 'automation/trex_control_plane/client/')) -from trex_stateless_client import CTRexStatelessClient, LoggerApi +from trex_stateless_client import CTRexStatelessClient, STLFailure c = CTRexStatelessClient() + try: c.connect() #before_ipackets = x.get_stats().get_rel('ipackets') - c.cmd_start_line("-f stl/imix_1pkt.yaml -m 5mpps -d 1") - c.cmd_wait_on_traffic() -finally: - c.disconnect() - -#x = BasicTestAPI() -# -#try: -# x.connect() -# -# before_ipackets = x.get_stats().get_rel('ipackets') -# -# print "input packets before test: %s" % before_ipackets -# -# x.inject_profile("stl/imix_1pkt.yaml", rate = "5mpps", duration = 1) -# x.wait_while_traffic_on() -# -# after_ipackets = x.get_stats().get_rel('ipackets') -# -# print "input packets after test: %s" % after_ipackets -# -# if (after_ipackets - before_ipackets) == 5000000: -# print "Test passed :-)\n" -# else: -# print "Test failed :-(\n" -# -#finally: -# x.disconnect() + c.start(profiles = 'stl/imix_3pkt.yaml', ports = [1]) + #c.cmd_wait_on_traffic() +except STLFailure as e: + print e +finally: + c.teardown() |