From: limon Date: Tue, 26 Jan 2021 16:51:10 +0000 (+0100) Subject: Fix vROps monitoring problems related to SOL006 migration X-Git-Tag: v9.1.0~15 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=09bcf03e83c5863c3c0bcf47a457e70162fca94e;p=osm%2FMON.git Fix vROps monitoring problems related to SOL006 migration Change-Id: I4d55f2419edcd20559012067b95585bba1b84fa2 Signed-off-by: limon (cherry picked from commit 5028f70a533f4daafa4da6ba9429dd33720b9745) --- diff --git a/osm_mon/collector/vnf_collectors/vio.py b/osm_mon/collector/vnf_collectors/vio.py index 8413496..e84f5e7 100644 --- a/osm_mon/collector/vnf_collectors/vio.py +++ b/osm_mon/collector/vnf_collectors/vio.py @@ -68,7 +68,7 @@ class VIOCollector(BaseVimCollector): vdu = next( filter(lambda vdu: vdu['id'] == vdur['vdu-id-ref'], vnfd['vdu']) ) - if 'monitoring-param' not in vdu: + if 'monitoring-parameter' not in vdu: continue vim_id = vdur['vim-id'] @@ -84,7 +84,7 @@ class VIOCollector(BaseVimCollector): if len(vdu_mappings) != 0: return self.vrops.get_metrics(vdu_mappings=vdu_mappings, - monitoring_params=vdu['monitoring-param'], + monitoring_params=vdu['monitoring-parameter'], vnfr=vnfr, tags=tags ) diff --git a/osm_mon/collector/vnf_collectors/vmware.py b/osm_mon/collector/vnf_collectors/vmware.py index b974d76..1bc33eb 100644 --- a/osm_mon/collector/vnf_collectors/vmware.py +++ b/osm_mon/collector/vnf_collectors/vmware.py @@ -200,7 +200,7 @@ class VMwareCollector(BaseVimCollector): filter(lambda vdu: vdu['id'] == vdur['vdu-id-ref'], vnfd['vdu']) ) - if 'monitoring-param' not in vdu: + if 'monitoring-parameter' not in vdu: continue resource_uuid = vdur['vim-id'] @@ -222,7 +222,7 @@ class VMwareCollector(BaseVimCollector): if len(vdu_mappings) != 0: return self.vrops.get_metrics(vdu_mappings=vdu_mappings, - monitoring_params=vdu['monitoring-param'], + monitoring_params=vdu['monitoring-parameter'], vnfr=vnfr, tags=tags ) diff --git a/osm_mon/collector/vnf_collectors/vrops/vrops_helper.py b/osm_mon/collector/vnf_collectors/vrops/vrops_helper.py index 39d3238..775aa10 100644 --- a/osm_mon/collector/vnf_collectors/vrops/vrops_helper.py +++ b/osm_mon/collector/vnf_collectors/vrops/vrops_helper.py @@ -105,7 +105,7 @@ class vROPS_Helper(): monitoring_keys = {} # Collect the names of all the metrics we need to query for metric_entry in monitoring_params: - metric_name = metric_entry['nfvi-metric'] + metric_name = metric_entry['performance-metric'] if metric_name not in METRIC_MAPPINGS: log.debug("Metric {} not supported, ignoring".format(metric_name)) continue 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 index 12105a4..6db19ed 100644 --- 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 @@ -1,5 +1,7 @@ { "_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, @@ -24,147 +26,85 @@ "userDefinedData": { } }, - "_id": "cb0da948-7bce-474d-bbcb-6bfce545d397", - "connection-point": [ - { - "name": "eth0", - "type": "VPORT" - } - ], - "description": "Simple Ubuntu VNF with metric collectors and scaling group", - "id": "ubuntu_vdu_alarm_vnf", - "logo": "ubuntu-64.png", - "mgmt-interface": { - "cp": "eth0" - }, - "monitoring-param": [ - { - "aggregation-type": "AVERAGE", - "id": "ubuntu_vnf_cpu_util", - "name": "ubuntu_vnf_cpu_util", - "vdu-monitoring-param": { - "vdu-monitoring-param-ref": "ubuntu_vnfd-VM_cpu_util", - "vdu-ref": "ubuntu_vnfd-VM" - } - }, - { - "aggregation-type": "AVERAGE", - "id": "ubuntu_vnf_average_memory_utilization", - "name": "ubuntu_vnf_average_memory_utilization", - "vdu-monitoring-param": { - "vdu-monitoring-param-ref": "ubuntu_vnfd-VM_average_memory_utilization", - "vdu-ref": "ubuntu_vnfd-VM" - } - }, - { - "aggregation-type": "AVERAGE", - "id": "ubuntu_vnf_disk_read_ops", - "name": "ubuntu_vnf_disk_read_ops", - "vdu-monitoring-param": { - "vdu-monitoring-param-ref": "ubuntu_vnfd-VM_disk_read_ops", - "vdu-ref": "ubuntu_vnfd-VM" - } - }, - { - "aggregation-type": "AVERAGE", - "id": "ubuntu_vnf_disk_write_ops", - "name": "ubuntu_vnf_disk_write_ops", - "vdu-monitoring-param": { - "vdu-monitoring-param-ref": "ubuntu_vnfd-VM_disk_write_ops", - "vdu-ref": "ubuntu_vnfd-VM" - } - }, - { - "aggregation-type": "AVERAGE", - "id": "ubuntu_vnf_disk_read_bytes", - "name": "ubuntu_vnf_disk_read_bytes", - "vdu-monitoring-param": { - "vdu-monitoring-param-ref": "ubuntu_vnfd-VM_disk_read_bytes", - "vdu-ref": "ubuntu_vnfd-VM" - } - }, - { - "aggregation-type": "AVERAGE", - "id": "ubuntu_vnf_disk_write_bytes", - "name": "ubuntu_vnf_disk_write_bytes", - "vdu-monitoring-param": { - "vdu-monitoring-param-ref": "ubuntu_vnfd-VM_disk_write_bytes", - "vdu-ref": "ubuntu_vnfd-VM" - } - }, - { - "aggregation-type": "AVERAGE", - "id": "ubuntu_vnf_packets_in_dropped", - "name": "ubuntu_vnf_packets_in_dropped", - "vdu-monitoring-param": { - "vdu-monitoring-param-ref": "ubuntu_vnfd-VM_packets_in_dropped", - "vdu-ref": "ubuntu_vnfd-VM" - } - }, - { - "aggregation-type": "AVERAGE", - "id": "ubuntu_vnf_packets_out_dropped", - "name": "ubuntu_vnf_packets_out_dropped", - "vdu-monitoring-param": { - "vdu-monitoring-param-ref": "ubuntu_vnfd-VM_packets_out_dropped", - "vdu-ref": "ubuntu_vnfd-VM" - } - }, - { - "aggregation-type": "AVERAGE", - "id": "ubuntu_vnf_packets_received", - "name": "ubuntu_vnf_packets_received", - "vdu-monitoring-param": { - "vdu-monitoring-param-ref": "ubuntu_vnfd-VM_packets_received", - "vdu-ref": "ubuntu_vnfd-VM" - } - }, - { - "aggregation-type": "AVERAGE", - "id": "ubuntu_vnf_packets_sent", - "name": "ubuntu_vnf_packets_sent", - "vdu-monitoring-param": { - "vdu-monitoring-param-ref": "ubuntu_vnfd-VM_packets_sent", - "vdu-ref": "ubuntu_vnfd-VM" - } - } - ], - "name": "ubuntu_vdu_alarm_vnf", - "scaling-group-descriptor": [ + "product-name": "ubuntu_vdu_alarm_vnf", + "version": "1.0", + "vdu": [ { - "min-instance-count": 0, - "name": "cpu_autoscaling_descriptor", - "scaling-policy": [ + "id": "ubuntu_vnfd-VM", + "name": "ubuntu_vnfd-VM", + "int-cpd": [ { - "cooldown-time": 120, - "name": "cpu_scaling_policy", - "scaling-criteria": [ + "virtual-network-interface-requirement": [ { - "name": "cpu_autoscaling_criteria", - "scale-in-relational-operation": "LT", - "scale-in-threshold": "20.0000000000", - "scale-out-relational-operation": "GT", - "scale-out-threshold": "80.0000000000", - "vnf-monitoring-param-ref": "ubuntu_vnf_cpu_util" + "name": "vdu-eth0" } ], - "scaling-type": "automatic" + "id": "vdu-eth0-int" } ], - "vdu": [ + "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" + }, { - "vdu-id-ref": "ubuntu_vnfd-VM" + "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" } - ] - } - ], - "short-name": "ubuntu_vdu_alarm_vnf", - "vdu": [ - { + ], "alarm": [ { + "alarm-id": "alarm-1", + "vnf-monitoring-param-ref": "ubuntu_vnf_cpu_util", "actions": { - "alarm": [ + "ok": [ { "url": "https://webhook.site/e65ad8a0-53b5-4d7f-bd50-c1a50b260871" } @@ -174,83 +114,112 @@ "url": "https://webhook.site/e65ad8a0-53b5-4d7f-bd50-c1a50b260871" } ], - "ok": [ + "alarm": [ { "url": "https://webhook.site/e65ad8a0-53b5-4d7f-bd50-c1a50b260871" } ] }, - "alarm-id": "alarm-1", "operation": "LT", - "value": "20.0000", - "vnf-monitoring-param-ref": "ubuntu_vnf_cpu_util" + "value": "20.0000" } - ], - "count": "1", - "description": "ubuntu_vnfd-VM", - "id": "ubuntu_vnfd-VM", - "image": "ubuntu", - "interface": [ + ] + } + ], + "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": [ { - "external-connection-point-ref": "eth0", - "name": "eth0", - "virtual-interface": { - "bandwidth": "0", - "type": "VIRTIO", - "vpci": "0000:00:0a.0" - } + "id": "ubuntu_vnfd-VM", + "min-number-of-instances": 1, + "max-number-of-instances": 2 } ], - "monitoring-param": [ - { - "id": "ubuntu_vnfd-VM_cpu_util", - "nfvi-metric": "cpu_utilization" - }, - { - "id": "ubuntu_vnfd-VM_average_memory_utilization", - "nfvi-metric": "average_memory_utilization" - }, - { - "id": "ubuntu_vnfd-VM_disk_read_ops", - "nfvi-metric": "disk_read_ops" - }, - { - "id": "ubuntu_vnfd-VM_disk_write_ops", - "nfvi-metric": "disk_write_ops" - }, - { - "id": "ubuntu_vnfd-VM_disk_read_bytes", - "nfvi-metric": "disk_read_bytes" - }, - { - "id": "ubuntu_vnfd-VM_disk_write_bytes", - "nfvi-metric": "disk_write_bytes" - }, - { - "id": "ubuntu_vnfd-VM_packets_in_dropped", - "nfvi-metric": "packets_in_dropped" - }, - { - "id": "ubuntu_vnfd-VM_packets_out_dropped", - "nfvi-metric": "packets_out_dropped" - }, + "instantiation-level": [ { - "id": "ubuntu_vnfd-VM_packets_received", - "nfvi-metric": "packets_received" - }, - { - "id": "ubuntu_vnfd-VM_packets_sent", - "nfvi-metric": "packets_sent" + "id": "default-instantiation-level", + "vdu-level": [ + { + "vdu-id": "ubuntu_vnfd-VM", + "number-of-instances": 1 + } + ] } ], - "name": "ubuntu_vnfd-VM", - "vm-flavor": { - "memory-mb": "4096", - "storage-gb": "20", - "vcpu-count": 4 - } + "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" + } + ] + } + ] + } + ] } ], - "vendor": "OSM", - "version": "1.0" -} + "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/test_vcd_collector.py b/osm_mon/tests/unit/collector/vnf_collectors/vmware/test_vcd_collector.py index 60c22a3..ccab0d2 100644 --- 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 @@ -61,9 +61,9 @@ class CollectorTest(TestCase): 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-param'] = [ - {"id": "ubuntu_vnfd-VM_cpu_util", "nfvi-metric": "cpu_utilization"}, - {"id": "ubuntu_vnfd-VM_average_memory_utilization", "nfvi-metric": "average_memory_utilization"} + 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 @@ -98,7 +98,7 @@ class CollectorTest(TestCase): self.assertEqual(len(metrics), 0, "Number of metrics returned") def test_collect_no_monitoring_param(self, _): - self.vnfd['vdu'][0]['monitoring-param'] = [] + 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', @@ -114,7 +114,7 @@ class CollectorTest(TestCase): self.assertEqual(len(metrics), 0, "Number of metrics returned") def test_collect_empty_monitoring_param(self, _): - del self.vnfd['vdu'][0]['monitoring-param'] + 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', 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 index 81e6024..2c72ea0 100644 --- 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 @@ -57,9 +57,9 @@ class CollectorTest(TestCase): super().tearDown() def test_collect_cpu_and_memory(self): - self.vnfd['vdu'][0]['monitoring-param'] = [ - {"id": "ubuntu_vnfd-VM_cpu_util", "nfvi-metric": "cpu_utilization"}, - {"id": "ubuntu_vnfd-VM_average_memory_utilization", "nfvi-metric": "average_memory_utilization"} + 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: @@ -84,7 +84,7 @@ class CollectorTest(TestCase): self.assertEqual(metrics[3].value, 15.23439884185791, "Memory metric value") def test_collect_no_monitoring_param(self): - self.vnfd['vdu'][0]['monitoring-param'] = [] + 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', @@ -100,7 +100,7 @@ class CollectorTest(TestCase): self.assertEqual(len(metrics), 0, "Number of metrics returned") def test_collect_empty_monitoring_param(self): - del self.vnfd['vdu'][0]['monitoring-param'] + 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', 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 index 846f98b..3589d7d 100644 --- 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 @@ -88,7 +88,7 @@ class vROPS_Helper_Get_Metrics_Test(TestCase): {'name': 'vmware-scaling-1-ubuntu_vnfd-VM-2', 'vrops_id': 'VROPS-UUID-1'}} monitoring_params = [ - {"id": "ubuntu_vnfd-VM_cpu_util", "nfvi-metric": "cpu_utilization"}, + {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"}, ] with requests_mock.Mocker() as mock_requests: @@ -109,8 +109,8 @@ class vROPS_Helper_Get_Metrics_Test(TestCase): {'name': 'vmware-scaling-1-ubuntu_vnfd-VM-2', 'vrops_id': 'VROPS-UUID-1'}} monitoring_params = [ - {"id": "ubuntu_vnfd-VM_cpu_util", "nfvi-metric": "cpu_utilization"}, - {"id": "ubuntu_vnfd-VM_average_memory_utilization", "nfvi-metric": "average_memory_utilization"} + {"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: @@ -134,7 +134,7 @@ class vROPS_Helper_Get_Metrics_Test(TestCase): {'name': 'vmware-scaling-1-ubuntu_vnfd-VM-2', 'vrops_id': 'VROPS-UUID-1'}} monitoring_params = [ - {'id': 'ubuntu_vnfd-VM_cpu_util', 'nfvi-metric': 'disk_read_bytes'} + {'id': 'ubuntu_vnf_cpu_util', 'performance-metric': 'disk_read_bytes'} ] with requests_mock.Mocker() as mock_requests: @@ -156,7 +156,7 @@ class vROPS_Helper_Get_Metrics_Test(TestCase): {'name': 'vmware-scaling-1-ubuntu_vnfd-VM-2', 'vrops_id': 'VROPS-UUID-1'}} monitoring_params = [ - {'id': 'cirros_vnfd-VM_packets_sent', 'nfvi-metric': 'packets_in_dropped'}, + {'id': 'cirros_vnf_packets_sent', 'performance-metric': 'packets_in_dropped'}, ] with requests_mock.Mocker() as mock_requests: @@ -176,7 +176,7 @@ class vROPS_Helper_Get_Metrics_Test(TestCase): {'name': 'vmware-scaling-1-ubuntu_vnfd-VM-2', 'vrops_id': 'VROPS-UUID-1'}} monitoring_params = [ - {'id': 'cirros_vnfd-Unknown_Metric', 'nfvi-metric': 'unknown'}, + {'id': 'cirros_vnf-Unknown_Metric', 'performance-metric': 'unknown'}, ] with requests_mock.Mocker() as mock_requests: @@ -196,7 +196,7 @@ class vROPS_Helper_Get_Metrics_Test(TestCase): {'name': 'vmware-scaling-1-ubuntu_vnfd-VM-2', 'vrops_id': 'VROPS-UUID-1'}} monitoring_params = [ - {"id": "ubuntu_vnfd-VM_cpu_util", "nfvi-metric": "cpu_utilization"}, + {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"}, ] with requests_mock.Mocker() as mock_requests: @@ -215,7 +215,7 @@ class vROPS_Helper_Get_Metrics_Test(TestCase): vdu_mappings = {'VMWARE-OID-VM-1': {'name': 'vmware-scaling-1-ubuntu_vnfd-VM-2'}} monitoring_params = [ - {"id": "ubuntu_vnfd-VM_cpu_util", "nfvi-metric": "cpu_utilization"}, + {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"}, ] with requests_mock.Mocker() as mock_requests: @@ -235,7 +235,7 @@ class vROPS_Helper_Get_Metrics_Test(TestCase): {'name': 'vmware-scaling-1-ubuntu_vnfd-VM-2', 'vrops_id': 'VROPS-UUID-1'}} monitoring_params = [ - {"id": "ubuntu_vnfd-VM_cpu_util", "nfvi-metric": "cpu_utilization"}, + {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"}, ] with requests_mock.Mocker() as mock_requests: @@ -255,7 +255,7 @@ class vROPS_Helper_Get_Metrics_Test(TestCase): {'name': 'vmware-scaling-1-ubuntu_vnfd-VM-2', 'vrops_id': 'VROPS-UUID-1'}} monitoring_params = [ - {"id": "ubuntu_vnfd-VM_cpu_util", "nfvi-metric": "cpu_utilization"}, + {"id": "ubuntu_vnf_cpu_util", "performance-metric": "cpu_utilization"}, ] with requests_mock.Mocker() as mock_requests: @@ -279,15 +279,15 @@ class vROPS_Helper_Get_Metrics_Test(TestCase): {'name': 'vmware-scaling-1-ubuntu_vnfd-VM-2', 'vrops_id': 'VROPS-UUID-3'} } monitoring_params = [ - {'id': 'ubuntu_vnfd-VM_cpu_util', 'nfvi-metric': 'cpu_utilization'}, - {'id': 'ubuntu_vnfd-VM_average_memory_utilization', 'nfvi-metric': 'average_memory_utilization'}, - {'id': 'ubuntu_vnfd-VM_disk_read_ops', 'nfvi-metric': 'disk_read_ops'}, - {'id': 'ubuntu_vnfd-VM_disk_write_ops', 'nfvi-metric': 'disk_write_ops'}, - {'id': 'ubuntu_vnfd-VM_disk_read_bytes', 'nfvi-metric': 'disk_read_bytes'}, - {'id': 'ubuntu_vnfd-VM_disk_write_bytes', 'nfvi-metric': 'disk_write_bytes'}, - {'id': 'ubuntu_vnfd-VM_packets_out_dropped', 'nfvi-metric': 'packets_out_dropped'}, - {'id': 'ubuntu_vnfd-VM_packets_received', 'nfvi-metric': 'packets_received'}, - {'id': 'ubuntu_vnfd-VM_packets_sent', 'nfvi-metric': 'packets_sent'} + {'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: diff --git a/osm_mon/tests/unit/evaluator/test_evaluator_service.py b/osm_mon/tests/unit/evaluator/test_evaluator_service.py index bc93046..a72dcaf 100644 --- a/osm_mon/tests/unit/evaluator/test_evaluator_service.py +++ b/osm_mon/tests/unit/evaluator/test_evaluator_service.py @@ -77,66 +77,93 @@ vnfr_record_mock = { vnfd_record_mock = { "_id": "63f44c41-45ee-456b-b10d-5f08fb1796e0", - "name": "cirros_vdu_scaling_vnf", - "vendor": "OSM", + "id": "cirros_vdu_scaling_vnf", + "_admin": {}, + "product-name": "cirros_vdu_scaling_vnf", + "version": "1.0", "vdu": [ { + "id": "cirros_vnfd-VM", "name": "cirros_vnfd-VM", - "monitoring-param": [ + "int-cpd": [ { - "id": "cirros_vnfd-VM_memory_util", - "nfvi-metric": "average_memory_utilization" + "virtual-network-interface-requirement": [ + { + "name": "vdu-eth0" + } + ], + "id": "vdu-eth0-int" } ], - "vm-flavor": { - "vcpu-count": 1, - "memory-mb": 256, - "storage-gb": 2 - }, - "description": "cirros_vnfd-VM", - "count": 1, - "id": "cirros_vnfd-VM", - "interface": [ + "virtual-compute-desc": "cirros_vnfd-VM-compute", + "virtual-storage-desc": [ + "cirros_vnfd-VM-storage" + ], + "sw-image-desc": "cirros034", + "monitoring-parameter": [ { - "name": "eth0", - "external-connection-point-ref": "eth0", - "type": "EXTERNAL", - "virtual-interface": { - "bandwidth": "0", - "type": "VIRTIO", - "vpci": "0000:00:0a.0" - } + "id": "cirros_vnfd-VM_memory_util", + "name": "cirros_vnfd-VM_memory_util", + "performance-metric": "average_memory_utilization" } - ], - "image": "cirros034" + ] } ], - "monitoring-param": [ + "virtual-compute-desc": [ { - "id": "cirros_vnf_memory_util", - "name": "cirros_vnf_memory_util", - "aggregation-type": "AVERAGE", - "vdu-monitoring-param": { - "vdu-monitoring-param-ref": "cirros_vnfd-VM_memory_util", - "vdu-ref": "cirros_vnfd-VM" + "id": "cirros_vnfd-VM-compute", + "virtual-cpu": { + "num-virtual-cpu": 1 + }, + "virtual-memory": { + "size": 1 } } ], - "description": "Simple VNF example with a cirros and a scaling group descriptor", - "id": "cirros_vdu_scaling_vnf", - "logo": "cirros-64.png", - "version": "1.0", - "connection-point": [ + "virtual-storage-desc": [ { - "name": "eth0", - "type": "VPORT" + "id": "cirros_vnfd-VM-storage", + "size-of-storage": 2 } ], - "mgmt-interface": { - "cp": "eth0" - }, - "short-name": "cirros_vdu_scaling_vnf", - "_admin": {} + "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" }