X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=nfvbench%2Ftraffic_client.py;fp=nfvbench%2Ftraffic_client.py;h=2ce118cea555031eec19c93e6b8b1c3f88f51ebd;hb=706561d483b2a698ef8cdd23b56455500df342f5;hp=056075a9277724a4056eb131845f7dadff095399;hpb=b996e6a2f7094c9746138aa9776a5e98c93c9ad2;p=nfvbench.git diff --git a/nfvbench/traffic_client.py b/nfvbench/traffic_client.py index 056075a..2ce118c 100755 --- a/nfvbench/traffic_client.py +++ b/nfvbench/traffic_client.py @@ -787,13 +787,11 @@ class TrafficClient(object): def cancel_traffic(self): self.runner.stop() - def get_interface(self, port_index): + def get_interface(self, port_index, stats): port = self.gen.port_handle[port_index] tx, rx = 0, 0 - if not self.config.no_traffic: - stats = self.get_stats() - if port in stats: - tx, rx = int(stats[port]['tx']['total_pkts']), int(stats[port]['rx']['total_pkts']) + if stats and port in stats: + tx, rx = int(stats[port]['tx']['total_pkts']), int(stats[port]['rx']['total_pkts']) return Interface('traffic-generator', self.tool.lower(), tx, rx) def get_traffic_config(self):