diff options
author | Chornyi, TarasX <tarasx.chornyi@intel.com> | 2018-05-29 17:59:49 +0300 |
---|---|---|
committer | Chornyi, TarasX <tarasx.chornyi@intel.com> | 2018-06-29 18:01:47 +0300 |
commit | 005358a39a87e42061dd5b344916c2ffe0475961 (patch) | |
tree | 847dee42251536f505076001b6ec5b9068fb60ba /yardstick/network_services/collector | |
parent | 6f4db35421d258cebd6e01769037e5cd64115639 (diff) |
NFVI support for standalone, baremetal and heat contexts
JIRA: YARDSTICK-1257
Change-Id: I6733bd49ac91985e8f3d7722e6990e8733bb430e
Signed-off-by: Chornyi, TarasX <tarasx.chornyi@intel.com>
Diffstat (limited to 'yardstick/network_services/collector')
-rw-r--r-- | yardstick/network_services/collector/subscriber.py | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/yardstick/network_services/collector/subscriber.py b/yardstick/network_services/collector/subscriber.py index 322b3f5a2..937c266a6 100644 --- a/yardstick/network_services/collector/subscriber.py +++ b/yardstick/network_services/collector/subscriber.py @@ -14,17 +14,36 @@ """This module implements stub for publishing results in yardstick format.""" import logging +from yardstick.network_services.nfvi.resource import ResourceProfile +from yardstick.network_services.utils import get_nsb_option + + LOG = logging.getLogger(__name__) class Collector(object): """Class that handles dictionary of results in yardstick-plot format.""" - def __init__(self, vnfs): + def __init__(self, vnfs, contexts_nodes, timeout=3600): super(Collector, self).__init__() self.vnfs = vnfs + self.nodes = contexts_nodes + self.bin_path = get_nsb_option('bin_path', '') + self.resource_profiles = {} + + for ctx_name, nodes in contexts_nodes.items(): + for node in (node for node in nodes if node.get('collectd')): + name = ".".join([node['name'], ctx_name]) + self.resource_profiles.update( + {name: ResourceProfile.make_from_node(node, timeout)} + ) def start(self): + for resource in self.resource_profiles.values(): + resource.initiate_systemagent(self.bin_path) + resource.start() + resource.amqp_process_for_nfvi_kpi() + for vnf in self.vnfs: vnf.start_collect() @@ -32,6 +51,9 @@ class Collector(object): for vnf in self.vnfs: vnf.stop_collect() + for resource in self.resource_profiles.values(): + resource.stop() + def get_kpi(self): """Returns dictionary of results in yardstick-plot format @@ -42,7 +64,12 @@ class Collector(object): for vnf in self.vnfs: # Result example: # {"VNF1: { "tput" : [1000, 999] }, "VNF2": { "latency": 100 }} - LOG.debug("collect KPI for %s", vnf.name) + LOG.debug("collect KPI for vnf %s", vnf.name) results[vnf.name] = vnf.collect_kpi() + for node_name, resource in self.resource_profiles.items(): + LOG.debug("collect KPI for nfvi_node %s", node_name) + results[node_name] = {"core": resource.amqp_collect_nfvi_kpi()} + LOG.debug("%s collect KPIs %s", node_name, results[node_name]['core']) + return results |