summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py2
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py15
-rw-r--r--yardstick/network_services/vnf_generic/vnf/prox_helpers.py12
-rw-r--r--yardstick/network_services/vnf_generic/vnf/prox_vnf.py4
4 files changed, 21 insertions, 12 deletions
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py
index f8b592d8c..c88b1528c 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py
@@ -342,7 +342,7 @@ class TestProxApproxVnf(unittest.TestCase):
resource_helper = mock.MagicMock()
resource_helper.execute.return_value = list(range(12))
- resource_helper.collect_kpi.return_value = {'core': {'result': 234}}
+ resource_helper.collect_collectd_kpi.return_value = {'core': {'result': 234}}
prox_approx_vnf = ProxApproxVnf(NAME, self.VNFD0)
prox_approx_vnf.resource_helper = resource_helper
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py
index 4e82c0d5e..eb569cfe6 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py
@@ -20,7 +20,6 @@ import mock
from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
from tests.unit import STL_MOCKS
-from yardstick.network_services.nfvi.resource import ResourceProfile
SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper'
NAME = 'vnf__1'
@@ -334,7 +333,7 @@ class TestProxTrafficGen(unittest.TestCase):
prox_traffic_gen._vnf_wrapper.resource_helper.resource = mock.MagicMock(
**{"check_if_sa_running.return_value": [False]})
prox_traffic_gen._vnf_wrapper.vnf_execute = mock.Mock(return_value="")
- self.assertEqual({"core": {}}, prox_traffic_gen.collect_kpi())
+ self.assertEqual({}, prox_traffic_gen.collect_kpi())
@mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.CpuSysCores')
@mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.find_relative_file')
@@ -372,12 +371,12 @@ class TestProxTrafficGen(unittest.TestCase):
'task_path': '',
'options': {'tg__1': {'prox_args': {'-e': '',
'-t': ''},
- 'prox_config': 'configs/l3-gen-2.cfg',
- 'prox_path': '/root/dppd-PROX-v035/build/prox'},
- 'vnf__1': {'prox_args': {'-t': ''},
- 'prox_config': 'configs/l3-swap-2.cfg',
- 'prox_path': '/root/dppd-PROX-v035/build/prox'}
- }
+ 'prox_config': 'configs/l3-gen-2.cfg',
+ 'prox_path': '/root/dppd-PROX-v035/build/prox'},
+ 'vnf__1': {'prox_args': {'-t': ''},
+ 'prox_config': 'configs/l3-swap-2.cfg',
+ 'prox_path': '/root/dppd-PROX-v035/build/prox'}
+ }
}
prox_traffic_gen.instantiate(scenario_cfg, {})
diff --git a/yardstick/network_services/vnf_generic/vnf/prox_helpers.py b/yardstick/network_services/vnf_generic/vnf/prox_helpers.py
index 30524a192..9952c3bf0 100644
--- a/yardstick/network_services/vnf_generic/vnf/prox_helpers.py
+++ b/yardstick/network_services/vnf_generic/vnf/prox_helpers.py
@@ -906,10 +906,18 @@ class ProxResourceHelper(ClientResourceHelper):
LOG.debug("tg_prox done")
self._terminated.value = 1
- # use ResourceHelper method to collect KPIs directly.
- def collect_kpi(self):
+ # For VNF use ResourceHelper method to collect KPIs directly.
+ # for TG leave the superclass ClientResourceHelper collect_kpi_method intact
+ def collect_collectd_kpi(self):
return self._collect_resource_kpi()
+ def collect_kpi(self):
+ result = super(ProxResourceHelper, self).collect_kpi()
+ # add in collectd kpis manually
+ if result:
+ result['collect_stats'] = self._collect_resource_kpi()
+ return result
+
def terminate(self):
# should not be called, use VNF terminate
raise NotImplementedError()
diff --git a/yardstick/network_services/vnf_generic/vnf/prox_vnf.py b/yardstick/network_services/vnf_generic/vnf/prox_vnf.py
index e87d452b4..2ac6ea412 100644
--- a/yardstick/network_services/vnf_generic/vnf/prox_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/prox_vnf.py
@@ -82,7 +82,9 @@ class ProxApproxVnf(SampleVNF):
"packets_in": tx_total,
"packets_dropped": (tx_total - rx_total),
"packets_fwd": rx_total,
- "collect_stats": self.resource_helper.collect_kpi(),
+ # we share ProxResourceHelper with TG, but we want to collect
+ # collectd KPIs here and not TG KPIs, so use a different method name
+ "collect_stats": self.resource_helper.collect_collectd_kpi(),
}
LOG.debug("%s collect KPIs %s", self.APP_NAME, result)
return result