From 87bac1abebe2f5a853e32301a68b9f6adf97de99 Mon Sep 17 00:00:00 2001 From: imarom Date: Tue, 12 Apr 2016 18:01:43 +0300 Subject: added checks for warnings on examples --- .../trex_control_plane/stl/examples/stl_flow_stats.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'scripts/automation/trex_control_plane/stl/examples/stl_flow_stats.py') 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 d938852e..ed4902fa 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 @@ -4,7 +4,7 @@ from trex_stl_lib.api import * import time import pprint -def rx_example (tx_port, rx_port, burst_size): +def rx_example (tx_port, rx_port, burst_size, bw): print("\nGoing to inject {0} packets on port {1} - checking RX stats on port {2}\n".format(burst_size, tx_port, rx_port)) @@ -19,9 +19,7 @@ def rx_example (tx_port, rx_port, burst_size): packet = pkt, flow_stats = STLFlowStats(pg_id = 5), mode = STLTXSingleBurst(total_pkts = total_pkts, - #pps = total_pkts - percentage = 80 - )) + percentage = bw)) # connect to server c.connect() @@ -36,7 +34,7 @@ def rx_example (tx_port, rx_port, burst_size): for i in range(0, 10): print("\nStarting iteration: {0}:".format(i)) - rc = rx_iteration(c, tx_port, rx_port, total_pkts, pkt.get_pkt_len()) + rc = rx_iteration(c, tx_port, rx_port, total_pkts, pkt.get_pkt_len(), bw) if not rc: passed = False break @@ -55,7 +53,7 @@ def rx_example (tx_port, rx_port, burst_size): print("\nTest has failed :-(\n") # RX one iteration -def rx_iteration (c, tx_port, rx_port, total_pkts, pkt_len): +def rx_iteration (c, tx_port, rx_port, total_pkts, pkt_len, bw): c.clear_stats() @@ -71,6 +69,12 @@ def rx_iteration (c, tx_port, rx_port, total_pkts, pkt_len): tx_bytes = flow_stats['tx_bytes'].get(tx_port, 0) rx_pkts = flow_stats['rx_pkts'].get(rx_port, 0) + if c.get_warnings(): + print("\n\n*** test had warnings ****\n\n") + for w in c.get_warnings(): + print(w) + return False + if tx_pkts != total_pkts: print("TX pkts mismatch - got: {0}, expected: {1}".format(tx_pkts, total_pkts)) pprint.pprint(flow_stats) @@ -95,5 +99,5 @@ def rx_iteration (c, tx_port, rx_port, total_pkts, pkt_len): return True # run the tests -rx_example(tx_port = 1, rx_port = 2, burst_size = 500000) +rx_example(tx_port = 1, rx_port = 2, burst_size = 500000, bw = 50) -- cgit 1.2.3-korg