summaryrefslogtreecommitdiffstats
path: root/scripts/automation/regression/stateless_tests/stl_rx_test.py
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2017-03-06 23:16:59 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2017-03-07 16:54:00 +0200
commit8bd778d02fc0260b109bb4bb8fc11e3567e9130d (patch)
tree3734f54cbaa2541526584d1461e97ddb7dfc5d0f /scripts/automation/regression/stateless_tests/stl_rx_test.py
parentcebf5a44b5f28a03b245e43013cc27671a980206 (diff)
* add trex22 (Mellanox VF) and trex23(XL710 VF) regression configs
* fix test_fcs_stream: it did not fail on virtual NICs at all now accumulating all the errors instread of failing on first one * fix XL710 VF input counters (+4 bytes) Change-Id: I7661b4e14a037e5ee2a9c1bc116d835c9a16df91 Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'scripts/automation/regression/stateless_tests/stl_rx_test.py')
-rw-r--r--scripts/automation/regression/stateless_tests/stl_rx_test.py137
1 files changed, 67 insertions, 70 deletions
diff --git a/scripts/automation/regression/stateless_tests/stl_rx_test.py b/scripts/automation/regression/stateless_tests/stl_rx_test.py
index 95896d44..abec9402 100644
--- a/scripts/automation/regression/stateless_tests/stl_rx_test.py
+++ b/scripts/automation/regression/stateless_tests/stl_rx_test.py
@@ -69,7 +69,7 @@ class STLRX_Test(CStlGeneral_Test):
'rate_percent': 80,
'total_pkts': 1000,
'rate_latency': 1,
- 'latency_9k_enable': True,
+ 'latency_9k_enable': False if self.is_vf_nics else True,
'latency_9k_max_average': 100,
'latency_9k_max_latency': 450, #see latency issue trex-261
},
@@ -138,6 +138,7 @@ class STLRX_Test(CStlGeneral_Test):
, vm = vm)
self.vm_9k_pkt = STLPktBuilder(pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/('a'*9000)
,vm = vm)
+ self.errs = []
@classmethod
@@ -456,121 +457,117 @@ class STLRX_Test(CStlGeneral_Test):
print("===>Iteration {0} PASS {1}".format(i,j));
- def check_stats (self,stats,a,b,err):
+ def check_stats(self, a, b, err):
if a != b:
tmp = 'ERROR field : {0}, read : {1} != expected : {2} '.format(err,a,b)
- pprint.pprint(stats)
- assert False,tmp
-
-
+ print tmp
+ self.errs.append(tmp)
- def send_1_burst(self,from_port,is_latency,pkts):
- pid = from_port
+ def send_1_burst(self, client_ports, is_latency, pkts):
+ self.errs = []
base_pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)
-
pad = (60 - len(base_pkt)) * 'x'
-
stream_pkt = STLPktBuilder(pkt = base_pkt/pad)
- all_ports=list(CTRexScenario.stl_ports_map['map'].keys());
-
- dpid = CTRexScenario.stl_ports_map['map'][pid]
-
- s_ports =[pid]
-
try:
# reset all ports
- self.c.reset(ports = all_ports)
+ self.c.reset()
- for pid in s_ports:
+ for c_port in client_ports:
if is_latency:
s1 = STLStream(name = 'rx',
packet = stream_pkt,
- flow_stats = STLFlowLatencyStats(pg_id = 5 + pid),
- mode = STLTXSingleBurst(total_pkts = pkts,pps = 1000))
+ flow_stats = STLFlowLatencyStats(pg_id = 5 + c_port),
+ mode = STLTXSingleBurst(total_pkts = pkts, pps = 1000))
else:
s1 = STLStream(name = 'rx',
packet = stream_pkt,
- mode = STLTXSingleBurst(total_pkts = pkts,pps = 1000))
+ mode = STLTXSingleBurst(total_pkts = pkts, pps = 1000))
# add both streams to ports
- self.c.add_streams(s1, ports = [pid])
+ self.c.add_streams(s1, ports = [c_port])
self.c.clear_stats()
- self.c.start(ports = s_ports)
- self.c.wait_on_traffic(ports = s_ports)
-
+ self.c.start(ports = client_ports)
+ self.c.wait_on_traffic(ports = client_ports)
stats = self.c.get_stats()
- ips = stats[dpid]
- ops = stats[pid]
- tps = stats['total']
- tbytes = pkts*64
-
- self.check_stats (stats,ops["obytes"], tbytes,"ops[obytes]")
- self.check_stats (stats,ops["opackets"], pkts,"ops[opackets]")
-
- self.check_stats (stats,ips["ibytes"], tbytes,"ips[ibytes]")
- self.check_stats (stats,ips["ipackets"], pkts,"ips[ipackets]")
+ bytes = pkts * 64
+ total_pkts = pkts * len(client_ports)
+ total_bytes = total_pkts * 64
- self.check_stats (stats,tps['ibytes'], tbytes,"tps[ibytes]")
- self.check_stats (stats,tps['obytes'], tbytes,"tps[obytes]")
- self.check_stats (stats,tps['ipackets'], pkts,"tps[ipackets]")
- self.check_stats (stats,tps['opackets'], pkts,"tps[opackets]")
-
- if is_latency:
- ls=stats['flow_stats'][5+ pid]
- self.check_stats (stats,ls['rx_pkts']['total'], pkts,"ls['rx_pkts']['total']")
- self.check_stats (stats,ls['rx_pkts'][dpid], pkts,"ls['rx_pkts'][dpid]")
+ tps = stats['total']
+ self.check_stats(tps['ibytes'], total_bytes, "tps[ibytes]")
+ self.check_stats(tps['obytes'], total_bytes, "tps[obytes]")
+ self.check_stats(tps['ipackets'], total_pkts, "tps[ipackets]")
+ self.check_stats(tps['opackets'], total_pkts, "tps[opackets]")
- self.check_stats (stats,ls['tx_pkts']['total'], pkts,"ls['tx_pkts']['total']")
- self.check_stats (stats,ls['tx_pkts'][pid], pkts,"ls['tx_pkts'][pid]")
+ for c_port in client_ports:
+ s_port = CTRexScenario.stl_ports_map['map'][c_port]
- self.check_stats (stats,ls['tx_bytes']['total'], tbytes,"ls['tx_bytes']['total']")
- self.check_stats (stats,ls['tx_bytes'][pid], tbytes,"ls['tx_bytes'][pid]")
+ ips = stats[s_port]
+ ops = stats[c_port]
+ self.check_stats(ops["obytes"], bytes, "stats[%s][obytes]" % c_port)
+ self.check_stats(ops["opackets"], pkts, "stats[%s][opackets]" % c_port)
+
+ self.check_stats(ips["ibytes"], bytes, "stats[%s][ibytes]" % s_port)
+ self.check_stats(ips["ipackets"], pkts, "stats[%s][ipackets]" % s_port)
- return 0
+ if is_latency:
+ ls = stats['flow_stats'][5 + c_port]
+ self.check_stats(ls['rx_pkts']['total'], pkts, "ls['rx_pkts']['total']")
+ self.check_stats(ls['rx_pkts'][s_port], pkts, "ls['rx_pkts'][%s]" % s_port)
+
+ self.check_stats(ls['tx_pkts']['total'], pkts, "ls['tx_pkts']['total']")
+ self.check_stats(ls['tx_pkts'][c_port], pkts, "ls['tx_pkts'][%s]" % c_port)
+
+ self.check_stats(ls['tx_bytes']['total'], bytes, "ls['tx_bytes']['total']")
+ self.check_stats(ls['tx_bytes'][c_port], bytes, "ls['tx_bytes'][%s]" % c_port)
+
+ if self.errs:
+ pprint.pprint(stats)
+ msg = 'Stats do not match the expected:\n' + '\n'.join(self.errs)
+ raise Exception(msg)
except STLError as e:
assert False , '{0}'.format(e)
def _run_fcs_stream (self,is_vm):
""" this test send 1 64 byte packet with latency and check that all counters are reported as 64 bytes"""
- res=True
try:
- all_ports=list(CTRexScenario.stl_ports_map['map'].keys());
- for port in all_ports:
- for l in [True,False]:
- print(" test port {0} latency : {1} ".format(port,l))
- self.send_1_burst(port,l,100)
+ ports = CTRexScenario.stl_ports_map['map'].keys()
+ for lat in [True, False]:
+ print("\nSending from ports: {0}, has latency: {1} ".format(ports, lat))
+ self.send_1_burst(ports, lat, 100)
+ print('Success.')
+ return True
except Exception as e:
if is_vm :
- res=False
+ return False
else:
- raise e
- return(res);
-
-
+ raise
+# this test sends 1 64 byte packet with latency and check that all counters are reported as 64 bytes
def test_fcs_stream(self):
- """ this test send 1 64 byte packet with latency and check that all counters are reported as 64 bytes"""
- is_vm=self.is_virt_nics # in case of VM and vSwitch there are drop of packets in some cases, let retry number of times
- # in this case we just want to check functionality that packet of 64 is reported as 64 in all levels
- retry=1
- if is_vm:
- retry=4
- for i in range(0,retry):
- if self._run_fcs_stream (is_vm):
- break;
- print("==> retry %d .." %(i));
+ # in case of VM and vSwitch there are drop of packets in some cases, let retry number of times
+ # in this case we just want to check functionality that packet of 64 is reported as 64 in all levels
+ is_vm = self.is_virt_nics or self.is_vf_nics
+ tries = 1
+ if is_vm:
+ tries = 4
+ for i in range(tries):
+ if self._run_fcs_stream(is_vm):
+ return
+ print("==> Try number #%d failed ..." % i)
+ self.fail('\n'.join(self.errs))
# this test adds more and more latency streams and re-test with incremental
def test_incremental_latency_streams (self):