blob: 1d4ef2507fef53c2fffe80d1920fc76006e06f65 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
import stl_path
from trex_stl_lib.api import *
import time
def simple ():
# create client
#verbose_level = LoggerApi.VERBOSE_HIGH
c = STLClient(verbose_level = LoggerApi.VERBOSE_REGULAR)
passed = True
try:
# connect to server
c.connect()
my_ports=[0,1]
# prepare our ports
c.reset(ports = my_ports)
print((" is connected {0}".format(c.is_connected())))
print((" number of ports {0}".format(c.get_port_count())))
print((" acquired_ports {0}".format(c.get_acquired_ports())))
# port stats
print(c.get_stats(my_ports))
# port info
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 %s -m 10mpps --port 0 1 " % profile_file)
time.sleep(2);
c.pause_line("--port 0 1");
time.sleep(2);
c.resume_line("--port 0 1");
time.sleep(2);
c.update_line("--port 0 1 -m 5mpps");
time.sleep(2);
c.stop_line("--port 0 1");
except STLError as e:
passed = False
print(e)
finally:
c.disconnect()
if passed:
print("\nTest has passed :-)\n")
else:
print("\nTest has failed :-(\n")
# run the tests
simple()
|