summaryrefslogtreecommitdiffstats
path: root/scripts/automation/regression/stateless_tests/stl_rx_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/automation/regression/stateless_tests/stl_rx_test.py')
-rw-r--r--scripts/automation/regression/stateless_tests/stl_rx_test.py69
1 files changed, 44 insertions, 25 deletions
diff --git a/scripts/automation/regression/stateless_tests/stl_rx_test.py b/scripts/automation/regression/stateless_tests/stl_rx_test.py
index a5bc115f..a7ff303e 100644
--- a/scripts/automation/regression/stateless_tests/stl_rx_test.py
+++ b/scripts/automation/regression/stateless_tests/stl_rx_test.py
@@ -7,7 +7,7 @@ class STLRX_Test(CStlGeneral_Test):
"""Tests for RX feature"""
def setUp(self):
- per_driver_params = {"rte_vmxnet3_pmd": [1, 50], "rte_ixgbe_pmd": [10, 5000], "rte_i40e_pmd": [80, 5000],
+ per_driver_params = {"rte_vmxnet3_pmd": [1, 50], "rte_ixgbe_pmd": [30, 5000], "rte_i40e_pmd": [80, 5000],
"rte_igb_pmd": [80, 500], "rte_em_pmd": [1, 50], "rte_virtio_pmd": [1, 50]}
CStlGeneral_Test.setUp(self)
@@ -19,9 +19,10 @@ class STLRX_Test(CStlGeneral_Test):
port_info = self.c.get_port_info(ports = self.rx_port)[0]
cap = port_info['rx']['caps']
-# print cap; ????
-# if cap != 1:
-# self.skip('port {0} does not support RX'.format(self.rx_port))
+ print cap
+ if "flow_stats" not in cap or "latency" not in cap:
+ self.skip('port {0} does not support RX'.format(self.rx_port))
+ self.cap = cap
self.rate_percent = per_driver_params[port_info['driver']][0]
self.total_pkts = per_driver_params[port_info['driver']][1]
@@ -36,9 +37,9 @@ class STLRX_Test(CStlGeneral_Test):
CTRexScenario.stl_trex.connect()
- def __verify_flow (self, pg_id, total_pkts, pkt_len):
- flow_stats = self.c.get_stats()['flow_stats'].get(pg_id)
- latency_stats = self.c.get_stats()['latency'].get(pg_id)
+ def __verify_flow (self, pg_id, total_pkts, pkt_len, stats):
+ flow_stats = stats['flow_stats'].get(pg_id)
+ latency_stats = stats['latency'].get(pg_id)
if not flow_stats:
assert False, "no flow stats available"
@@ -46,27 +47,35 @@ class STLRX_Test(CStlGeneral_Test):
tx_pkts = flow_stats['tx_pkts'].get(self.tx_port, 0)
tx_bytes = flow_stats['tx_bytes'].get(self.tx_port, 0)
rx_pkts = flow_stats['rx_pkts'].get(self.rx_port, 0)
- drops = latency_stats['err_cntrs']['dropped']
- ooo = latency_stats['err_cntrs']['out_of_order']
- jitter = latency_stats['jitter']
- latency = latency_stats['latency']
-
- if drops != 0 or ooo != 0:
- pprint.pprint(latency_stats)
- tmp='Dropped or out of order packets - dropped: {0}, ooo: {1}'.format(drops, ooo)
- assert False, tmp
+ if latency_stats is not None:
+ drops = latency_stats['err_cntrs']['dropped']
+ ooo = latency_stats['err_cntrs']['out_of_order']
+ if drops != 0 or ooo != 0:
+ pprint.pprint(latency_stats)
+ tmp='Dropped or out of order packets - dropped: {0}, ooo: {1}'.format(drops, ooo)
+ assert False, tmp
if tx_pkts != total_pkts:
pprint.pprint(flow_stats)
- assert False, 'TX pkts mismatch - got: {0}, expected: {1}'.format(tx_pkts, total_pkts)
+ tmp = 'TX pkts mismatch - got: {0}, expected: {1}'.format(tx_pkts, total_pkts)
+ assert False, tmp
if tx_bytes != (total_pkts * pkt_len):
pprint.pprint(flow_stats)
- assert False, 'TX bytes mismatch - got: {0}, expected: {1}'.format(tx_bytes, (total_pkts * pkt_len))
+ tmp = 'TX bytes mismatch - got: {0}, expected: {1}'.format(tx_bytes, (total_pkts * pkt_len))
+ assert False, tmp
if rx_pkts != total_pkts:
pprint.pprint(flow_stats)
- assert False, 'RX pkts mismatch - got: {0}, expected: {1}'.format(rx_pkts, total_pkts)
+ tmp = 'RX pkts mismatch - got: {0}, expected: {1}'.format(rx_pkts, total_pkts)
+ assert False, tmp
+
+ if "rx_bytes" in self.cap:
+ rx_bytes = flow_stats['rx_bytes'].get(self.rx_port, 0)
+ if rx_bytes != (total_pkts * pkt_len):
+ pprint.pprint(flow_stats)
+ tmp = 'RX bytes mismatch - got: {0}, expected: {1}'.format(rx_bytes, (total_pkts * pkt_len))
+ assert False, tmp
# RX itreation
@@ -76,10 +85,10 @@ class STLRX_Test(CStlGeneral_Test):
self.c.start(ports = [self.tx_port])
self.c.wait_on_traffic(ports = [self.tx_port])
+ stats = self.c.get_stats()
for exp in exp_list:
- self.__verify_flow(exp['pg_id'], exp['total_pkts'], exp['pkt_len'])
-
+ self.__verify_flow(exp['pg_id'], exp['total_pkts'], exp['pkt_len'], stats)
# one simple stream on TX --> RX
@@ -110,17 +119,18 @@ class STLRX_Test(CStlGeneral_Test):
# one simple stream on TX --> RX
def test_multiple_streams(self):
- num_streams = 128
- total_pkts = int(self.total_pkts / num_streams)
+ num_latency_streams = 128
+ num_flow_stat_streams = 127
+ total_pkts = int(self.total_pkts / num_latency_streams)
if total_pkts == 0:
total_pkts = 1
- percent = float(self.rate_percent) / num_streams
+ percent = float(self.rate_percent) / num_latency_streams
try:
streams = []
exp = []
# 10 identical streams
- for pg_id in range(1, num_streams):
+ for pg_id in range(1, num_latency_streams):
streams.append(STLStream(name = 'rx {0}'.format(pg_id),
packet = self.pkt,
@@ -129,6 +139,15 @@ class STLRX_Test(CStlGeneral_Test):
exp.append({'pg_id': pg_id, 'total_pkts': total_pkts+pg_id, 'pkt_len': self.pkt.get_pkt_len()})
+ for pg_id in range(num_latency_streams + 1, num_latency_streams + num_flow_stat_streams):
+
+ streams.append(STLStream(name = 'rx {0}'.format(pg_id),
+ packet = self.pkt,
+ flow_stats = STLFlowStats(pg_id = pg_id),
+ mode = STLTXSingleBurst(total_pkts = total_pkts+pg_id, percentage = percent)))
+
+ exp.append({'pg_id': pg_id, 'total_pkts': total_pkts+pg_id, 'pkt_len': self.pkt.get_pkt_len()})
+
# add both streams to ports
self.c.add_streams(streams, ports = [self.tx_port])