summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/examples/stl_flow_stats.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-03-21 17:22:06 +0200
committerimarom <imarom@cisco.com>2016-03-21 17:22:06 +0200
commit738da2c0cd38f13a3cf7ae726f7698959ebf1ff0 (patch)
tree8be6fb021cbf6039cb91ce991e22254bdfb8cff7 /scripts/automation/trex_control_plane/stl/examples/stl_flow_stats.py
parentc59a02f8036bbdc488f286412e990a16e3aa1df9 (diff)
python 3 - examples working
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/examples/stl_flow_stats.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/examples/stl_flow_stats.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_flow_stats.py b/scripts/automation/trex_control_plane/stl/examples/stl_flow_stats.py
index fa6e67c3..d938852e 100644
--- a/scripts/automation/trex_control_plane/stl/examples/stl_flow_stats.py
+++ b/scripts/automation/trex_control_plane/stl/examples/stl_flow_stats.py
@@ -6,7 +6,7 @@ import pprint
def rx_example (tx_port, rx_port, burst_size):
- print "\nGoing to inject {0} packets on port {1} - checking RX stats on port {2}\n".format(burst_size, tx_port, rx_port)
+ print("\nGoing to inject {0} packets on port {1} - checking RX stats on port {2}\n".format(burst_size, tx_port, rx_port))
# create client
c = STLClient()
@@ -32,10 +32,10 @@ def rx_example (tx_port, rx_port, burst_size):
# add both streams to ports
c.add_streams([s1], ports = [tx_port])
- print "\ninjecting {0} packets on port {1}\n".format(total_pkts, tx_port)
+ print("\ninjecting {0} packets on port {1}\n".format(total_pkts, tx_port))
for i in range(0, 10):
- print "\nStarting iteration: {0}:".format(i)
+ print("\nStarting iteration: {0}:".format(i))
rc = rx_iteration(c, tx_port, rx_port, total_pkts, pkt.get_pkt_len())
if not rc:
passed = False
@@ -44,15 +44,15 @@ def rx_example (tx_port, rx_port, burst_size):
except STLError as e:
passed = False
- print e
+ print(e)
finally:
c.disconnect()
if passed:
- print "\nTest has passed :-)\n"
+ print("\nTest has passed :-)\n")
else:
- print "\nTest has failed :-(\n"
+ print("\nTest has failed :-(\n")
# RX one iteration
def rx_iteration (c, tx_port, rx_port, total_pkts, pkt_len):
@@ -64,7 +64,7 @@ def rx_iteration (c, tx_port, rx_port, total_pkts, pkt_len):
flow_stats = c.get_stats()['flow_stats'].get(5)
if not flow_stats:
- print "no flow stats available"
+ print("no flow stats available")
return False
tx_pkts = flow_stats['tx_pkts'].get(tx_port, 0)
@@ -72,25 +72,25 @@ def rx_iteration (c, tx_port, rx_port, total_pkts, pkt_len):
rx_pkts = flow_stats['rx_pkts'].get(rx_port, 0)
if tx_pkts != total_pkts:
- print "TX pkts mismatch - got: {0}, expected: {1}".format(tx_pkts, total_pkts)
+ print("TX pkts mismatch - got: {0}, expected: {1}".format(tx_pkts, total_pkts))
pprint.pprint(flow_stats)
return False
else:
- print "TX pkts match - {0}".format(tx_pkts)
+ print("TX pkts match - {0}".format(tx_pkts))
if tx_bytes != (total_pkts * pkt_len):
- print "TX bytes mismatch - got: {0}, expected: {1}".format(tx_bytes, (total_pkts * pkt_len))
+ print("TX bytes mismatch - got: {0}, expected: {1}".format(tx_bytes, (total_pkts * pkt_len)))
pprint.pprint(flow_stats)
return False
else:
- print "TX bytes match - {0}".format(tx_bytes)
+ print("TX bytes match - {0}".format(tx_bytes))
if rx_pkts != total_pkts:
- print "RX pkts mismatch - got: {0}, expected: {1}".format(rx_pkts, total_pkts)
+ print("RX pkts mismatch - got: {0}, expected: {1}".format(rx_pkts, total_pkts))
pprint.pprint(flow_stats)
return False
else:
- print "RX pkts match - {0}".format(rx_pkts)
+ print("RX pkts match - {0}".format(rx_pkts))
return True