summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-07-04 12:55:42 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-07-04 12:55:42 +0300
commit7f58dadbd502f6fe504170c443505c7ad2eb3785 (patch)
tree1f86a439d24565332a7a286841913d080fb0be74 /scripts
parenta76479bc269cad96475f9c71381b4f826d47709f (diff)
parent582e6dddb5693d5fa7576c19b0ef7c1c0723ff59 (diff)
Merge branch 'master' into cpu_per_core
Diffstat (limited to 'scripts')
-rw-r--r--scripts/automation/regression/stateless_tests/stl_rx_test.py107
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py22
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py16
-rwxr-xr-xscripts/run_regression9
4 files changed, 122 insertions, 32 deletions
diff --git a/scripts/automation/regression/stateless_tests/stl_rx_test.py b/scripts/automation/regression/stateless_tests/stl_rx_test.py
index 84f32081..23ebf081 100644
--- a/scripts/automation/regression/stateless_tests/stl_rx_test.py
+++ b/scripts/automation/regression/stateless_tests/stl_rx_test.py
@@ -74,7 +74,7 @@ class STLRX_Test(CStlGeneral_Test):
pprint.pprint(err_latency)
tmp = 'RX pkts ERROR - one of the error is on'
print(tmp)
- #assert False, tmp
+ assert False, tmp
if latency['average']> max_average:
pprint.pprint(latency_stats)
@@ -261,7 +261,7 @@ class STLRX_Test(CStlGeneral_Test):
- def __test_9k_stream(self,pgid,ports,precet,max_latency,avg_latency,duration,pkt_size):
+ def __9k_stream(self,pgid,ports,precet,max_latency,avg_latency,duration,pkt_size):
my_pg_id=pgid
s_ports=ports;
all_ports=list(CTRexScenario.stl_ports_map['map'].keys());
@@ -314,6 +314,8 @@ class STLRX_Test(CStlGeneral_Test):
# check low latency when you have stream of 9K stream
def test_9k_stream(self):
+ #self.skip('Skip due to bug trex-215')
+
if self.latency_9k_enable == False:
print("SKIP")
return
@@ -330,18 +332,14 @@ class STLRX_Test(CStlGeneral_Test):
s_port=sorted(s_port)
if self.speed == 40 :
# the NIC does not support all full rate in case both port works let's filter odd ports
- tmp_l=[]
- for port in s_port:
- if ((int(port) % 2) ==0):
- tmp_l.append(port);
- s_port=tmp_l;
+ s_port=list(filter(lambda x: x % 2==0, s_port))
if len(s_port)==0:
s_port=[0];
error=1;
for j in range(0,5):
print(" {4} - duration {0} pgid {1} pkt_size {2} s_port {3} ".format(duration,pgid,pkt_size,s_port,j));
- if self.__test_9k_stream(pgid,
+ if self.__9k_stream(pgid,
s_port,90,
self.latency_9k_max_latency,
self.latency_9k_max_average,
@@ -356,7 +354,100 @@ class STLRX_Test(CStlGeneral_Test):
print("===>Iteration {0} PASS {1}".format(i,j));
+ def check_stats (self,stats,a,b,err):
+ if a != b:
+ tmp = 'ERROR field : {0}, read : {1} != expected : {2} '.format(err,a,b)
+ pprint.pprint(stats)
+ assert False,tmp
+
+
+
+ def send_1_burst(self,from_port,is_latency,pkts):
+
+ pid = from_port
+ 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)
+
+
+ for pid in s_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))
+ else:
+ s1 = STLStream(name = 'rx',
+ packet = stream_pkt,
+ mode = STLTXSingleBurst(total_pkts = pkts,pps = 1000))
+
+
+ # add both streams to ports
+ self.c.add_streams(s1, ports = [pid])
+
+ self.c.clear_stats()
+
+ self.c.start(ports = s_ports)
+ self.c.wait_on_traffic(ports = s_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]")
+
+ 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]")
+
+ 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]")
+
+ self.check_stats (stats,ls['tx_bytes']['total'], tbytes,"ls['tx_bytes']['total']")
+ self.check_stats (stats,ls['tx_bytes'][pid], pkts+1,"ls['tx_bytes'][pid]")
+
+
+ return 0
+
+ except STLError as e:
+ assert False , '{0}'.format(e)
+
+
+
+ def test_fcs_stream(self):
+ """ this test send 1 64 byte packet with latency and check that all counters are reported as 64 bytes"""
+ #self.skip('Skip due to bug trex-213')
+
+ 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,False,100)
# this test adds more and more latency streams and re-test with incremental
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
index 38a18d16..dc0035b3 100755
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
@@ -1287,18 +1287,20 @@ class STLClient(object):
**total** and per port statistics contain dictionary with following format.
+ Most of the bytes counters (unless specified otherwise) are in L2 layer including the FCS. e.g. minimum packet size in 64 bytes
+
=============================== ===============
key Meaning
=============================== ===============
- ibytes Number of input bytes
+ ibytes Number of input bytes
ierrors Number of input errors
- ipackets Number of input packets
- obytes Number of output bytes
+ ipackets Number of input packets
+ obytes Number of output bytes
oerrors Number of output errors
opackets Number of output packets
- rx_bps Receive bytes per second rate
+ rx_bps Receive bytes per second rate (L2 layer)
rx_pps Receive packet per second rate
- tx_bps Transmit bytes per second rate
+ tx_bps Transmit bytes per second rate (L2 layer)
tx_pps Transmit packet per second rate
=============================== ===============
@@ -1330,8 +1332,8 @@ class STLClient(object):
================= ===============
bw_per_core Estimated byte rate Trex can support per core. This is calculated by extrapolation of current rate and load on transmitting cores.
cpu_util Estimate of the average utilization percentage of the transimitting cores
- queue_full Total number of packets we could not transmit because NIC TX queue was full. This usually indicates that the rate we trying to transmit is too high for this port
- rx_cpu_util Estimate of the utilization percentage of the core handling RX traffic
+ queue_full Total number of packets transmitted while the NIC TX queue was full. The packets will be transmitted, eventually, but will create high CPU%due to polling the queue. This usually indicates that the rate we trying to transmit is too high for this port.
+ rx_cpu_util Estimate of the utilization percentage of the core handling RX traffic. Too high value of this CPU utilization could cause drop of latency streams.
rx_drop_bps Received bytes per second drop rate
rx_bps Received bytes per second rate
rx_pps Received packets per second rate
@@ -1359,7 +1361,7 @@ class STLClient(object):
================= ===============
key Meaning (see better explanation below the table)
================= ===============
- dropped How many packets were dropped.
+ dropped How many packets were dropped (estimation)
dup How many packets were duplicated.
out_of_order How many packets we received out of order.
seq_too_high How many events of packet with sequence number too high we saw.
@@ -1387,10 +1389,10 @@ class STLClient(object):
================= ===============
key Meaning
================= ===============
- average Average latency over the stream lifetime (usec). Total average is computed each sampling period by following formula: <average> = <prev average>/2 + <last sampling period average>/2
+ average Average latency over the stream lifetime (usec).Low pass filter is applied to the last window average.It is computed each sampling period by following formula: <average> = <prev average>/2 + <last sampling period average>/2
histogram Dictionary describing logarithmic distribution histogram of packet latencies. Keys in the dictionary represent range of latencies (in usec). Values are the total number of packets received in this latency range. For example, an entry {100:13} would mean that we saw 13 packets with latency in the range between 100 and 200 usec.
jitter Jitter of latency samples, computed as described in :rfc:`3550#appendix-A.8`
- last_max Maximum latency measured between last two data reads from server.
+ last_max Maximum latency measured between last two data reads from server (0.5 sec window).
total_max Maximum latency measured over the stream lifetime (in usec).
total_min Minimum latency measured over the stream lifetime (in usec).
================= ===============
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
index 8e8388fd..678adb4e 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
@@ -1130,12 +1130,7 @@ class CRxStats(CTRexStats):
def __init__(self, ports):
super(CRxStats, self).__init__()
self.ports = ports
- self.ports_speed = {}
- def get_ports_speed(self):
- for port in self.ports:
- self.ports_speed[str(port)] = self.ports[port].get_speed_bps()
- self.ports_speed['total'] = sum(self.ports_speed.values())
# calculates a diff between previous snapshot
# and current one
@@ -1253,8 +1248,8 @@ class CRxStats(CTRexStats):
return
# TX
- self.get_ports_speed()
for port in pg_current['tx_pkts'].keys():
+
prev_tx_pps = pg_prev['tx_pps'].get(port)
now_tx_pkts = pg_current['tx_pkts'].get(port)
prev_tx_pkts = pg_prev['tx_pkts'].get(port)
@@ -1263,19 +1258,20 @@ class CRxStats(CTRexStats):
prev_tx_bps = pg_prev['tx_bps'].get(port)
now_tx_bytes = pg_current['tx_bytes'].get(port)
prev_tx_bytes = pg_prev['tx_bytes'].get(port)
+
pg_current['tx_bps'][port], pg_current['tx_bps_lpf'][port] = self.calc_bps(prev_tx_bps, now_tx_bytes, prev_tx_bytes, diff_sec)
if pg_current['tx_bps'].get(port) != None and pg_current['tx_pps'].get(port) != None:
pg_current['tx_bps_L1'][port] = calc_bps_L1(pg_current['tx_bps'][port], pg_current['tx_pps'][port])
pg_current['tx_bps_L1_lpf'][port] = calc_bps_L1(pg_current['tx_bps_lpf'][port], pg_current['tx_pps_lpf'][port])
- pg_current['tx_line_util'][port] = 100.0 * pg_current['tx_bps_L1'][port] / self.ports_speed[port]
else:
pg_current['tx_bps_L1'][port] = None
pg_current['tx_bps_L1_lpf'][port] = None
- pg_current['tx_line_util'][port] = None
+
# RX
for port in pg_current['rx_pkts'].keys():
+
prev_rx_pps = pg_prev['rx_pps'].get(port)
now_rx_pkts = pg_current['rx_pkts'].get(port)
prev_rx_pkts = pg_prev['rx_pkts'].get(port)
@@ -1288,11 +1284,9 @@ class CRxStats(CTRexStats):
if pg_current['rx_bps'].get(port) != None and pg_current['rx_pps'].get(port) != None:
pg_current['rx_bps_L1'][port] = calc_bps_L1(pg_current['rx_bps'][port], pg_current['rx_pps'][port])
pg_current['rx_bps_L1_lpf'][port] = calc_bps_L1(pg_current['rx_bps_lpf'][port], pg_current['rx_pps_lpf'][port])
- pg_current['rx_line_util'][port] = 100.0 * pg_current['rx_bps_L1'][port] / self.ports_speed[port]
else:
pg_current['rx_bps_L1'][port] = None
pg_current['rx_bps_L1_lpf'][port] = None
- pg_current['rx_line_util'][port] = None
def calc_pps (self, prev_bw, now, prev, diff_sec):
@@ -1355,7 +1349,7 @@ class CRxStats(CTRexStats):
stats[int(pg_id)][field][int(port)] = val if val != 'N/A' else StatNotAvailable(field)
# BW values
- for field in ['tx_pps', 'tx_bps', 'tx_bps_L1', 'rx_pps', 'rx_bps', 'rx_bps_L1', 'tx_line_util', 'rx_line_util']:
+ for field in ['tx_pps', 'tx_bps', 'tx_bps_L1', 'rx_pps', 'rx_bps', 'rx_bps_L1']:
val = self.get([pg_id, field, 'total'])
stats[int(pg_id)][field] = {'total': val if val != 'N/A' else StatNotAvailable(field)}
for port in value[field].keys():
diff --git a/scripts/run_regression b/scripts/run_regression
index bdc2f185..407b7f84 100755
--- a/scripts/run_regression
+++ b/scripts/run_regression
@@ -1,6 +1,9 @@
#!/bin/bash
-INPUT_ARGS=${@//--python[23]/}
+ARGS=()
+for var in "$@"; do
+ [[ "$var" != '--python2' && "$var" != '--python3' ]] && ARGS+=("$var")
+done
if [[ $@ =~ '--python2' || ! $@ =~ '--python3' ]]; then
source find_python.sh --python2
@@ -8,7 +11,7 @@ if [[ $@ =~ '--python2' || ! $@ =~ '--python3' ]]; then
# Python 2
echo Python2 test
- $PYTHON trex_unit_test.py $INPUT_ARGS
+ $PYTHON trex_unit_test.py "${ARGS[@]}"
if [ $? -eq 0 ]; then
printf "\n$PYTHON test succeeded\n\n"
else
@@ -24,7 +27,7 @@ if [[ $@ =~ '--python3' ]]; then
# Python 3
echo Python3 test
- $PYTHON trex_unit_test.py $INPUT_ARGS
+ $PYTHON trex_unit_test.py "${ARGS[@]}"
if [ $? -eq 0 ]; then
printf "\n$PYTHON test succeeded\n\n"
else