Code Review
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Change the bootstrap and download NSH SFC packages.
[csit.git]
/
resources
/
tools
/
t-rex
/
t-rex-stateless-stop.py
diff --git
a/resources/tools/t-rex/t-rex-stateless-stop.py
b/resources/tools/t-rex/t-rex-stateless-stop.py
index
a706629
..
cc00846
100755
(executable)
--- a/
resources/tools/t-rex/t-rex-stateless-stop.py
+++ b/
resources/tools/t-rex/t-rex-stateless-stop.py
@@
-27,8
+27,9
@@
Functionality:
"""
import sys
"""
import sys
+import json
-sys.path.insert(0, "/opt/trex-core-2.2
2
/scripts/automation/"+\
+sys.path.insert(0, "/opt/trex-core-2.2
5
/scripts/automation/"+\
"trex_control_plane/stl/")
from trex_stl_lib.api import *
"trex_control_plane/stl/")
from trex_stl_lib.api import *
@@
-40,12
+41,9
@@
def stop_all_traffic_streams():
"""
# create client
"""
# create client
- client = STLClient()
+ client = STLClient(
verbose_level=LoggerApi.VERBOSE_QUIET
)
try:
try:
- # turn this off if too many logs
- #client.set_verbose("high")
-
# connect to server
client.connect()
# connect to server
client.connect()
@@
-55,18
+53,15
@@
def stop_all_traffic_streams():
# read the stats after the test
stats = client.get_stats()
# read the stats after the test
stats = client.get_stats()
- print
"#####statistics (approx.)#####"
- print
json.dumps(stats, indent=4,
- separators=(',', ': '), sort_keys=True)
+ print
("#####statistics (approx.)#####")
+ print
(
json.dumps(stats, indent=4,
+ separators=(',', ': '), sort_keys=True)
)
lost_a = stats[0]["opackets"] - stats[1]["ipackets"]
lost_b = stats[1]["opackets"] - stats[0]["ipackets"]
lost_a = stats[0]["opackets"] - stats[1]["ipackets"]
lost_b = stats[1]["opackets"] - stats[0]["ipackets"]
- total_sent = stats[0]["opackets"] + stats[1]["opackets"]
- total_rcvd = stats[0]["ipackets"] + stats[1]["ipackets"]
-
- print "\npackets lost from 0 --> 1: {0} pkts".format(lost_a)
- print "packets lost from 1 --> 0: {0} pkts".format(lost_b)
+ print("\npackets lost from 0 --> 1: {0} pkts".format(lost_a))
+ print("packets lost from 1 --> 0: {0} pkts".format(lost_b))
except STLError as ex_error:
print_error(str(ex_error))
except STLError as ex_error:
print_error(str(ex_error))
@@
-76,7
+71,6
@@
def stop_all_traffic_streams():
client.disconnect()
client.disconnect()
-
def print_error(msg):
"""Print error message on stderr.
def print_error(msg):
"""Print error message on stderr.