diff options
author | 2016-05-22 15:05:16 +0300 | |
---|---|---|
committer | 2016-05-22 15:05:16 +0300 | |
commit | fddd473cf780027ee9f0c45eaefe0a5a70127fd4 (patch) | |
tree | e504a464bb62875dbf4b7c5386daebdfb1339f10 /scripts/automation/regression/stateless_tests | |
parent | db594915dbe0a1f612b913588def675261656ebf (diff) | |
parent | 0e69ec7a8c24849b9b383efcb2cdf91138ddd604 (diff) |
Merge v2.01:
Diffstat (limited to 'scripts/automation/regression/stateless_tests')
-rw-r--r-- | scripts/automation/regression/stateless_tests/stl_rx_test.py | 86 |
1 files changed, 75 insertions, 11 deletions
diff --git a/scripts/automation/regression/stateless_tests/stl_rx_test.py b/scripts/automation/regression/stateless_tests/stl_rx_test.py index 70c003aa..10e70b86 100644 --- a/scripts/automation/regression/stateless_tests/stl_rx_test.py +++ b/scripts/automation/regression/stateless_tests/stl_rx_test.py @@ -7,7 +7,9 @@ class STLRX_Test(CStlGeneral_Test): """Tests for RX feature""" def setUp(self): - per_driver_params = {"rte_vmxnet3_pmd": [1, 50], "rte_ixgbe_pmd": [30, 5000], "rte_i40e_pmd": [80, 5000], + if self.is_virt_nics: + self.skip('Skip this for virtual NICs for now') + per_driver_params = {"rte_vmxnet3_pmd": [1, 50], "rte_ixgbe_pmd": [30, 5000], "rte_i40e_pmd": [80, 5000, 25], "rte_igb_pmd": [80, 500], "rte_em_pmd": [1, 50], "rte_virtio_pmd": [1, 50]} CStlGeneral_Test.setUp(self) @@ -19,16 +21,21 @@ class STLRX_Test(CStlGeneral_Test): port_info = self.c.get_port_info(ports = self.rx_port)[0] cap = port_info['rx']['caps'] - print(port_info) 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] + if len(per_driver_params[port_info['driver']]) > 2: + self.rate_lat = per_driver_params[port_info['driver']][2] + else: + self.rate_lat = self.rate_percent + self.drops_expected = False self.c.reset(ports = [self.tx_port, self.rx_port]) - self.pkt = STLPktBuilder(pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/IP()/'a_payload_example') + self.pkt = STLPktBuilder(pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/('Your_paylaod_comes_here')) + self.large_pkt = STLPktBuilder(pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/('a'*1000)) @classmethod def tearDownClass(cls): @@ -54,11 +61,18 @@ class STLRX_Test(CStlGeneral_Test): sth = latency_stats['err_cntrs']['seq_too_high'] stl = latency_stats['err_cntrs']['seq_too_low'] lat = latency_stats['latency'] - if drops != 0 or ooo != 0 or dup != 0 or stl !=0 or sth != 0: + if ooo != 0 or dup != 0 or sth != 0: pprint.pprint(latency_stats) - tmp='Dropped or out of order packets - dropped:{0}, ooo:{1} dup:{2} seq too high:{3} seq too low:{4}'.format(drops, ooo, dup, sth, stl) + tmp='Error packets - dropped:{0}, ooo:{1} dup:{2} seq too high:{3} seq too low:{4}'.format(drops, ooo, dup, sth, stl) assert False, tmp + if (drops != 0 or stl != 0) and not self.drops_expected: + pprint.pprint(latency_stats) + tmp='Error packets - dropped:{0}, ooo:{1} dup:{2} seq too high:{3} seq too low:{4}'.format(drops, ooo, dup, sth, stl) + assert False, tmp + + + if tx_pkts != total_pkts: pprint.pprint(flow_stats) tmp = 'TX pkts mismatch - got: {0}, expected: {1}'.format(tx_pkts, total_pkts) @@ -69,14 +83,14 @@ class STLRX_Test(CStlGeneral_Test): tmp = 'TX bytes mismatch - got: {0}, expected: {1}'.format(tx_bytes, (total_pkts * pkt_len)) assert False, tmp - if rx_pkts != total_pkts: + if rx_pkts != total_pkts and not self.drops_expected: pprint.pprint(flow_stats) 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): + if rx_bytes != (total_pkts * pkt_len) and not self.drops_expected: pprint.pprint(flow_stats) tmp = 'RX bytes mismatch - got: {0}, expected: {1}'.format(rx_bytes, (total_pkts * pkt_len)) assert False, tmp @@ -123,12 +137,12 @@ class STLRX_Test(CStlGeneral_Test): # one simple stream on TX --> RX def test_multiple_streams(self): - num_latency_streams = 110 - num_flow_stat_streams = 110 - total_pkts = int(self.total_pkts / num_latency_streams) / 2 + num_latency_streams = 128 + num_flow_stat_streams = 127 + total_pkts = int(self.total_pkts / (num_latency_streams + num_flow_stat_streams)) if total_pkts == 0: total_pkts = 1 - percent = float(self.rate_percent) / num_latency_streams / 2 + percent = float(self.rate_percent) / (num_latency_streams + num_flow_stat_streams) try: streams = [] @@ -187,3 +201,53 @@ class STLRX_Test(CStlGeneral_Test): except STLError as e: assert False , '{0}'.format(e) + + + + # this test adds more and more latency streams and re-test with incremental + # test does not work yet + def test_incremental_latency_streams (self): + total_pkts = self.total_pkts + percent = 0.5 + + try: + # We run till maximum streams allowed. At some point, expecting drops, because rate is too high. + # then run with less streams again, to see that system is still working. + for num_iter in [128, 5]: + exp = [] + for i in range(1, num_iter): + # mix small and large packets + if i % 2 != 0: + my_pkt = self.pkt + else: + my_pkt = self.large_pkt + s1 = STLStream(name = 'rx', + packet = my_pkt, + flow_stats = STLFlowLatencyStats(pg_id = i), + mode = STLTXSingleBurst(total_pkts = total_pkts, + percentage = percent + )) + + # add both streams to ports + self.c.add_streams([s1], ports = [self.tx_port]) + total_percent = i * percent + if total_percent > self.rate_lat: + self.drops_expected = True + else: + self.drops_expected = False + + print("port {0} : {1} streams at {2}% of line rate\n".format(self.tx_port, i, total_percent)) + + exp.append({'pg_id': i, 'total_pkts': total_pkts, 'pkt_len': my_pkt.get_pkt_len()}) + + self.__rx_iteration( exp ) + + self.c.remove_all_streams(ports = [self.tx_port]) + + + + except STLError as e: + assert False , '{0}'.format(e) + + + |