aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services/vnf_generic/vnf/prox_vnf.py
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/network_services/vnf_generic/vnf/prox_vnf.py')
-rw-r--r--yardstick/network_services/vnf_generic/vnf/prox_vnf.py34
1 files changed, 24 insertions, 10 deletions
diff --git a/yardstick/network_services/vnf_generic/vnf/prox_vnf.py b/yardstick/network_services/vnf_generic/vnf/prox_vnf.py
index 839f30967..c3b50369b 100644
--- a/yardstick/network_services/vnf_generic/vnf/prox_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/prox_vnf.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2017 Intel Corporation
+# Copyright (c) 2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
import errno
import logging
import datetime
+import time
from yardstick.common.process import check_if_process_failed
from yardstick.network_services.vnf_generic.vnf.prox_helpers import ProxDpdkVnfSetupEnvHelper
@@ -81,6 +82,8 @@ class ProxApproxVnf(SampleVNF):
"packets_in": 0,
"packets_dropped": 0,
"packets_fwd": 0,
+ "curr_packets_in": 0,
+ "curr_packets_fwd": 0,
"collect_stats": {"core": {}},
})
return result
@@ -97,15 +100,26 @@ class ProxApproxVnf(SampleVNF):
raise RuntimeError("Failed ..Invalid no of ports .. "
"1, 2 or 4 ports only supported at this time")
- all_port_stats = self.vnf_execute('multi_port_stats', range(port_count))
- rx_total = tx_total = tsc = 0
- try:
- for single_port_stats in all_port_stats:
- rx_total = rx_total + single_port_stats[1]
- tx_total = tx_total + single_port_stats[2]
- tsc = tsc + single_port_stats[5]
- except (TypeError, IndexError):
- LOG.error("Invalid data ...")
+ tmpPorts = [self.vnfd_helper.port_num(port_name)
+ for port_name in self.vnfd_helper.port_pairs.all_ports]
+ ok = False
+ timeout = time.time() + constants.RETRY_TIMEOUT
+ while not ok:
+ ok, all_port_stats = self.vnf_execute('multi_port_stats', tmpPorts)
+ if time.time() > timeout:
+ break
+
+ if ok:
+ rx_total = tx_total = tsc = 0
+ try:
+ for single_port_stats in all_port_stats:
+ rx_total = rx_total + single_port_stats[1]
+ tx_total = tx_total + single_port_stats[2]
+ tsc = tsc + single_port_stats[5]
+ except (TypeError, IndexError):
+ LOG.error("Invalid data ...")
+ return {}
+ else:
return {}
tsc = tsc / port_count