summaryrefslogtreecommitdiffstats
path: root/scripts/stl_test_example.py
blob: 9a296bec419044c921e76ef42e9ecba1f2aaec14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import sys
import time

api_path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(api_path, 'automation/trex_control_plane/client/'))

from trex_stateless_client import CTRexStatelessClient, STLError

c = CTRexStatelessClient()

try:
    c.connect()
    c.stop()
    #before_ipackets = x.get_stats().get_rel('ipackets')

    c.start(profiles = 'stl/imix_3pkt.yaml', ports = [0,1], mult = "1gbps")

    for i in xrange(0, 10):
        time.sleep(5)
        c.update(ports = [0,1], mult = "1gbps+")

    #c.cmd_wait_on_traffic()
    #c.stop()

except STLError as e:
    print e
finally:
    c.teardown()