diff options
Diffstat (limited to 'nfvbench/traffic_gen/trex_gen.py')
-rw-r--r-- | nfvbench/traffic_gen/trex_gen.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/nfvbench/traffic_gen/trex_gen.py b/nfvbench/traffic_gen/trex_gen.py index 4e20f73..d5625eb 100644 --- a/nfvbench/traffic_gen/trex_gen.py +++ b/nfvbench/traffic_gen/trex_gen.py @@ -168,6 +168,8 @@ class TRex(AbstractTrafficGenerator): result["latency"] = in_stats["latency"] # Merge HDRHistogram to have an overall value for all chains and ports + # (provided that the histogram exists in the stats returned by T-Rex) + # Of course, empty histograms will produce an empty (invalid) histogram. try: hdrh_list = [] if ifstats: @@ -186,7 +188,7 @@ class TRex(AbstractTrafficGenerator): x.add(y) return x decoded_hdrh = reduce(add_hdrh, hdrh_list) - result["hdrh"] = HdrHistogram.encode(decoded_hdrh).decode('utf-8') + result["overall_hdrh"] = HdrHistogram.encode(decoded_hdrh).decode('utf-8') except KeyError: pass @@ -589,8 +591,6 @@ class TRex(AbstractTrafficGenerator): """ streams = [] pg_id, lat_pg_id = self.get_pg_id(port, chain_id) - if self.config.no_flow_stats: - LOG.info("Traffic flow statistics are disabled.") if l2frame == 'IMIX': for ratio, l2_frame_size in zip(IMIX_RATIOS, IMIX_L2_SIZES): pkt = self._create_pkt(stream_cfg, l2_frame_size) @@ -602,12 +602,12 @@ class TRex(AbstractTrafficGenerator): streams.append(STLStream(packet=pkt, flow_stats=STLFlowStats(pg_id=pg_id, vxlan=True) - if not self.config.no_flow_stats else None, + if not self.config.no_flow_stats else None, mode=STLTXCont(pps=ratio))) else: streams.append(STLStream(packet=pkt, flow_stats=STLFlowStats(pg_id=pg_id) - if not self.config.no_flow_stats else None, + if not self.config.no_flow_stats else None, mode=STLTXCont(pps=ratio))) if latency: @@ -633,12 +633,12 @@ class TRex(AbstractTrafficGenerator): streams.append(STLStream(packet=pkt, flow_stats=STLFlowStats(pg_id=pg_id, vxlan=True) - if not self.config.no_flow_stats else None, + if not self.config.no_flow_stats else None, mode=STLTXCont())) else: streams.append(STLStream(packet=pkt, flow_stats=STLFlowStats(pg_id=pg_id) - if not self.config.no_flow_stats else None, + if not self.config.no_flow_stats else None, mode=STLTXCont())) # for the latency stream, the minimum payload is 16 bytes even in case of vlan tagging # without vlan, the min l2 frame size is 64 @@ -662,12 +662,12 @@ class TRex(AbstractTrafficGenerator): streams.append(STLStream(packet=pkt, flow_stats=STLFlowLatencyStats(pg_id=lat_pg_id, vxlan=True) - if not self.config.no_latency_stats else None, + if not self.config.no_latency_stats else None, mode=STLTXCont(pps=self.LATENCY_PPS))) else: streams.append(STLStream(packet=pkt, flow_stats=STLFlowLatencyStats(pg_id=lat_pg_id) - if not self.config.no_latency_stats else None, + if not self.config.no_latency_stats else None, mode=STLTXCont(pps=self.LATENCY_PPS))) return streams @@ -1005,6 +1005,8 @@ class TRex(AbstractTrafficGenerator): latency: True if latency measurement is needed e2e: True if performing "end to end" connectivity check """ + if self.config.no_flow_stats: + LOG.info("Traffic flow statistics are disabled.") r = self.__is_rate_enough(l2frame_size, rates, bidirectional, latency) if not r['result']: raise TrafficGeneratorException( |