Feature 11061: Clean MON to have only the dashboarder 74/15174/2
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 24 Apr 2025 11:01:33 +0000 (13:01 +0200)
committerelumalai <deepika.e@tataelxsi.co.in>
Fri, 27 Jun 2025 10:16:19 +0000 (12:16 +0200)
Change-Id: I2249f145dfa7ae8869cb595d3b2af9f78f92d825
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
70 files changed:
osm_mon/cmd/mon_collector.py [deleted file]
osm_mon/cmd/mon_evaluator.py [deleted file]
osm_mon/cmd/mon_healthcheck.py [deleted file]
osm_mon/cmd/mon_server.py [deleted file]
osm_mon/collector/__init__.py [deleted file]
osm_mon/collector/backends/__init__.py [deleted file]
osm_mon/collector/backends/base.py [deleted file]
osm_mon/collector/backends/prometheus.py [deleted file]
osm_mon/collector/collector.py [deleted file]
osm_mon/collector/infra_collectors/__init__.py [deleted file]
osm_mon/collector/infra_collectors/base.py [deleted file]
osm_mon/collector/infra_collectors/base_osinfra.py [deleted file]
osm_mon/collector/infra_collectors/base_sdnc.py [deleted file]
osm_mon/collector/infra_collectors/base_vim.py [deleted file]
osm_mon/collector/infra_collectors/onos.py [deleted file]
osm_mon/collector/infra_collectors/openstack.py [deleted file]
osm_mon/collector/infra_collectors/vio.py [deleted file]
osm_mon/collector/infra_collectors/vmware.py [deleted file]
osm_mon/collector/metric.py [deleted file]
osm_mon/collector/service.py [deleted file]
osm_mon/collector/utils/__init__.py [deleted file]
osm_mon/collector/utils/openstack.py [deleted file]
osm_mon/collector/vnf_collectors/__init__.py [deleted file]
osm_mon/collector/vnf_collectors/base.py [deleted file]
osm_mon/collector/vnf_collectors/base_vim.py [deleted file]
osm_mon/collector/vnf_collectors/juju.py [deleted file]
osm_mon/collector/vnf_collectors/openstack.py [deleted file]
osm_mon/collector/vnf_collectors/vio.py [deleted file]
osm_mon/collector/vnf_collectors/vmware.py [deleted file]
osm_mon/collector/vnf_collectors/vrops/__init__.py [deleted file]
osm_mon/collector/vnf_collectors/vrops/metrics.py [deleted file]
osm_mon/collector/vnf_collectors/vrops/vrops_helper.py [deleted file]
osm_mon/collector/vnf_metric.py [deleted file]
osm_mon/evaluator/__init__.py [deleted file]
osm_mon/evaluator/backends/__init__.py [deleted file]
osm_mon/evaluator/backends/base.py [deleted file]
osm_mon/evaluator/backends/prometheus.py [deleted file]
osm_mon/evaluator/evaluator.py [deleted file]
osm_mon/evaluator/service.py [deleted file]
osm_mon/server/__init__.py [deleted file]
osm_mon/server/server.py [deleted file]
osm_mon/server/service.py [deleted file]
osm_mon/tests/unit/collector/__init__.py [deleted file]
osm_mon/tests/unit/collector/test_collector.py [deleted file]
osm_mon/tests/unit/collector/test_collector_service.py [deleted file]
osm_mon/tests/unit/collector/utils/__init__.py [deleted file]
osm_mon/tests/unit/collector/utils/test_openstack.py [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/__init__.py [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/test_openstack.py [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/__init__.py [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/mock_http.py [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/osm_mocks/VNFD.json [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/osm_mocks/VNFR.json [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/test_vcd_collector.py [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/test_vio_collector.py [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/test_vrops_helper.py [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/404.txt [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/OK.json [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/malformed.json [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/vcd_vapp_response.xml [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/vrops_multi.json [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/vrops_resources.json [deleted file]
osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/vrops_token.json [deleted file]
osm_mon/tests/unit/evaluator/__init__.py [deleted file]
osm_mon/tests/unit/evaluator/test_evaluator.py [deleted file]
osm_mon/tests/unit/evaluator/test_evaluator_service.py [deleted file]
osm_mon/tests/unit/evaluator/test_prometheus.py [deleted file]
osm_mon/tests/unit/server/__init__.py [deleted file]
osm_mon/tests/unit/server/test_server_service.py [deleted file]
setup.py

diff --git a/osm_mon/cmd/mon_collector.py b/osm_mon/cmd/mon_collector.py
deleted file mode 100644 (file)
index 30e6676..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import argparse
-import logging
-import sys
-
-from osm_mon.collector.collector import Collector
-from osm_mon.core.config import Config
-from osm_mon.cmd.mon_utils import wait_till_core_services_are_ready
-
-
-def main():
-    parser = argparse.ArgumentParser(prog="osm-mon-collector")
-    parser.add_argument("--config-file", nargs="?", help="MON configuration file")
-    args = parser.parse_args()
-    cfg = Config(args.config_file)
-
-    root = logging.getLogger()
-    root.setLevel(logging.getLevelName(cfg.get("global", "loglevel")))
-    ch = logging.StreamHandler(sys.stdout)
-    ch.setLevel(logging.getLevelName(cfg.get("global", "loglevel")))
-    formatter = logging.Formatter(
-        "%(asctime)s - %(name)s - %(levelname)s - %(message)s", "%m/%d/%Y %I:%M:%S %p"
-    )
-    ch.setFormatter(formatter)
-    root.addHandler(ch)
-
-    log = logging.getLogger(__name__)
-    if wait_till_core_services_are_ready(cfg, "osm-mon-collector"):
-        log.info("Starting MON Collector...")
-        log.debug("Config: %s", cfg.conf)
-        log.info("Initializing database...")
-        try:
-            collector = Collector(cfg)
-            collector.collect_forever()
-        except Exception as e:
-            log.error("Failed to start MON Collector")
-            log.exception("Exception: %s", str(e))
-    else:
-        log.error("Failed to start MON Collector")
-
-
-if __name__ == "__main__":
-    main()
diff --git a/osm_mon/cmd/mon_evaluator.py b/osm_mon/cmd/mon_evaluator.py
deleted file mode 100644 (file)
index b1c0e2a..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import argparse
-import logging
-import sys
-
-from osm_mon.core.config import Config
-from osm_mon.evaluator.evaluator import Evaluator
-from osm_mon.cmd.mon_utils import wait_till_core_services_are_ready
-
-
-def main():
-    parser = argparse.ArgumentParser(prog="osm-mon-evaluator")
-    parser.add_argument("--config-file", nargs="?", help="MON configuration file")
-    args = parser.parse_args()
-    cfg = Config(args.config_file)
-
-    root = logging.getLogger()
-    root.setLevel(logging.getLevelName(cfg.get("global", "loglevel")))
-    ch = logging.StreamHandler(sys.stdout)
-    ch.setLevel(logging.getLevelName(cfg.get("global", "loglevel")))
-    formatter = logging.Formatter(
-        "%(asctime)s - %(name)s - %(levelname)s - %(message)s", "%m/%d/%Y %I:%M:%S %p"
-    )
-    ch.setFormatter(formatter)
-    root.addHandler(ch)
-
-    log = logging.getLogger(__name__)
-    if wait_till_core_services_are_ready(cfg, "osm-mon-evaluator"):
-        log.info("Starting MON Evaluator...")
-        log.debug("Config: %s", cfg.conf)
-        log.info("Initializing database...")
-        try:
-            evaluator = Evaluator(cfg)
-            evaluator.evaluate_forever()
-        except Exception as e:
-            log.error("Failed to start MON Evaluator")
-            log.exception("Exception: %s", str(e))
-    else:
-        log.error("Failed to start MON Evaluator")
-
-
-if __name__ == "__main__":
-    main()
diff --git a/osm_mon/cmd/mon_healthcheck.py b/osm_mon/cmd/mon_healthcheck.py
deleted file mode 100644 (file)
index 7eae4c2..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import argparse
-import logging
-import subprocess
-import sys
-
-import requests
-
-log = logging.getLogger(__name__)
-
-
-def main():
-    parser = argparse.ArgumentParser(prog="osm-mon-healthcheck")
-    parser.add_argument("--config-file", nargs="?", help="MON configuration file")
-    # args = parser.parse_args()
-    # cfg = Config(args.config_file)
-
-    if not _processes_running():
-        sys.exit(1)
-    if not _is_prometheus_exporter_ok():
-        sys.exit(1)
-    sys.exit(0)
-
-
-def _processes_running():
-    def _contains_process(processes, process_name):
-        for row in processes:
-            if process_name in row:
-                return True
-        return False
-
-    processes_to_check = ["osm-mon-collector", "osm-mon-evaluator", "osm-mon-server"]
-    ps = subprocess.Popen(["ps", "aux"], stdout=subprocess.PIPE).communicate()[0]
-    processes_running = ps.decode().split("\n")
-    for p in processes_to_check:
-        if not _contains_process(processes_running, p):
-            log.error("Process %s not running!" % p)
-            return False
-    return True
-
-
-def _is_prometheus_exporter_ok():
-    try:
-        r = requests.get("http://localhost:8000")
-        r.raise_for_status()
-        return True
-    except Exception:
-        log.exception("MON Prometheus exporter is not running")
-        return False
-
-
-if __name__ == "__main__":
-    main()
diff --git a/osm_mon/cmd/mon_server.py b/osm_mon/cmd/mon_server.py
deleted file mode 100644 (file)
index c4fa08b..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import argparse
-import logging
-import sys
-
-from osm_mon.core.config import Config
-from osm_mon.server.server import Server
-from osm_mon.cmd.mon_utils import wait_till_core_services_are_ready
-
-
-def main():
-    parser = argparse.ArgumentParser(prog="osm-mon-server")
-    parser.add_argument("--config-file", nargs="?", help="MON configuration file")
-    args = parser.parse_args()
-    cfg = Config(args.config_file)
-
-    root = logging.getLogger()
-    root.setLevel(logging.getLevelName(cfg.get("global", "loglevel")))
-    ch = logging.StreamHandler(sys.stdout)
-    ch.setLevel(logging.getLevelName(cfg.get("global", "loglevel")))
-    formatter = logging.Formatter(
-        "%(asctime)s - %(name)s - %(levelname)s - %(message)s", "%m/%d/%Y %I:%M:%S %p"
-    )
-    ch.setFormatter(formatter)
-    root.addHandler(ch)
-
-    log = logging.getLogger(__name__)
-    if wait_till_core_services_are_ready(cfg, "osm-mon-server"):
-        log.info("Starting MON Server...")
-        log.debug("Config: %s", cfg.conf)
-        log.info("Initializing database...")
-        try:
-            server = Server(cfg)
-            server.run()
-        except Exception as e:
-            log.error("Failed to start MON Server")
-            log.exception("Exception: %s", str(e))
-    else:
-        log.error("Failed to start MON Server")
-
-
-if __name__ == "__main__":
-    main()
diff --git a/osm_mon/collector/__init__.py b/osm_mon/collector/__init__.py
deleted file mode 100644 (file)
index d81308a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
diff --git a/osm_mon/collector/backends/__init__.py b/osm_mon/collector/backends/__init__.py
deleted file mode 100644 (file)
index 971f4e9..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
diff --git a/osm_mon/collector/backends/base.py b/osm_mon/collector/backends/base.py
deleted file mode 100644 (file)
index 8cba5e1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-
-
-class BaseBackend:
-    def handle(self, metrics: list):
-        pass
diff --git a/osm_mon/collector/backends/prometheus.py b/osm_mon/collector/backends/prometheus.py
deleted file mode 100644 (file)
index a9bb938..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import logging
-from typing import List
-
-from prometheus_client import start_http_server
-from prometheus_client.core import REGISTRY, GaugeMetricFamily
-
-from osm_mon.collector.backends.base import BaseBackend
-from osm_mon.collector.metric import Metric
-
-log = logging.getLogger(__name__)
-
-OSM_METRIC_PREFIX = "osm_"
-
-
-class PrometheusBackend(BaseBackend):
-    def __init__(self):
-        self.custom_collector = CustomCollector()
-        self._start_exporter(8000)
-
-    def handle(self, metrics: List[Metric]):
-        log.debug("handle")
-        log.debug("metrics: %s", metrics)
-        prometheus_metrics = {}
-        for metric in metrics:
-            if metric.name not in prometheus_metrics:
-                prometheus_metrics[metric.name] = GaugeMetricFamily(
-                    OSM_METRIC_PREFIX + metric.name,
-                    "OSM metric",
-                    labels=list(metric.tags.keys()),
-                )
-            prometheus_metrics[metric.name].add_metric(
-                list(metric.tags.values()), metric.value
-            )
-        self.custom_collector.metrics = prometheus_metrics.values()
-
-    def _start_exporter(self, port):
-        log.debug("_start_exporter")
-        log.debug("port: %s", port)
-        REGISTRY.register(self.custom_collector)
-        log.info("Starting MON Prometheus exporter at port %s", port)
-        start_http_server(port)
-
-
-class CustomCollector(object):
-    def __init__(self):
-        self.metrics = []
-
-    def describe(self):
-        log.debug("describe")
-        return []
-
-    def collect(self):
-        log.debug("collect")
-        return self.metrics
diff --git a/osm_mon/collector/collector.py b/osm_mon/collector/collector.py
deleted file mode 100644 (file)
index a69e651..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import logging
-import time
-
-from osm_mon.collector.backends.prometheus import PrometheusBackend
-from osm_mon.collector.service import CollectorService
-from osm_mon.core.config import Config
-
-log = logging.getLogger(__name__)
-
-METRIC_BACKENDS = [PrometheusBackend]
-
-
-class Collector:
-    def __init__(self, config: Config):
-        self.conf = config
-        self.service = CollectorService(config)
-        self.backends = []
-        self._init_backends()
-
-    def collect_forever(self):
-        log.debug("collect_forever")
-        while True:
-            try:
-                self.collect_metrics()
-                time.sleep(int(self.conf.get("collector", "interval")))
-            except Exception:
-                log.exception("Error collecting metrics")
-
-    def collect_metrics(self):
-        metrics = self.service.collect_metrics()
-        for backend in self.backends:
-            backend.handle(metrics)
-
-    def _init_backends(self):
-        for backend in METRIC_BACKENDS:
-            self.backends.append(backend())
diff --git a/osm_mon/collector/infra_collectors/__init__.py b/osm_mon/collector/infra_collectors/__init__.py
deleted file mode 100644 (file)
index 971f4e9..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
diff --git a/osm_mon/collector/infra_collectors/base.py b/osm_mon/collector/infra_collectors/base.py
deleted file mode 100644 (file)
index 2f97ebc..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-from typing import List
-
-from osm_mon.collector.metric import Metric
-
-
-class BaseInfraCollector:
-    def collect(self) -> List[Metric]:
-        pass
diff --git a/osm_mon/collector/infra_collectors/base_osinfra.py b/osm_mon/collector/infra_collectors/base_osinfra.py
deleted file mode 100644 (file)
index 8ab34e4..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import logging
-from typing import List
-
-from keystoneclient.v3 import client as keystone_client
-from novaclient import client as nova_client
-from cinderclient import client as cinder_client
-from neutronclient.neutron import client as neutron_client
-
-from osm_mon.collector.infra_collectors.base_vim import BaseVimInfraCollector
-from osm_mon.collector.metric import Metric
-from osm_mon.collector.utils.openstack import OpenstackUtils
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-
-log = logging.getLogger(__name__)
-
-
-class BaseOpenStackInfraCollector(BaseVimInfraCollector):
-    def __init__(self, config: Config, vim_account_id: str):
-        super().__init__(config, vim_account_id)
-        self.conf = config
-        self.common_db = CommonDbClient(config)
-        self.vim_account = self.common_db.get_vim_account(vim_account_id)
-        # self.keystone = self._build_keystone_client(self.vim_account)
-        self.vim_session = None
-        self.nova = self._build_nova_client(self.vim_account)
-        self.cinder = self._build_cinder_client(self.vim_account)
-        self.neutron, self.tenant_id = self._build_neutron_client(self.vim_account)
-
-    def collect(self) -> List[Metric]:
-        metrics = []
-        vim_status = self.is_vim_ok()
-        if vim_status:
-            # Updating the resources in mongoDB
-            self.update_resources()
-        if self.vim_account["_admin"]["projects_read"]:
-            vim_project_id = self.vim_account["_admin"]["projects_read"][0]
-        else:
-            vim_project_id = ""
-        vim_tags = {
-            "vim_account_id": self.vim_account["_id"],
-            "project_id": vim_project_id,
-        }
-        vim_status_metric = Metric(vim_tags, "vim_status", vim_status)
-        metrics.append(vim_status_metric)
-        vnfrs = self.common_db.get_vnfrs(vim_account_id=self.vim_account["_id"])
-        if self.conf.get("collector", "vm_infra_metrics"):
-            vm_infra_metrics_enabled = str(
-                self.conf.get("collector", "vm_infra_metrics")
-            ).lower() in ("yes", "true", "1")
-        else:
-            vm_infra_metrics_enabled = True
-        if vm_infra_metrics_enabled:
-            for vnfr in vnfrs:
-                nsr_id = vnfr["nsr-id-ref"]
-                ns_name = self.common_db.get_nsr(nsr_id)["name"]
-                vnf_member_index = vnfr["member-vnf-index-ref"]
-                if vnfr["_admin"]["projects_read"]:
-                    vnfr_project_id = vnfr["_admin"]["projects_read"][0]
-                else:
-                    vnfr_project_id = ""
-                for vdur in vnfr["vdur"]:
-                    if "vim-id" not in vdur:
-                        log.debug("Field vim-id is not present in vdur")
-                        continue
-                    resource_uuid = vdur["vim-id"]
-                    tags = {
-                        "vim_account_id": self.vim_account["_id"],
-                        "resource_uuid": resource_uuid,
-                        "ns_id": nsr_id,
-                        "ns_name": ns_name,
-                        "vnf_member_index": vnf_member_index,
-                        "vdu_name": vdur.get("name", ""),
-                        "project_id": vnfr_project_id,
-                    }
-                    try:
-                        vm = self.nova.servers.get(resource_uuid)
-                        vm_status = 0 if (vm.status == "ERROR") else 1
-                        vm_status_metric = Metric(tags, "vm_status", vm_status)
-                    except Exception as e:
-                        log.warning("VM status is not OK: %s" % e)
-                        vm_status_metric = Metric(tags, "vm_status", 0)
-                    metrics.append(vm_status_metric)
-
-        return metrics
-
-    def is_vim_ok(self) -> bool:
-        try:
-            self.nova.servers.list()
-            return True
-        except Exception as e:
-            log.warning("VIM status is not OK: %s" % e)
-            return False
-
-    def update_resources(self):
-        if "resources" in self.vim_account:
-            vimacc_resources = self.vim_account["resources"]
-            # Compute resources
-            try:
-                com_lim = self.nova.limits.get()._info["absolute"]
-                if ("compute" in vimacc_resources) and (
-                    (
-                        vimacc_resources["compute"]["ram"]["total"]
-                        != com_lim["maxTotalRAMSize"]
-                    )
-                    or (
-                        vimacc_resources["compute"]["vcpus"]["total"]
-                        != com_lim["maxTotalCores"]
-                    )
-                    or (
-                        vimacc_resources["compute"]["ram"]["used"]
-                        != com_lim["totalRAMUsed"]
-                    )
-                    or (
-                        vimacc_resources["compute"]["vcpus"]["used"]
-                        != com_lim["totalCoresUsed"]
-                    )
-                    or (
-                        vimacc_resources["compute"]["instances"]["total"]
-                        != com_lim["maxTotalInstances"]
-                    )
-                    or (
-                        vimacc_resources["compute"]["instances"]["used"]
-                        != com_lim["totalInstancesUsed"]
-                    )
-                ):
-                    update_dict = {
-                        "resources.compute": {
-                            "ram": {
-                                "total": com_lim["maxTotalRAMSize"],
-                                "used": com_lim["totalRAMUsed"],
-                            },
-                            "vcpus": {
-                                "total": com_lim["maxTotalCores"],
-                                "used": com_lim["totalCoresUsed"],
-                            },
-                            "instances": {
-                                "total": com_lim["maxTotalInstances"],
-                                "used": com_lim["totalInstancesUsed"],
-                            },
-                        }
-                    }
-                    suc_value = self.common_db.set_vim_account(
-                        str(self.vim_account["_id"]), update_dict
-                    )
-                    log.info("Compute resources update in mongoDB  = %s" % suc_value)
-            except Exception as e:
-                log.warning("Error in updating compute resources: %s" % e)
-
-            # Volume resources
-            try:
-                vol_lim = self.cinder.limits.get()._info["absolute"]
-                if ("storage" in vimacc_resources) and (
-                    (
-                        vimacc_resources["storage"]["volumes"]["total"]
-                        != vol_lim["maxTotalVolumes"]
-                    )
-                    or (
-                        vimacc_resources["storage"]["snapshots"]["total"]
-                        != vol_lim["maxTotalSnapshots"]
-                    )
-                    or (
-                        vimacc_resources["storage"]["volumes"]["used"]
-                        != vol_lim["totalVolumesUsed"]
-                    )
-                    or (
-                        vimacc_resources["storage"]["snapshots"]["used"]
-                        != vol_lim["totalSnapshotsUsed"]
-                    )
-                    or (
-                        vimacc_resources["storage"]["storage"]["total"]
-                        != vol_lim["maxTotalVolumeGigabytes"]
-                    )
-                    or (
-                        vimacc_resources["storage"]["storage"]["used"]
-                        != vol_lim["totalGigabytesUsed"]
-                    )
-                ):
-                    update_dict = {
-                        "resources.storage": {
-                            "volumes": {
-                                "total": vol_lim["maxTotalVolumes"],
-                                "used": vol_lim["totalVolumesUsed"],
-                            },
-                            "snapshots": {
-                                "total": vol_lim["maxTotalSnapshots"],
-                                "used": vol_lim["totalSnapshotsUsed"],
-                            },
-                            "storage": {
-                                "total": vol_lim["maxTotalVolumeGigabytes"],
-                                "used": vol_lim["totalGigabytesUsed"],
-                            },
-                        }
-                    }
-                    suc_value = self.common_db.set_vim_account(
-                        str(self.vim_account["_id"]), update_dict
-                    )
-                    log.info("Volume resources update in mongoDB = %s" % suc_value)
-            except Exception as e:
-                log.warning("Error in updating volume resources: %s" % e)
-
-            # Network resources
-            try:
-                net_lim = self.neutron.show_quota_details(self.tenant_id)["quota"]
-                if ("network" in vimacc_resources) and (
-                    (
-                        vimacc_resources["network"]["networks"]["total"]
-                        != net_lim["network"]["limit"]
-                    )
-                    or (
-                        vimacc_resources["network"]["networks"]["used"]
-                        != net_lim["network"]["used"]
-                    )
-                    or (
-                        vimacc_resources["network"]["subnets"]["total"]
-                        != net_lim["subnet"]["limit"]
-                    )
-                    or (
-                        vimacc_resources["network"]["subnets"]["used"]
-                        != net_lim["subnet"]["used"]
-                    )
-                    or (
-                        vimacc_resources["network"]["floating_ips"]["total"]
-                        != net_lim["floatingip"]["limit"]
-                    )
-                    or (
-                        vimacc_resources["network"]["floating_ips"]["used"]
-                        != net_lim["floatingip"]["used"]
-                    )
-                ):
-                    update_dict = {
-                        "resources.network": {
-                            "networks": {
-                                "total": net_lim["network"]["limit"],
-                                "used": net_lim["network"]["used"],
-                            },
-                            "subnets": {
-                                "total": net_lim["subnet"]["limit"],
-                                "used": net_lim["subnet"]["used"],
-                            },
-                            "floating_ips": {
-                                "total": net_lim["floatingip"]["limit"],
-                                "used": net_lim["floatingip"]["used"],
-                            },
-                        }
-                    }
-                    suc_value = self.common_db.set_vim_account(
-                        str(self.vim_account["_id"]), update_dict
-                    )
-                    log.info("Network resources update in mongoDB = %s" % suc_value)
-            except Exception as e:
-                log.warning("Error in updating network resources: %s" % e)
-
-    def _build_keystone_client(self, vim_account: dict) -> keystone_client.Client:
-        sess = OpenstackUtils.get_session(vim_account)
-        return keystone_client.Client(session=sess, timeout=10)
-
-    def _build_nova_client(self, vim_account: dict) -> nova_client.Client:
-        sess = OpenstackUtils.get_session(vim_account)
-        self.vim_session = sess
-        return nova_client.Client("2", session=sess, timeout=10)
-
-    def _build_cinder_client(self, vim_account: dict) -> cinder_client.Client:
-        # sess = OpenstackUtils.get_session(vim_account)
-        return cinder_client.Client("3", session=self.vim_session, timeout=10)
-
-    def _build_neutron_client(self, vim_account: dict) -> tuple:
-        # sess = OpenstackUtils.get_session(vim_account)
-        tenant_id = self.vim_session.get_project_id()
-        return (
-            neutron_client.Client("2", session=self.vim_session, timeout=10),
-            tenant_id,
-        )
diff --git a/osm_mon/collector/infra_collectors/base_sdnc.py b/osm_mon/collector/infra_collectors/base_sdnc.py
deleted file mode 100644 (file)
index e46f984..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-from osm_mon.collector.infra_collectors.base import BaseInfraCollector
-
-from osm_mon.core.config import Config
-
-
-class BaseSdncInfraCollector(BaseInfraCollector):
-    def __init__(self, config: Config, sdn_id: str):
-        pass
diff --git a/osm_mon/collector/infra_collectors/base_vim.py b/osm_mon/collector/infra_collectors/base_vim.py
deleted file mode 100644 (file)
index 698dde4..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-from osm_mon.collector.infra_collectors.base import BaseInfraCollector
-
-from osm_mon.core.config import Config
-
-
-class BaseVimInfraCollector(BaseInfraCollector):
-    def __init__(self, config: Config, vim_account_id: str):
-        pass
diff --git a/osm_mon/collector/infra_collectors/onos.py b/osm_mon/collector/infra_collectors/onos.py
deleted file mode 100644 (file)
index 1798f8b..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import logging
-from typing import List
-
-import requests
-from requests.auth import HTTPBasicAuth
-
-from osm_mon.collector.infra_collectors.base_sdnc import BaseSdncInfraCollector
-from osm_mon.collector.metric import Metric
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-
-log = logging.getLogger(__name__)
-
-
-class OnosInfraCollector(BaseSdncInfraCollector):
-    def __init__(self, config: Config, sdnc_id: str):
-        super().__init__(config, sdnc_id)
-        self.common_db = CommonDbClient(config)
-        self.sdnc = self.common_db.get_sdnc(sdnc_id)
-
-    def _obtain_url(self, sdnc_dict):
-        url = sdnc_dict.get("url")
-        if url:
-            return url
-        else:
-            if not sdnc_dict.get("ip") or not sdnc_dict.get("port"):
-                raise Exception("You must provide a URL to contact the SDN Controller")
-            else:
-                return "http://{}:{}/onos/v1/devices".format(
-                    sdnc_dict["ip"], sdnc_dict["port"]
-                )
-
-    def collect(self) -> List[Metric]:
-        metrics = []
-        sdnc_status = self.is_sdnc_ok()
-        if self.sdnc["_admin"]["projects_read"]:
-            sdnc_project_id = self.sdnc["_admin"]["projects_read"][0]
-        else:
-            sdnc_project_id = ""
-        sdnc_tags = {"sdnc_id": self.sdnc["_id"], "project_id": sdnc_project_id}
-        sdnc_status_metric = Metric(sdnc_tags, "sdnc_status", sdnc_status)
-        metrics.append(sdnc_status_metric)
-
-        return metrics
-
-    def is_sdnc_ok(self) -> bool:
-        try:
-            url = self._obtain_url(self.sdnc)
-            user = self.sdnc["user"]
-            password = self.common_db.decrypt_sdnc_password(
-                self.sdnc["password"], self.sdnc["schema_version"], self.sdnc["_id"]
-            )
-
-            requests.get(url, auth=HTTPBasicAuth(user, password))
-            return True
-        except Exception:
-            log.exception("SDNC status is not OK!")
-            return False
diff --git a/osm_mon/collector/infra_collectors/openstack.py b/osm_mon/collector/infra_collectors/openstack.py
deleted file mode 100644 (file)
index 577bf06..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-
-from osm_mon.collector.infra_collectors.base_osinfra import BaseOpenStackInfraCollector
-
-from osm_mon.core.config import Config
-
-
-class OpenstackInfraCollector(BaseOpenStackInfraCollector):
-    def __init__(self, config: Config, vim_account_id: str):
-        super(OpenstackInfraCollector, self).__init__(config, vim_account_id)
diff --git a/osm_mon/collector/infra_collectors/vio.py b/osm_mon/collector/infra_collectors/vio.py
deleted file mode 100644 (file)
index d8d8fcc..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##
-# Copyright 2016-2017 VMware Inc.
-# This file is part of ETSI OSM
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact:  osslegalrouting@vmware.com
-##
-
-from osm_mon.collector.infra_collectors.base_osinfra import BaseOpenStackInfraCollector
-
-from osm_mon.core.config import Config
-
-
-class VIOInfraCollector(BaseOpenStackInfraCollector):
-    def __init__(self, config: Config, vim_account_id: str):
-        super(VIOInfraCollector, self).__init__(config, vim_account_id)
diff --git a/osm_mon/collector/infra_collectors/vmware.py b/osm_mon/collector/infra_collectors/vmware.py
deleted file mode 100644 (file)
index 8f39464..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##
-# Copyright 2016-2019 VMware Inc.
-# This file is part of ETSI OSM
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact:  osslegalrouting@vmware.com
-##
-
-# pylint: disable=E1101
-
-import logging
-from typing import List
-from lxml import etree as XmlElementTree
-
-import requests
-from pyvcloud.vcd.client import BasicLoginCredentials
-from pyvcloud.vcd.client import Client
-
-from osm_mon.collector.infra_collectors.base_vim import BaseVimInfraCollector
-from osm_mon.collector.metric import Metric
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-
-log = logging.getLogger(__name__)
-API_VERSION = "27.0"
-
-
-class VMwareInfraCollector(BaseVimInfraCollector):
-    def __init__(self, config: Config, vim_account_id: str):
-        super().__init__(config, vim_account_id)
-        self.vim_account_id = vim_account_id
-        self.common_db = CommonDbClient(config)
-        vim_account = self.get_vim_account(vim_account_id)
-        self.vcloud_site = vim_account["vim_url"]
-        self.admin_username = vim_account["admin_username"]
-        self.admin_password = vim_account["admin_password"]
-        self.vim_uuid = vim_account["vim_uuid"]
-        self.org_name = vim_account["orgname"]
-        self.vim_project_id = vim_account["project_id"]
-        self.verify_ssl = vim_account.get("insecure", False)
-
-    def connect_vim_as_admin(self):
-        """Method connect as pvdc admin user to vCloud director.
-        There are certain action that can be done only by provider vdc admin user.
-        Organization creation / provider network creation etc.
-
-        Returns:
-            The return client object that letter can be used to connect to vcloud direct as admin for provider vdc
-        """
-
-        log.info("Logging into vCD org as admin.")
-
-        admin_user = None
-        try:
-            host = self.vcloud_site
-            admin_user = self.admin_username
-            admin_passwd = self.admin_password
-            org = "System"
-            client = Client(host, verify_ssl_certs=self.verify_ssl)
-            client.set_highest_supported_version()
-            client.set_credentials(BasicLoginCredentials(admin_user, org, admin_passwd))
-            return client
-
-        except Exception as e:
-            log.info(
-                "Can't connect to a vCloud director as: {} with exception {}".format(
-                    admin_user, e
-                )
-            )
-
-    def get_vim_account(self, vim_account_id: str):
-        """
-        Method to get VIM account details by its ID
-        arg - VIM ID
-        return - dict with vim account details
-        """
-        vim_account = {}
-        vim_account_info = self.common_db.get_vim_account(vim_account_id)
-
-        vim_account["name"] = vim_account_info["name"]
-        vim_account["vim_tenant_name"] = vim_account_info["vim_tenant_name"]
-        vim_account["vim_type"] = vim_account_info["vim_type"]
-        vim_account["vim_url"] = vim_account_info["vim_url"]
-        vim_account["org_user"] = vim_account_info["vim_user"]
-        vim_account["vim_uuid"] = vim_account_info["_id"]
-        if vim_account_info["_admin"]["projects_read"]:
-            vim_account["project_id"] = vim_account_info["_admin"]["projects_read"][0]
-        else:
-            vim_account["project_id"] = ""
-
-        vim_config = vim_account_info["config"]
-        vim_account["admin_username"] = vim_config["admin_username"]
-        vim_account["admin_password"] = vim_config["admin_password"]
-
-        if vim_config["orgname"] is not None:
-            vim_account["orgname"] = vim_config["orgname"]
-
-        return vim_account
-
-    def check_vim_status(self):
-        try:
-            client = self.connect_vim_as_admin()
-            if client._session:
-                org_list = client.get_org_list()
-                org_uuid = ""
-                for org in org_list.Org:
-                    if org.get("name") == self.org_name:
-                        org_uuid = org.get("href").split("/")[-1]
-
-                url = "{}/api/org/{}".format(self.vcloud_site, org_uuid)
-
-                headers = {
-                    "Accept": "application/*+xml;version=" + API_VERSION,
-                    "x-vcloud-authorization": client._session.headers[
-                        "x-vcloud-authorization"
-                    ],
-                }
-
-                response = requests.get(
-                    url=url, headers=headers, verify=self.verify_ssl
-                )
-
-                if (
-                    response.status_code != requests.codes.ok
-                ):  # pylint: disable=no-member
-                    log.info("check_vim_status(): failed to get org details")
-                else:
-                    org_details = XmlElementTree.fromstring(response.content)
-                    vdc_list = {}
-                    for child in org_details:
-                        if "type" in child.attrib:
-                            if (
-                                child.attrib["type"]
-                                == "application/vnd.vmware.vcloud.vdc+xml"
-                            ):
-                                vdc_list[
-                                    child.attrib["href"].split("/")[-1:][0]
-                                ] = child.attrib["name"]
-
-                if vdc_list:
-                    return True
-                else:
-                    return False
-        except Exception as e:
-            log.info("Exception occured while checking vim status {}".format(str(e)))
-
-    def check_vm_status(self, vapp_id):
-        try:
-            client = self.connect_vim_as_admin()
-            if client._session:
-                url = "{}/api/vApp/vapp-{}".format(self.vcloud_site, vapp_id)
-
-                headers = {
-                    "Accept": "application/*+xml;version=" + API_VERSION,
-                    "x-vcloud-authorization": client._session.headers[
-                        "x-vcloud-authorization"
-                    ],
-                }
-
-                response = requests.get(
-                    url=url, headers=headers, verify=self.verify_ssl
-                )
-
-                if (
-                    response.status_code != requests.codes.ok
-                ):  # pylint: disable=no-member
-                    log.info("check_vm_status(): failed to get vApp details")
-                else:
-                    vapp_details = XmlElementTree.fromstring(response.content)
-                    vm_list = []
-                    for child in vapp_details:
-                        if child.tag.split("}")[1] == "Children":
-                            for item in child.getchildren():
-                                vm_list.append(item.attrib)
-                return vm_list
-        except Exception as e:
-            log.info("Exception occured while checking vim status {}".format(str(e)))
-
-    def collect(self) -> List[Metric]:
-        metrics = []
-        vim_status = self.check_vim_status()
-        vim_account_id = self.vim_account_id
-        vim_project_id = self.vim_project_id
-        vim_tags = {"vim_account_id": vim_account_id, "project_id": vim_project_id}
-        vim_status_metric = Metric(vim_tags, "vim_status", vim_status)
-        metrics.append(vim_status_metric)
-        vnfrs = self.common_db.get_vnfrs(vim_account_id=vim_account_id)
-        if self.conf.get("collector", "vm_infra_metrics"):
-            vm_infra_metrics_enabled = str(
-                self.conf.get("collector", "vm_infra_metrics")
-            ).lower() in ("yes", "true", "1")
-        else:
-            vm_infra_metrics_enabled = True
-        if vm_infra_metrics_enabled:
-            for vnfr in vnfrs:
-                nsr_id = vnfr["nsr-id-ref"]
-                ns_name = self.common_db.get_nsr(nsr_id)["name"]
-                vnf_member_index = vnfr["member-vnf-index-ref"]
-                if vnfr["_admin"]["projects_read"]:
-                    vnfr_project_id = vnfr["_admin"]["projects_read"][0]
-                else:
-                    vnfr_project_id = ""
-                for vdur in vnfr["vdur"]:
-                    resource_uuid = vdur["vim-id"]
-                    tags = {
-                        "vim_account_id": self.vim_account_id,
-                        "resource_uuid": resource_uuid,
-                        "nsr_id": nsr_id,
-                        "ns_name": ns_name,
-                        "vnf_member_index": vnf_member_index,
-                        "vdur_name": vdur["name"],
-                        "project_id": vnfr_project_id,
-                    }
-                    try:
-                        vm_list = self.check_vm_status(resource_uuid)
-                        for vm in vm_list:
-                            if vm["status"] == "4" and vm["deployed"] == "true":
-                                vm_status = 1
-                            else:
-                                vm_status = 0
-                            vm_status_metric = Metric(tags, "vm_status", vm_status)
-                    except Exception:
-                        log.exception("VM status is not OK!")
-                        vm_status_metric = Metric(tags, "vm_status", 0)
-                    metrics.append(vm_status_metric)
-        return metrics
diff --git a/osm_mon/collector/metric.py b/osm_mon/collector/metric.py
deleted file mode 100644 (file)
index 741096f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-
-
-class Metric:
-    def __init__(self, tags: dict, name: str, value):
-        self.tags = tags
-        self.name = name
-        self.value = value
diff --git a/osm_mon/collector/service.py b/osm_mon/collector/service.py
deleted file mode 100644 (file)
index 5215e9b..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-
-# This version uses a ProcessThreadPoolExecutor to limit the number of processes launched
-
-import logging
-from typing import List
-import concurrent.futures
-import time
-import keystoneauth1.exceptions
-
-from osm_mon.collector.infra_collectors.onos import OnosInfraCollector
-from osm_mon.collector.infra_collectors.openstack import OpenstackInfraCollector
-from osm_mon.collector.infra_collectors.vio import VIOInfraCollector
-from osm_mon.collector.infra_collectors.vmware import VMwareInfraCollector
-from osm_mon.collector.metric import Metric
-from osm_mon.collector.vnf_collectors.juju import VCACollector
-from osm_mon.collector.vnf_collectors.openstack import OpenstackCollector
-from osm_mon.collector.vnf_collectors.vio import VIOCollector
-from osm_mon.collector.vnf_collectors.vmware import VMwareCollector
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-
-log = logging.getLogger(__name__)
-
-VIM_COLLECTORS = {
-    "openstack": OpenstackCollector,
-    "vmware": VMwareCollector,
-    "vio": VIOCollector,
-}
-VIM_INFRA_COLLECTORS = {
-    "openstack": OpenstackInfraCollector,
-    "vmware": VMwareInfraCollector,
-    "vio": VIOInfraCollector,
-}
-SDN_INFRA_COLLECTORS = {"onosof": OnosInfraCollector, "onos_vpls": OnosInfraCollector}
-
-# Map to store vim ids and corresponding vim session objects
-vim_sess_map = {}
-
-
-# Invoked from process executor to initialize the vim session map
-def init_session(session_map: dict):
-    global vim_sess_map
-    vim_sess_map = session_map
-
-
-class CollectorService:
-    def __init__(self, config: Config):
-        self.conf = config
-        self.common_db = CommonDbClient(self.conf)
-        return
-
-    # static methods to be executed in the Processes
-    @staticmethod
-    def _get_vim_type(conf: Config, vim_account_id: str) -> str:
-        common_db = CommonDbClient(conf)
-        vim_account = common_db.get_vim_account(vim_account_id)
-        vim_type = vim_account["vim_type"]
-        if "config" in vim_account and "vim_type" in vim_account["config"]:
-            vim_type = vim_account["config"]["vim_type"].lower()
-            if vim_type == "vio" and "vrops_site" not in vim_account["config"]:
-                vim_type = "openstack"
-        return vim_type
-
-    @staticmethod
-    def _collect_vim_metrics(conf: Config, vnfr: dict, vim_account_id: str):
-        # TODO(diazb) Add support for aws
-        metrics = []
-        vim_type = CollectorService._get_vim_type(conf, vim_account_id)
-        log.debug("vim type.....{}".format(vim_type))
-        if vim_type in VIM_COLLECTORS:
-            collector = VIM_COLLECTORS[vim_type](
-                conf, vim_account_id, vim_sess_map[vim_account_id]
-            )
-            metrics = collector.collect(vnfr)
-            log.debug("Collecting vim metrics.....{}".format(metrics))
-        else:
-            log.debug("vimtype %s is not supported.", vim_type)
-        return metrics
-
-    @staticmethod
-    def _collect_vca_metrics(conf: Config, vnfr: dict):
-        metrics = []
-        vca_collector = VCACollector(conf)
-        metrics = vca_collector.collect(vnfr)
-        log.debug("Collecting vca metrics.....{}".format(metrics))
-        return metrics
-
-    @staticmethod
-    def _collect_vim_infra_metrics(conf: Config, vim_account_id: str):
-        log.info("Collecting vim infra metrics")
-        metrics = []
-        vim_type = CollectorService._get_vim_type(conf, vim_account_id)
-        if vim_type in VIM_INFRA_COLLECTORS:
-            collector = VIM_INFRA_COLLECTORS[vim_type](conf, vim_account_id)
-            metrics = collector.collect()
-            log.debug("Collecting vim infra metrics.....{}".format(metrics))
-        else:
-            log.debug("vimtype %s is not supported.", vim_type)
-        return metrics
-
-    @staticmethod
-    def _collect_sdnc_infra_metrics(conf: Config, sdnc_id: str):
-        log.info("Collecting sdnc metrics")
-        metrics = []
-        common_db = CommonDbClient(conf)
-        sdn_type = common_db.get_sdnc(sdnc_id)["type"]
-        if sdn_type in SDN_INFRA_COLLECTORS:
-            collector = SDN_INFRA_COLLECTORS[sdn_type](conf, sdnc_id)
-            metrics = collector.collect()
-            log.debug("Collecting sdnc metrics.....{}".format(metrics))
-        else:
-            log.debug("sdn_type %s is not supported.", sdn_type)
-        return metrics
-
-    @staticmethod
-    def _stop_process_pool(executor):
-        log.info("Shutting down process pool")
-        try:
-            log.debug("Stopping residual processes in the process pool")
-            for pid, process in executor._processes.items():
-                if process.is_alive():
-                    process.terminate()
-        except Exception as e:
-            log.info("Exception during process termination")
-            log.debug("Exception %s" % (e))
-
-        try:
-            # Shutting down executor
-            log.debug("Shutting down process pool executor")
-            executor.shutdown()
-        except RuntimeError as e:
-            log.info("RuntimeError in shutting down executer")
-            log.debug("RuntimeError %s" % (e))
-        return
-
-    def collect_metrics(self) -> List[Metric]:
-        vnfrs = self.common_db.get_vnfrs()
-        metrics = []
-
-        # Get all vim ids regiestered in osm and create their corresponding vim session objects
-        # Vim ids and their corresponding session objects are stored in vim-session-map
-        # It optimizes the number of authentication tokens created in vim for metric colleciton
-        vim_sess_map.clear()
-        vims = self.common_db.get_vim_accounts()
-        for vim in vims:
-            vim_type = CollectorService._get_vim_type(self.conf, vim["_id"])
-            if vim_type in VIM_INFRA_COLLECTORS:
-                collector = VIM_INFRA_COLLECTORS[vim_type](self.conf, vim["_id"])
-                vim_sess = collector.vim_session if vim_type == "openstack" else None
-                # Populate the vim session map with vim ids and corresponding session objects
-                # vim session objects are stopred only for vim type openstack
-                if vim_sess:
-                    vim_sess_map[vim["_id"]] = vim_sess
-
-        start_time = time.time()
-        # Starting executor pool with pool size process_pool_size. Default process_pool_size is 20
-        # init_session is called to assign the session map to the gloabal vim session map variable
-        with concurrent.futures.ProcessPoolExecutor(
-            self.conf.get("collector", "process_pool_size"),
-            initializer=init_session,
-            initargs=(vim_sess_map,),
-        ) as executor:
-            log.info(
-                "Started metric collector process pool with pool size %s"
-                % (self.conf.get("collector", "process_pool_size"))
-            )
-            futures = []
-            for vnfr in vnfrs:
-                nsr_id = vnfr["nsr-id-ref"]
-                vnf_member_index = vnfr["member-vnf-index-ref"]
-                vim_account_id = self.common_db.get_vim_account_id(
-                    nsr_id, vnf_member_index
-                )
-                futures.append(
-                    executor.submit(
-                        CollectorService._collect_vim_metrics,
-                        self.conf,
-                        vnfr,
-                        vim_account_id,
-                    )
-                )
-                futures.append(
-                    executor.submit(
-                        CollectorService._collect_vca_metrics, self.conf, vnfr
-                    )
-                )
-
-            for vim in vims:
-                futures.append(
-                    executor.submit(
-                        CollectorService._collect_vim_infra_metrics,
-                        self.conf,
-                        vim["_id"],
-                    )
-                )
-
-            sdncs = self.common_db.get_sdncs()
-            for sdnc in sdncs:
-                futures.append(
-                    executor.submit(
-                        CollectorService._collect_sdnc_infra_metrics,
-                        self.conf,
-                        sdnc["_id"],
-                    )
-                )
-
-            try:
-                # Wait for future calls to complete till process_execution_timeout. Default is 50 seconds
-                for future in concurrent.futures.as_completed(
-                    futures, self.conf.get("collector", "process_execution_timeout")
-                ):
-                    try:
-                        result = future.result(
-                            timeout=int(
-                                self.conf.get("collector", "process_execution_timeout")
-                            )
-                        )
-                        metrics.extend(result)
-                        log.debug("result = %s" % (result))
-                    except keystoneauth1.exceptions.connection.ConnectionError as e:
-                        log.info("Keystone connection error during metric collection")
-                        log.debug("Keystone connection error exception %s" % (e))
-            except concurrent.futures.TimeoutError as e:
-                # Some processes have not completed due to timeout error
-                log.info(
-                    "Some processes have not finished due to TimeoutError exception"
-                )
-                log.debug("concurrent.futures.TimeoutError exception %s" % (e))
-
-            # Shutting down process pool executor
-            CollectorService._stop_process_pool(executor)
-
-        end_time = time.time()
-        log.info("Collection completed in %s seconds", end_time - start_time)
-
-        return metrics
diff --git a/osm_mon/collector/utils/__init__.py b/osm_mon/collector/utils/__init__.py
deleted file mode 100644 (file)
index cbff444..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2019 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
diff --git a/osm_mon/collector/utils/openstack.py b/osm_mon/collector/utils/openstack.py
deleted file mode 100644 (file)
index 89b13d1..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2019 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import logging
-from os import makedirs, path
-
-from keystoneauth1 import session
-from keystoneauth1.identity import v3
-
-from osm_mon.core.exceptions import CertificateNotCreated
-
-log = logging.getLogger(__name__)
-
-
-class OpenstackUtils:
-    @staticmethod
-    def get_session(creds: dict):
-        verify_ssl = True
-        project_domain_name = "Default"
-        user_domain_name = "Default"
-        try:
-            if "config" in creds:
-                vim_config = creds["config"]
-                if "insecure" in vim_config and vim_config["insecure"]:
-                    verify_ssl = False
-                if "ca_cert" in vim_config:
-                    verify_ssl = vim_config["ca_cert"]
-                elif "ca_cert_content" in vim_config:
-                    vim_config = OpenstackUtils._create_file_cert(
-                        vim_config, creds["_id"]
-                    )
-                    verify_ssl = vim_config["ca_cert"]
-                if "project_domain_name" in vim_config:
-                    project_domain_name = vim_config["project_domain_name"]
-                if "user_domain_name" in vim_config:
-                    user_domain_name = vim_config["user_domain_name"]
-            auth = v3.Password(
-                auth_url=creds["vim_url"],
-                username=creds["vim_user"],
-                password=creds["vim_password"],
-                project_name=creds["vim_tenant_name"],
-                project_domain_name=project_domain_name,
-                user_domain_name=user_domain_name,
-            )
-            return session.Session(auth=auth, verify=verify_ssl, timeout=10)
-        except CertificateNotCreated as e:
-            log.error(e)
-
-    @staticmethod
-    def _create_file_cert(vim_config: dict, target_id: str) -> dict:
-        """
-        Process vim config, creating vim configuration files as ca_cert
-        Creates a folder '/app/osm_mon/certs/{target_id}' and the ca_cert inside
-        :param target_id: vim-id
-        :param db_vim: Vim dictionary obtained from database
-        :return: Modified vim configuration dictionary.
-        """
-
-        work_dir = f"/app/osm_mon/certs/{target_id}"
-        file_name = ""
-
-        try:
-            if vim_config.get("ca_cert_content"):
-                if not path.isdir(work_dir):
-                    makedirs(work_dir)
-
-                file_name = f"{work_dir}/ca_cert"
-                with open(file_name, "w") as f:
-                    f.write(vim_config["ca_cert_content"])
-                    del vim_config["ca_cert_content"]
-                    vim_config["ca_cert"] = file_name
-                return vim_config
-        except Exception as e:
-            if file_name:
-                raise CertificateNotCreated(f"Error writing to file '{file_name}': {e}")
-            else:
-                raise CertificateNotCreated(
-                    f"Error creating the directory '{work_dir}': {e}"
-                )
diff --git a/osm_mon/collector/vnf_collectors/__init__.py b/osm_mon/collector/vnf_collectors/__init__.py
deleted file mode 100644 (file)
index 971f4e9..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
diff --git a/osm_mon/collector/vnf_collectors/base.py b/osm_mon/collector/vnf_collectors/base.py
deleted file mode 100644 (file)
index 0ec12b5..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-from typing import List
-
-from osm_mon.collector.metric import Metric
-from osm_mon.core.config import Config
-
-
-class BaseCollector:
-    def __init__(self, config: Config):
-        pass
-
-    def collect(self, vnfr: dict) -> List[Metric]:
-        pass
diff --git a/osm_mon/collector/vnf_collectors/base_vim.py b/osm_mon/collector/vnf_collectors/base_vim.py
deleted file mode 100644 (file)
index 6c270f4..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-
-from osm_mon.collector.vnf_collectors.base import BaseCollector
-from osm_mon.core.config import Config
-
-
-class BaseVimCollector(BaseCollector):
-    def __init__(self, config: Config, vim_account_id: str):
-        super().__init__(config)
diff --git a/osm_mon/collector/vnf_collectors/juju.py b/osm_mon/collector/vnf_collectors/juju.py
deleted file mode 100644 (file)
index fbc6bc2..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import asyncio
-import logging
-from typing import List
-
-from n2vc.n2vc_juju_conn import N2VCJujuConnector
-
-from osm_mon.collector.metric import Metric
-from osm_mon.collector.vnf_collectors.base import BaseCollector
-from osm_mon.collector.vnf_metric import VnfMetric
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-from osm_mon.core.exceptions import VcaDeploymentInfoNotFound
-
-log = logging.getLogger(__name__)
-
-
-class VCACollector(BaseCollector):
-    def __init__(self, config: Config):
-        super().__init__(config)
-        self.common_db = CommonDbClient(config)
-        # host = config.get("vca", "host")
-        # port = config.get("vca", "port") if "port" in config.conf["vca"] else 17070
-
-        # Backwards compatibility
-        if "cacert" in config.conf["vca"]:
-            ca_cert = config.conf["vca"].pop("cacert")
-            config.set("vca", "ca_cert", ca_cert)
-
-        if "pubkey" in config.conf["vca"]:
-            public_key = config.conf["vca"].pop("pubkey")
-            config.set("vca", "public_key", public_key)
-
-        if "apiproxy" in config.conf["vca"]:
-            api_proxy = config.conf["vca"].pop("apiproxy")
-            config.set("vca", "api_proxy", api_proxy)
-
-        self.n2vc = N2VCJujuConnector(
-            db=self.common_db.common_db,
-            fs=object(),
-            log=log,
-            on_update_db=None,
-        )
-
-    def collect(self, vnfr: dict) -> List[Metric]:
-        nsr_id = vnfr["nsr-id-ref"]
-        vnf_member_index = vnfr["member-vnf-index-ref"]
-        vnfd = self.common_db.get_vnfd(vnfr["vnfd-id"])
-
-        # Populate extra tags for metrics
-        tags = {}
-        tags["ns_name"] = self.common_db.get_nsr(nsr_id)["name"]
-        if vnfr["_admin"]["projects_read"]:
-            tags["project_id"] = vnfr["_admin"]["projects_read"][0]
-        else:
-            tags["project_id"] = ""
-
-        metrics = []
-        vdur = None
-        lcm_ops = vnfd["df"][0].get("lcm-operations-configuration")
-        if not lcm_ops:
-            return metrics
-        ops_config = lcm_ops.get("operate-vnf-op-config")
-        if not ops_config:
-            return metrics
-        day12ops = ops_config.get("day1-2", [])
-        for day12op in day12ops:
-            if day12op and "metrics" in day12op:
-                vdur = next(
-                    filter(
-                        lambda vdur: vdur["vdu-id-ref"] == day12op["id"], vnfr["vdur"]
-                    )
-                )
-
-                # This avoids errors when vdur records have not been completely filled
-                if vdur and "name" in vdur:
-                    try:
-                        vca_deployment_info = self.get_vca_deployment_info(
-                            nsr_id,
-                            vnf_member_index,
-                            vdur["vdu-id-ref"],
-                            vdur["count-index"],
-                        )
-                    except VcaDeploymentInfoNotFound as e:
-                        log.warning(repr(e))
-                        continue
-                    # This avoids errors before application and model is not ready till they are occured
-                    if vca_deployment_info.get("model") and vca_deployment_info.get(
-                        "application"
-                    ):
-                        measures = asyncio.run(
-                            self.n2vc.get_metrics(
-                                vca_deployment_info["model"],
-                                vca_deployment_info["application"],
-                                vca_id=vnfr.get("vca-id"),
-                            )
-                        )
-                        log.debug("Measures: %s", measures)
-                        for measure_list in measures.values():
-                            for measure in measure_list:
-                                log.debug("Measure: %s", measure)
-                                metric = VnfMetric(
-                                    nsr_id,
-                                    vnf_member_index,
-                                    vdur["name"],
-                                    measure["key"],
-                                    float(measure["value"]),
-                                    tags,
-                                )
-                                metrics.append(metric)
-
-        return metrics
-
-    def get_vca_deployment_info(
-        self, nsr_id, vnf_member_index, vdu_id=None, vdu_count=0
-    ):
-        nsr = self.common_db.get_nsr(nsr_id)
-        for vca_deployment in nsr["_admin"]["deployed"]["VCA"]:
-            if vca_deployment:
-                if vdu_id is None:
-                    if (
-                        vca_deployment["member-vnf-index"] == vnf_member_index
-                        and vca_deployment["vdu_id"] is None
-                    ):
-                        return vca_deployment
-                else:
-                    if (
-                        vca_deployment["member-vnf-index"] == vnf_member_index
-                        and vca_deployment["vdu_id"] == vdu_id
-                        and vca_deployment["vdu_count_index"] == vdu_count
-                    ):
-                        return vca_deployment
-        raise VcaDeploymentInfoNotFound(
-            "VCA deployment info for nsr_id {}, index {}, vdu_id {} and vdu_count_index {} not found.".format(
-                nsr_id, vnf_member_index, vdu_id, vdu_count
-            )
-        )
diff --git a/osm_mon/collector/vnf_collectors/openstack.py b/osm_mon/collector/vnf_collectors/openstack.py
deleted file mode 100644 (file)
index 6aedf88..0000000
+++ /dev/null
@@ -1,458 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-from enum import Enum
-import logging
-import time
-from typing import List
-
-from ceilometerclient import client as ceilometer_client
-from ceilometerclient.exc import HTTPException
-import gnocchiclient.exceptions
-from gnocchiclient.v1 import client as gnocchi_client
-from keystoneauth1.exceptions.catalog import EndpointNotFound
-from keystoneclient.v3 import client as keystone_client
-from neutronclient.v2_0 import client as neutron_client
-from prometheus_api_client import PrometheusConnect as prometheus_client
-
-from osm_mon.collector.metric import Metric
-from osm_mon.collector.utils.openstack import OpenstackUtils
-from osm_mon.collector.vnf_collectors.base_vim import BaseVimCollector
-from osm_mon.collector.vnf_metric import VnfMetric
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-
-
-log = logging.getLogger(__name__)
-
-METRIC_MAPPINGS = {
-    "average_memory_utilization": "memory.usage",
-    "disk_read_ops": "disk.read.requests.rate",
-    "disk_write_ops": "disk.write.requests.rate",
-    "disk_read_bytes": "disk.read.bytes.rate",
-    "disk_write_bytes": "disk.write.bytes.rate",
-    "packets_in_dropped": "network.outgoing.packets.drop",
-    "packets_out_dropped": "network.incoming.packets.drop",
-    "packets_received": "network.incoming.packets.rate",
-    "packets_sent": "network.outgoing.packets.rate",
-    "cpu_utilization": "cpu",
-}
-
-METRIC_MAPPINGS_FOR_PROMETHEUS_TSBD = {
-    "cpu_utilization": "cpu",
-    "average_memory_utilization": "memory_usage",
-    "disk_read_ops": "disk_device_read_requests",
-    "disk_write_ops": "disk_device_write_requests",
-    "disk_read_bytes": "disk_device_read_bytes",
-    "disk_write_bytes": "disk_device_write_bytes",
-    "packets_in_dropped": "network_incoming_packets_drop",
-    "packets_out_dropped": "network_outgoing_packets_drop",
-    "packets_received": "network_incoming_packets",
-    "packets_sent": "network_outgoing_packets",
-}
-
-# Metrics which have new names in Rocky and higher releases
-METRIC_MAPPINGS_FOR_ROCKY_AND_NEWER_RELEASES = {
-    "disk_read_ops": "disk.device.read.requests",
-    "disk_write_ops": "disk.device.write.requests",
-    "disk_read_bytes": "disk.device.read.bytes",
-    "disk_write_bytes": "disk.device.write.bytes",
-    "packets_received": "network.incoming.packets",
-    "packets_sent": "network.outgoing.packets",
-}
-
-METRIC_MULTIPLIERS = {"cpu": 0.0000001}
-
-METRIC_AGGREGATORS = {"cpu": "rate:mean"}
-
-INTERFACE_METRICS = [
-    "packets_in_dropped",
-    "packets_out_dropped",
-    "packets_received",
-    "packets_sent",
-]
-
-INSTANCE_DISK = [
-    "disk_read_ops",
-    "disk_write_ops",
-    "disk_read_bytes",
-    "disk_write_bytes",
-]
-
-
-class MetricType(Enum):
-    INSTANCE = "instance"
-    INTERFACE_ALL = "interface_all"
-    INTERFACE_ONE = "interface_one"
-    INSTANCEDISK = "instancedisk"
-
-
-class OpenstackCollector(BaseVimCollector):
-    def __init__(self, config: Config, vim_account_id: str, vim_session: object):
-        super().__init__(config, vim_account_id)
-        self.common_db = CommonDbClient(config)
-        vim_account = self.common_db.get_vim_account(vim_account_id)
-        self.backend = self._get_backend(vim_account, vim_session)
-
-    def _build_keystone_client(self, vim_account: dict) -> keystone_client.Client:
-        sess = OpenstackUtils.get_session(vim_account)
-        return keystone_client.Client(session=sess)
-
-    def _get_resource_uuid(
-        self, nsr_id: str, vnf_member_index: str, vdur_name: str
-    ) -> str:
-        vdur = self.common_db.get_vdur(nsr_id, vnf_member_index, vdur_name)
-        return vdur["vim-id"]
-
-    def collect(self, vnfr: dict) -> List[Metric]:
-        nsr_id = vnfr["nsr-id-ref"]
-        vnf_member_index = vnfr["member-vnf-index-ref"]
-        vnfd = self.common_db.get_vnfd(vnfr["vnfd-id"])
-        # Populate extra tags for metrics
-        tags = {}
-        tags["ns_name"] = self.common_db.get_nsr(nsr_id)["name"]
-        if vnfr["_admin"]["projects_read"]:
-            tags["project_id"] = vnfr["_admin"]["projects_read"][0]
-        else:
-            tags["project_id"] = ""
-
-        metrics = []
-
-        for vdur in vnfr["vdur"]:
-            # This avoids errors when vdur records have not been completely filled
-            if "name" not in vdur:
-                continue
-            vdu = next(filter(lambda vdu: vdu["id"] == vdur["vdu-id-ref"], vnfd["vdu"]))
-            if "monitoring-parameter" in vdu:
-                for param in vdu["monitoring-parameter"]:
-                    metric_name = param["performance-metric"]
-                    log.info(f"Using an {type(self.backend)} as backend")
-                    if type(self.backend) is PrometheusTSBDBackend:
-                        openstack_metric_name = self.backend.map_metric(metric_name)
-                    else:
-                        try:
-                            openstack_metric_name = METRIC_MAPPINGS[metric_name]
-                        except KeyError:
-                            continue
-                    metric_type = self._get_metric_type(metric_name)
-                    try:
-                        resource_id = self._get_resource_uuid(
-                            nsr_id, vnf_member_index, vdur["name"]
-                        )
-                    except ValueError:
-                        log.warning(
-                            "Could not find resource_uuid for vdur %s, vnf_member_index %s, nsr_id %s. "
-                            "Was it recently deleted?",
-                            vdur["name"],
-                            vnf_member_index,
-                            nsr_id,
-                        )
-                        continue
-                    try:
-                        log.info(
-                            "Collecting metric type: %s and metric_name: %s and resource_id %s and ",
-                            metric_type,
-                            metric_name,
-                            resource_id,
-                        )
-                        value = self.backend.collect_metric(
-                            metric_type, openstack_metric_name, resource_id
-                        )
-
-                        if (
-                            value is None
-                            and metric_name
-                            in METRIC_MAPPINGS_FOR_ROCKY_AND_NEWER_RELEASES
-                            and type(self.backend) is not PrometheusTSBDBackend
-                        ):
-                            # Reattempting metric collection with new metric names.
-                            # Some metric names have changed in newer Openstack releases
-                            log.info(
-                                "Reattempting metric collection for type: %s and name: %s and resource_id %s",
-                                metric_type,
-                                metric_name,
-                                resource_id,
-                            )
-                            openstack_metric_name = (
-                                METRIC_MAPPINGS_FOR_ROCKY_AND_NEWER_RELEASES[
-                                    metric_name
-                                ]
-                            )
-                            value = self.backend.collect_metric(
-                                metric_type, openstack_metric_name, resource_id
-                            )
-                        if value is not None:
-                            log.info("value: %s", value)
-                            metric = VnfMetric(
-                                nsr_id,
-                                vnf_member_index,
-                                vdur["name"],
-                                metric_name,
-                                value,
-                                tags,
-                            )
-                            metrics.append(metric)
-                        else:
-                            log.info("metric value is empty")
-                    except Exception as e:
-                        log.exception(
-                            "Error collecting metric %s for vdu %s"
-                            % (metric_name, vdur["name"])
-                        )
-                        log.info("Error in metric collection: %s" % e)
-        return metrics
-
-    def _get_backend(self, vim_account: dict, vim_session: object):
-        if vim_account.get("prometheus-config"):
-            try:
-                tsbd = PrometheusTSBDBackend(vim_account)
-                log.debug("Using prometheustsbd backend to collect metric")
-                return tsbd
-            except Exception as e:
-                log.error(f"Can't create prometheus client, {e}")
-                return None
-        try:
-            gnocchi = GnocchiBackend(vim_account, vim_session)
-            gnocchi.client.metric.list(limit=1)
-            log.debug("Using gnocchi backend to collect metric")
-            return gnocchi
-        except (HTTPException, EndpointNotFound):
-            ceilometer = CeilometerBackend(vim_account, vim_session)
-            ceilometer.client.capabilities.get()
-            log.debug("Using ceilometer backend to collect metric")
-            return ceilometer
-
-    def _get_metric_type(self, metric_name: str) -> MetricType:
-        if metric_name not in INTERFACE_METRICS:
-            if metric_name not in INSTANCE_DISK:
-                return MetricType.INSTANCE
-            else:
-                return MetricType.INSTANCEDISK
-        else:
-            return MetricType.INTERFACE_ALL
-
-
-class OpenstackBackend:
-    def collect_metric(
-        self, metric_type: MetricType, metric_name: str, resource_id: str
-    ):
-        pass
-
-
-class PrometheusTSBDBackend(OpenstackBackend):
-    def __init__(self, vim_account: dict):
-        self.map = self._build_map(vim_account)
-        self.cred = vim_account["prometheus-config"].get("prometheus-cred")
-        self.client = self._build_prometheus_client(
-            vim_account["prometheus-config"]["prometheus-url"]
-        )
-
-    def _build_prometheus_client(self, url: str) -> prometheus_client:
-        return prometheus_client(url, disable_ssl=True)
-
-    def _build_map(self, vim_account: dict) -> dict:
-        custom_map = METRIC_MAPPINGS_FOR_PROMETHEUS_TSBD
-        if "prometheus-map" in vim_account["prometheus-config"]:
-            custom_map.update(vim_account["prometheus-config"]["prometheus-map"])
-        return custom_map
-
-    def collect_metric(
-        self, metric_type: MetricType, metric_name: str, resource_id: str
-    ):
-        metric = self.query_metric(metric_name, resource_id)
-        return metric["value"][1] if metric else None
-
-    def map_metric(self, metric_name: str):
-        return self.map[metric_name]
-
-    def query_metric(self, metric_name, resource_id=None):
-        metrics = self.client.get_current_metric_value(metric_name=metric_name)
-        if resource_id:
-            metric = next(
-                filter(lambda x: resource_id in x["metric"]["resource_id"], metrics)
-            )
-            return metric
-        return metrics
-
-
-class GnocchiBackend(OpenstackBackend):
-    def __init__(self, vim_account: dict, vim_session: object):
-        self.client = self._build_gnocchi_client(vim_account, vim_session)
-        self.neutron = self._build_neutron_client(vim_account, vim_session)
-
-    def _build_gnocchi_client(
-        self, vim_account: dict, vim_session: object
-    ) -> gnocchi_client.Client:
-        return gnocchi_client.Client(session=vim_session)
-
-    def _build_neutron_client(
-        self, vim_account: dict, vim_session: object
-    ) -> neutron_client.Client:
-        return neutron_client.Client(session=vim_session)
-
-    def collect_metric(
-        self, metric_type: MetricType, metric_name: str, resource_id: str
-    ):
-        if metric_type == MetricType.INTERFACE_ALL:
-            return self._collect_interface_all_metric(metric_name, resource_id)
-
-        elif metric_type == MetricType.INSTANCE:
-            return self._collect_instance_metric(metric_name, resource_id)
-
-        elif metric_type == MetricType.INSTANCEDISK:
-            return self._collect_instance_disk_metric(metric_name, resource_id)
-
-        else:
-            raise Exception("Unknown metric type %s" % metric_type.value)
-
-    def _collect_interface_all_metric(self, openstack_metric_name, resource_id):
-        total_measure = None
-        interfaces = self.client.resource.search(
-            resource_type="instance_network_interface",
-            query={"=": {"instance_id": resource_id}},
-        )
-        for interface in interfaces:
-            try:
-                measures = self.client.metric.get_measures(
-                    openstack_metric_name, resource_id=interface["id"], limit=1
-                )
-                if measures:
-                    if not total_measure:
-                        total_measure = 0.0
-                    total_measure += measures[-1][2]
-            except (gnocchiclient.exceptions.NotFound, TypeError) as e:
-                # Gnocchi in some Openstack versions raise TypeError instead of NotFound
-                log.debug(
-                    "No metric %s found for interface %s: %s",
-                    openstack_metric_name,
-                    interface["id"],
-                    e,
-                )
-        return total_measure
-
-    def _collect_instance_disk_metric(self, openstack_metric_name, resource_id):
-        value = None
-        instances = self.client.resource.search(
-            resource_type="instance_disk",
-            query={"=": {"instance_id": resource_id}},
-        )
-        for instance in instances:
-            try:
-                measures = self.client.metric.get_measures(
-                    openstack_metric_name, resource_id=instance["id"], limit=1
-                )
-                if measures:
-                    value = measures[-1][2]
-
-            except gnocchiclient.exceptions.NotFound as e:
-                log.debug(
-                    "No metric %s found for instance disk %s: %s",
-                    openstack_metric_name,
-                    instance["id"],
-                    e,
-                )
-        return value
-
-    def _collect_instance_metric(self, openstack_metric_name, resource_id):
-        value = None
-        try:
-            aggregation = METRIC_AGGREGATORS.get(openstack_metric_name)
-
-            try:
-                measures = self.client.metric.get_measures(
-                    openstack_metric_name,
-                    aggregation=aggregation,
-                    start=time.time() - 1200,
-                    resource_id=resource_id,
-                )
-                if measures:
-                    value = measures[-1][2]
-            except (
-                gnocchiclient.exceptions.NotFound,
-                gnocchiclient.exceptions.BadRequest,
-                TypeError,
-            ) as e:
-                # CPU metric in previous Openstack versions do not support rate:mean aggregation method
-                # Gnocchi in some Openstack versions raise TypeError instead of NotFound or BadRequest
-                if openstack_metric_name == "cpu":
-                    log.debug(
-                        "No metric %s found for instance %s: %s",
-                        openstack_metric_name,
-                        resource_id,
-                        e,
-                    )
-                    log.info(
-                        "Retrying to get metric %s for instance %s without aggregation",
-                        openstack_metric_name,
-                        resource_id,
-                    )
-                    measures = self.client.metric.get_measures(
-                        openstack_metric_name, resource_id=resource_id, limit=1
-                    )
-                else:
-                    raise e
-                # measures[-1] is the last measure
-                # measures[-2] is the previous measure
-                # measures[x][2] is the value of the metric
-                if measures and len(measures) >= 2:
-                    value = measures[-1][2] - measures[-2][2]
-            if value:
-                # measures[-1][0] is the time of the reporting interval
-                # measures[-1][1] is the duration of the reporting interval
-                if aggregation:
-                    # If this is an aggregate, we need to divide the total over the reported time period.
-                    # Even if the aggregation method is not supported by Openstack, the code will execute it
-                    # because aggregation is specified in METRIC_AGGREGATORS
-                    value = value / measures[-1][1]
-                if openstack_metric_name in METRIC_MULTIPLIERS:
-                    value = value * METRIC_MULTIPLIERS[openstack_metric_name]
-        except gnocchiclient.exceptions.NotFound as e:
-            log.debug(
-                "No metric %s found for instance %s: %s",
-                openstack_metric_name,
-                resource_id,
-                e,
-            )
-        return value
-
-
-class CeilometerBackend(OpenstackBackend):
-    def __init__(self, vim_account: dict, vim_session: object):
-        self.client = self._build_ceilometer_client(vim_account, vim_session)
-
-    def _build_ceilometer_client(
-        self, vim_account: dict, vim_session: object
-    ) -> ceilometer_client.Client:
-        return ceilometer_client.Client("2", session=vim_session)
-
-    def collect_metric(
-        self, metric_type: MetricType, metric_name: str, resource_id: str
-    ):
-        if metric_type != MetricType.INSTANCE:
-            raise NotImplementedError(
-                "Ceilometer backend only support instance metrics"
-            )
-        measures = self.client.samples.list(
-            meter_name=metric_name,
-            limit=1,
-            q=[{"field": "resource_id", "op": "eq", "value": resource_id}],
-        )
-        return measures[0].counter_volume if measures else None
diff --git a/osm_mon/collector/vnf_collectors/vio.py b/osm_mon/collector/vnf_collectors/vio.py
deleted file mode 100644 (file)
index 130b253..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##
-# Copyright 2016-2017 VMware Inc.
-# This file is part of ETSI OSM
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact:  osslegalrouting@vmware.com
-##
-
-import logging
-
-from osm_mon.collector.vnf_collectors.base_vim import BaseVimCollector
-from osm_mon.collector.vnf_collectors.vrops.vrops_helper import vROPS_Helper
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-
-log = logging.getLogger(__name__)
-
-
-class VIOCollector(BaseVimCollector):
-    def __init__(self, config: Config, vim_account_id: str, vim_session: object):
-        super().__init__(config, vim_account_id)
-        self.common_db = CommonDbClient(config)
-        cfg = self.get_vim_account(vim_account_id)
-        self.vrops = vROPS_Helper(
-            vrops_site=cfg["vrops_site"],
-            vrops_user=cfg["vrops_user"],
-            vrops_password=cfg["vrops_password"],
-        )
-
-    def get_vim_account(self, vim_account_id: str):
-        vim_account_info = self.common_db.get_vim_account(vim_account_id)
-        return vim_account_info["config"]
-
-    def collect(self, vnfr: dict):
-        vnfd = self.common_db.get_vnfd(vnfr["vnfd-id"])
-        vdu_mappings = {}
-
-        # Populate extra tags for metrics
-        nsr_id = vnfr["nsr-id-ref"]
-        tags = {}
-        tags["ns_name"] = self.common_db.get_nsr(nsr_id)["name"]
-        if vnfr["_admin"]["projects_read"]:
-            tags["project_id"] = vnfr["_admin"]["projects_read"][0]
-        else:
-            tags["project_id"] = ""
-
-        # Fetch the list of all known resources from vROPS.
-        resource_list = self.vrops.get_vm_resource_list_from_vrops()
-
-        for vdur in vnfr["vdur"]:
-            # This avoids errors when vdur records have not been completely filled
-            if "name" not in vdur:
-                continue
-
-            vdu = next(filter(lambda vdu: vdu["id"] == vdur["vdu-id-ref"], vnfd["vdu"]))
-            if "monitoring-parameter" not in vdu:
-                continue
-
-            vim_id = vdur["vim-id"]
-            vdu_mappings[vim_id] = {"name": vdur["name"]}
-
-            # Map the vROPS instance id to the vim-id so we can look it up.
-            for resource in resource_list:
-                for resourceIdentifier in resource["resourceKey"][
-                    "resourceIdentifiers"
-                ]:
-                    if (
-                        resourceIdentifier["identifierType"]["name"]
-                        == "VMEntityInstanceUUID"
-                    ):
-                        if resourceIdentifier["value"] != vim_id:
-                            continue
-                        vdu_mappings[vim_id]["vrops_id"] = resource["identifier"]
-
-        if len(vdu_mappings) != 0:
-            return self.vrops.get_metrics(
-                vdu_mappings=vdu_mappings,
-                monitoring_params=vdu["monitoring-parameter"],
-                vnfr=vnfr,
-                tags=tags,
-            )
-        else:
-            return []
diff --git a/osm_mon/collector/vnf_collectors/vmware.py b/osm_mon/collector/vnf_collectors/vmware.py
deleted file mode 100644 (file)
index 7284298..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##
-# Copyright 2016-2019 VMware Inc.
-# This file is part of ETSI OSM
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact:  osslegalrouting@vmware.com
-##
-
-import logging
-import traceback
-from lxml import etree as XmlElementTree
-
-import requests
-from pyvcloud.vcd.client import BasicLoginCredentials
-from pyvcloud.vcd.client import Client
-
-from osm_mon.collector.vnf_collectors.base_vim import BaseVimCollector
-from osm_mon.collector.vnf_collectors.vrops.vrops_helper import vROPS_Helper
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-
-log = logging.getLogger(__name__)
-
-API_VERSION = "27.0"
-
-
-class VMwareCollector(BaseVimCollector):
-    def __init__(self, config: Config, vim_account_id: str, vim_session: object):
-        super().__init__(config, vim_account_id)
-        self.common_db = CommonDbClient(config)
-        vim_account = self.get_vim_account(vim_account_id)
-        self.vcloud_site = vim_account["vim_url"]
-        self.admin_username = vim_account["admin_username"]
-        self.admin_password = vim_account["admin_password"]
-        self.vrops = vROPS_Helper(
-            vrops_site=vim_account["vrops_site"],
-            vrops_user=vim_account["vrops_user"],
-            vrops_password=vim_account["vrops_password"],
-        )
-
-    def connect_as_admin(self):
-        """Method connect as pvdc admin user to vCloud director.
-        There are certain action that can be done only by provider vdc admin user.
-        Organization creation / provider network creation etc.
-
-        Returns:
-            The return client object that letter can be used to connect to vcloud direct as admin for provider vdc
-        """
-
-        log.debug("Logging into vCD org as admin.")
-
-        admin_user = None
-        try:
-            host = self.vcloud_site
-            admin_user = self.admin_username
-            admin_passwd = self.admin_password
-            org = "System"
-            client = Client(host, verify_ssl_certs=False)
-            client.set_highest_supported_version()
-            client.set_credentials(BasicLoginCredentials(admin_user, org, admin_passwd))
-            return client
-
-        except Exception as e:
-            log.error(
-                "Can't connect to a vCloud director as: {} with exception {}".format(
-                    admin_user, e
-                )
-            )
-
-    def get_vim_account(self, vim_account_id: str):
-        """
-        Method to get VIM account details by its ID
-        arg - VIM ID
-        return - dict with vim account details
-        """
-        vim_account = {}
-        vim_account_info = self.common_db.get_vim_account(vim_account_id)
-
-        vim_account["vim_url"] = vim_account_info["vim_url"]
-
-        vim_config = vim_account_info["config"]
-        vim_account["admin_username"] = vim_config["admin_username"]
-        vim_account["admin_password"] = vim_config["admin_password"]
-        vim_account["vrops_site"] = vim_config["vrops_site"]
-        vim_account["vrops_user"] = vim_config["vrops_user"]
-        vim_account["vrops_password"] = vim_config["vrops_password"]
-
-        return vim_account
-
-    def get_vm_moref_id(self, vapp_uuid):
-        """
-        Method to get the moref_id of given VM
-        arg - vapp_uuid
-        return - VM mored_id
-        """
-        vm_moref_id = None
-        try:
-            if vapp_uuid:
-                vm_details = self.get_vapp_details_rest(vapp_uuid)
-
-                if vm_details and "vm_vcenter_info" in vm_details:
-                    vm_moref_id = vm_details["vm_vcenter_info"].get("vm_moref_id", None)
-                    log.debug(
-                        "Found vm_moref_id: {} for vApp UUID: {}".format(
-                            vm_moref_id, vapp_uuid
-                        )
-                    )
-                else:
-                    log.error(
-                        "Failed to find vm_moref_id from vApp UUID: {}".format(
-                            vapp_uuid
-                        )
-                    )
-
-        except Exception as exp:
-            log.warning(
-                "Error occurred while getting VM moref ID for VM: {}\n{}".format(
-                    exp, traceback.format_exc()
-                )
-            )
-
-        return vm_moref_id
-
-    def get_vapp_details_rest(self, vapp_uuid=None):
-        """
-        Method retrieve vapp detail from vCloud director
-        vapp_uuid - is vapp identifier.
-        Returns - VM MOref ID or return None
-        """
-        parsed_respond = {}
-
-        if vapp_uuid is None:
-            return parsed_respond
-
-        vca = self.connect_as_admin()
-
-        if not vca:
-            log.error("Failed to connect to vCD")
-            return parsed_respond
-
-        url_list = [self.vcloud_site, "/api/vApp/vapp-", vapp_uuid]
-        get_vapp_restcall = "".join(url_list)
-
-        if vca._session:
-            headers = {
-                "Accept": "application/*+xml;version=" + API_VERSION,
-                "x-vcloud-authorization": vca._session.headers[
-                    "x-vcloud-authorization"
-                ],
-            }
-            response = requests.get(get_vapp_restcall, headers=headers)
-
-            if response.status_code != 200:
-                log.error(
-                    "REST API call {} failed. Return status code {}".format(
-                        get_vapp_restcall, response.content
-                    )
-                )
-                return parsed_respond
-
-            try:
-                xmlroot_respond = XmlElementTree.fromstring(response.content)
-
-                namespaces = {
-                    "vm": "http://www.vmware.com/vcloud/v1.5",
-                    "vmext": "http://www.vmware.com/vcloud/extension/v1.5",
-                    "xmlns": "http://www.vmware.com/vcloud/v1.5",
-                }
-
-                # parse children section for other attrib
-                children_section = xmlroot_respond.find("vm:Children/", namespaces)
-                if children_section is not None:
-                    vCloud_extension_section = children_section.find(
-                        "xmlns:VCloudExtension", namespaces
-                    )
-                    if vCloud_extension_section is not None:
-                        vm_vcenter_info = {}
-                        vim_info = vCloud_extension_section.find(
-                            "vmext:VmVimInfo", namespaces
-                        )
-                        vmext = vim_info.find("vmext:VmVimObjectRef", namespaces)
-                        if vmext is not None:
-                            vm_vcenter_info["vm_moref_id"] = vmext.find(
-                                "vmext:MoRef", namespaces
-                            ).text
-                        parsed_respond["vm_vcenter_info"] = vm_vcenter_info
-
-            except Exception as exp:
-                log.warning(
-                    "Error occurred for getting vApp details: {}\n{}".format(
-                        exp, traceback.format_exc()
-                    )
-                )
-
-        return parsed_respond
-
-    def collect(self, vnfr: dict):
-        vnfd = self.common_db.get_vnfd(vnfr["vnfd-id"])
-        vdu_mappings = {}
-
-        # Populate extra tags for metrics
-        nsr_id = vnfr["nsr-id-ref"]
-        tags = {}
-        tags["ns_name"] = self.common_db.get_nsr(nsr_id)["name"]
-        if vnfr["_admin"]["projects_read"]:
-            tags["project_id"] = vnfr["_admin"]["projects_read"][0]
-        else:
-            tags["project_id"] = ""
-
-        # Fetch the list of all known resources from vROPS.
-        resource_list = self.vrops.get_vm_resource_list_from_vrops()
-
-        for vdur in vnfr["vdur"]:
-            # This avoids errors when vdur records have not been completely filled
-            if "name" not in vdur:
-                continue
-            vdu = next(filter(lambda vdu: vdu["id"] == vdur["vdu-id-ref"], vnfd["vdu"]))
-
-            if "monitoring-parameter" not in vdu:
-                continue
-
-            resource_uuid = vdur["vim-id"]
-            # Find vm_moref_id from vApp uuid in vCD
-            vim_id = self.get_vm_moref_id(resource_uuid)
-            if vim_id is None:
-                log.debug(
-                    "Failed to find vROPS ID for vApp in vCD: {}".format(resource_uuid)
-                )
-                continue
-
-            vdu_mappings[vim_id] = {"name": vdur["name"]}
-
-            # Map the vROPS instance id to the vim-id so we can look it up.
-            for resource in resource_list:
-                for resourceIdentifier in resource["resourceKey"][
-                    "resourceIdentifiers"
-                ]:
-                    if (
-                        resourceIdentifier["identifierType"]["name"]
-                        == "VMEntityObjectID"
-                    ):
-                        if resourceIdentifier["value"] != vim_id:
-                            continue
-                        vdu_mappings[vim_id]["vrops_id"] = resource["identifier"]
-
-        if len(vdu_mappings) != 0:
-            return self.vrops.get_metrics(
-                vdu_mappings=vdu_mappings,
-                monitoring_params=vdu["monitoring-parameter"],
-                vnfr=vnfr,
-                tags=tags,
-            )
-        else:
-            return []
diff --git a/osm_mon/collector/vnf_collectors/vrops/__init__.py b/osm_mon/collector/vnf_collectors/vrops/__init__.py
deleted file mode 100644 (file)
index 30d864e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# #
-# Copyright 2016-2019 VMware Inc.
-# This file is part of ETSI OSM
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact:  osslegalrouting@vmware.com
-# #
diff --git a/osm_mon/collector/vnf_collectors/vrops/metrics.py b/osm_mon/collector/vnf_collectors/vrops/metrics.py
deleted file mode 100644 (file)
index d4bd69f..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# #
-# Copyright 2016-2019 VMware Inc.
-# This file is part of ETSI OSM
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact:  osslegalrouting@vmware.com
-# #
-
-# Ref: https://docs.vmware.com/en/vRealize-Operations-Manager/7.0/vrealize-operations-manager-70-reference-guide.pdf
-# Potential metrics of interest
-# "cpu|capacity_contentionPct"
-# "cpu|corecount_provisioned"
-# "cpu|costopPct"
-# "cpu|demandmhz"
-# "cpu|demandPct"
-# "cpu|effective_limit"
-# "cpu|iowaitPct"
-# "cpu|readyPct"
-# "cpu|swapwaitPct"
-# "cpu|usage_average"
-# "cpu|usagemhz_average"
-# "cpu|usagemhz_average_mtd"
-# "cpu|vm_capacity_provisioned"
-# "cpu|workload"
-# "guestfilesystem|percentage_total"
-# "guestfilesystem|usage_total"
-# "mem|consumedPct"
-# "mem|guest_usage"
-# "mem|host_contentionPct"
-# "mem|reservation_used"
-# "mem|swapinRate_average"
-# "mem|swapoutRate_average"
-# "mem|swapped_average"
-# "mem|usage_average"
-# "net:Aggregate of all instances|droppedPct"
-# "net|broadcastTx_summation"
-# "net|droppedTx_summation"
-# "net|multicastTx_summation"
-# "net|pnicBytesRx_average"
-# "net|pnicBytesTx_average"
-# "net|received_average"
-# "net|transmitted_average"
-# "net|usage_average"
-# "virtualDisk:Aggregate of all instances|commandsAveraged_average"
-# "virtualDisk:Aggregate of all instances|numberReadAveraged_average"
-# "virtualDisk:Aggregate of all instances|numberWriteAveraged_average"
-# "virtualDisk:Aggregate of all instances|totalLatency"
-# "virtualDisk:Aggregate of all instances|totalReadLatency_average"
-# "virtualDisk:Aggregate of all instances|totalWriteLatency_average"
-# "virtualDisk:Aggregate of all instances|usage"
-# "virtualDisk:Aggregate of all instances|vDiskOIO"
-# "virtualDisk|read_average"
-# "virtualDisk|write_average"
-
-METRIC_MAPPINGS = {
-    # Percent guest operating system active memory.
-    "average_memory_utilization": "mem|usage_average",
-    # Percentage of CPU that was used out of all the CPU that was allocated.
-    "cpu_utilization": "cpu|usage_average",
-    # KB/s of data read in the performance interval
-    "disk_read_bytes": "virtualDisk|read_average",
-    # Average of read commands per second during the collection interval.
-    "disk_read_ops": "virtualDisk:aggregate of all instances|numberReadAveraged_average",
-    # KB/s  of data written in the performance interval.
-    "disk_write_bytes": "virtualDisk|write_average",
-    # Average of write commands per second during the collection interval.
-    "disk_write_ops": "virtualDisk:aggregate of all instances|numberWriteAveraged_average",
-    # Not supported by vROPS, will always return 0.
-    "packets_in_dropped": "net|droppedRx_summation",
-    # Transmitted packets dropped in the collection interval.
-    "packets_out_dropped": "net|droppedTx_summation",
-    # Bytes received in the performance interval.
-    "packets_received": "net|received_average",
-    # Packets transmitted in the performance interval.
-    "packets_sent": "net|transmitted_average",
-}
diff --git a/osm_mon/collector/vnf_collectors/vrops/vrops_helper.py b/osm_mon/collector/vnf_collectors/vrops/vrops_helper.py
deleted file mode 100644 (file)
index eadd5c7..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# #
-# Copyright 2016-2019 VMware Inc.
-# This file is part of ETSI OSM
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact:  osslegalrouting@vmware.com
-# #
-
-import logging
-import json
-import requests
-import traceback
-
-from osm_mon.collector.vnf_metric import VnfMetric
-from osm_mon.collector.vnf_collectors.vrops.metrics import METRIC_MAPPINGS
-import copy
-
-log = logging.getLogger(__name__)
-
-
-# If the unit from vROPS does not align with the expected value. multiply by the specified amount to ensure
-# the correct unit is returned.
-METRIC_MULTIPLIERS = {
-    "disk_read_bytes": 1024,
-    "disk_write_bytes": 1024,
-    "packets_received": 1024,
-    "packets_sent": 1024,
-}
-
-
-class vROPS_Helper:
-    def __init__(
-        self,
-        vrops_site="https://vrops",
-        vrops_user="",
-        vrops_password="",
-        verify_ssl=False,
-    ):
-        self.vrops_site = vrops_site
-        self.vrops_user = vrops_user
-        self.vrops_password = vrops_password
-        self.verify_ssl = verify_ssl
-
-    def get_vrops_token(self):
-        """Fetches token from vrops"""
-        auth_url = "/suite-api/api/auth/token/acquire"
-        headers = {"Content-Type": "application/json", "Accept": "application/json"}
-        req_body = {"username": self.vrops_user, "password": self.vrops_password}
-        resp = requests.post(
-            self.vrops_site + auth_url,
-            json=req_body,
-            verify=self.verify_ssl,
-            headers=headers,
-        )
-        if resp.status_code != 200:
-            log.error(
-                "Failed to get token from vROPS: {} {}".format(
-                    resp.status_code, resp.content
-                )
-            )
-            return None
-
-        resp_data = json.loads(resp.content.decode("utf-8"))
-        return resp_data["token"]
-
-    def get_vm_resource_list_from_vrops(self):
-        """Find all known resource IDs in vROPs"""
-        auth_token = self.get_vrops_token()
-        api_url = "/suite-api/api/resources?resourceKind=VirtualMachine"
-        headers = {
-            "Accept": "application/json",
-            "Authorization": "vRealizeOpsToken {}".format(auth_token),
-        }
-        resource_list = []
-
-        resp = requests.get(
-            self.vrops_site + api_url, verify=self.verify_ssl, headers=headers
-        )
-
-        if resp.status_code != 200:
-            log.error(
-                "Failed to get resource list from vROPS: {} {}".format(
-                    resp.status_code, resp.content
-                )
-            )
-            return resource_list
-
-        try:
-            resp_data = json.loads(resp.content.decode("utf-8"))
-            if resp_data.get("resourceList") is not None:
-                resource_list = resp_data.get("resourceList")
-
-        except Exception as exp:
-            log.error(
-                "get_vm_resource_id: Error in parsing {}\n{}".format(
-                    exp, traceback.format_exc()
-                )
-            )
-
-        return resource_list
-
-    def get_metrics(self, vdu_mappings={}, monitoring_params={}, vnfr=None, tags={}):
-        monitoring_keys = {}
-        # Collect the names of all the metrics we need to query
-        for metric_entry in monitoring_params:
-            metric_name = metric_entry["performance-metric"]
-            if metric_name not in METRIC_MAPPINGS:
-                log.debug("Metric {} not supported, ignoring".format(metric_name))
-                continue
-            monitoring_keys[metric_name] = METRIC_MAPPINGS[metric_name]
-
-        metrics = []
-        # Make a query for only the stats we have been asked for
-        stats_key = ""
-        for stat in monitoring_keys.values():
-            stats_key += "&statKey={}".format(stat)
-
-        # And only ask for the resource ids that we are interested in
-        resource_ids = ""
-        sanitized_vdu_mappings = copy.deepcopy(vdu_mappings)
-        for key in vdu_mappings.keys():
-            vdu = vdu_mappings[key]
-            if "vrops_id" not in vdu:
-                log.info("Could not find vROPS id for vdu {}".format(vdu))
-                del sanitized_vdu_mappings[key]
-                continue
-            resource_ids += "&resourceId={}".format(vdu["vrops_id"])
-        vdu_mappings = sanitized_vdu_mappings
-
-        try:
-            # Now we can make a single call to vROPS to collect all relevant metrics for resources we need to monitor
-            api_url = (
-                "/suite-api/api/resources/stats?IntervalType=MINUTES&IntervalCount=1"
-                "&rollUpType=MAX&currentOnly=true{}{}".format(stats_key, resource_ids)
-            )
-
-            auth_token = self.get_vrops_token()
-            headers = {
-                "Accept": "application/json",
-                "Authorization": "vRealizeOpsToken {}".format(auth_token),
-            }
-
-            resp = requests.get(
-                self.vrops_site + api_url, verify=self.verify_ssl, headers=headers
-            )
-
-            if resp.status_code != 200:
-                log.error(
-                    "Failed to get Metrics data from vROPS for {} {}".format(
-                        resp.status_code, resp.content
-                    )
-                )
-                return metrics
-
-            m_data = json.loads(resp.content.decode("utf-8"))
-            if "values" not in m_data:
-                return metrics
-
-            statistics = m_data["values"]
-            for vdu_stat in statistics:
-                vrops_id = vdu_stat["resourceId"]
-                vdu_name = None
-                for vdu in vdu_mappings.values():
-                    if vdu["vrops_id"] == vrops_id:
-                        vdu_name = vdu["name"]
-                if vdu_name is None:
-                    continue
-                for item in vdu_stat["stat-list"]["stat"]:
-                    reported_metric = item["statKey"]["key"]
-                    if reported_metric not in METRIC_MAPPINGS.values():
-                        continue
-
-                    # Convert the vROPS metric name back to OSM key
-                    metric_name = list(METRIC_MAPPINGS.keys())[
-                        list(METRIC_MAPPINGS.values()).index(reported_metric)
-                    ]
-                    if metric_name in monitoring_keys.keys():
-                        metric_value = item["data"][-1]
-                        if metric_name in METRIC_MULTIPLIERS:
-                            metric_value *= METRIC_MULTIPLIERS[metric_name]
-                        metric = VnfMetric(
-                            vnfr["nsr-id-ref"],
-                            vnfr["member-vnf-index-ref"],
-                            vdu_name,
-                            metric_name,
-                            metric_value,
-                            tags,
-                        )
-
-                        metrics.append(metric)
-
-        except Exception as exp:
-            log.error(
-                "Exception while parsing metrics data from vROPS {}\n{}".format(
-                    exp, traceback.format_exc()
-                )
-            )
-
-        return metrics
diff --git a/osm_mon/collector/vnf_metric.py b/osm_mon/collector/vnf_metric.py
deleted file mode 100644 (file)
index 961a4ef..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-from osm_mon.collector.metric import Metric
-import logging
-
-log = logging.getLogger(__name__)
-
-
-class VnfMetric(Metric):
-    def __init__(
-        self, nsr_id, vnf_member_index, vdur_name, name, value, extra_tags: dict = None
-    ):
-        tags = {
-            "ns_id": nsr_id,
-            "vnf_member_index": vnf_member_index,
-            "vdu_name": vdur_name,
-        }
-        if extra_tags:
-            tags.update(extra_tags)
-        log.debug("Tags: %s", tags)
-        super().__init__(tags, name, value)
diff --git a/osm_mon/evaluator/__init__.py b/osm_mon/evaluator/__init__.py
deleted file mode 100644 (file)
index 4450364..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
diff --git a/osm_mon/evaluator/backends/__init__.py b/osm_mon/evaluator/backends/__init__.py
deleted file mode 100644 (file)
index 4450364..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
diff --git a/osm_mon/evaluator/backends/base.py b/osm_mon/evaluator/backends/base.py
deleted file mode 100644 (file)
index 30793c1..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-
-from osm_mon.core.config import Config
-
-
-class BaseBackend:
-    def __init__(self, config: Config):
-        pass
-
-    def get_metric_data(self, metric_name: str, tags: dict):
-        pass
diff --git a/osm_mon/evaluator/backends/prometheus.py b/osm_mon/evaluator/backends/prometheus.py
deleted file mode 100644 (file)
index c5b935e..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import base64
-import logging
-from typing import Dict, List
-
-import requests
-
-from osm_mon.core.config import Config
-from osm_mon.evaluator.backends.base import BaseBackend
-
-log = logging.getLogger(__name__)
-
-OSM_METRIC_PREFIX = "osm_"
-
-DEFAULT_QUERY_METRICS = ["ns_id", "vnf_member_index", "vdu_name"]
-
-
-class PrometheusBackend(BaseBackend):
-    def __init__(self, config: Config):
-        super().__init__(config)
-        self.conf = config
-
-    def get_metric_data(self, metric_name: str, tags: dict):
-        query = self._build_query(metric_name, tags)
-        request_url = self._build_url(query)
-        request_headers = self._build_headers()
-        return self._query_metric(request_url, request_headers)
-
-    def _query_metric(self, request_url: str, headers: Dict[str, str]):
-        log.info("Querying Prometheus: %s", request_url)
-        r = requests.get(
-            request_url,
-            timeout=int(self.conf.get("global", "request_timeout")),
-            headers=headers,
-        )
-        if r.status_code == 200:
-            json_response = r.json()
-            if json_response["status"] == "success":
-                return self._get_metric_data_from_response(json_response)
-            else:
-                log.warning(
-                    "Prometheus response is not success. Got status %s",
-                    json_response["status"],
-                )
-        else:
-            log.warning(
-                "Error contacting Prometheus. Got status code %s: %s",
-                r.status_code,
-                r.text,
-            )
-        return None
-
-    def _build_query(self, metric_name: str, tags: dict) -> str:
-        query_section_tags = []
-        for k, v in tags.items():
-            query_section_tags.append(k + '="' + v + '"')
-        query_section = "query={0}{{{1}}}".format(
-            OSM_METRIC_PREFIX + metric_name, ",".join(query_section_tags)
-        )
-        return query_section
-
-    def _build_url(self, query: str):
-        return self.conf.get("prometheus", "url") + "/api/v1/query?" + query
-
-    def _build_headers(self) -> Dict[str, str]:
-        headers = {}
-        user = self.conf.get("prometheus", "user")
-        password = self.conf.get("prometheus", "password")
-        if user and password:
-            _phrase = f"{user}:{password}".encode("utf-8")
-            token = base64.b64encode(_phrase).decode("utf-8")
-            headers["Authorization"] = f"Basic {token}"
-        return headers
-
-    def _get_metric_data_from_response(self, json_response) -> List[Dict[str, str]]:
-        result = json_response["data"]["result"]
-        metrics_data = []
-        if len(result):
-            for metric in result:
-                metrics_labels = metric["metric"]
-                metric_value = float(metric["value"][1])
-                log.info("Metric value: %s", metric_value)
-                metrics_data.append({"labels": metrics_labels, "value": metric_value})
-            return metrics_data
-        else:
-            return None
diff --git a/osm_mon/evaluator/evaluator.py b/osm_mon/evaluator/evaluator.py
deleted file mode 100644 (file)
index 44b0af6..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import asyncio
-import logging
-import multiprocessing
-import time
-
-from osm_mon.core.config import Config
-from osm_mon.core.message_bus_client import MessageBusClient
-from osm_mon.core.models import Alarm
-from osm_mon.core.response import ResponseBuilder
-from osm_mon.evaluator.service import EvaluatorService, AlarmStatus
-
-log = logging.getLogger(__name__)
-
-
-class Evaluator:
-    def __init__(self, config: Config):
-        self.conf = config
-        self.service = EvaluatorService(config)
-        self.msg_bus = MessageBusClient(config)
-
-    def evaluate_forever(self):
-        log.debug("evaluate_forever")
-        while True:
-            try:
-                self.evaluate()
-                time.sleep(int(self.conf.get("evaluator", "interval")))
-            except Exception:
-                log.exception("Error evaluating alarms")
-
-    def evaluate(self):
-        log.debug("evaluate")
-        log.info("Starting alarm evaluation")
-        alarms_tuples = self.service.evaluate_alarms()
-        processes = []
-        for alarm, status in alarms_tuples:
-            p = multiprocessing.Process(target=self.notify_alarm, args=(alarm, status))
-            p.start()
-            processes.append(p)
-        for process in processes:
-            process.join(timeout=10)
-        log.info("Alarm evaluation is complete")
-
-    def notify_alarm(self, alarm: Alarm, status: AlarmStatus):
-        log.debug("_notify_alarm")
-        resp_message = self._build_alarm_response(alarm, status)
-        log.info("Sent alarm notification: %s", resp_message)
-        asyncio.run(
-            self.msg_bus.aiowrite("alarm_response", "notify_alarm", resp_message)
-        )
-        evaluator_service = EvaluatorService(self.conf)
-        evaluator_service.update_alarm_status(status.value, alarm.uuid)
-        evaluator_service.update_alarm_extra_labels(alarm.extra_labels, alarm.uuid)
-        return
-
-    def _build_alarm_response(self, alarm: Alarm, status: AlarmStatus):
-        log.debug("_build_alarm_response")
-        response = ResponseBuilder()
-        tags = {}
-        for name, value in alarm.tags.items():
-            tags[name] = value
-        now = time.strftime("%d-%m-%Y") + " " + time.strftime("%X")
-        return response.generate_response(
-            "notify_alarm",
-            alarm_id=alarm.uuid,
-            metric_name=alarm.metric,
-            operation=alarm.operation,
-            threshold_value=alarm.threshold,
-            sev=alarm.severity,
-            status=status.value,
-            date=now,
-            tags=tags,
-            extra_tabels=alarm.extra_labels,
-        )
diff --git a/osm_mon/evaluator/service.py b/osm_mon/evaluator/service.py
deleted file mode 100644 (file)
index e97586c..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import logging
-import multiprocessing
-from enum import Enum
-from typing import Tuple, List
-
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-from osm_mon.core.models import Alarm
-from osm_mon.evaluator.backends.prometheus import PrometheusBackend
-
-log = logging.getLogger(__name__)
-
-BACKENDS = {"prometheus": PrometheusBackend}
-
-
-class AlarmStatus(Enum):
-    ALARM = "alarm"
-    OK = "ok"
-    INSUFFICIENT = "insufficient-data"
-    DISABLED = "disabled"
-
-
-class EvaluatorService:
-    def __init__(self, config: Config):
-        self.conf = config
-        self.common_db = CommonDbClient(self.conf)
-        self.queue = multiprocessing.Queue()
-
-    def _get_metric_data(self, metric_name: str, tags: dict):
-        return BACKENDS[self.conf.get("evaluator", "backend")](
-            self.conf
-        ).get_metric_data(metric_name, tags)
-
-    def _evaluate_metric(self, alarm: Alarm):
-        """Method to evaluate a metric value comparing it against an alarm threshold.
-
-        Args:
-            alarm (Alarm): the alarm with the threshold to compare the metric against
-        """
-
-        log.debug("_evaluate_metric")
-        metric_data = self._get_metric_data(alarm.metric, alarm.tags)
-        if metric_data is None:
-            log.warning("No metric result for alarm %s", alarm.uuid)
-            self.queue.put((alarm, AlarmStatus.INSUFFICIENT))
-        else:
-            for metric in metric_data:
-                metric_value = metric["value"]
-                metric_labels = metric["labels"]
-                alarm.extra_labels.update(metric_labels)
-                if alarm.alarm_status.upper() != AlarmStatus.DISABLED.value.upper():
-                    if (
-                        (
-                            alarm.operation.upper() == "GT"
-                            and metric_value > alarm.threshold
-                        )
-                        or (
-                            alarm.operation.upper() == "LT"
-                            and metric_value < alarm.threshold
-                        )
-                        or (
-                            alarm.operation.upper() == "GE"
-                            and metric_value >= alarm.threshold
-                        )
-                        or (
-                            alarm.operation.upper() == "LE"
-                            and metric_value <= alarm.threshold
-                        )
-                        or (
-                            alarm.operation.upper() == "EQ"
-                            and metric_value == alarm.threshold
-                        )
-                        or (
-                            alarm.operation.upper() == "NE"
-                            and metric_value != alarm.threshold
-                        )
-                    ):
-                        self.queue.put((alarm, AlarmStatus.ALARM))
-                    elif alarm.operation.upper() in (
-                        "GT",
-                        "LT",
-                        "GE",
-                        "LE",
-                        "EQ",
-                        "NE",
-                    ):
-                        self.queue.put((alarm, AlarmStatus.OK))
-
-    def update_alarm_status(self, alarm_state, uuid):
-        alarm_data = self.common_db.get_alarm_by_uuid(uuid)
-        if alarm_data.get("alarm_status").upper() != AlarmStatus.DISABLED.value.upper():
-            self.common_db.update_alarm_status(alarm_state, uuid)
-        return
-
-    def update_alarm_extra_labels(self, alarm_labels, uuid):
-        self.common_db.update_alarm_extra_labels(alarm_labels, uuid)
-        return
-
-    def evaluate_alarms(self) -> List[Tuple[Alarm, AlarmStatus]]:
-        log.debug("evaluate_alarms")
-        processes = []
-        for alarm in self.common_db.get_alarms():
-            p = multiprocessing.Process(target=self._evaluate_metric, args=(alarm,))
-            processes.append(p)
-            p.start()
-
-        for process in processes:
-            process.join(timeout=10)
-        alarms_tuples = []
-        while not self.queue.empty():
-            alarms_tuples.append(self.queue.get())
-        return alarms_tuples
diff --git a/osm_mon/server/__init__.py b/osm_mon/server/__init__.py
deleted file mode 100644 (file)
index 4450364..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
diff --git a/osm_mon/server/server.py b/osm_mon/server/server.py
deleted file mode 100755 (executable)
index bb8f0e8..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-"""
-MON component in charge of CRUD operations for vim_accounts and alarms. It uses the message bus to communicate.
-"""
-import asyncio
-import json
-import logging
-import time
-
-from osm_mon.core.config import Config
-from osm_mon.core.message_bus_client import MessageBusClient
-from osm_mon.core.response import ResponseBuilder
-from osm_mon.server.service import ServerService
-
-log = logging.getLogger(__name__)
-
-
-class Server:
-    def __init__(self, config: Config):
-        self.conf = config
-        self.msg_bus = MessageBusClient(config)
-        self.service = ServerService(config)
-        self.service.populate_prometheus()
-
-    def run(self):
-        asyncio.run(self.start())
-
-    async def start(self, wait_time=5):
-        topics = ["alarm_request"]
-        while True:
-            try:
-                await self.msg_bus.aioread(topics, self._process_msg)
-                break
-            except Exception as e:
-                # Failed to subscribe to kafka topic
-                log.error("Error when subscribing to topic(s) %s", str(topics))
-                log.exception("Exception %s", str(e))
-                # Wait for some time for kaka to stabilize and then reattempt to subscribe again
-                time.sleep(wait_time)
-                log.info("Retrying to subscribe the kafka topic(s) %s", str(topics))
-
-    async def _process_msg(self, topic, key, values):
-        log.info("Message arrived: %s", values)
-        try:
-            if topic == "alarm_request":
-                if key == "create_alarm_request":
-                    alarm_details = values["alarm_create_request"]
-                    cor_id = alarm_details["correlation_id"]
-                    response_builder = ResponseBuilder()
-                    try:
-                        alarm = self.service.create_alarm(
-                            alarm_details["alarm_name"],
-                            alarm_details["threshold_value"],
-                            alarm_details["operation"].lower(),
-                            alarm_details["severity"].lower(),
-                            alarm_details["statistic"].lower(),
-                            alarm_details["metric_name"],
-                            alarm_details["action"],
-                            alarm_details["tags"],
-                        )
-                        response = response_builder.generate_response(
-                            "create_alarm_response",
-                            cor_id=cor_id,
-                            status=True,
-                            alarm_id=alarm.uuid,
-                        )
-                    except Exception:
-                        log.exception("Error creating alarm: ")
-                        response = response_builder.generate_response(
-                            "create_alarm_response",
-                            cor_id=cor_id,
-                            status=False,
-                            alarm_id=None,
-                        )
-                    await self._publish_response(
-                        "alarm_response_" + str(cor_id),
-                        "create_alarm_response",
-                        response,
-                    )
-
-                if key == "delete_alarm_request":
-                    alarm_details = values["alarm_delete_request"]
-                    alarm_uuid = alarm_details["alarm_uuid"]
-                    response_builder = ResponseBuilder()
-                    cor_id = alarm_details["correlation_id"]
-                    try:
-                        self.service.delete_alarm(alarm_uuid)
-                        response = response_builder.generate_response(
-                            "delete_alarm_response",
-                            cor_id=cor_id,
-                            status=True,
-                            alarm_id=alarm_uuid,
-                        )
-                    except Exception:
-                        log.exception("Error deleting alarm: ")
-                        response = response_builder.generate_response(
-                            "delete_alarm_response",
-                            cor_id=cor_id,
-                            status=False,
-                            alarm_id=alarm_uuid,
-                        )
-                    await self._publish_response(
-                        "alarm_response_" + str(cor_id),
-                        "delete_alarm_response",
-                        response,
-                    )
-
-        except Exception:
-            log.exception("Exception processing message: ")
-
-    async def _publish_response(self, topic: str, key: str, msg: dict):
-        log.info(
-            "Sending response %s to topic %s with key %s", json.dumps(msg), topic, key
-        )
-        await self.msg_bus.aiowrite(topic, key, msg)
diff --git a/osm_mon/server/service.py b/osm_mon/server/service.py
deleted file mode 100755 (executable)
index 7bc6dfc..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import logging
-
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-from osm_mon.core.models import Alarm
-
-log = logging.getLogger(__name__)
-
-
-class ServerService:
-    def __init__(self, config: Config):
-        self.common_db = CommonDbClient(config)
-
-    def create_alarm(
-        self,
-        name: str,
-        threshold: float,
-        operation: str,
-        severity: str,
-        statistic: str,
-        metric_name: str,
-        action: str,
-        tags: dict,
-    ) -> Alarm:
-        log.debug("create_alarm")
-        alarm = Alarm(
-            name, severity, threshold, operation, statistic, metric_name, action, tags
-        )
-        self.common_db.create_alarm(alarm)
-        log.info("Alarm %s created", alarm.name)
-        return alarm
-
-    def delete_alarm(self, alarm_uuid: str) -> None:
-        log.debug("delete_alarm")
-        self.common_db.delete_alarm(alarm_uuid)
-        log.info("Alarm %s is deleted", alarm_uuid)
-
-    def populate_prometheus(self):
-        # This method can be executed infinite number of times
-        # without side-effects.
-        log.info("Setting up MON Exporter in prometheus")
-        result = self.common_db.common_db.set_one(
-            "prometheus_jobs",
-            {"job_name": "mon_exporter"},
-            {"job_name": "mon_exporter", "static_configs": [{"targets": ["mon:8000"]}]},
-            fail_on_empty=False,
-            upsert=True,
-        )
-        log.info("Prometheus Jobs added > {}".format(result))
diff --git a/osm_mon/tests/unit/collector/__init__.py b/osm_mon/tests/unit/collector/__init__.py
deleted file mode 100644 (file)
index 4450364..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
diff --git a/osm_mon/tests/unit/collector/test_collector.py b/osm_mon/tests/unit/collector/test_collector.py
deleted file mode 100644 (file)
index 4a3e859..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import unittest
-
-from osm_mon.core.config import Config
-
-
-class CollectorTest(unittest.TestCase):
-    def setUp(self):
-        super().setUp()
-        self.config = Config()
-
-    def tearDown(self):
-        super().tearDown()
diff --git a/osm_mon/tests/unit/collector/test_collector_service.py b/osm_mon/tests/unit/collector/test_collector_service.py
deleted file mode 100644 (file)
index d3cd395..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-from unittest import TestCase, mock
-
-from osm_mon.collector.service import CollectorService
-from osm_mon.collector.vnf_collectors.openstack import OpenstackCollector
-from osm_mon.collector.vnf_collectors.vio import VIOCollector
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-from osm_mon.collector.service import init_session
-
-
-@mock.patch.object(CommonDbClient, "__init__", lambda *args, **kwargs: None)
-class CollectorServiceTest(TestCase):
-    def setUp(self):
-        super().setUp()
-        self.config = Config()
-        mock_vim_session = mock.MagicMock()
-        init_session(mock_vim_session)
-
-    @mock.patch.object(OpenstackCollector, "__init__", lambda *args, **kwargs: None)
-    @mock.patch.object(OpenstackCollector, "collect")
-    @mock.patch.object(CommonDbClient, "get_vim_account")
-    def test_init_vim_collector_and_collect_openstack(self, _get_vim_account, collect):
-        _get_vim_account.return_value = {"vim_type": "openstack"}
-        collector = CollectorService(self.config)
-        collector._collect_vim_metrics(self.config, {}, "test_vim_account_id")
-        collect.assert_called_once_with({})
-
-    @mock.patch.object(OpenstackCollector, "collect")
-    @mock.patch.object(CommonDbClient, "get_vim_account")
-    def test_init_vim_collector_and_collect_unknown(
-        self, _get_vim_account, openstack_collect
-    ):
-        _get_vim_account.return_value = {"vim_type": "unknown"}
-        collector = CollectorService(self.config)
-        collector._collect_vim_metrics(self.config, {}, "test_vim_account_id")
-        openstack_collect.assert_not_called()
-
-    @mock.patch.object(OpenstackCollector, "__init__", lambda *args, **kwargs: None)
-    @mock.patch.object(OpenstackCollector, "collect")
-    @mock.patch.object(CommonDbClient, "get_vim_account")
-    def test_init_vim_collector_and_collect_vio_with_openstack_collector(
-        self, _get_vim_account, openstack_collect
-    ):
-        _get_vim_account.return_value = {
-            "vim_type": "openstack",
-            "config": {"vim_type": "VIO"},
-        }
-        collector = CollectorService(self.config)
-        collector._collect_vim_metrics(self.config, {}, "test_vim_account_id")
-        openstack_collect.assert_called_once_with({})
-
-    @mock.patch.object(VIOCollector, "__init__", lambda *args, **kwargs: None)
-    @mock.patch.object(VIOCollector, "collect")
-    @mock.patch.object(CommonDbClient, "get_vim_account")
-    def test_init_vim_collector_and_collect_vio_with_vrops_collector(
-        self, _get_vim_account, vio_collect
-    ):
-        _get_vim_account.return_value = {
-            "vim_type": "openstack",
-            "config": {"vim_type": "VIO", "vrops_site": "https://vrops"},
-        }
-        collector = CollectorService(self.config)
-        collector._collect_vim_metrics(self.config, {}, "test_vim_account_id")
-        vio_collect.assert_called_once_with({})
-
-    @mock.patch("osm_mon.collector.service.VCACollector", autospec=True)
-    def test_collect_vca_metrics(self, vca_collector):
-        collector = CollectorService(self.config)
-        collector._collect_vca_metrics(self.config, {})
-        vca_collector.assert_called_once_with(self.config)
-        vca_collector.return_value.collect.assert_called_once_with({})
diff --git a/osm_mon/tests/unit/collector/utils/__init__.py b/osm_mon/tests/unit/collector/utils/__init__.py
deleted file mode 100644 (file)
index 4ce2d84..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-# #
diff --git a/osm_mon/tests/unit/collector/utils/test_openstack.py b/osm_mon/tests/unit/collector/utils/test_openstack.py
deleted file mode 100644 (file)
index 989c486..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-# #
-from unittest import TestCase, mock
-
-from osm_mon.collector.utils.openstack import OpenstackUtils
-from osm_mon.core.exceptions import CertificateNotCreated
-
-
-@mock.patch("osm_mon.collector.utils.openstack.session")
-class OpenstackUtilsTest(TestCase):
-    def setUp(self):
-        super().setUp()
-
-    def test_session_without_insecure(self, mock_session):
-        creds = {
-            "config": {},
-            "vim_url": "url",
-            "vim_user": "user",
-            "vim_password": "password",
-            "vim_tenant_name": "tenant_name",
-        }
-        OpenstackUtils.get_session(creds)
-
-        mock_session.Session.assert_called_once_with(
-            auth=mock.ANY, verify=True, timeout=10
-        )
-
-    def test_session_with_insecure(self, mock_session):
-        creds = {
-            "config": {"insecure": True},
-            "vim_url": "url",
-            "vim_user": "user",
-            "vim_password": "password",
-            "vim_tenant_name": "tenant_name",
-        }
-        OpenstackUtils.get_session(creds)
-
-        mock_session.Session.assert_called_once_with(
-            auth=mock.ANY, verify=False, timeout=10
-        )
-
-    def test_session_with_insecure_false(self, mock_session):
-        creds = {
-            "config": {"insecure": False},
-            "vim_url": "url",
-            "vim_user": "user",
-            "vim_password": "password",
-            "vim_tenant_name": "tenant_name",
-        }
-        OpenstackUtils.get_session(creds)
-        mock_session.Session.assert_called_once_with(
-            auth=mock.ANY, verify=True, timeout=10
-        )
-
-    @mock.patch("osm_mon.collector.utils.openstack.OpenstackUtils._create_file_cert")
-    def test_session_with_ca_cert_content(self, mock_create_file_cert, mock_session):
-        creds = {
-            "_id": "1234",
-            "config": {"ca_cert_content": "test"},
-            "vim_url": "url",
-            "vim_user": "user",
-            "vim_password": "password",
-            "vim_tenant_name": "tenant_name",
-        }
-        mock_create_file_cert.return_value = {"ca_cert": "testfile"}
-        OpenstackUtils.get_session(creds)
-        mock_session.Session.assert_called_once_with(
-            auth=mock.ANY, verify="testfile", timeout=10
-        )
-
-    @mock.patch("osm_mon.collector.utils.openstack.makedirs", return_value="")
-    @mock.patch("osm_mon.collector.utils.openstack.path")
-    def test_create_file_cert(self, mock_path, mock_makedirs, mock_session):
-        vim_config = {"ca_cert_content": "test"}
-        target_id = "1234"
-        mock_path.isdir.return_value = False
-
-        with mock.patch("builtins.open", mock.mock_open()) as mocked_file:
-            OpenstackUtils._create_file_cert(vim_config, target_id)
-            mock_makedirs.assert_called_once_with("/app/osm_mon/certs/1234")
-            mocked_file.assert_called_once_with(
-                f"/app/osm_mon/certs/{target_id}/ca_cert", "w"
-            )
-            assert vim_config["ca_cert"] == f"/app/osm_mon/certs/{target_id}/ca_cert"
-
-    @mock.patch("osm_mon.collector.utils.openstack.makedirs")
-    @mock.patch("osm_mon.collector.utils.openstack.path")
-    def test_create_file_cert_exists(self, mock_path, mock_makedirs, mock_session):
-        vim_config = {"ca_cert_content": "test"}
-        target_id = "1234"
-        mock_path.isdir.return_value = True
-
-        with mock.patch("builtins.open", mock.mock_open()) as mocked_file:
-            OpenstackUtils._create_file_cert(vim_config, target_id)
-            mock_makedirs.assert_not_called()
-            mocked_file.assert_called_once_with(
-                f"/app/osm_mon/certs/{target_id}/ca_cert", "w"
-            )
-            assert vim_config["ca_cert"] == f"/app/osm_mon/certs/{target_id}/ca_cert"
-
-    @mock.patch("osm_mon.collector.utils.openstack.makedirs", side_effect=Exception)
-    @mock.patch("osm_mon.collector.utils.openstack.path")
-    def test_create_file_cert_makedirs_except(
-        self, mock_path, mock_makedirs, mock_session
-    ):
-        vim_config = {"ca_cert_content": "test"}
-        target_id = "1234"
-        mock_path.isdir.return_value = False
-
-        with mock.patch("builtins.open", mock.mock_open()) as mocked_file:
-            with self.assertRaises(CertificateNotCreated):
-                OpenstackUtils._create_file_cert(vim_config, target_id)
-            mock_makedirs.assert_called_once_with("/app/osm_mon/certs/1234")
-            mocked_file.assert_not_called()
-            assert vim_config["ca_cert_content"] == "test"
-
-    @mock.patch("osm_mon.collector.utils.openstack.makedirs", return_value="")
-    @mock.patch("osm_mon.collector.utils.openstack.path")
-    def test_create_file_cert_open_excepts(
-        self, mock_path, mock_makedirs, mock_session
-    ):
-        vim_config = {"ca_cert_content": "test"}
-        target_id = "1234"
-        mock_path.isdir.return_value = False
-
-        with mock.patch("builtins.open", mock.mock_open()) as mocked_file:
-            mocked_file.side_effect = Exception
-            with self.assertRaises(CertificateNotCreated):
-                OpenstackUtils._create_file_cert(vim_config, target_id)
-            mock_makedirs.assert_called_once_with("/app/osm_mon/certs/1234")
-            mocked_file.assert_called_once_with(
-                f"/app/osm_mon/certs/{target_id}/ca_cert", "w"
-            )
-            assert vim_config["ca_cert_content"] == "test"
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/__init__.py b/osm_mon/tests/unit/collector/vnf_collectors/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/test_openstack.py b/osm_mon/tests/unit/collector/vnf_collectors/test_openstack.py
deleted file mode 100644 (file)
index 0b4f4a7..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-
-# pylint: disable=E1101
-
-import datetime
-from unittest import TestCase, mock
-
-import gnocchiclient
-
-from osm_mon.collector.vnf_collectors.openstack import GnocchiBackend
-from osm_mon.core.config import Config
-
-
-class CollectorTest(TestCase):
-    def setUp(self):
-        super().setUp()
-        self.config = Config()
-
-    def tearDown(self):
-        super().tearDown()
-
-    @mock.patch.object(GnocchiBackend, "_build_neutron_client")
-    @mock.patch.object(GnocchiBackend, "_build_gnocchi_client")
-    def test_collect_gnocchi_rate_instance(self, build_gnocchi_client, _):
-        mock_gnocchi_client = mock.Mock()
-        mock_gnocchi_client.metric = mock.Mock()
-        mock_vim_session = mock.Mock()
-        mock_gnocchi_client.metric.get_measures.return_value = [
-            (
-                datetime.datetime(
-                    2019,
-                    4,
-                    12,
-                    15,
-                    43,
-                    tzinfo=datetime.timezone(datetime.timedelta(0), "+00:00"),
-                ),
-                60.0,
-                0.0345442539,
-            ),
-            (
-                datetime.datetime(
-                    2019,
-                    4,
-                    12,
-                    15,
-                    44,
-                    tzinfo=datetime.timezone(datetime.timedelta(0), "+00:00"),
-                ),
-                60.0,
-                600000000,
-            ),
-        ]
-        build_gnocchi_client.return_value = mock_gnocchi_client
-
-        backend = GnocchiBackend({"_id": "test_uuid"}, mock_vim_session)
-        value = backend._collect_instance_metric("cpu", "test_resource_id")
-        self.assertEqual(value, 1.0)
-        mock_gnocchi_client.metric.get_measures.assert_called_once_with(
-            "cpu",
-            aggregation="rate:mean",
-            start=mock.ANY,
-            resource_id="test_resource_id",
-        )
-
-    @mock.patch.object(GnocchiBackend, "_build_neutron_client")
-    @mock.patch.object(GnocchiBackend, "_build_gnocchi_client")
-    def test_collect_gnocchi_non_rate_instance(self, build_gnocchi_client, _):
-        mock_gnocchi_client = mock.Mock()
-        mock_vim_session = mock.Mock()
-        mock_gnocchi_client.metric.get_measures.return_value = [
-            (
-                datetime.datetime(
-                    2019,
-                    4,
-                    12,
-                    15,
-                    43,
-                    tzinfo=datetime.timezone(datetime.timedelta(0), "+00:00"),
-                ),
-                60.0,
-                0.0345442539,
-            ),
-            (
-                datetime.datetime(
-                    2019,
-                    4,
-                    12,
-                    15,
-                    44,
-                    tzinfo=datetime.timezone(datetime.timedelta(0), "+00:00"),
-                ),
-                60.0,
-                128,
-            ),
-        ]
-        build_gnocchi_client.return_value = mock_gnocchi_client
-
-        backend = GnocchiBackend({"_id": "test_uuid"}, mock_vim_session)
-        value = backend._collect_instance_metric("memory.usage", "test_resource_id")
-        self.assertEqual(value, 128)
-        mock_gnocchi_client.metric.get_measures.assert_called_once_with(
-            "memory.usage",
-            aggregation=None,
-            start=mock.ANY,
-            resource_id="test_resource_id",
-        )
-
-    @mock.patch.object(GnocchiBackend, "_build_neutron_client")
-    @mock.patch.object(GnocchiBackend, "_build_gnocchi_client")
-    def test_collect_gnocchi_no_metric(self, build_gnocchi_client, _):
-        mock_gnocchi_client = mock.Mock()
-        mock_vim_session = mock.Mock()
-        mock_gnocchi_client.metric.get_measures.side_effect = (
-            gnocchiclient.exceptions.NotFound()
-        )
-        build_gnocchi_client.return_value = mock_gnocchi_client
-
-        backend = GnocchiBackend({"_id": "test_uuid"}, mock_vim_session)
-        value = backend._collect_instance_metric("memory.usage", "test_resource_id")
-        self.assertIsNone(value)
-        mock_gnocchi_client.metric.get_measures.assert_called_once_with(
-            "memory.usage",
-            aggregation=None,
-            start=mock.ANY,
-            resource_id="test_resource_id",
-        )
-
-    @mock.patch.object(GnocchiBackend, "_build_neutron_client")
-    @mock.patch.object(GnocchiBackend, "_build_gnocchi_client")
-    def test_collect_interface_all_metric(
-        self, build_gnocchi_client, build_neutron_client
-    ):
-        mock_gnocchi_client = mock.Mock()
-        mock_vim_session = mock.Mock()
-        mock_gnocchi_client.resource.search.return_value = [
-            {"id": "test_id_1"},
-            {"id": "test_id_2"},
-        ]
-        mock_gnocchi_client.metric.get_measures.return_value = [
-            (
-                datetime.datetime(
-                    2019,
-                    4,
-                    12,
-                    15,
-                    43,
-                    tzinfo=datetime.timezone(datetime.timedelta(0), "+00:00"),
-                ),
-                60.0,
-                0.0345442539,
-            ),
-            (
-                datetime.datetime(
-                    2019,
-                    4,
-                    12,
-                    15,
-                    44,
-                    tzinfo=datetime.timezone(datetime.timedelta(0), "+00:00"),
-                ),
-                60.0,
-                0.0333070363,
-            ),
-        ]
-
-        build_gnocchi_client.return_value = mock_gnocchi_client
-
-        backend = GnocchiBackend({"_id": "test_uuid"}, mock_vim_session)
-        value = backend._collect_interface_all_metric(
-            "packets_received", "test_resource_id"
-        )
-        self.assertEqual(value, 0.0666140726)
-        mock_gnocchi_client.metric.get_measures.assert_any_call(
-            "packets_received", resource_id="test_id_1", limit=1
-        )
-        mock_gnocchi_client.metric.get_measures.assert_any_call(
-            "packets_received", resource_id="test_id_2", limit=1
-        )
-
-    @mock.patch.object(GnocchiBackend, "_build_neutron_client")
-    @mock.patch.object(GnocchiBackend, "_build_gnocchi_client")
-    def test_collect_instance_disk_metric(
-        self, build_gnocchi_client, build_neutron_client
-    ):
-        mock_gnocchi_client = mock.Mock()
-        mock_vim_session = mock.Mock()
-        mock_gnocchi_client.resource.search.return_value = [
-            {"id": "test_id"},
-        ]
-        mock_gnocchi_client.metric.get_measures.return_value = [
-            (
-                datetime.datetime(
-                    2019,
-                    4,
-                    12,
-                    15,
-                    43,
-                    tzinfo=datetime.timezone(datetime.timedelta(0), "+00:00"),
-                ),
-                60.0,
-                0.0225808,
-            ),
-            (
-                datetime.datetime(
-                    2019,
-                    4,
-                    12,
-                    15,
-                    44,
-                    tzinfo=datetime.timezone(datetime.timedelta(0), "+00:00"),
-                ),
-                60.0,
-                230848,
-            ),
-        ]
-
-        build_gnocchi_client.return_value = mock_gnocchi_client
-
-        backend = GnocchiBackend({"_id": "test_uuid"}, mock_vim_session)
-        value = backend._collect_instance_disk_metric(
-            "disk_read_bytes", "test_resource_id"
-        )
-        self.assertEqual(value, 230848)
-        mock_gnocchi_client.metric.get_measures.assert_any_call(
-            "disk_read_bytes", resource_id="test_id", limit=1
-        )
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/__init__.py b/osm_mon/tests/unit/collector/vnf_collectors/vmware/__init__.py
deleted file mode 100644 (file)
index 30d864e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# #
-# Copyright 2016-2019 VMware Inc.
-# This file is part of ETSI OSM
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact:  osslegalrouting@vmware.com
-# #
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/mock_http.py b/osm_mon/tests/unit/collector/vnf_collectors/vmware/mock_http.py
deleted file mode 100644 (file)
index 21145be..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright 2019 VMware
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to VMware
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: mbeierl@vmware.com
-# #
-
-import os
-import re
-
-
-def mock_http_response(
-    mocker,
-    method="GET",
-    site="https://vrops",
-    url_pattern="",
-    response_file="OK",
-    status_code=200,
-    exception=None,
-):
-    """Helper function to load a canned response from a file."""
-    with open(
-        os.path.join(os.path.dirname(__file__), "vmware_mocks", "%s" % response_file),
-        "r",
-    ) as f:
-        response = f.read()
-
-    matcher = re.compile(site + url_pattern)
-    if exception is None:
-        mocker.register_uri(method, matcher, text=response, status_code=status_code)
-    else:
-        mocker.register_uri(method, matcher, exc=exception)
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/osm_mocks/VNFD.json b/osm_mon/tests/unit/collector/vnf_collectors/vmware/osm_mocks/VNFD.json
deleted file mode 100644 (file)
index 6db19ed..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-{
-       "_copyright_comment": "Copyright 2016-2019 VMware Inc.  This file is part of ETSI OSM  All Rights Reserved. Licensed under the Apache License, Version 2.0 (the 'License'); you may  not use this file except in compliance with the License. You may obtain a copy of the License at   http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. For those usages not covered by the Apache License, Version 2.0 please contact:  osslegalrouting@vmware.com",
-       "_id": "cb0da948-7bce-474d-bbcb-6bfce545d397",
-       "id": "ubuntu_vdu_alarm_vnf",
-       "_admin": {
-               "created": 1562374395.5216513,
-               "modified": 1562374395.5216513,
-               "onboardingState": "ONBOARDED",
-               "operationalState": "ENABLED",
-               "projects_read": [
-                       "775be778-0f51-495a-b865-a23ab20a080f"
-               ],
-               "projects_write": [
-                       "775be778-0f51-495a-b865-a23ab20a080f"
-               ],
-               "storage": {
-                       "descriptor": "cirros_vnf/cirros_vdu_alarm_vnfd.yaml",
-                       "folder": "cb0da948-7bce-474d-bbcb-6bfce545d397",
-                       "fs": "local",
-                       "path": "/app/storage/",
-                       "pkg-dir": "cirros_vnf",
-                       "zipfile": "package.tar.gz"
-               },
-               "type": "vnfd",
-               "usageState": "NOT_IN_USE",
-               "userDefinedData": {
-               }
-       },
-       "product-name": "ubuntu_vdu_alarm_vnf",
-       "version": "1.0",
-       "vdu": [
-               {
-                       "id": "ubuntu_vnfd-VM",
-                       "name": "ubuntu_vnfd-VM",
-                       "int-cpd": [
-                               {
-                                       "virtual-network-interface-requirement": [
-                                               {
-                                                       "name": "vdu-eth0"
-                                               }
-                                       ],
-                                       "id": "vdu-eth0-int"
-                               }
-                       ],
-                       "virtual-compute-desc": "ubuntu_vnfd-VM-compute",
-                       "virtual-storage-desc": [
-                               "ubuntu_vnfd-VM-storage"
-                       ],
-                       "sw-image-desc": "ubuntu",
-                       "monitoring-parameter": [
-                               {
-                                       "id": "ubuntu_vnf_cpu_util",
-                                       "name": "ubuntu_vnf_cpu_util",
-                                       "performance-metric": "cpu_utilization"
-                               },
-                               {
-                                       "id": "ubuntu_vnf_average_memory_utilization",
-                                       "name": "ubuntu_vnf_average_memory_utilization",
-                                       "performance-metric": "average_memory_utilization"
-                               },
-                               {
-                                       "id": "ubuntu_vnf_packets_sent",
-                                       "name": "ubuntu_vnf_packets_sent",
-                                       "performance-metric": "packets_sent"
-                               },
-                               {
-                                       "id": "ubuntu_vnf_packets_received",
-                                       "name": "ubuntu_vnf_packets_received",
-                                       "performance-metric": "packets_received"
-                               },
-                               {
-                                       "id": "ubuntu_vnf_disk_read_ops",
-                                       "name": "ubuntu_vnf_disk_read_ops",
-                                       "performance-metric": "disk_read_ops"
-                               },
-                               {
-                                       "id": "ubuntu_vnf_disk_write_ops",
-                                       "name": "ubuntu_vnf_disk_write_ops",
-                                       "performance-metric": "disk_write_ops"
-                               },
-                               {
-                                       "id": "ubuntu_vnf_disk_read_bytes",
-                                       "name": "ubuntu_vnf_disk_read_bytes",
-                                       "performance-metric": "disk_read_bytes"
-                               },
-                               {
-                                       "id": "ubuntu_vnf_disk_write_bytes",
-                                       "name": "ubuntu_vnf_disk_write_bytes",
-                                       "performance-metric": "disk_write_bytes"
-                               },
-                               {
-                                       "id": "ubuntu_vnf_packets_out_dropped",
-                                       "name": "ubuntu_vnf_packets_out_dropped",
-                                       "performance-metric": "packets_out_dropped"
-                               },
-                               {
-                                       "id": "ubuntu_vnf_packets_in_dropped",
-                                       "name": "ubuntu_vnf_packets_in_dropped",
-                                       "performance-metric": "packets_in_dropped"
-                               }
-                       ],
-                       "alarm": [
-                               {
-                                       "alarm-id": "alarm-1",
-                                       "vnf-monitoring-param-ref": "ubuntu_vnf_cpu_util",
-                                       "actions": {
-                                               "ok": [
-                                                       {
-                                                               "url": "https://webhook.site/e65ad8a0-53b5-4d7f-bd50-c1a50b260871"
-                                                       }
-                                               ],
-                                               "insufficient-data": [
-                                                       {
-                                                               "url": "https://webhook.site/e65ad8a0-53b5-4d7f-bd50-c1a50b260871"
-                                                       }
-                                               ],
-                                               "alarm": [
-                                                       {
-                                                               "url": "https://webhook.site/e65ad8a0-53b5-4d7f-bd50-c1a50b260871"
-                                                       }
-                                               ]
-                                       },
-                                       "operation": "LT",
-                                       "value": "20.0000"
-                               }
-                       ]
-               }
-       ],
-       "virtual-compute-desc": [
-               {
-                       "id": "ubuntu_vnfd-VM-compute",
-                       "virtual-cpu": {
-                               "num-virtual-cpu": 4
-                       },
-                       "virtual-memory": {
-                               "size": 4
-                       }
-               }
-       ],
-       "virtual-storage-desc": [
-               {
-                       "id": "ubuntu_vnfd-VM-storage",
-                       "size-of-storage": 20
-               }
-       ],
-       "sw-image-desc": [
-               {
-                       "id": "ubuntu",
-                       "name": "ubuntu",
-                       "image": "ubuntu"
-               }
-       ],
-       "ext-cpd": [
-               {
-                       "int-cpd": {
-                               "vdu-id": "ubuntu_vnfd-VM",
-                               "cpd": "vdu-eth0-int"
-                       },
-                       "id": "vnf-cp0-ext"
-               }
-       ],
-       "df": [
-               {
-                       "id": "default-df",
-                       "vdu-profile": [
-                               {
-                                       "id": "ubuntu_vnfd-VM",
-                                       "min-number-of-instances": 1,
-                                       "max-number-of-instances": 2
-                               }
-                       ],
-                       "instantiation-level": [
-                               {
-                                       "id": "default-instantiation-level",
-                                       "vdu-level": [
-                                               {
-                                                       "vdu-id": "ubuntu_vnfd-VM",
-                                                       "number-of-instances": 1
-                                               }
-                                       ]
-                               }
-                       ],
-                       "scaling-aspect": [
-                               {
-                                       "id": "cpu_autoscaling_descriptor",
-                                       "name": "cpu_autoscaling_descriptor",
-                                       "max-scale-level": 1,
-                                       "aspect-delta-details": {
-                                               "deltas": [
-                                                       {
-                                                               "id": "vdu_autoscale-delta",
-                                                               "vdu-delta": [
-                                                                       {
-                                                                               "id": "ubuntu_vnfd-VM",
-                                                                               "number-of-instances": 1
-                                                                       }
-                                                               ]
-                                                       }
-                                               ]
-                                       },
-                                       "scaling-policy": [
-                                               {
-                                                       "name": "cpu_scaling_policy",
-                                                       "scaling-type": "automatic",
-                                                       "threshold-time": 10,
-                                                       "cooldown-time": 120,
-                                                       "scaling-criteria": [
-                                                               {
-                                                                       "name": "cpu_autoscaling_criteria",
-                                                                       "scale-in-threshold": "20.0000000000",
-                                                                       "scale-in-relational-operation": "LT",
-                                                                       "scale-out-threshold": "80.0000000000",
-                                                                       "scale-out-relational-operation": "GT",
-                                                                       "vnf-monitoring-param-ref": "ubuntu_vnf_cpu_util"
-                                                               }
-                                                       ]
-                                               }
-                                       ]
-                               }
-                       ]
-               }
-       ],
-       "description": "Simple Ubuntu VNF with metric collectors and scaling group",
-       "mgmt-cp": "vnf-cp0-ext"
-}
\ No newline at end of file
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/osm_mocks/VNFR.json b/osm_mon/tests/unit/collector/vnf_collectors/vmware/osm_mocks/VNFR.json
deleted file mode 100644 (file)
index 2583c8e..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-{
-       "_copyright_comment": "Copyright 2016-2019 VMware Inc.  This file is part of ETSI OSM  All Rights Reserved. Licensed under the Apache License, Version 2.0 (the 'License'); you may  not use this file except in compliance with the License. You may obtain a copy of the License at   http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. For those usages not covered by the Apache License, Version 2.0 please contact:  osslegalrouting@vmware.com",
-       "_admin": {
-               "created": 1563297813.7205596,
-               "modified": 1563297813.7205596,
-               "projects_read": [
-                       "775be778-0f51-495a-b865-a23ab20a080f"
-               ],
-               "projects_write": [
-                       "775be778-0f51-495a-b865-a23ab20a080f"
-               ]
-       },
-       "_id": "a3ec20d6-a47d-4459-ac17-65391424856b",
-       "additionalParamsForVnf": null,
-       "connection-point": [
-               {
-                       "connection-point-id": null,
-                       "id": null,
-                       "name": "eth0"
-               }
-       ],
-       "created-time": 1563297813.7185328,
-       "id": "a3ec20d6-a47d-4459-ac17-65391424856b",
-       "ip-address": "172.21.6.152",
-       "member-vnf-index-ref": "1",
-       "nsr-id-ref": "5915fddf-519a-4235-b18a-41997d76bca0",
-       "vdur": [
-               {
-                       "_id": "66f70869-8c11-48b6-bd48-95312832ea67",
-                       "count-index": 0,
-                       "interfaces": [
-                               {
-                                       "ip-address": "172.21.6.152",
-                                       "mac-address": "fa:16:3e:d2:22:5d",
-                                       "mgmt-vnf": true,
-                                       "name": "eth0",
-                                       "ns-vld-id": "ubuntu_nsd_vld1"
-                               }
-                       ],
-                       "internal-connection-point": [
-                       ],
-                       "ip-address": "172.21.6.152",
-                       "name": "vmware-scaling-1-ubuntu_vnfd-VM-1",
-                       "status": "ACTIVE",
-                       "status-detailed": null,
-                       "vdu-id-ref": "ubuntu_vnfd-VM",
-                       "vim-id": "VMWARE-UUID-VM-1"
-               },
-               {
-                       "_id": "a1e81bfc-5ded-4a72-9e26-6e1a5f91902a",
-                       "count-index": 1,
-                       "interfaces": [
-                               {
-                                       "ip-address": "172.21.6.163",
-                                       "mac-address": "fa:16:3e:b8:9e:7c",
-                                       "mgmt-vnf": true,
-                                       "name": "eth0",
-                                       "ns-vld-id": "ubuntu_nsd_vld1"
-                               }
-                       ],
-                       "internal-connection-point": [
-                       ],
-                       "ip-address": "172.21.6.163",
-                       "name": "vmware-scaling-1-ubuntu_vnfd-VM-2",
-                       "status": "ACTIVE",
-                       "status-detailed": null,
-                       "vdu-id-ref": "ubuntu_vnfd-VM",
-                       "vim-id": "VMWARE-UUID-VM-2"
-               }
-       ],
-       "vim-account-id": "1fc05d6c-2b8b-483e-8d59-f65d658ccfc1",
-       "vnfd-id": "cb0da948-7bce-474d-bbcb-6bfce545d397",
-       "vnfd-ref": "ubuntu_vdu_alarm_vnf"
-}
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/test_vcd_collector.py b/osm_mon/tests/unit/collector/vnf_collectors/vmware/test_vcd_collector.py
deleted file mode 100644 (file)
index adb84c7..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-# -*- coding: utf-8 -*-
-# #
-# Copyright 2016-2019 VMware Inc.
-# This file is part of ETSI OSM
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact:  osslegalrouting@vmware.com
-# #
-
-from osm_mon.collector.vnf_collectors.vmware import VMwareCollector
-from osm_mon.core.config import Config
-from osm_mon.tests.unit.collector.vnf_collectors.vmware.mock_http import (
-    mock_http_response,
-)
-from unittest import TestCase, mock
-
-import json
-import os
-import requests_mock
-
-VIM_ACCOUNT = {
-    "vrops_site": "https://vrops",
-    "vrops_user": "",
-    "vrops_password": "",
-    "vim_url": "https://vcd",
-    "admin_username": "",
-    "admin_password": "",
-    "vim_uuid": "",
-}
-
-
-@mock.patch.object(VMwareCollector, "get_vm_moref_id", spec_set=True, autospec=True)
-class CollectorTest(TestCase):
-    @mock.patch.object(VMwareCollector, "get_vim_account", spec_set=True, autospec=True)
-    @mock.patch("osm_mon.collector.vnf_collectors.vmware.CommonDbClient")
-    def setUp(self, mock_db, mock_get_vim_account):
-        super().setUp()
-        mock_vim_session = mock.Mock()
-        mock_get_vim_account.return_value = VIM_ACCOUNT
-        self.collector = VMwareCollector(
-            Config(), "9de6df67-b820-48c3-bcae-ee4838c5c5f4", mock_vim_session
-        )
-        self.mock_db = mock_db
-        with open(
-            os.path.join(os.path.dirname(__file__), "osm_mocks", "VNFR.json"), "r"
-        ) as f:
-            self.vnfr = json.load(f)
-        with open(
-            os.path.join(os.path.dirname(__file__), "osm_mocks", "VNFD.json"), "r"
-        ) as f:
-            self.vnfd = json.load(f)
-
-    def tearDown(self):
-        super().tearDown()
-
-    def test_collect_cpu_and_memory(self, mock_vm_moref_id):
-        mock_vm_moref_id.return_value = "VMWARE-OID-VM-1"
-        self.vnfd["vdu"][0]["monitoring-parameter"] = [
-            {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"},
-            {
-                "id": "ubuntu_vnf_average_memory_utilization",
-                "performance-metric": "average_memory_utilization",
-            },
-        ]
-        self.mock_db.return_value.get_vnfd.return_value = self.vnfd
-
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources\\?resourceKind=VirtualMachine",
-                response_file="vrops_resources.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-            metrics = self.collector.collect(self.vnfr)
-        self.assertEqual(len(metrics), 2, "Number of metrics returned")
-        self.assertEqual(metrics[0].name, "cpu_utilization", "First metric name")
-        self.assertEqual(metrics[0].value, 100.0, "CPU metric value")
-        self.assertEqual(
-            metrics[1].name, "average_memory_utilization", "Second metric name"
-        )
-        self.assertEqual(metrics[1].value, 20.515941619873047, "Memory metric value")
-
-    def test_collect_no_moref(self, mock_vm_moref_id):
-        mock_vm_moref_id.return_value = None
-        self.mock_db.return_value.get_vnfd.return_value = self.vnfd
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources\\?resourceKind=VirtualMachine",
-                response_file="404.txt",
-                status_code=404,
-            )
-            metrics = self.collector.collect(self.vnfr)
-        self.assertEqual(len(metrics), 0, "Number of metrics returned")
-
-    def test_collect_no_monitoring_param(self, _):
-        self.vnfd["vdu"][0]["monitoring-parameter"] = []
-        self.mock_db.return_value.get_vnfd.return_value = self.vnfd
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources\\?resourceKind=VirtualMachine",
-                response_file="vrops_resources.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-            metrics = self.collector.collect(self.vnfr)
-        self.assertEqual(len(metrics), 0, "Number of metrics returned")
-
-    def test_collect_empty_monitoring_param(self, _):
-        del self.vnfd["vdu"][0]["monitoring-parameter"]
-        self.mock_db.return_value.get_vnfd.return_value = self.vnfd
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources\\?resourceKind=VirtualMachine",
-                response_file="vrops_resources.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-            metrics = self.collector.collect(self.vnfr)
-        self.assertEqual(len(metrics), 0, "Number of metrics returned")
-
-    def test_collect_no_name(self, _):
-        del self.vnfr["vdur"][0]["name"]
-        del self.vnfr["vdur"][1]["name"]
-        self.mock_db.return_value.get_vnfd.return_value = self.vnfd
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources\\?resourceKind=VirtualMachine",
-                response_file="vrops_resources.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-            metrics = self.collector.collect(self.vnfr)
-        self.assertEqual(len(metrics), 0, "Number of metrics returned")
-
-
-class VApp_Details_Test(TestCase):
-    @mock.patch.object(VMwareCollector, "get_vim_account", spec_set=True, autospec=True)
-    @mock.patch("osm_mon.collector.vnf_collectors.vmware.CommonDbClient")
-    def setUp(self, mock_db, mock_get_vim_account):
-        super().setUp()
-        self.mock_db = mock_db
-        mock_vim_session = mock.Mock()
-        mock_get_vim_account.return_value = VIM_ACCOUNT
-        self.collector = VMwareCollector(
-            Config(), "9de6df67-b820-48c3-bcae-ee4838c5c5f4", mock_vim_session
-        )
-
-    def tearDown(self):
-        super().tearDown()
-
-    @mock.patch("osm_mon.collector.vnf_collectors.vmware.Client")
-    def test_get_vapp_details(self, mock_vcd_client):
-        mock_vcd_client.return_value._session.headers = {"x-vcloud-authorization": ""}
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                site="https://vcd",
-                url_pattern="/api/vApp/.*",
-                response_file="vcd_vapp_response.xml",
-            )
-            response = self.collector.get_vapp_details_rest("")
-        self.assertDictContainsSubset(
-            {"vm_vcenter_info": {"vm_moref_id": "vm-4055"}},
-            response,
-            "Managed object reference id incorrect",
-        )
-
-    def test_no_admin_connect(self):
-        response = self.collector.get_vapp_details_rest("")
-        self.assertDictEqual(
-            response, {}, "Failed to connect should return empty dictionary"
-        )
-
-    def test_no_id(self):
-        response = self.collector.get_vapp_details_rest()
-        self.assertDictEqual(
-            response, {}, "No id supplied should return empty dictionary"
-        )
-
-    @mock.patch("osm_mon.collector.vnf_collectors.vmware.Client")
-    def test_get_vapp_details_404(self, mock_vcd_client):
-        mock_vcd_client.return_value._session.headers = {"x-vcloud-authorization": ""}
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                site="https://vcd",
-                url_pattern="/api/vApp/.*",
-                response_file="404.txt",
-                status_code=404,
-            )
-            response = self.collector.get_vapp_details_rest("")
-        self.assertDictEqual(response, {}, "HTTP error should return empty dictionary")
-
-    @mock.patch("osm_mon.collector.vnf_collectors.vmware.Client")
-    def test_get_vapp_details_xml_parse_error(self, mock_vcd_client):
-        mock_vcd_client.return_value._session.headers = {"x-vcloud-authorization": ""}
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                site="https://vcd",
-                url_pattern="/api/vApp/.*",
-                response_file="404.txt",
-            )
-            response = self.collector.get_vapp_details_rest("")
-        self.assertDictEqual(
-            response, {}, "XML parse error should return empty dictionary"
-        )
-
-
-class Get_VM_Moref_Test(TestCase):
-    @mock.patch.object(VMwareCollector, "get_vim_account", spec_set=True, autospec=True)
-    @mock.patch("osm_mon.collector.vnf_collectors.vmware.CommonDbClient")
-    def setUp(self, mock_db, mock_get_vim_account):
-        super().setUp()
-        self.mock_db = mock_db
-        mock_vim_session = mock.Mock()
-        mock_get_vim_account.return_value = VIM_ACCOUNT
-        self.collector = VMwareCollector(
-            Config(), "9de6df67-b820-48c3-bcae-ee4838c5c5f4", mock_vim_session
-        )
-
-    def tearDown(self):
-        super().tearDown()
-
-    @mock.patch.object(
-        VMwareCollector, "get_vapp_details_rest", spec_set=True, autospec=True
-    )
-    def test_get_vm_moref_id(self, mock_vapp_details):
-        mock_vapp_details.return_value = {"vm_vcenter_info": {"vm_moref_id": "vm-4055"}}
-        response = self.collector.get_vm_moref_id("1234")
-        self.assertEqual(
-            response, "vm-4055", "Did not fetch correct ref id from dictionary"
-        )
-
-    @mock.patch.object(
-        VMwareCollector, "get_vapp_details_rest", spec_set=True, autospec=True
-    )
-    def test_get_vm_moref_bad_content(self, mock_vapp_details):
-        mock_vapp_details.return_value = {}
-        response = self.collector.get_vm_moref_id("1234")
-        self.assertEqual(
-            response, None, "Error fetching vapp details should return None"
-        )
-
-    @mock.patch.object(
-        VMwareCollector, "get_vapp_details_rest", spec_set=True, autospec=True
-    )
-    def test_get_vm_moref_has_exception(self, mock_vapp_details):
-        mock_vapp_details.side_effect = Exception("Testing")
-        response = self.collector.get_vm_moref_id("1234")
-        self.assertEqual(
-            response, None, "Exception while fetching vapp details should return None"
-        )
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/test_vio_collector.py b/osm_mon/tests/unit/collector/vnf_collectors/vmware/test_vio_collector.py
deleted file mode 100644 (file)
index 411a595..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-# -*- coding: utf-8 -*-
-# #
-# Copyright 2016-2019 VMware Inc.
-# This file is part of ETSI OSM
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact:  osslegalrouting@vmware.com
-# #
-
-from osm_mon.collector.vnf_collectors.vio import VIOCollector
-from osm_mon.core.config import Config
-from osm_mon.tests.unit.collector.vnf_collectors.vmware.mock_http import (
-    mock_http_response,
-)
-from unittest import TestCase, mock
-
-import json
-import os
-import requests_mock
-
-VIM_ACCOUNT = {
-    "vrops_site": "https://vrops",
-    "vrops_user": "",
-    "vrops_password": "",
-    "vim_url": "",
-    "admin_username": "",
-    "admin_password": "",
-    "vim_uuid": "",
-}
-
-
-class CollectorTest(TestCase):
-    @mock.patch.object(VIOCollector, "get_vim_account", spec_set=True, autospec=True)
-    @mock.patch("osm_mon.collector.vnf_collectors.vio.CommonDbClient")
-    def setUp(self, mock_db, mock_get_vim_account):
-        super().setUp()
-        self.mock_db = mock_db
-        mock_vim_session = mock.Mock()
-        mock_get_vim_account.return_value = VIM_ACCOUNT
-        self.collector = VIOCollector(
-            Config(), "9de6df67-b820-48c3-bcae-ee4838c5c5f4", mock_vim_session
-        )
-        with open(
-            os.path.join(os.path.dirname(__file__), "osm_mocks", "VNFR.json"), "r"
-        ) as f:
-            self.vnfr = json.load(f)
-        with open(
-            os.path.join(os.path.dirname(__file__), "osm_mocks", "VNFD.json"), "r"
-        ) as f:
-            self.vnfd = json.load(f)
-
-    def tearDown(self):
-        super().tearDown()
-
-    def test_collect_cpu_and_memory(self):
-        self.vnfd["vdu"][0]["monitoring-parameter"] = [
-            {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"},
-            {
-                "id": "ubuntu_vnf_average_memory_utilization",
-                "performance-metric": "average_memory_utilization",
-            },
-        ]
-        self.mock_db.return_value.get_vnfd.return_value = self.vnfd
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources\\?resourceKind=VirtualMachine",
-                response_file="vrops_resources.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-            metrics = self.collector.collect(self.vnfr)
-            self.assertEqual(len(metrics), 4, "Number of metrics returned")
-            self.assertEqual(metrics[0].name, "cpu_utilization", "First metric name")
-            self.assertEqual(metrics[0].value, 100.0, "CPU metric value")
-            self.assertEqual(
-                metrics[1].name, "average_memory_utilization", "Second metric name"
-            )
-            self.assertEqual(
-                metrics[1].value, 20.515941619873047, "Memory metric value"
-            )
-            self.assertEqual(metrics[2].name, "cpu_utilization", "First metric name")
-            self.assertEqual(metrics[2].value, 0.05400000140070915, "CPU metric value")
-            self.assertEqual(
-                metrics[3].name, "average_memory_utilization", "Second metric name"
-            )
-            self.assertEqual(metrics[3].value, 15.23439884185791, "Memory metric value")
-
-    def test_collect_no_monitoring_param(self):
-        self.vnfd["vdu"][0]["monitoring-parameter"] = []
-        self.mock_db.return_value.get_vnfd.return_value = self.vnfd
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources\\?resourceKind=VirtualMachine",
-                response_file="vrops_resources.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-            metrics = self.collector.collect(self.vnfr)
-            self.assertEqual(len(metrics), 0, "Number of metrics returned")
-
-    def test_collect_empty_monitoring_param(self):
-        del self.vnfd["vdu"][0]["monitoring-parameter"]
-        self.mock_db.return_value.get_vnfd.return_value = self.vnfd
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources\\?resourceKind=VirtualMachine",
-                response_file="vrops_resources.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-            metrics = self.collector.collect(self.vnfr)
-            self.assertEqual(len(metrics), 0, "Number of metrics returned")
-
-    def test_collect_no_name(self):
-        del self.vnfr["vdur"][0]["name"]
-        del self.vnfr["vdur"][1]["name"]
-        self.mock_db.return_value.get_vnfd.return_value = self.vnfd
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources\\?resourceKind=VirtualMachine",
-                response_file="vrops_resources.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-            metrics = self.collector.collect(self.vnfr)
-            self.assertEqual(len(metrics), 0, "Number of metrics returned")
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/test_vrops_helper.py b/osm_mon/tests/unit/collector/vnf_collectors/vmware/test_vrops_helper.py
deleted file mode 100644 (file)
index db8b28a..0000000
+++ /dev/null
@@ -1,434 +0,0 @@
-# -*- coding: utf-8 -*-
-# #
-# Copyright 2016-2019 VMware Inc.
-# This file is part of ETSI OSM
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact:  osslegalrouting@vmware.com
-# #
-
-from osm_mon.collector.vnf_collectors.vrops.vrops_helper import vROPS_Helper
-from osm_mon.tests.unit.collector.vnf_collectors.vmware.mock_http import (
-    mock_http_response,
-)
-from unittest import TestCase
-
-import json
-import os
-import requests_mock
-
-
-class vROPS_Helper_Resource_List_Test(TestCase):
-    def setUp(self):
-        super().setUp()
-        self.vrops = vROPS_Helper()
-
-    def tearDown(self):
-        super().tearDown()
-
-    def test_get_vm_resource_list_from_vrops(self):
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources\\?resourceKind=VirtualMachine",
-                response_file="vrops_resources.json",
-            )
-            resource_list = self.vrops.get_vm_resource_list_from_vrops()
-            self.assertEqual(
-                len(resource_list),
-                3,
-                "List of resources from canned vrops_resources.json",
-            )
-
-    def test_get_vm_resource_list_from_vrops_http_404(self):
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources\\?resourceKind=VirtualMachine",
-                response_file="404.txt",
-                status_code=404,
-            )
-            resource_list = self.vrops.get_vm_resource_list_from_vrops()
-            self.assertEqual(len(resource_list), 0, "Should return an empty list")
-
-    def test_get_vm_resource_list_from_vrops_bad_json(self):
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources\\?resourceKind=VirtualMachine",
-                response_file="malformed.json",
-            )
-            resource_list = self.vrops.get_vm_resource_list_from_vrops()
-            self.assertEqual(len(resource_list), 0, "Should return an empty list")
-
-
-class vROPS_Helper_Get_Metrics_Test(TestCase):
-    def setUp(self):
-        super().setUp()
-        self.vrops = vROPS_Helper()
-        with open(
-            os.path.join(os.path.dirname(__file__), "osm_mocks", "VNFR.json"), "r"
-        ) as f:
-            self.vnfr = json.load(f)
-
-    def tearDown(self):
-        super().tearDown()
-
-    def test_collect_one_metric_only(self):
-        vdu_mappings = {
-            "VMWARE-OID-VM-1": {
-                "name": "vmware-scaling-1-ubuntu_vnfd-VM-2",
-                "vrops_id": "VROPS-UUID-1",
-            }
-        }
-        monitoring_params = [
-            {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"},
-        ]
-
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-
-            metrics = self.vrops.get_metrics(vdu_mappings, monitoring_params, self.vnfr)
-        self.assertEqual(len(metrics), 1, "Number of metrics returned")
-        self.assertEqual(metrics[0].name, "cpu_utilization", "First metric name")
-        self.assertEqual(metrics[0].value, 100.0, "CPU metric value")
-
-    def test_collect_cpu_and_memory(self):
-        vdu_mappings = {
-            "VMWARE-OID-VM-1": {
-                "name": "vmware-scaling-1-ubuntu_vnfd-VM-2",
-                "vrops_id": "VROPS-UUID-1",
-            }
-        }
-        monitoring_params = [
-            {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"},
-            {
-                "id": "ubuntu_vnf_average_memory_utilization",
-                "performance-metric": "average_memory_utilization",
-            },
-        ]
-
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-
-            metrics = self.vrops.get_metrics(vdu_mappings, monitoring_params, self.vnfr)
-
-        self.assertEqual(len(metrics), 2, "Number of metrics returned")
-        self.assertEqual(metrics[0].name, "cpu_utilization", "First metric name")
-        self.assertEqual(metrics[0].value, 100.0, "CPU metric value")
-        self.assertEqual(
-            metrics[1].name, "average_memory_utilization", "Second metric name"
-        )
-        self.assertEqual(metrics[1].value, 20.515941619873047, "Memory metric value")
-
-    def test_collect_adjusted_metric(self):
-        vdu_mappings = {
-            "VMWARE-OID-VM-1": {
-                "name": "vmware-scaling-1-ubuntu_vnfd-VM-2",
-                "vrops_id": "VROPS-UUID-1",
-            }
-        }
-        monitoring_params = [
-            {"id": "ubuntu_vnf_cpu_util", "performance-metric": "disk_read_bytes"}
-        ]
-
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-
-            metrics = self.vrops.get_metrics(vdu_mappings, monitoring_params, self.vnfr)
-
-        self.assertEqual(len(metrics), 1, "Number of metrics returned")
-        self.assertEqual(metrics[0].name, "disk_read_bytes", "First metric name")
-        self.assertEqual(metrics[0].value, 10240.0, "Disk read bytes (not KB/s)")
-
-    def test_collect_not_provided_metric(self):
-        vdu_mappings = {
-            "VMWARE-OID-VM-1": {
-                "name": "vmware-scaling-1-ubuntu_vnfd-VM-2",
-                "vrops_id": "VROPS-UUID-1",
-            }
-        }
-        monitoring_params = [
-            {
-                "id": "cirros_vnf_packets_sent",
-                "performance-metric": "packets_in_dropped",
-            },
-        ]
-
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-
-            metrics = self.vrops.get_metrics(vdu_mappings, monitoring_params, self.vnfr)
-
-        self.assertEqual(len(metrics), 0, "Number of metrics returned")
-
-    def test_collect_unkown_metric(self):
-        vdu_mappings = {
-            "VMWARE-OID-VM-1": {
-                "name": "vmware-scaling-1-ubuntu_vnfd-VM-2",
-                "vrops_id": "VROPS-UUID-1",
-            }
-        }
-        monitoring_params = [
-            {"id": "cirros_vnf-Unknown_Metric", "performance-metric": "unknown"},
-        ]
-
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-
-            metrics = self.vrops.get_metrics(vdu_mappings, monitoring_params, self.vnfr)
-
-        self.assertEqual(len(metrics), 0, "Number of metrics returned")
-
-    def test_collect_vrops_no_data(self):
-        vdu_mappings = {
-            "VMWARE-OID-VM-1": {
-                "name": "vmware-scaling-1-ubuntu_vnfd-VM-2",
-                "vrops_id": "VROPS-UUID-1",
-            }
-        }
-        monitoring_params = [
-            {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"},
-        ]
-
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="OK.json",
-            )
-
-            metrics = self.vrops.get_metrics(vdu_mappings, monitoring_params, self.vnfr)
-
-        self.assertEqual(len(metrics), 0, "Number of metrics returned")
-
-    def test_collect_vrops_unknown_vim_id(self):
-        vdu_mappings = {
-            "VMWARE-OID-VM-1": {"name": "vmware-scaling-1-ubuntu_vnfd-VM-2"}
-        }
-        monitoring_params = [
-            {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"},
-        ]
-
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-
-            metrics = self.vrops.get_metrics(vdu_mappings, monitoring_params, self.vnfr)
-
-        self.assertEqual(len(metrics), 0, "Number of metrics returned")
-
-    def test_collect_vrops_http_error(self):
-        vdu_mappings = {
-            "VMWARE-OID-VM-1": {
-                "name": "vmware-scaling-1-ubuntu_vnfd-VM-2",
-                "vrops_id": "VROPS-UUID-1",
-            }
-        }
-        monitoring_params = [
-            {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"},
-        ]
-
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="404.txt",
-                status_code=404,
-            )
-
-            metrics = self.vrops.get_metrics(vdu_mappings, monitoring_params, self.vnfr)
-
-        self.assertEqual(len(metrics), 0, "Number of metrics returned")
-
-    def test_collect_vrops_json_parse_error(self):
-        vdu_mappings = {
-            "VMWARE-OID-VM-1": {
-                "name": "vmware-scaling-1-ubuntu_vnfd-VM-2",
-                "vrops_id": "VROPS-UUID-1",
-            }
-        }
-        monitoring_params = [
-            {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"},
-        ]
-
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="404.txt",
-            )
-
-            metrics = self.vrops.get_metrics(vdu_mappings, monitoring_params, self.vnfr)
-
-        self.assertEqual(len(metrics), 0, "Number of metrics returned")
-
-    def test_collect_multi_vdu(self):
-        vdu_mappings = {
-            "VMWARE-UUID-VM-1": {
-                "name": "vmware-scaling-1-ubuntu_vnfd-VM-1",
-                "vrops_id": "VROPS-UUID-1",
-            },
-            "VMWARE-UUID-VM-2": {
-                "name": "vmware-scaling-1-ubuntu_vnfd-VM-2",
-                "vrops_id": "VROPS-UUID-2",
-            },
-            "VMWARE-UUID-VM-3": {
-                "name": "vmware-scaling-1-ubuntu_vnfd-VM-2",
-                "vrops_id": "VROPS-UUID-3",
-            },
-        }
-        monitoring_params = [
-            {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"},
-            {
-                "id": "ubuntu_vnf_average_memory_utilization",
-                "performance-metric": "average_memory_utilization",
-            },
-            {"id": "ubuntu_vnf_disk_read_ops", "performance-metric": "disk_read_ops"},
-            {"id": "ubuntu_vnf_disk_write_ops", "performance-metric": "disk_write_ops"},
-            {
-                "id": "ubuntu_vnf_disk_read_bytes",
-                "performance-metric": "disk_read_bytes",
-            },
-            {
-                "id": "ubuntu_vnf_disk_write_bytes",
-                "performance-metric": "disk_write_bytes",
-            },
-            {
-                "id": "ubuntu_vnf_packets_out_dropped",
-                "performance-metric": "packets_out_dropped",
-            },
-            {
-                "id": "ubuntu_vnf_packets_received",
-                "performance-metric": "packets_received",
-            },
-            {"id": "ubuntu_vnf_packets_sent", "performance-metric": "packets_sent"},
-        ]
-
-        with requests_mock.Mocker() as mock_requests:
-            mock_http_response(
-                mock_requests,
-                method="POST",
-                url_pattern="/suite-api/api/auth/token/acquire",
-                response_file="vrops_token.json",
-            )
-            mock_http_response(
-                mock_requests,
-                url_pattern="/suite-api/api/resources/stats.*",
-                response_file="vrops_multi.json",
-            )
-            metrics = self.vrops.get_metrics(vdu_mappings, monitoring_params, self.vnfr)
-
-        self.assertEqual(
-            len(metrics),
-            len(monitoring_params) * len(vdu_mappings),
-            "Number of metrics returned",
-        )
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/404.txt b/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/404.txt
deleted file mode 100644 (file)
index 4e38daa..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-404 NOT FOUND
-
- Copyright 2016-2019 VMware Inc.
- This file is part of ETSI OSM
- All Rights Reserved.
-
- Licensed under the Apache License, Version 2.0 (the "License"); you may
- not use this file except in compliance with the License. You may obtain
- a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- License for the specific language governing permissions and limitations
- under the License.
-
- For those usages not covered by the Apache License, Version 2.0 please
- contact:  osslegalrouting@vmware.com
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/OK.json b/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/OK.json
deleted file mode 100644 (file)
index cad20b3..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-       "_copyright_comment": "Copyright 2016-2019 VMware Inc.  This file is part of ETSI OSM  All Rights Reserved. Licensed under the Apache License, Version 2.0 (the 'License'); you may  not use this file except in compliance with the License. You may obtain a copy of the License at   http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. For those usages not covered by the Apache License, Version 2.0 please contact:  osslegalrouting@vmware.com"
-}
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/malformed.json b/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/malformed.json
deleted file mode 100644 (file)
index 9b3bf23..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-{
-       This is not valid JSON
-
- Copyright 2016-2019 VMware Inc.
- This file is part of ETSI OSM
- All Rights Reserved.
-
- Licensed under the Apache License, Version 2.0 (the "License"); you may
- not use this file except in compliance with the License. You may obtain
- a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- License for the specific language governing permissions and limitations
- under the License.
-
- For those usages not covered by the Apache License, Version 2.0 please
- contact:  osslegalrouting@vmware.com
-}
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/vcd_vapp_response.xml b/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/vcd_vapp_response.xml
deleted file mode 100644 (file)
index 5b1fd54..0000000
+++ /dev/null
@@ -1,521 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
- Copyright 2016-2019 VMware Inc.
- This file is part of ETSI OSM
- All Rights Reserved.
-
- Licensed under the Apache License, Version 2.0 (the "License"); you may
- not use this file except in compliance with the License. You may obtain
- a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- License for the specific language governing permissions and limitations
- under the License.
-
- For those usages not covered by the Apache License, Version 2.0 please
- contact:  osslegalrouting@vmware.com
--->
-<VApp xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:common="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:ovfenv="http://schemas.dmtf.org/ovf/environment/1" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:ns9="http://www.vmware.com/vcloud/versions" ovfDescriptorUploaded="true" deployed="true" status="4" name="MB-Ubuntu-1-ubuntu_vnfd-VM-1-c01293c4-e427-47fb-8e6c-694c9af660d3" id="urn:vcloud:vapp:80c8a597-5ed1-4b52-a8b6-e04945fd36b2" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2" type="application/vnd.vmware.vcloud.vApp+xml">
-    <Link rel="power:powerOff" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/power/action/powerOff"/>
-    <Link rel="power:reboot" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/power/action/reboot"/>
-    <Link rel="power:reset" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/power/action/reset"/>
-    <Link rel="power:shutdown" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/power/action/shutdown"/>
-    <Link rel="power:suspend" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/power/action/suspend"/>
-    <Link rel="deploy" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/action/deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml"/>
-    <Link rel="undeploy" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/action/undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml"/>
-    <Link rel="down" href="https://172.21.6.38/api/network/6d042159-d109-44e5-89e4-39a30ed8208f" name="vnf-mgmt" type="application/vnd.vmware.vcloud.vAppNetwork+xml"/>
-    <Link rel="down" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/controlAccess/" type="application/vnd.vmware.vcloud.controlAccess+xml"/>
-    <Link rel="controlAccess" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/action/controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml"/>
-    <Link rel="recompose" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/action/recomposeVApp" type="application/vnd.vmware.vcloud.recomposeVAppParams+xml"/>
-    <Link rel="enterMaintenanceMode" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/action/enterMaintenanceMode"/>
-    <Link rel="up" href="https://172.21.6.38/api/vdc/a5771f81-471a-4cda-a02c-0b897ba49c51" type="application/vnd.vmware.vcloud.vdc+xml"/>
-    <Link rel="edit" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2" type="application/vnd.vmware.vcloud.vApp+xml"/>
-    <Link rel="down" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/owner" type="application/vnd.vmware.vcloud.owner+xml"/>
-    <Link rel="down" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/metadata" type="application/vnd.vmware.vcloud.metadata+xml"/>
-    <Link rel="ovf" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/ovf" type="text/xml"/>
-    <Link rel="down" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/productSections/" type="application/vnd.vmware.vcloud.productSections+xml"/>
-    <Link rel="snapshot:create" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/action/createSnapshot" type="application/vnd.vmware.vcloud.createSnapshotParams+xml"/>
-    <Description>Vapp instantiation</Description>
-    <LeaseSettingsSection href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/leaseSettingsSection/" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" ovf:required="false">
-        <ovf:Info>Lease settings section</ovf:Info>
-        <Link rel="edit" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/leaseSettingsSection/" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"/>
-        <DeploymentLeaseInSeconds>604800</DeploymentLeaseInSeconds>
-        <StorageLeaseInSeconds>172800</StorageLeaseInSeconds>
-        <DeploymentLeaseExpiration>2019-07-31T21:22:09.915Z</DeploymentLeaseExpiration>
-    </LeaseSettingsSection>
-    <ovf:StartupSection xmlns:ns10="http://www.vmware.com/vcloud/v1.5" ns10:type="application/vnd.vmware.vcloud.startupSection+xml" ns10:href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/startupSection/">
-        <ovf:Info>VApp startup section</ovf:Info>
-        <ovf:Item ovf:id="ubuntu" ovf:order="0" ovf:startAction="powerOn" ovf:startDelay="0" ovf:stopAction="powerOff" ovf:stopDelay="0"/>
-        <Link rel="edit" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/startupSection/" type="application/vnd.vmware.vcloud.startupSection+xml"/>
-    </ovf:StartupSection>
-    <ovf:NetworkSection xmlns:ns10="http://www.vmware.com/vcloud/v1.5" ns10:type="application/vnd.vmware.vcloud.networkSection+xml" ns10:href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/networkSection/">
-        <ovf:Info>The list of logical networks</ovf:Info>
-        <ovf:Network ovf:name="vnf-mgmt">
-            <ovf:Description></ovf:Description>
-        </ovf:Network>
-    </ovf:NetworkSection>
-    <NetworkConfigSection href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/networkConfigSection/" type="application/vnd.vmware.vcloud.networkConfigSection+xml" ovf:required="false">
-        <ovf:Info>The configuration parameters for logical networks</ovf:Info>
-        <Link rel="edit" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/networkConfigSection/" type="application/vnd.vmware.vcloud.networkConfigSection+xml"/>
-        <NetworkConfig networkName="vnf-mgmt">
-            <VCloudExtension required="false">
-                <vmext:VimObjectRef>
-                    <vmext:VimServerRef href="https://172.21.6.38/api/admin/extension/vimServer/116d2935-59fc-4702-876c-a417436caec7" id="urn:vcloud:vimserver:116d2935-59fc-4702-876c-a417436caec7" type="application/vnd.vmware.admin.vmwvirtualcenter+xml"/>
-                    <vmext:MoRef>dvportgroup-956</vmext:MoRef>
-                    <vmext:VimObjectType>DV_PORTGROUP</vmext:VimObjectType>
-                </vmext:VimObjectRef>
-            </VCloudExtension>
-            <Link rel="repair" href="https://172.21.6.38/api/admin/network/6d042159-d109-44e5-89e4-39a30ed8208f/action/reset"/>
-            <Description></Description>
-            <Configuration>
-                <IpScopes>
-                    <IpScope>
-                        <IsInherited>true</IsInherited>
-                        <Gateway>172.21.6.130</Gateway>
-                        <Netmask>255.255.255.128</Netmask>
-                        <SubnetPrefixLength>25</SubnetPrefixLength>
-                        <Dns1>172.21.6.10</Dns1>
-                        <DnsSuffix>corp.local</DnsSuffix>
-                        <IsEnabled>true</IsEnabled>
-                        <IpRanges>
-                            <IpRange>
-<StartAddress>172.21.6.175</StartAddress>
-<EndAddress>172.21.6.198</EndAddress>
-                            </IpRange>
-                        </IpRanges>
-                    </IpScope>
-                </IpScopes>
-                <ParentNetwork href="https://172.21.6.38/api/admin/network/6412df5b-340c-4949-b843-da0fa29af418" id="6412df5b-340c-4949-b843-da0fa29af418" name="vnf-mgmt"/>
-                <FenceMode>bridged</FenceMode>
-                <RetainNetInfoAcrossDeployments>false</RetainNetInfoAcrossDeployments>
-            </Configuration>
-            <IsDeployed>true</IsDeployed>
-        </NetworkConfig>
-    </NetworkConfigSection>
-    <SnapshotSection href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2/snapshotSection" type="application/vnd.vmware.vcloud.snapshotSection+xml" ovf:required="false">
-        <ovf:Info>Snapshot information section</ovf:Info>
-    </SnapshotSection>
-    <DateCreated>2019-07-24T21:20:41.929Z</DateCreated>
-    <Owner type="application/vnd.vmware.vcloud.owner+xml">
-        <User href="https://172.21.6.38/api/admin/user/e2686eea-0a8e-4c59-a52c-4a9826d5a12b" name="orgadmin" type="application/vnd.vmware.admin.user+xml"/>
-    </Owner>
-    <autoNature>false</autoNature>
-    <InMaintenanceMode>false</InMaintenanceMode>
-    <Children>
-        <Vm needsCustomization="false" nestedHypervisorEnabled="false" deployed="true" status="4" name="ubuntu" id="urn:vcloud:vm:a1022e38-05e9-404d-b6ff-d6b896cec1bc" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc" type="application/vnd.vmware.vcloud.vm+xml">
-            <VCloudExtension required="false">
-                <vmext:VmVimInfo>
-                    <vmext:VmVimObjectRef>
-                        <vmext:VimServerRef href="https://172.21.6.38/api/admin/extension/vimServer/116d2935-59fc-4702-876c-a417436caec7" id="urn:vcloud:vimserver:116d2935-59fc-4702-876c-a417436caec7" name="Hive VC" type="application/vnd.vmware.admin.vmwvirtualcenter+xml"/>
-                        <vmext:MoRef>vm-4055</vmext:MoRef>
-                        <vmext:VimObjectType>VIRTUAL_MACHINE</vmext:VimObjectType>
-                    </vmext:VmVimObjectRef>
-                    <vmext:DatastoreVimObjectRef>
-                        <vmext:VimServerRef href="https://172.21.6.38/api/admin/extension/vimServer/116d2935-59fc-4702-876c-a417436caec7" id="urn:vcloud:vimserver:116d2935-59fc-4702-876c-a417436caec7" name="Hive VC" type="application/vnd.vmware.admin.vmwvirtualcenter+xml"/>
-                        <vmext:MoRef>datastore-936</vmext:MoRef>
-                        <vmext:VimObjectType>DATASTORE</vmext:VimObjectType>
-                    </vmext:DatastoreVimObjectRef>
-                    <vmext:VmDiskDatastores instanceId="2000">
-                        <vmext:VimServerRef href="https://172.21.6.38/api/admin/extension/vimServer/116d2935-59fc-4702-876c-a417436caec7" id="urn:vcloud:vimserver:116d2935-59fc-4702-876c-a417436caec7" name="Hive VC" type="application/vnd.vmware.admin.vmwvirtualcenter+xml"/>
-                        <vmext:MoRef>datastore-936</vmext:MoRef>
-                        <vmext:VimObjectType>DATASTORE</vmext:VimObjectType>
-                    </vmext:VmDiskDatastores>
-                    <vmext:HostVimObjectRef>
-                        <vmext:VimServerRef href="https://172.21.6.38/api/admin/extension/vimServer/116d2935-59fc-4702-876c-a417436caec7" id="urn:vcloud:vimserver:116d2935-59fc-4702-876c-a417436caec7" name="Hive VC" type="application/vnd.vmware.admin.vmwvirtualcenter+xml"/>
-                        <vmext:MoRef>host-13</vmext:MoRef>
-                        <vmext:VimObjectType>HOST</vmext:VimObjectType>
-                    </vmext:HostVimObjectRef>
-                    <vmext:VirtualDisksMaxChainLength>2</vmext:VirtualDisksMaxChainLength>
-                </vmext:VmVimInfo>
-            </VCloudExtension>
-            <Link rel="power:powerOff" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/power/action/powerOff"/>
-            <Link rel="power:reboot" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/power/action/reboot"/>
-            <Link rel="power:reset" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/power/action/reset"/>
-            <Link rel="power:shutdown" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/power/action/shutdown"/>
-            <Link rel="power:suspend" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/power/action/suspend"/>
-            <Link rel="undeploy" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/action/undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml"/>
-            <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc" type="application/vnd.vmware.vcloud.vm+xml"/>
-            <Link rel="down" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/metadata" type="application/vnd.vmware.vcloud.metadata+xml"/>
-            <Link rel="down" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/complianceResult" type="application/vnd.vmware.vm.complianceResult+xml"/>
-            <Link rel="down" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/productSections/" type="application/vnd.vmware.vcloud.productSections+xml"/>
-            <Link rel="down" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/metrics/current" type="application/vnd.vmware.vcloud.metrics.currentUsageSpec+xml"/>
-            <Link rel="metrics" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/metrics/current" type="application/vnd.vmware.vcloud.metrics.currentUsageSpec+xml"/>
-            <Link rel="down" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/metrics/historic" type="application/vnd.vmware.vcloud.metrics.historicUsageSpec+xml"/>
-            <Link rel="metrics" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/metrics/historic" type="application/vnd.vmware.vcloud.metrics.historicUsageSpec+xml"/>
-            <Link rel="screen:thumbnail" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/screen"/>
-            <Link rel="screen:acquireTicket" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/screen/action/acquireTicket" type="application/vnd.vmware.vcloud.screenTicket+xml"/>
-            <Link rel="screen:acquireMksTicket" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/screen/action/acquireMksTicket" type="application/vnd.vmware.vcloud.mksTicket+xml"/>
-            <Link rel="media:insertMedia" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/media/action/insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"/>
-            <Link rel="media:ejectMedia" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/media/action/ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"/>
-            <Link rel="disk:attach" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/disk/action/attach" type="application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml"/>
-            <Link rel="disk:detach" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/disk/action/detach" type="application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml"/>
-            <Link rel="installVmwareTools" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/action/installVMwareTools"/>
-            <Link rel="relocate" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/action/relocate" type="application/vnd.vmware.vcloud.relocateVmParams+xml"/>
-            <Link rel="customizeAtNextPowerOn" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/action/customizeAtNextPowerOn"/>
-            <Link rel="reloadFromVc" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/action/reloadFromVc"/>
-            <Link rel="checkCompliance" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/action/checkCompliance"/>
-            <Link rel="snapshot:create" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/action/createSnapshot" type="application/vnd.vmware.vcloud.createSnapshotParams+xml"/>
-            <Link rel="reconfigureVm" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/action/reconfigureVm" name="ubuntu" type="application/vnd.vmware.vcloud.vm+xml"/>
-            <Link rel="up" href="https://172.21.6.38/api/vApp/vapp-80c8a597-5ed1-4b52-a8b6-e04945fd36b2" type="application/vnd.vmware.vcloud.vApp+xml"/>
-            <Description></Description>
-            <ovf:VirtualHardwareSection xmlns:ns10="http://www.vmware.com/vcloud/v1.5" ovf:transport="" ns10:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" ns10:href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/">
-                <ovf:Info>Virtual hardware requirements</ovf:Info>
-                <ovf:System>
-                    <vssd:AutomaticRecoveryAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:AutomaticShutdownAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:AutomaticStartupAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:AutomaticStartupActionDelay xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:AutomaticStartupActionSequenceNumber xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:Caption xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:ChangeableType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:ConfigurationDataRoot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:ConfigurationFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:ConfigurationID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:ConfigurationName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:CreationTime xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:Description xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
-                    <vssd:Generation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:InstanceID>0</vssd:InstanceID>
-                    <vssd:LogDataRoot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:RecoveryFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:SnapshotDataRoot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:SuspendDataRoot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:SwapFileDataRoot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <vssd:VirtualSystemIdentifier>ubuntu</vssd:VirtualSystemIdentifier>
-                    <vssd:VirtualSystemType>vmx-14</vssd:VirtualSystemType>
-                </ovf:System>
-                <ovf:Item>
-                    <rasd:Address>00:50:56:03:01:86</rasd:Address>
-                    <rasd:AddressOnParent>0</rasd:AddressOnParent>
-                    <rasd:AllocationUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
-                    <rasd:AutomaticDeallocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Caption xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ChangeableType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ConfigurationName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Connection ns10:ipAddressingMode="DHCP" ns10:ipAddress="172.21.6.214" ns10:primaryNetworkConnection="true">vnf-mgmt</rasd:Connection>
-                    <rasd:ConsumerVisibility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Description>Vmxnet3 ethernet adapter on "vnf-mgmt"</rasd:Description>
-                    <rasd:ElementName>Network adapter 0</rasd:ElementName>
-                    <rasd:Generation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:InstanceID>1</rasd:InstanceID>
-                    <rasd:Limit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:MappingBehavior xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:OtherResourceType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Parent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:PoolID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Reservation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ResourceSubType>VMXNET3</rasd:ResourceSubType>
-                    <rasd:ResourceType>10</rasd:ResourceType>
-                    <rasd:VirtualQuantity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:VirtualQuantityUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Weight xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                </ovf:Item>
-                <ovf:Item>
-                    <rasd:Address>0</rasd:Address>
-                    <rasd:AddressOnParent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AllocationUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AutomaticAllocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AutomaticDeallocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Caption xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ChangeableType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ConfigurationName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ConsumerVisibility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Description>SCSI Controller</rasd:Description>
-                    <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
-                    <rasd:Generation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:InstanceID>2</rasd:InstanceID>
-                    <rasd:Limit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:MappingBehavior xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:OtherResourceType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Parent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:PoolID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Reservation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
-                    <rasd:ResourceType>6</rasd:ResourceType>
-                    <rasd:VirtualQuantity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:VirtualQuantityUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Weight xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                </ovf:Item>
-                <ovf:Item>
-                    <rasd:Address xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AddressOnParent>0</rasd:AddressOnParent>
-                    <rasd:AllocationUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AutomaticAllocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AutomaticDeallocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Caption xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ChangeableType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ConfigurationName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ConsumerVisibility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Description>Hard disk</rasd:Description>
-                    <rasd:ElementName>Hard disk 1</rasd:ElementName>
-                    <rasd:Generation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:HostResource ns10:storageProfileHref="https://172.21.6.38/api/vdcStorageProfile/a9dae5fb-43fd-4fdd-885d-87bb6532aa18" ns10:busType="6" ns10:busSubType="lsilogic" ns10:capacity="16384" ns10:iops="0" ns10:storageProfileOverrideVmDefault="false"></rasd:HostResource>
-                    <rasd:InstanceID>2000</rasd:InstanceID>
-                    <rasd:Limit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:MappingBehavior xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:OtherResourceType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Parent>2</rasd:Parent>
-                    <rasd:PoolID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Reservation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ResourceSubType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ResourceType>17</rasd:ResourceType>
-                    <rasd:VirtualQuantity>17179869184</rasd:VirtualQuantity>
-                    <rasd:VirtualQuantityUnits>byte</rasd:VirtualQuantityUnits>
-                    <rasd:Weight xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                </ovf:Item>
-                <ovf:Item>
-                    <rasd:Address>0</rasd:Address>
-                    <rasd:AddressOnParent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AllocationUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AutomaticAllocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AutomaticDeallocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Caption xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ChangeableType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ConfigurationName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ConsumerVisibility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Description>SATA Controller</rasd:Description>
-                    <rasd:ElementName>SATA Controller 0</rasd:ElementName>
-                    <rasd:Generation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:InstanceID>3</rasd:InstanceID>
-                    <rasd:Limit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:MappingBehavior xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:OtherResourceType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Parent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:PoolID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Reservation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ResourceSubType>vmware.sata.ahci</rasd:ResourceSubType>
-                    <rasd:ResourceType>20</rasd:ResourceType>
-                    <rasd:VirtualQuantity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:VirtualQuantityUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Weight xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                </ovf:Item>
-                <ovf:Item>
-                    <rasd:Address xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AddressOnParent>0</rasd:AddressOnParent>
-                    <rasd:AllocationUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
-                    <rasd:AutomaticDeallocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Caption xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ChangeableType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ConfigurationName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ConsumerVisibility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Description>CD/DVD Drive</rasd:Description>
-                    <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
-                    <rasd:Generation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:HostResource></rasd:HostResource>
-                    <rasd:InstanceID>16000</rasd:InstanceID>
-                    <rasd:Limit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:MappingBehavior xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:OtherResourceType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Parent>3</rasd:Parent>
-                    <rasd:PoolID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Reservation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ResourceSubType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ResourceType>15</rasd:ResourceType>
-                    <rasd:VirtualQuantity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:VirtualQuantityUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Weight xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                </ovf:Item>
-                <ovf:Item ns10:type="application/vnd.vmware.vcloud.rasdItem+xml" ns10:href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/cpu">
-                    <rasd:Address xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AddressOnParent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
-                    <rasd:AutomaticAllocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AutomaticDeallocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Caption xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ChangeableType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ConfigurationName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ConsumerVisibility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Description>Number of Virtual CPUs</rasd:Description>
-                    <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
-                    <rasd:Generation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:InstanceID>4</rasd:InstanceID>
-                    <rasd:Limit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:MappingBehavior xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:OtherResourceType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Parent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:PoolID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Reservation>0</rasd:Reservation>
-                    <rasd:ResourceSubType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ResourceType>3</rasd:ResourceType>
-                    <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
-                    <rasd:VirtualQuantityUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Weight>1000</rasd:Weight>
-                    <vmw:CoresPerSocket ovf:required="false">1</vmw:CoresPerSocket>
-                    <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/cpu" type="application/vnd.vmware.vcloud.rasdItem+xml"/>
-                </ovf:Item>
-                <ovf:Item ns10:type="application/vnd.vmware.vcloud.rasdItem+xml" ns10:href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/memory">
-                    <rasd:Address xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AddressOnParent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
-                    <rasd:AutomaticAllocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:AutomaticDeallocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Caption xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ChangeableType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ConfigurationName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ConsumerVisibility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Description>Memory Size</rasd:Description>
-                    <rasd:ElementName>1024 MB of memory</rasd:ElementName>
-                    <rasd:Generation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:InstanceID>5</rasd:InstanceID>
-                    <rasd:Limit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:MappingBehavior xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:OtherResourceType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Parent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:PoolID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Reservation>0</rasd:Reservation>
-                    <rasd:ResourceSubType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:ResourceType>4</rasd:ResourceType>
-                    <rasd:VirtualQuantity>1024</rasd:VirtualQuantity>
-                    <rasd:VirtualQuantityUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
-                    <rasd:Weight>10240</rasd:Weight>
-                    <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/memory" type="application/vnd.vmware.vcloud.rasdItem+xml"/>
-                </ovf:Item>
-                <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml"/>
-                <Link rel="down" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/cpu" type="application/vnd.vmware.vcloud.rasdItem+xml"/>
-                <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/cpu" type="application/vnd.vmware.vcloud.rasdItem+xml"/>
-                <Link rel="down" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/memory" type="application/vnd.vmware.vcloud.rasdItem+xml"/>
-                <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/memory" type="application/vnd.vmware.vcloud.rasdItem+xml"/>
-                <Link rel="down" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/disks" type="application/vnd.vmware.vcloud.rasdItemsList+xml"/>
-                <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/disks" type="application/vnd.vmware.vcloud.rasdItemsList+xml"/>
-                <Link rel="down" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/media" type="application/vnd.vmware.vcloud.rasdItemsList+xml"/>
-                <Link rel="down" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/networkCards" type="application/vnd.vmware.vcloud.rasdItemsList+xml"/>
-                <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/networkCards" type="application/vnd.vmware.vcloud.rasdItemsList+xml"/>
-                <Link rel="down" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/serialPorts" type="application/vnd.vmware.vcloud.rasdItemsList+xml"/>
-                <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/virtualHardwareSection/serialPorts" type="application/vnd.vmware.vcloud.rasdItemsList+xml"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="vmotion.checkpointSVGAPrimarySize" vmw:value="4194304"/>
-                <vmw:ExtraConfig ovf:required="true" vmw:key="pciBridge0.present" vmw:value="TRUE"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge6.functions" vmw:value="8"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="vmware.tools.internalversion" vmw:value="10304"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="vmware.tools.requiredversion" vmw:value="10338"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="sata0.pciSlotNumber" vmw:value="33"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="guestinfo.vmtools.buildNumber" vmw:value="7253323"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="sched.swap.derivedName" vmw:value="/vmfs/volumes/8e81a4eb-407b9e20/ubuntu-pDRI/ubuntu-pDRI-9ef8ca33.vswp"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge5.virtualDev" vmw:value="pcieRootPort"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="cloud.uuid" vmw:value="8bc8661d-5172-49d5-b2ec-c4808040a4f0"/>
-                <vmw:ExtraConfig ovf:required="true" vmw:key="pciBridge4.present" vmw:value="TRUE"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="nvram" vmw:value="ubuntu-pDRI.nvram"/>
-                <vmw:ExtraConfig ovf:required="true" vmw:key="pciBridge5.present" vmw:value="TRUE"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="tools.guest.desktop.autolock" vmw:value="FALSE"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge6.pciSlotNumber" vmw:value="23"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="guestinfo.vmtools.versionString" vmw:value="10.2.0"/>
-                <vmw:ExtraConfig ovf:required="true" vmw:key="pciBridge7.present" vmw:value="TRUE"/>
-                <vmw:ExtraConfig ovf:required="true" vmw:key="pciBridge6.present" vmw:value="TRUE"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge4.pciSlotNumber" vmw:value="21"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="guestinfo.vmtools.versionNumber" vmw:value="10304"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge6.virtualDev" vmw:value="pcieRootPort"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="migrate.migrationId" vmw:value="8827505165397353629"/>
-                <vmw:ExtraConfig ovf:required="true" vmw:key="hpet0.present" vmw:value="TRUE"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="migrate.hostLog" vmw:value="ubuntu-pDRI-7c665aaf.hlog"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="numa.autosize.cookie" vmw:value="10001"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge5.functions" vmw:value="8"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="monitor.phys_bits_used" vmw:value="43"/>
-                <vmw:ExtraConfig ovf:required="true" vmw:key="svga.present" vmw:value="TRUE"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge7.pciSlotNumber" vmw:value="24"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge0.pciSlotNumber" vmw:value="17"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="ethernet0.pciSlotNumber" vmw:value="160"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge7.functions" vmw:value="8"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="scsi0.pciSlotNumber" vmw:value="16"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge7.virtualDev" vmw:value="pcieRootPort"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="migrate.hostLogState" vmw:value="none"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge5.pciSlotNumber" vmw:value="22"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="guestinfo.vmtools.description" vmw:value="open-vm-tools 10.2.0 build 7253323"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="softPowerOff" vmw:value="FALSE"/>
-                <vmw:ExtraConfig ovf:required="true" vmw:key="svga.guestBackedPrimaryAware" vmw:value="TRUE"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="scsi0:0.redo" vmw:value=""/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="guestinfo.ovfEnv" vmw:value=""/>
-                <vmw:ExtraConfig ovf:required="true" vmw:key="numa.autosize.vcpu.maxPerVirtualNode" vmw:value="1"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="vmci0.pciSlotNumber" vmw:value="32"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge4.virtualDev" vmw:value="pcieRootPort"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="sched.cpu.latencySensitivity" vmw:value="normal"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge4.functions" vmw:value="8"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="guestinfo.gc.status" vmw:value="Successful"/>
-                <vmw:ExtraConfig ovf:required="false" vmw:key="vmotion.checkpointFBSize" vmw:value="4194304"/>
-            </ovf:VirtualHardwareSection>
-            <ovf:OperatingSystemSection xmlns:ns10="http://www.vmware.com/vcloud/v1.5" ovf:id="102" ns10:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="ubuntu64Guest" ns10:href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/operatingSystemSection/">
-                <ovf:Info>Specifies the operating system installed</ovf:Info>
-                <ovf:Description>Ubuntu Linux (64-bit)</ovf:Description>
-                <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/operatingSystemSection/" type="application/vnd.vmware.vcloud.operatingSystemSection+xml"/>
-            </ovf:OperatingSystemSection>
-            <NetworkConnectionSection href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/networkConnectionSection/" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" ovf:required="false">
-                <ovf:Info>Specifies the available VM network connections</ovf:Info>
-                <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
-                <NetworkConnection needsCustomization="false" network="vnf-mgmt">
-                    <NetworkConnectionIndex>0</NetworkConnectionIndex>
-                    <IpAddress>172.21.6.214</IpAddress>
-                    <IsConnected>true</IsConnected>
-                    <MACAddress>00:50:56:03:01:86</MACAddress>
-                    <IpAddressAllocationMode>DHCP</IpAddressAllocationMode>
-                    <NetworkAdapterType>VMXNET3</NetworkAdapterType>
-                </NetworkConnection>
-                <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/networkConnectionSection/" type="application/vnd.vmware.vcloud.networkConnectionSection+xml"/>
-            </NetworkConnectionSection>
-            <GuestCustomizationSection href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/guestCustomizationSection/" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" ovf:required="false">
-                <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
-                <Enabled>true</Enabled>
-                <ChangeSid>false</ChangeSid>
-                <VirtualMachineId>a1022e38-05e9-404d-b6ff-d6b896cec1bc</VirtualMachineId>
-                <JoinDomainEnabled>false</JoinDomainEnabled>
-                <UseOrgSettings>false</UseOrgSettings>
-                <AdminPasswordEnabled>false</AdminPasswordEnabled>
-                <AdminPasswordAuto>true</AdminPasswordAuto>
-                <AdminAutoLogonEnabled>false</AdminAutoLogonEnabled>
-                <AdminAutoLogonCount>0</AdminAutoLogonCount>
-                <ResetPasswordRequired>false</ResetPasswordRequired>
-                <ComputerName>ubuntu-001</ComputerName>
-                <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/guestCustomizationSection/" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"/>
-                <Link rel="down" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/guestcustomizationstatus/" type="application/vnd.vmware.vcloud.guestCustomizationStatusSection+xml"/>
-                <Link rel="down" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/checkpostcustomizationscript/" type="application/vnd.vmware.vcloud.vm.checkPostGuestCustomizationSection+xml"/>
-            </GuestCustomizationSection>
-            <RuntimeInfoSection xmlns:ns10="http://www.vmware.com/vcloud/v1.5" ns10:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" ns10:href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/runtimeInfoSection">
-                <ovf:Info>Specifies Runtime info</ovf:Info>
-                <VMWareTools version="10304"/>
-            </RuntimeInfoSection>
-            <SnapshotSection href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/snapshotSection" type="application/vnd.vmware.vcloud.snapshotSection+xml" ovf:required="false">
-                <ovf:Info>Snapshot information section</ovf:Info>
-            </SnapshotSection>
-            <DateCreated>2019-07-24T21:20:47.602Z</DateCreated>
-            <VAppScopedLocalId>ubuntu</VAppScopedLocalId>
-            <ovfenv:Environment xmlns:ve="http://www.vmware.com/schema/ovfenv" ovfenv:id="" ve:vCenterId="vm-4055">
-                <ovfenv:PlatformSection>
-                    <ovfenv:Kind>VMware ESXi</ovfenv:Kind>
-                    <ovfenv:Version>6.7.0</ovfenv:Version>
-                    <ovfenv:Vendor>VMware, Inc.</ovfenv:Vendor>
-                    <ovfenv:Locale>en</ovfenv:Locale>
-                </ovfenv:PlatformSection>
-                <ovfenv:PropertySection>
-                    <ovfenv:Property ovfenv:key="vCloud_UseSysPrep" ovfenv:value="None"/>
-                    <ovfenv:Property ovfenv:key="vCloud_bitMask" ovfenv:value="1"/>
-                    <ovfenv:Property ovfenv:key="vCloud_bootproto_0" ovfenv:value="dhcp"/>
-                    <ovfenv:Property ovfenv:key="vCloud_computerName" ovfenv:value="ubuntu-001"/>
-                    <ovfenv:Property ovfenv:key="vCloud_macaddr_0" ovfenv:value="00:50:56:03:01:86"/>
-                    <ovfenv:Property ovfenv:key="vCloud_markerid" ovfenv:value="32ef75ab-6ff8-494f-bade-208e3b5ff086"/>
-                    <ovfenv:Property ovfenv:key="vCloud_numnics" ovfenv:value="1"/>
-                    <ovfenv:Property ovfenv:key="vCloud_primaryNic" ovfenv:value="0"/>
-                    <ovfenv:Property ovfenv:key="vCloud_reconfigToken" ovfenv:value="300838675"/>
-                    <ovfenv:Property ovfenv:key="vCloud_resetPassword" ovfenv:value="0"/>
-                </ovfenv:PropertySection>
-                <ve:EthernetAdapterSection xmlns="http://schemas.dmtf.org/ovf/environment/1" xmlns:oe="http://schemas.dmtf.org/ovf/environment/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-                    <ve:Adapter ve:mac="00:50:56:03:01:86" ve:network="DP-VCD-External-102" ve:unitNumber="7"/>
-   </ve:EthernetAdapterSection>
-            </ovfenv:Environment>
-            <VmCapabilities href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/vmCapabilities/" type="application/vnd.vmware.vcloud.vmCapabilitiesSection+xml">
-                <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/vmCapabilities/" type="application/vnd.vmware.vcloud.vmCapabilitiesSection+xml"/>
-                <MemoryHotAddEnabled>false</MemoryHotAddEnabled>
-                <CpuHotAddEnabled>false</CpuHotAddEnabled>
-            </VmCapabilities>
-            <StorageProfile href="https://172.21.6.38/api/vdcStorageProfile/a9dae5fb-43fd-4fdd-885d-87bb6532aa18" id="urn:vcloud:vdcstorageProfile:a9dae5fb-43fd-4fdd-885d-87bb6532aa18" name="NFS Storage" type="application/vnd.vmware.vcloud.vdcStorageProfile+xml"/>
-            <BootOptions href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/bootOptions/" type="application/vnd.vmware.vcloud.bootOptionsSection+xml">
-                <Link rel="edit" href="https://172.21.6.38/api/vApp/vm-a1022e38-05e9-404d-b6ff-d6b896cec1bc/action/bootOptions" type="application/vnd.vmware.vcloud.bootOptionsSection+xml"/>
-                <BootDelay>0</BootDelay>
-                <EnterBIOSSetup>false</EnterBIOSSetup>
-            </BootOptions>
-        </Vm>
-    </Children>
-</VApp>
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/vrops_multi.json b/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/vrops_multi.json
deleted file mode 100644 (file)
index e11179f..0000000
+++ /dev/null
@@ -1,1490 +0,0 @@
-{
-       "_copyright_comment": "Copyright 2016-2019 VMware Inc.  This file is part of ETSI OSM  All Rights Reserved. Licensed under the Apache License, Version 2.0 (the 'License'); you may  not use this file except in compliance with the License. You may obtain a copy of the License at   http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. For those usages not covered by the Apache License, Version 2.0 please contact:  osslegalrouting@vmware.com",
-       "values": [
-               {
-                       "resourceId": "VROPS-UUID-1",
-                       "stat-list": {
-                               "stat": [
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk:aggregate of all instances|totalReadLatency_average"
-                                               },
-                                               "timestamps": [
-                                                       1561744712552,
-                                                       1561744772549,
-                                                       1561744832548,
-                                                       1561744892557
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       1.1373332738876343,
-                                                       1.1440000534057617,
-                                                       1.1239999532699585,
-                                                       100.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "cpu|usage_average"
-                                               },
-                                               "timestamps": [
-                                                       1561744712552,
-                                                       1561744772549,
-                                                       1561744832548,
-                                                       1561744892557
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       6.0,
-                                                       6.066666603088379,
-                                                       6.133333206176758,
-                                                       6.066666603088379
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk:aggregate of all instances|numberWriteAveraged_average"
-                                               },
-                                               "timestamps": [
-                                                       1561744712552,
-                                                       1561744772549,
-                                                       1561744832548,
-                                                       1561744892557
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk:aggregate of all instances|numberReadAveraged_average"
-                                               },
-                                               "timestamps": [
-                                                       1561744712552,
-                                                       1561744772549,
-                                                       1561744832548,
-                                                       1561744892557
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net|droppedTx_summation"
-                                               },
-                                               "timestamps": [
-                                                       1561744712552,
-                                                       1561744772549,
-                                                       1561744832548,
-                                                       1561744892557
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.20000000298023224,
-                                                       0.20000000298023224,
-                                                       0.20000000298023224,
-                                                       10.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk|read_average"
-                                               },
-                                               "timestamps": [
-                                                       1561744712552,
-                                                       1561744772549,
-                                                       1561744832548,
-                                                       1561744892557
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1561744712552,
-                                                       1561744772549,
-                                                       1561744832548,
-                                                       1561744892557
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       20.491540908813477,
-                                                       20.505388259887695,
-                                                       20.517423629760742,
-                                                       20.515941619873047
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "mem|usage_average"
-                                               },
-                                               "timestamps": [
-                                                       1561744712552,
-                                                       1561744772549,
-                                                       1561744832548,
-                                                       1561744892557
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk:aggregate of all instances|totalWriteLatency_average"
-                                               },
-                                               "timestamps": [
-                                                       1561744712552,
-                                                       1561744772549,
-                                                       1561744832548,
-                                                       1561744892557
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       46.266666412353516,
-                                                       46.599998474121094,
-                                                       46.93333435058594,
-                                                       46.86666488647461
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk|write_average"
-                                               },
-                                               "timestamps": [
-                                                       1561744712552,
-                                                       1561744772549,
-                                                       1561744832548,
-                                                       1561744892557
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1561744712552,
-                                                       1561744772549,
-                                                       1561744832548,
-                                                       1561744892557
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic5|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1561744712552,
-                                                       1561744772549,
-                                                       1561744832548,
-                                                       1561744892557
-                                               ]
-                                       }
-                               ]
-                       }
-               },
-               {
-                       "resourceId": "VROPS-UUID-2",
-                       "stat-list": {
-                               "stat": [
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic4|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic0|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic9|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic5|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.05400000140070915,
-                                                       0.05533333495259285,
-                                                       0.05400000140070915
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "cpu|usage_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic9|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk:scsi0:0|read_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk:aggregate of all instances|numberWriteAveraged_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic6|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic1|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk:scsi0:0|write_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic2|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic7|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk:aggregate of all instances|numberReadAveraged_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic2|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:4000|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic7|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic8|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic0|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net|droppedTx_summation"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic5|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk|read_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic3|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic3|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       15.234436988830566,
-                                                       15.23439884185791,
-                                                       15.23439884185791
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "mem|usage_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk|write_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:4000|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:4000|droppedTx_summation"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic8|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic1|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic4|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic6|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       }
-                               ]
-                       }
-               },
-               {
-                       "resourceId": "VROPS-UUID-3",
-                       "stat-list": {
-                               "stat": [
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic4|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic0|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic9|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic5|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0560000017285347,
-                                                       0.05400000140070915,
-                                                       0.052666667848825455
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "cpu|usage_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic9|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk:scsi0:0|read_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk:aggregate of all instances|numberWriteAveraged_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic6|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic1|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk:scsi0:0|write_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic2|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic7|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk:aggregate of all instances|numberReadAveraged_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic2|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:4000|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic7|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic8|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic0|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net|droppedTx_summation"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic5|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk|read_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic3|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic3|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       15.244717597961426,
-                                                       15.244698524475098,
-                                                       15.24467945098877
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "mem|usage_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "virtualDisk|write_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:4000|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:4000|droppedTx_summation"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic8|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic1|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic4|received_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       },
-                                       {
-                                               "data": [
-                                                       0.0,
-                                                       0.0,
-                                                       0.0
-                                               ],
-                                               "intervalUnit": {
-                                                       "quantifier": 1
-                                               },
-                                               "statKey": {
-                                                       "key": "net:vmnic6|transmitted_average"
-                                               },
-                                               "timestamps": [
-                                                       1563301072756,
-                                                       1563301132765,
-                                                       1563301192756
-                                               ]
-                                       }
-                               ]
-                       }
-               }
-       ]
-}
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/vrops_resources.json b/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/vrops_resources.json
deleted file mode 100644 (file)
index 1165740..0000000
+++ /dev/null
@@ -1,447 +0,0 @@
-{
-       "_copyright_comment": "Copyright 2016-2019 VMware Inc.  This file is part of ETSI OSM  All Rights Reserved. Licensed under the Apache License, Version 2.0 (the 'License'); you may  not use this file except in compliance with the License. You may obtain a copy of the License at   http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. For those usages not covered by the Apache License, Version 2.0 please contact:  osslegalrouting@vmware.com",
-       "links": [
-               {
-                       "href": "/suite-api/api/resources?resourceKind=VirtualMachine&amp;page=0&amp;pageSize=1000",
-                       "name": "current",
-                       "rel": "SELF"
-               },
-               {
-                       "href": "/suite-api/api/resources?resourceKind=VirtualMachine&amp;page=0&amp;pageSize=1000",
-                       "name": "first",
-                       "rel": "RELATED"
-               },
-               {
-                       "href": "/suite-api/api/resources?resourceKind=VirtualMachine&amp;page=0&amp;pageSize=1000",
-                       "name": "last",
-                       "rel": "RELATED"
-               }
-       ],
-       "pageInfo": {
-               "page": 0,
-               "pageSize": 1000,
-               "totalCount": 130
-       },
-       "resourceList": [
-               {
-                       "badges": [
-                               {
-                                       "color": "GREEN",
-                                       "score": 0.0,
-                                       "type": "RISK"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 100.0,
-                                       "type": "CAPACITY_REMAINING"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 100.0,
-                                       "type": "EFFICIENCY"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 0.0,
-                                       "type": "WORKLOAD"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 366.0,
-                                       "type": "TIME_REMAINING"
-                               },
-                               {
-                                       "color": "GREY",
-                                       "score": -1.0,
-                                       "type": "COMPLIANCE"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 100.0,
-                                       "type": "HEALTH"
-                               }
-                       ],
-                       "creationTime": 1559557138756,
-                       "dtEnabled": true,
-                       "identifier": "VROPS-UUID-1",
-                       "links": [
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982",
-                                       "name": "linkToSelf",
-                                       "rel": "SELF"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/relationships",
-                                       "name": "relationsOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/properties",
-                                       "name": "propertiesOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/alerts?resourceId=01ffd926-f8eb-4153-bb59-4d3da4ce7982",
-                                       "name": "alertsOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/symptoms?resourceId=01ffd926-f8eb-4153-bb59-4d3da4ce7982",
-                                       "name": "symptomsOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/statkeys",
-                                       "name": "statKeysOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/stats/latest",
-                                       "name": "latestStatsOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/properties",
-                                       "name": "latestPropertiesOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/credentials/",
-                                       "name": "credentialsOfResource",
-                                       "rel": "RELATED"
-                               }
-                       ],
-                       "relatedResources": [
-                       ],
-                       "resourceHealth": "GREEN",
-                       "resourceHealthValue": 100.0,
-                       "resourceKey": {
-                               "adapterKindKey": "VMWARE",
-                               "name": "52a28e3c-4e5b-4408-b8e3-7755a4222774-vc-HNILML",
-                               "resourceIdentifiers": [
-                                       {
-                                               "identifierType": {
-                                                       "dataType": "STRING",
-                                                       "isPartOfUniqueness": false,
-                                                       "name": "VMEntityInstanceUUID"
-                                               },
-                                               "value": "VMWARE-UUID-VM-1"
-                                       },
-                                       {
-                                               "identifierType": {
-                                                       "dataType": "STRING",
-                                                       "isPartOfUniqueness": false,
-                                                       "name": "VMEntityName"
-                                               },
-                                               "value": "52a28e3c-4e5b-4408-b8e3-7755a4222774-vc-HNILML"
-                                       },
-                                       {
-                                               "identifierType": {
-                                                       "dataType": "STRING",
-                                                       "isPartOfUniqueness": true,
-                                                       "name": "VMEntityObjectID"
-                                               },
-                                               "value": "VMWARE-OID-VM-1"
-                                       },
-                                       {
-                                               "identifierType": {
-                                                       "dataType": "STRING",
-                                                       "isPartOfUniqueness": true,
-                                                       "name": "VMEntityVCID"
-                                               },
-                                               "value": "1ec8501f-dce7-4e0b-8f8b-19ba7060d33c"
-                                       }
-                               ],
-                               "resourceKindKey": "VirtualMachine"
-                       },
-                       "resourceStatusStates": [
-                               {
-                                       "adapterInstanceId": "fcf7ba35-72f0-4d36-a12d-45a0c4065e17",
-                                       "resourceState": "STARTED",
-                                       "resourceStatus": "DATA_RECEIVING",
-                                       "statusMessage": ""
-                               }
-                       ]
-               },
-               {
-                       "badges": [
-                               {
-                                       "color": "GREEN",
-                                       "score": 0.0,
-                                       "type": "RISK"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 100.0,
-                                       "type": "CAPACITY_REMAINING"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 100.0,
-                                       "type": "EFFICIENCY"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 0.0,
-                                       "type": "WORKLOAD"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 366.0,
-                                       "type": "TIME_REMAINING"
-                               },
-                               {
-                                       "color": "GREY",
-                                       "score": -1.0,
-                                       "type": "COMPLIANCE"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 100.0,
-                                       "type": "HEALTH"
-                               }
-                       ],
-                       "creationTime": 1559557138756,
-                       "dtEnabled": true,
-                       "identifier": "VROPS-UUID-2",
-                       "links": [
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982",
-                                       "name": "linkToSelf",
-                                       "rel": "SELF"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/relationships",
-                                       "name": "relationsOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/properties",
-                                       "name": "propertiesOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/alerts?resourceId=01ffd926-f8eb-4153-bb59-4d3da4ce7982",
-                                       "name": "alertsOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/symptoms?resourceId=01ffd926-f8eb-4153-bb59-4d3da4ce7982",
-                                       "name": "symptomsOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/statkeys",
-                                       "name": "statKeysOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/stats/latest",
-                                       "name": "latestStatsOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/properties",
-                                       "name": "latestPropertiesOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/credentials/",
-                                       "name": "credentialsOfResource",
-                                       "rel": "RELATED"
-                               }
-                       ],
-                       "relatedResources": [
-                       ],
-                       "resourceHealth": "GREEN",
-                       "resourceHealthValue": 100.0,
-                       "resourceKey": {
-                               "adapterKindKey": "VMWARE",
-                               "name": "52a28e3c-4e5b-4408-b8e3-7755a4222774-vc-HNILML",
-                               "resourceIdentifiers": [
-                                       {
-                                               "identifierType": {
-                                                       "dataType": "STRING",
-                                                       "isPartOfUniqueness": false,
-                                                       "name": "VMEntityInstanceUUID"
-                                               },
-                                               "value": "VMWARE-UUID-VM-2"
-                                       },
-                                       {
-                                               "identifierType": {
-                                                       "dataType": "STRING",
-                                                       "isPartOfUniqueness": false,
-                                                       "name": "VMEntityName"
-                                               },
-                                               "value": "52a28e3c-4e5b-4408-b8e3-7755a4222774-vc-HNILML"
-                                       },
-                                       {
-                                               "identifierType": {
-                                                       "dataType": "STRING",
-                                                       "isPartOfUniqueness": true,
-                                                       "name": "VMEntityObjectID"
-                                               },
-                                               "value": "VMWARE-OID-VM-2"
-                                       },
-                                       {
-                                               "identifierType": {
-                                                       "dataType": "STRING",
-                                                       "isPartOfUniqueness": true,
-                                                       "name": "VMEntityVCID"
-                                               },
-                                               "value": "1ec8501f-dce7-4e0b-8f8b-19ba7060d33c"
-                                       }
-                               ],
-                               "resourceKindKey": "VirtualMachine"
-                       },
-                       "resourceStatusStates": [
-                               {
-                                       "adapterInstanceId": "fcf7ba35-72f0-4d36-a12d-45a0c4065e17",
-                                       "resourceState": "STARTED",
-                                       "resourceStatus": "DATA_RECEIVING",
-                                       "statusMessage": ""
-                               }
-                       ]
-               },
-               {
-                       "badges": [
-                               {
-                                       "color": "GREEN",
-                                       "score": 0.0,
-                                       "type": "RISK"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 100.0,
-                                       "type": "CAPACITY_REMAINING"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 100.0,
-                                       "type": "EFFICIENCY"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 0.0,
-                                       "type": "WORKLOAD"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 366.0,
-                                       "type": "TIME_REMAINING"
-                               },
-                               {
-                                       "color": "GREY",
-                                       "score": -1.0,
-                                       "type": "COMPLIANCE"
-                               },
-                               {
-                                       "color": "GREEN",
-                                       "score": 100.0,
-                                       "type": "HEALTH"
-                               }
-                       ],
-                       "creationTime": 1559557138756,
-                       "dtEnabled": true,
-                       "identifier": "VROPS-UUID-3",
-                       "links": [
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982",
-                                       "name": "linkToSelf",
-                                       "rel": "SELF"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/relationships",
-                                       "name": "relationsOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/properties",
-                                       "name": "propertiesOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/alerts?resourceId=01ffd926-f8eb-4153-bb59-4d3da4ce7982",
-                                       "name": "alertsOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/symptoms?resourceId=01ffd926-f8eb-4153-bb59-4d3da4ce7982",
-                                       "name": "symptomsOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/statkeys",
-                                       "name": "statKeysOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/stats/latest",
-                                       "name": "latestStatsOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/resources/01ffd926-f8eb-4153-bb59-4d3da4ce7982/properties",
-                                       "name": "latestPropertiesOfResource",
-                                       "rel": "RELATED"
-                               },
-                               {
-                                       "href": "/suite-api/api/credentials/",
-                                       "name": "credentialsOfResource",
-                                       "rel": "RELATED"
-                               }
-                       ],
-                       "relatedResources": [
-                       ],
-                       "resourceHealth": "GREEN",
-                       "resourceHealthValue": 100.0,
-                       "resourceKey": {
-                               "adapterKindKey": "VMWARE",
-                               "name": "52a28e3c-4e5b-4408-b8e3-7755a4222774-vc-HNILML",
-                               "resourceIdentifiers": [
-                                       {
-                                               "identifierType": {
-                                                       "dataType": "STRING",
-                                                       "isPartOfUniqueness": false,
-                                                       "name": "VMEntityInstanceUUID"
-                                               },
-                                               "value": "VMWARE-UUID-VM-3"
-                                       },
-                                       {
-                                               "identifierType": {
-                                                       "dataType": "STRING",
-                                                       "isPartOfUniqueness": false,
-                                                       "name": "VMEntityName"
-                                               },
-                                               "value": "52a28e3c-4e5b-4408-b8e3-7755a4222774-vc-HNILML"
-                                       },
-                                       {
-                                               "identifierType": {
-                                                       "dataType": "STRING",
-                                                       "isPartOfUniqueness": true,
-                                                       "name": "VMEntityObjectID"
-                                               },
-                                               "value": "VMWARE-OID-VM-3"
-                                       },
-                                       {
-                                               "identifierType": {
-                                                       "dataType": "STRING",
-                                                       "isPartOfUniqueness": true,
-                                                       "name": "VMEntityVCID"
-                                               },
-                                               "value": "1ec8501f-dce7-4e0b-8f8b-19ba7060d33c"
-                                       }
-                               ],
-                               "resourceKindKey": "VirtualMachine"
-                       },
-                       "resourceStatusStates": [
-                               {
-                                       "adapterInstanceId": "fcf7ba35-72f0-4d36-a12d-45a0c4065e17",
-                                       "resourceState": "STARTED",
-                                       "resourceStatus": "DATA_RECEIVING",
-                                       "statusMessage": ""
-                               }
-                       ]
-               }
-       ]
-}
diff --git a/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/vrops_token.json b/osm_mon/tests/unit/collector/vnf_collectors/vmware/vmware_mocks/vrops_token.json
deleted file mode 100644 (file)
index 59ea495..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-{  
-  "_copyright_comment": "Copyright 2016-2019 VMware Inc.  This file is part of ETSI OSM  All Rights Reserved. Licensed under the Apache License, Version 2.0 (the 'License'); you may  not use this file except in compliance with the License. You may obtain a copy of the License at   http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. For those usages not covered by the Apache License, Version 2.0 please contact:  osslegalrouting@vmware.com",
-  "token": "8f868cca-27cc-43d6-a838-c5467e73ec45::77cea9b2-1e87-490e-b626-e878beeaa23b",  
-  "validity": 1470421325035,  
-  "expiresAt": "Friday, August 5, 2016 6:22:05 PM UTC",  
-  "roles": []
-}
diff --git a/osm_mon/tests/unit/evaluator/__init__.py b/osm_mon/tests/unit/evaluator/__init__.py
deleted file mode 100644 (file)
index 971f4e9..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
diff --git a/osm_mon/tests/unit/evaluator/test_evaluator.py b/osm_mon/tests/unit/evaluator/test_evaluator.py
deleted file mode 100644 (file)
index ce72d09..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-from unittest import TestCase, mock
-
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-from osm_mon.core.message_bus_client import MessageBusClient
-from osm_mon.evaluator.evaluator import AlarmStatus, Evaluator
-from osm_mon.evaluator.service import EvaluatorService
-
-
-@mock.patch.object(CommonDbClient, "__init__", lambda *args, **kwargs: None)
-@mock.patch.object(MessageBusClient, "__init__", lambda *args, **kwargs: None)
-class EvaluatorTest(TestCase):
-    def setUp(self):
-        super().setUp()
-        self.config = Config()
-
-    @mock.patch("multiprocessing.Process")
-    @mock.patch.object(Evaluator, "notify_alarm")
-    @mock.patch.object(EvaluatorService, "evaluate_alarms")
-    def test_evaluate(self, evaluate_alarms, notify_alarm, process):
-        mock_alarm = mock.Mock()
-        mock_alarm.operation = "gt"
-        mock_alarm.threshold = 50.0
-        evaluate_alarms.return_value = [(mock_alarm, AlarmStatus.ALARM)]
-
-        evaluator = Evaluator(self.config)
-        evaluator.evaluate()
-
-        process.assert_called_with(
-            target=notify_alarm, args=(mock_alarm, AlarmStatus.ALARM)
-        )
diff --git a/osm_mon/tests/unit/evaluator/test_evaluator_service.py b/osm_mon/tests/unit/evaluator/test_evaluator_service.py
deleted file mode 100644 (file)
index 54368dd..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-
-from unittest import TestCase, mock
-
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-from osm_mon.core.message_bus_client import MessageBusClient
-from osm_mon.evaluator.backends.prometheus import PrometheusBackend
-from osm_mon.evaluator.evaluator import AlarmStatus
-from osm_mon.evaluator.service import EvaluatorService
-
-vnfr_record_mock = {
-    "_id": "0d9d06ad-3fc2-418c-9934-465e815fafe2",
-    "ip-address": "192.168.160.2",
-    "created-time": 1535392482.0044956,
-    "vim-account-id": "be48ae31-1d46-4892-a4b4-d69abd55714b",
-    "vdur": [
-        {
-            "interfaces": [
-                {
-                    "mac-address": "fa:16:3e:71:fd:b8",
-                    "name": "eth0",
-                    "ip-address": "192.168.160.2",
-                }
-            ],
-            "status": "ACTIVE",
-            "vim-id": "63a65636-9fc8-4022-b070-980823e6266a",
-            "name": "cirros_ns-1-cirros_vnfd-VM-1",
-            "status-detailed": None,
-            "ip-address": "192.168.160.2",
-            "vdu-id-ref": "cirros_vnfd-VM",
-        }
-    ],
-    "id": "0d9d06ad-3fc2-418c-9934-465e815fafe2",
-    "vnfd-ref": "cirros_vdu_scaling_vnf",
-    "vnfd-id": "63f44c41-45ee-456b-b10d-5f08fb1796e0",
-    "_admin": {
-        "created": 1535392482.0067868,
-        "projects_read": ["admin"],
-        "modified": 1535392482.0067868,
-        "projects_write": ["admin"],
-    },
-    "nsr-id-ref": "87776f33-b67c-417a-8119-cb08e4098951",
-    "member-vnf-index-ref": "1",
-    "connection-point": [{"name": "eth0", "id": None, "connection-point-id": None}],
-}
-
-vnfd_record_mock = {
-    "_id": "63f44c41-45ee-456b-b10d-5f08fb1796e0",
-    "id": "cirros_vdu_scaling_vnf",
-    "_admin": {},
-    "product-name": "cirros_vdu_scaling_vnf",
-    "version": "1.0",
-    "vdu": [
-        {
-            "id": "cirros_vnfd-VM",
-            "name": "cirros_vnfd-VM",
-            "int-cpd": [
-                {
-                    "virtual-network-interface-requirement": [{"name": "vdu-eth0"}],
-                    "id": "vdu-eth0-int",
-                }
-            ],
-            "virtual-compute-desc": "cirros_vnfd-VM-compute",
-            "virtual-storage-desc": ["cirros_vnfd-VM-storage"],
-            "sw-image-desc": "cirros034",
-            "monitoring-parameter": [
-                {
-                    "id": "cirros_vnfd-VM_memory_util",
-                    "name": "cirros_vnfd-VM_memory_util",
-                    "performance-metric": "average_memory_utilization",
-                }
-            ],
-        }
-    ],
-    "virtual-compute-desc": [
-        {
-            "id": "cirros_vnfd-VM-compute",
-            "virtual-cpu": {"num-virtual-cpu": 1},
-            "virtual-memory": {"size": 1},
-        }
-    ],
-    "virtual-storage-desc": [{"id": "cirros_vnfd-VM-storage", "size-of-storage": 2}],
-    "sw-image-desc": [{"id": "cirros034", "name": "cirros034", "image": "cirros034"}],
-    "ext-cpd": [
-        {
-            "int-cpd": {"vdu-id": "cirros_vnfd-VM", "cpd": "vdu-eth0-int"},
-            "id": "vnf-cp0-ext",
-        }
-    ],
-    "df": [
-        {
-            "id": "default-df",
-            "vdu-profile": [{"id": "cirros_vnfd-VM"}],
-            "instantiation-level": [
-                {
-                    "id": "default-instantiation-level",
-                    "vdu-level": [{"vdu-id": "cirros_vnfd-VM"}],
-                }
-            ],
-        }
-    ],
-    "description": "Simple VNF example with a cirros and a scaling group descriptor",
-    "mgmt-cp": "vnf-cp0-ext",
-}
-
-
-@mock.patch.object(CommonDbClient, "__init__", lambda *args, **kwargs: None)
-@mock.patch.object(MessageBusClient, "__init__", lambda *args, **kwargs: None)
-class EvaluatorTest(TestCase):
-    def setUp(self):
-        super().setUp()
-        self.config = Config()
-
-    @mock.patch.object(EvaluatorService, "_get_metric_data")
-    def test_evaluate_metric(self, get_metric_data):
-        mock_alarm = mock.Mock()
-        mock_alarm.operation = "gt"
-        mock_alarm.threshold = 50.0
-        mock_alarm.metric = "metric_name"
-        get_metric_data.return_value = [
-            {
-                "labels": {
-                    "vdu_name": "cirros_vnfd-VM",
-                    "ns_id": "87776f33-b67c-417a-8119-cb08e4098951",
-                    "vnf_member_index": "1",
-                    "extra_label": "run_time_added_label",
-                },
-                "value": 100.0,
-            }
-        ]
-
-        service = EvaluatorService(self.config)
-        service.queue = mock.Mock()
-        service._evaluate_metric(mock_alarm)
-        service.queue.put.assert_called_with((mock_alarm, AlarmStatus.ALARM))
-        service.queue.reset_mock()
-
-        mock_alarm.operation = "lt"
-        service._evaluate_metric(mock_alarm)
-        service.queue.put.assert_called_with((mock_alarm, AlarmStatus.OK))
-        service.queue.reset_mock()
-
-        get_metric_data.return_value = None
-        service._evaluate_metric(mock_alarm)
-        service.queue.put.assert_called_with((mock_alarm, AlarmStatus.INSUFFICIENT))
-
-    @mock.patch("multiprocessing.Process")
-    @mock.patch.object(EvaluatorService, "_evaluate_metric")
-    @mock.patch.object(CommonDbClient, "get_vnfd")
-    @mock.patch.object(CommonDbClient, "get_vnfr")
-    @mock.patch.object(CommonDbClient, "get_alarms")
-    def test_evaluate_alarms(
-        self, alarm_list, get_vnfr, get_vnfd, evaluate_metric, process
-    ):
-        mock_alarm = mock.Mock()
-        mock_alarm.vdur_name = "cirros_ns-1-cirros_vnfd-VM-1"
-        mock_alarm.monitoring_param = "cirros_vnf_memory_util"
-        mock_alarm.tags = {"name": "value"}
-        alarm_list.return_value = [mock_alarm]
-        get_vnfr.return_value = vnfr_record_mock
-        get_vnfd.return_value = vnfd_record_mock
-
-        evaluator = EvaluatorService(self.config)
-        evaluator.evaluate_alarms()
-
-        process.assert_called_with(target=evaluate_metric, args=(mock_alarm,))
-
-    @mock.patch.object(PrometheusBackend, "get_metric_data")
-    def test_get_metric_data_prometheus(self, get_metric_data):
-        self.config.set("evaluator", "backend", "prometheus")
-        evaluator = EvaluatorService(self.config)
-        evaluator._get_metric_data("test", {})
-
-        get_metric_data.assert_called_with("test", {})
diff --git a/osm_mon/tests/unit/evaluator/test_prometheus.py b/osm_mon/tests/unit/evaluator/test_prometheus.py
deleted file mode 100644 (file)
index b4c1223..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-import collections
-from unittest import TestCase
-
-from osm_mon.core.config import Config
-from osm_mon.evaluator.backends.prometheus import PrometheusBackend
-
-
-class EvaluatorTest(TestCase):
-    def setUp(self):
-        super().setUp()
-        self.config = Config()
-
-    def test_build_query(self):
-        prometheus = PrometheusBackend(self.config)
-        alarm_tags = collections.OrderedDict()
-        alarm_tags["tag_1"] = "value_1"
-        alarm_tags["tag_2"] = "value_2"
-        query = prometheus._build_query("metric_name", alarm_tags)
-        self.assertEqual(
-            query, 'query=osm_metric_name{tag_1="value_1",tag_2="value_2"}'
-        )
-
-    def test_build_headers(self):
-        prometheus = PrometheusBackend(self.config)
-        headers = prometheus._build_headers()
-        self.assertEqual(headers, {"Authorization": "Basic YWRtaW46YWRtaW4="})
diff --git a/osm_mon/tests/unit/server/__init__.py b/osm_mon/tests/unit/server/__init__.py
deleted file mode 100644 (file)
index 971f4e9..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
diff --git a/osm_mon/tests/unit/server/test_server_service.py b/osm_mon/tests/unit/server/test_server_service.py
deleted file mode 100644 (file)
index f3b1120..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2018 Whitestack, LLC
-# *************************************************************
-
-# This file is part of OSM Monitoring module
-# All Rights Reserved to Whitestack, LLC
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-
-#         http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact: bdiaz@whitestack.com or glavado@whitestack.com
-##
-from unittest import TestCase, mock
-
-from osm_mon.core.common_db import CommonDbClient
-from osm_mon.core.config import Config
-
-
-@mock.patch.object(CommonDbClient, "__init__", lambda *args, **kwargs: None)
-class ServerServiceTest(TestCase):
-    def setUp(self):
-        super().setUp()
-        self.config = Config()
-
-    def test_create_alarm(self):
-        # TODO
-        pass
index 3c91487..560cb54 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -47,11 +47,7 @@ setup(
     include_package_data=True,
     entry_points={
         "console_scripts": [
-            "osm-mon-server = osm_mon.cmd.mon_server:main",
-            "osm-mon-evaluator = osm_mon.cmd.mon_evaluator:main",
-            "osm-mon-collector = osm_mon.cmd.mon_collector:main",
             "osm-mon-dashboarder = osm_mon.cmd.mon_dashboarder:main",
-            "osm-mon-healthcheck = osm_mon.cmd.mon_healthcheck:main",
         ]
     },
     setup_requires=["setuptools-version-command"],