summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-05-11 10:47:16 +0300
committerIdo Barnea <ibarnea@cisco.com>2016-05-18 19:23:23 +0300
commit03d70c4218be1932e4d69dc52bf24106f85dcafb (patch)
tree86402d59d7465cb6e98ee40a0a1ff82be7ff1485 /scripts
parentcb13e66205717a8fcf69185ba350adab3438ffa0 (diff)
unit tests + simulator work
Diffstat (limited to 'scripts')
-rw-r--r--scripts/automation/regression/stateless_tests/stl_rx_test.py69
-rw-r--r--scripts/exp/stl_vm_enable0_flow_stat-0-ex.erfbin0 -> 880 bytes
-rw-r--r--scripts/exp/stl_vm_enable1_flow_stat-0-ex.erfbin0 -> 6160 bytes
3 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])
diff --git a/scripts/exp/stl_vm_enable0_flow_stat-0-ex.erf b/scripts/exp/stl_vm_enable0_flow_stat-0-ex.erf
new file mode 100644
index 00000000..ff2a76f1
--- /dev/null
+++ b/scripts/exp/stl_vm_enable0_flow_stat-0-ex.erf
Binary files differ
diff --git a/scripts/exp/stl_vm_enable1_flow_stat-0-ex.erf b/scripts/exp/stl_vm_enable1_flow_stat-0-ex.erf
new file mode 100644
index 00000000..85bf5b6f
--- /dev/null
+++ b/scripts/exp/stl_vm_enable1_flow_stat-0-ex.erf
Binary files differ