Browse Source

Parameter changed from mgmt_url to mgmt_ip_address

At present the VNF mgmt IP address is assigned to parameter name
of "mgmt_url". In this patch it is changed to "mgmt_ip_address"
which will be relevant one

Co-Authored-By: Dharmendra Kushwaha <dharmendra.kushwaha@india.nec.com>

Change-Id: I621b71d4af96a4bfa0f27442efe4d302c5afa96d
Partial-Bug: #1648327
changes/71/490471/10
venkatamahesh 5 years ago committed by dharmendra
parent
commit
5a1e4a1ccb
  1. 6
      api-ref/source/v1/nss.inc
  2. 8
      api-ref/source/v1/parameters.yaml
  3. 2
      api-ref/source/v1/samples/nss/nss-create-response.json
  4. 2
      api-ref/source/v1/samples/nss/nss-inline-create-response.json
  5. 2
      api-ref/source/v1/samples/nss/nss-list-response.json
  6. 2
      api-ref/source/v1/samples/nss/nss-show-response.json
  7. 2
      api-ref/source/v1/samples/vnfs/vnfs-create-response.json
  8. 2
      api-ref/source/v1/samples/vnfs/vnfs-list-response.json
  9. 2
      api-ref/source/v1/samples/vnfs/vnfs-show-response.json
  10. 2
      api-ref/source/v1/samples/vnfs/vnfs-update-response.json
  11. 8
      api-ref/source/v1/vnfs.inc
  12. 2
      doc/source/contributor/encrypt_vim_auth_with_barbican.rst
  13. 2
      doc/source/contributor/event_logging.rst
  14. 4
      doc/source/reference/mistral_workflows_usage_guide.rst
  15. 4
      doc/source/user/containerized_vnf_usage_guide.rst
  16. 2
      doc/source/user/multisite_vim_usage_guide.rst
  17. 2
      doc/source/user/vnffg_usage_guide.rst
  18. 6
      samples/mistral/workflows/create_vnf.yaml
  19. 2
      tacker/db/migration/alembic_migrations/versions/HEAD
  20. 38
      tacker/db/migration/alembic_migrations/versions/cd04a8335c18_mgmt_url_to_mgmt_ip_address.py
  21. 24
      tacker/db/nfvo/ns_db.py
  22. 23
      tacker/db/vnfm/vnfm_db.py
  23. 2
      tacker/extensions/nfvo.py
  24. 2
      tacker/extensions/vnfm.py
  25. 12
      tacker/nfvo/drivers/workflow/workflow_generator.py
  26. 3
      tacker/tests/functional/base.py
  27. 4
      tacker/tests/functional/nfvo/test_nfvo.py
  28. 14
      tacker/tests/functional/vnfm/test_tosca_vnf.py
  29. 3
      tacker/tests/functional/vnfm/test_tosca_vnf_alarm.py
  30. 8
      tacker/tests/functional/vnfm/test_tosca_vnf_block_storage.py
  31. 2
      tacker/tests/functional/vnfm/test_tosca_vnf_floatingip.py
  32. 9
      tacker/tests/functional/vnfm/test_tosca_vnf_multiple_vdu.py
  33. 3
      tacker/tests/functional/vnfm/test_tosca_vnf_scale.py
  34. 9
      tacker/tests/functional/vnfm/test_tosca_vnfc.py
  35. 3
      tacker/tests/functional/vnfm/test_vnf.py
  36. 3
      tacker/tests/functional/vnfm/test_vnfm_param.py
  37. 5
      tacker/tests/unit/db/utils.py
  38. 50
      tacker/tests/unit/nfvo/drivers/workflow/test_workflow_generator.py
  39. 9
      tacker/tests/unit/vnfm/infra_drivers/openstack/test_openstack.py
  40. 2
      tacker/tests/unit/vnfm/policy_actions/vdu_autoheal/test_vdu_autoheal.py
  41. 22
      tacker/tests/unit/vnfm/test_monitor.py
  42. 14
      tacker/tests/unit/vnfm/test_plugin.py
  43. 2
      tacker/vnfm/infra_drivers/kubernetes/kubernetes_driver.py
  44. 4
      tacker/vnfm/infra_drivers/openstack/openstack.py
  45. 2
      tacker/vnfm/mgmt_drivers/abstract_driver.py
  46. 4
      tacker/vnfm/mgmt_drivers/noop.py
  47. 12
      tacker/vnfm/mgmt_drivers/openwrt/openwrt.py
  48. 22
      tacker/vnfm/monitor.py
  49. 26
      tacker/vnfm/plugin.py

6
api-ref/source/v1/nss.inc

@ -64,7 +64,7 @@ Response Parameters
- tenant_id: tenant_id
- created_at: ns_created_at
- updated_at: ns_updated_at
- mgmt_url: ns_mgmt_url
- mgmt_ip_address: ns_mgmt_ip_address
- vim_id: vim_id
- error_reason: ns_error_reason
- attributes: ns_attributes
@ -109,7 +109,7 @@ Response Parameters
- tenant_id: tenant_id
- created_at: ns_created_at
- updated_at: ns_updated_at
- mgmt_url: ns_mgmt_url
- mgmt_ip_address: ns_mgmt_ip_address
- vim_id: vim_id
- error_reason: ns_error_reason
- attributes: ns_attributes
@ -162,7 +162,7 @@ Response Parameters
- tenant_id: tenant_id
- created_at: ns_created_at
- updated_at: ns_updated_at
- mgmt_url: ns_mgmt_url
- mgmt_ip_address: ns_mgmt_ip_address
- vim_id: vim_id
- error_reason: ns_error_reason
- attributes: ns_attributes

8
api-ref/source/v1/parameters.yaml

@ -304,9 +304,9 @@ ns_id:
in: body
required: true
type: string
ns_mgmt_url:
ns_mgmt_ip_address:
description: |
Management URL information for the NS.
Management ip address for the NS.
in: body
required: true
type: string
@ -696,9 +696,9 @@ vnf_mapping_opt:
in: body
required: false
type: object
vnf_mgmt_url:
vnf_mgmt_ip_address:
description: |
Management URL information for the VNF.
Management ip address for the VNF.
in: body
required: true
type: string

2
api-ref/source/v1/samples/nss/nss-create-response.json

@ -7,7 +7,7 @@
"tenant_id": "a81900a92bda40588c52699e1873a92f",
"vim_id": "96025dd5-ca16-49f3-9823-958eb04260c4",
"updated_at": null,
"mgmt_urls": null,
"mgmt_ip_addresses": null,
"vnf_ids": null,
"error_reason": null,
"nsd_id": "99b2851e-a6a7-4467-9554-0eb50633f012",

2
api-ref/source/v1/samples/nss/nss-inline-create-response.json

@ -6,7 +6,7 @@
"tenant_id": "058079ca392749bfa58831e0467a5439",
"vim_id": "0e70ec23-6f32-420a-a039-2cdb2c20c329",
"updated_at": null,
"mgmt_urls": null,
"mgmt_ip_addresses": null,
"vnf_ids": null,
"error_reason": null,
"nsd_id": "be18005d-5656-4d81-b499-6af4d4d8437f",

2
api-ref/source/v1/samples/nss/nss-list-response.json

@ -8,7 +8,7 @@
"tenant_id": "a81900a92bda40588c52699e1873a92f",
"vim_id": "96025dd5-ca16-49f3-9823-958eb04260c4",
"updated_at": null,
"mgmt_urls": null,
"mgmt_ip_addresses": null,
"vnf_ids": null,
"error_reason": null,
"nsd_id": "99b2851e-a6a7-4467-9554-0eb50633f012",

2
api-ref/source/v1/samples/nss/nss-show-response.json

@ -7,7 +7,7 @@
"tenant_id": "a81900a92bda40588c52699e1873a92f",
"vim_id": "96025dd5-ca16-49f3-9823-958eb04260c4",
"updated_at": null,
"mgmt_urls": null,
"mgmt_ip_addresses": null,
"vnf_ids": null,
"error_reason": null,
"nsd_id": "99b2851e-a6a7-4467-9554-0eb50633f012",

2
api-ref/source/v1/samples/vnfs/vnfs-create-response.json

@ -7,7 +7,7 @@
"created_at": "2016-10-25 10:15:06.959431",
"updated_at": null,
"instance_id": "178d3186-5b5f-483c-b2f5-75b484ec793e",
"mgmt_url": null,
"mgmt_ip_address": null,
"vim_id": "f6bd6f24-7a0e-4111-8994-e108c5ee2ff2",
"placement_attr": {
"region_name": "RegionOne",

2
api-ref/source/v1/samples/vnfs/vnfs-list-response.json

@ -8,7 +8,7 @@
"created_at": "2016-10-25 10:15:06",
"updated_at": null,
"instance_id": "178d3186-5b5f-483c-b2f5-75b484ec793e",
"mgmt_url": "{\"VDU1\": \"192.168.120.3\"}",
"mgmt_ip_address": "{\"VDU1\": \"192.168.120.3\"}",
"vim_id": "f6bd6f24-7a0e-4111-8994-e108c5ee2ff2",
"placement_attr": {
"region_name": "RegionOne",

2
api-ref/source/v1/samples/vnfs/vnfs-show-response.json

@ -7,7 +7,7 @@
"created_at": "2016-10-25 10:15:06",
"updated_at": "2016-10-25 10:16:43",
"instance_id": "178d3186-5b5f-483c-b2f5-75b484ec793e",
"mgmt_url": "{\"VDU1\": \"192.168.120.3\"}",
"mgmt_ip_address": "{\"VDU1\": \"192.168.120.3\"}",
"vim_id": "f6bd6f24-7a0e-4111-8994-e108c5ee2ff2",
"placement_attr": {
"region_name": "RegionOne",

2
api-ref/source/v1/samples/vnfs/vnfs-update-response.json

@ -7,7 +7,7 @@
"created_at": "2016-10-25 10:15:06",
"updated_at": "2016-10-25 10:16:43",
"instance_id": "178d3186-5b5f-483c-b2f5-75b484ec793e",
"mgmt_url": "{\"VDU1\": \"192.168.120.3\"}",
"mgmt_ip_address": "{\"VDU1\": \"192.168.120.3\"}",
"vim_id": "f6bd6f24-7a0e-4111-8994-e108c5ee2ff2",
"placement_attr": {
"region_name": "RegionOne",

8
api-ref/source/v1/vnfs.inc

@ -65,7 +65,7 @@ Response Parameters
- created_at: vnf_created_at
- updated_at: vnf_updated_at
- instance_id: vnf_instance_id
- mgmt_url: vnf_mgmt_url
- mgmt_ip_address: vnf_mgmt_ip_address
- vim_id: vim_id
- placement_attr: vnf_placement_attr
- error_reason: vnf_error_reason
@ -115,7 +115,7 @@ Response Parameters
- created_at: vnf_created_at
- updated_at: vnf_updated_at
- instance_id: vnf_instance_id
- mgmt_url: vnf_mgmt_url
- mgmt_ip_address: vnf_mgmt_ip_address
- vim_id: vim_id
- placement_attr: vnf_placement_attr
- error_reason: vnf_error_reason
@ -173,7 +173,7 @@ Response Parameters
- created_at: vnf_created_at
- updated_at: vnf_updated_at
- instance_id: vnf_instance_id
- mgmt_url: vnf_mgmt_url
- mgmt_ip_address: vnf_mgmt_ip_address
- vim_id: vim_id
- placement_attr: vnf_placement_attr
- error_reason: vnf_error_reason
@ -241,7 +241,7 @@ Response Parameters
- created_at: vnf_created_at
- updated_at: vnf_updated_at
- instance_id: vnf_instance_id
- mgmt_url: vnf_mgmt_url
- mgmt_ip_address: vnf_mgmt_ip_address
- vim_id: vim_id
- placement_attr: vnf_placement_attr
- error_reason: vnf_error_reason

2
doc/source/contributor/encrypt_vim_auth_with_barbican.rst

@ -142,7 +142,7 @@ Now we create a vnf to verify it works:
| error_reason | |
| id | 71d3eef7-6b53-4495-b210-78786cb28ba4 |
| instance_id | 08d0ce6f-69bc-4ff0-87b0-52686a01ce3e |
| mgmt_url | |
| mgmt_ip_address| |
| name | vnf-test |
| placement_attr | {"region_name": "RegionOne", "vim_name": "vim-test"} |
| status | PENDING_CREATE |

2
doc/source/contributor/event_logging.rst

@ -189,7 +189,7 @@ Miscellaneous events command examples:
+----------------+------------------------------------------------------------------------------------------+
| Field | Value |
+----------------+------------------------------------------------------------------------------------------+
| event_details | Infra Instance ID created: 046dcb04-318d-4ec9-8a23-19d9c1f8c21d and Mgmt URL set: |
| event_details | Infra Instance ID created: 046dcb04-318d-4ec9-8a23-19d9c1f8c21d and Mgmt IP address set: |
| | {"VDU1": "192.168.120.8"} |
| event_type | CREATE |
| id | 5 |

4
doc/source/reference/mistral_workflows_usage_guide.rst

@ -273,7 +273,7 @@ Gather VNF ID from execution output data.
{
"status": "ACTIVE",
"mgmt_url": "{\"VDU1\": \"192.168.120.7\"}",
"mgmt_ip_address": "{\"VDU1\": \"192.168.120.7\"}",
"vim_id": "22ac5ce6-1415-460c-badf-40ffc5091f94",
"vnf_id": "1c349534-a539-4d5a-b854-033f98036cd5"
}
@ -297,7 +297,7 @@ Verify VNF details using OpenStackClient CLI
| error_reason | |
| id | 1c349534-a539-4d5a-b854-033f98036cd5 |
| instance_id | 771c53df-9f41-454c-a719-7eccd3a4eba9 |
| mgmt_url | {"VDU1": "192.168.120.7"} |
| mgmt_ip_address| {"VDU1": "192.168.120.7"} |
| name | tacker-create-vnf |
| placement_attr | {"vim_name": "VIM0"} |
| status | ACTIVE |

4
doc/source/user/containerized_vnf_usage_guide.rst

@ -238,7 +238,7 @@ Create sample containerized VNF
| error_reason | |
| id | 1faf776b-8d2b-4ee6-889d-e3b7c7310411 |
| instance_id | default,svc-vdu1-05db44 |
| mgmt_url | |
| mgmt_ip_address| |
| name | VNF1 |
| placement_attr | {"vim_name": "vim-kubernetes"} |
| status | PENDING_CREATE |
@ -250,7 +250,7 @@ Create sample containerized VNF
$ openstack vnf list
+--------------------------------------+------+----------------------------+--------+--------------------------------------+--------------------------------------+
| id | name | mgmt_url | status | vim_id | vnfd_id |
| id | name | mgmt_ip_address | status | vim_id | vnfd_id |
+--------------------------------------+------+----------------------------+--------+--------------------------------------+--------------------------------------+
| 1faf776b-8d2b-4ee6-889d-e3b7c7310411 | VNF1 | | ACTIVE | 791830a6-45fd-468a-bd85-e07fe24e5ce3 | fb4a0aa8-e410-4e73-abdc-d2808de155ef |
+--------------------------------------+------+----------------------------+--------+--------------------------------------+--------------------------------------+

2
doc/source/user/multisite_vim_usage_guide.rst

@ -115,7 +115,7 @@ Deploying a new VNF on registered VIM
| description | Openwrt tosca template |
| id | 159ed8a5-a5a7-4f7a-be50-0f5f86603e3a |
| instance_id | 7b4ab046-d977-4781-9f0c-1ee9dcce01c6 |
| mgmt_url | |
| mgmt_ip_address| |
| name | openwrt_VNF |
| placement_attr | {"vim_name": "Site1"} |
| status | PENDING_CREATE |

2
doc/source/user/vnffg_usage_guide.rst

@ -218,7 +218,7 @@ to the desired VNF instance:
openstack vnf list
+--------------------------------------+------+---------------------------+--------+--------------------------------------+--------------------------------------+
| id | name | mgmt_url | status | vim_id | vnfd_id |
| id | name | mgmt_ip_address | status | vim_id | vnfd_id |
+--------------------------------------+------+---------------------------+--------+--------------------------------------+--------------------------------------+
| 7168062e-9fa1-4203-8cb7-f5c99ff3ee1b | VNF2 | {"VDU1": "192.168.1.5"} | ACTIVE | 0e70ec23-6f32-420a-a039-2cdb2c20c329 | ea842879-5a7a-4f29-a8b0-528b2ad3b027 |
| 91e32c20-6d1f-47a4-9ba7-08f5e5effe07 | VNF1 | {"VDU1": "192.168.1.7"} | ACTIVE | 0e70ec23-6f32-420a-a039-2cdb2c20c329 | 27795330-62a7-406d-9443-2daad76e674b |

6
samples/mistral/workflows/create_vnf.yaml

@ -12,7 +12,7 @@ std.create_vnf:
output:
vnf_id: <% $.vnf_id %>
vim_id: <% $.vim_id %>
mgmt_url: <% $.mgmt_url %>
mgmt_ip_address: <% $.mgmt_ip_address %>
status: <% $.status %>
task-defaults:
@ -28,7 +28,7 @@ std.create_vnf:
publish:
vnf_id: <% task(create_vnf).result.vnf.id %>
vim_id: <% task(create_vnf).result.vnf.vim_id %>
mgmt_url: <% task(create_vnf).result.vnf.mgmt_url %>
mgmt_ip_address: <% task(create_vnf).result.vnf.mgmt_ip_address %>
status: <% task(create_vnf).result.vnf.status %>
on-success:
- wait_vnf_active
@ -43,7 +43,7 @@ std.create_vnf:
break-on: <% $.status = 'ERROR' %>
continue-on: <% $.status = 'PENDING_CREATE' %>
publish:
mgmt_url: <% task(wait_vnf_active).result.vnf.mgmt_url %>
mgmt_ip_address: <% task(wait_vnf_active).result.vnf.mgmt_ip_address %>
status: <% task(wait_vnf_active).result.vnf.status %>
on-success:
- delete_vnf: <% $.status = 'ERROR' %>

2
tacker/db/migration/alembic_migrations/versions/HEAD

@ -1 +1 @@
13ecc2dd6f7f
cd04a8335c18

38
tacker/db/migration/alembic_migrations/versions/cd04a8335c18_mgmt_url_to_mgmt_ip_address.py

@ -0,0 +1,38 @@
# Copyright 2019 OpenStack Foundation
#
# 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.
#
"""mgmt_url to mgmt_ip_address
Revision ID: cd04a8335c18
Revises: 13ecc2dd6f7f
Create Date: 2019-01-25 13:43:10.499421
"""
# revision identifiers, used by Alembic.
revision = 'cd04a8335c18'
down_revision = '13ecc2dd6f7f'
from alembic import op
import sqlalchemy as sa
def upgrade(active_plugins=None, options=None):
op.alter_column('ns',
'mgmt_urls', new_column_name='mgmt_ip_addresses',
existing_type=sa.TEXT(65535), nullable=True)
op.alter_column('vnf',
'mgmt_url', new_column_name='mgmt_ip_address',
existing_type=sa.String(255), nullable=True)

24
tacker/db/nfvo/ns_db.py

@ -101,8 +101,8 @@ class NS(model_base.BASE, models_v1.HasId, models_v1.HasTenant,
# VNFFG ids
vnffg_ids = sa.Column(sa.TEXT(65535), nullable=True)
# Dict of mgmt urls that network servic launches
mgmt_urls = sa.Column(sa.TEXT(65535), nullable=True)
# Dict of mgmt ip addresses that network service launches
mgmt_ip_addresses = sa.Column(sa.TEXT(65535), nullable=True)
status = sa.Column(sa.String(64), nullable=False)
vim_id = sa.Column(types.Uuid, sa.ForeignKey('vims.id'), nullable=False)
@ -164,7 +164,7 @@ class NSPluginDb(network_service.NSPluginBase, db_base.CommonDbMixin):
LOG.debug('ns_db %s', ns_db)
res = {}
key_list = ('id', 'tenant_id', 'nsd_id', 'name', 'description',
'vnf_ids', 'vnffg_ids', 'status', 'mgmt_urls',
'vnf_ids', 'vnffg_ids', 'status', 'mgmt_ip_addresses',
'error_reason', 'vim_id', 'created_at', 'updated_at')
res.update((key, ns_db[key]) for key in key_list)
return self._fields(res, fields)
@ -270,7 +270,7 @@ class NSPluginDb(network_service.NSPluginBase, db_base.CommonDbMixin):
vnf_ids=None,
vnffg_ids=None,
status=constants.PENDING_CREATE,
mgmt_urls=None,
mgmt_ip_addresses=None,
nsd_id=nsd_id,
vim_id=vim_id,
error_reason=None,
@ -294,18 +294,18 @@ class NSPluginDb(network_service.NSPluginBase, db_base.CommonDbMixin):
vnfd_dict, vnffgd_templates, error_reason):
LOG.debug('ns ID %s', ns_id)
output = ast.literal_eval(mistral_obj.output)
mgmt_urls = dict()
mgmt_ip_addresses = dict()
vnf_ids = dict()
vnffg_ids = dict()
if len(output) > 0:
for vnfd_name, vnfd_val in iteritems(vnfd_dict):
for instance in vnfd_val['instances']:
if 'mgmt_url_' + instance in output:
mgmt_urls[instance] = ast.literal_eval(
output['mgmt_url_' + instance].strip())
if 'mgmt_ip_address_' + instance in output:
mgmt_ip_addresses[instance] = ast.literal_eval(
output['mgmt_ip_address_' + instance].strip())
vnf_ids[instance] = output['vnf_id_' + instance]
vnf_ids = str(vnf_ids)
mgmt_urls = str(mgmt_urls)
mgmt_ip_addresses = str(mgmt_ip_addresses)
if vnffgd_templates:
for vnffg_name in vnffgd_templates:
vnffg_output = 'vnffg_id_%s' % vnffg_name
@ -314,8 +314,8 @@ class NSPluginDb(network_service.NSPluginBase, db_base.CommonDbMixin):
if not vnf_ids:
vnf_ids = None
if not mgmt_urls:
mgmt_urls = None
if not mgmt_ip_addresses:
mgmt_ip_addresses = None
if not vnffg_ids:
vnffg_ids = None
status = constants.ACTIVE if mistral_obj.state == 'SUCCESS' \
@ -325,7 +325,7 @@ class NSPluginDb(network_service.NSPluginBase, db_base.CommonDbMixin):
ns_db = self._get_resource(context, NS, ns_id)
ns_db.update({'vnf_ids': vnf_ids})
ns_db.update({'vnffg_ids': vnffg_ids})
ns_db.update({'mgmt_urls': mgmt_urls})
ns_db.update({'mgmt_ip_addresses': mgmt_ip_addresses})
ns_db.update({'status': status})
ns_db.update({'error_reason': error_reason})
ns_db.update({'updated_at': timeutils.utcnow()})

23
tacker/db/vnfm/vnfm_db.py

@ -131,8 +131,8 @@ class VNF(model_base.BASE, models_v1.HasId, models_v1.HasTenant,
# For a management tool to talk to manage this hosting vnf.
# opaque string.
# e.g. (driver, mgmt_url) = (ssh, ip address), ...
mgmt_url = sa.Column(sa.String(255), nullable=True)
# e.g. (driver, mgmt_ip_address) = (ssh, ip address), ...
mgmt_ip_address = sa.Column(sa.String(255), nullable=True)
attributes = orm.relationship("VNFAttribute", backref="vnf")
status = sa.Column(sa.String(64), nullable=False)
@ -227,7 +227,8 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
}
key_list = ('id', 'tenant_id', 'name', 'description', 'instance_id',
'vim_id', 'placement_attr', 'vnfd_id', 'status',
'mgmt_url', 'error_reason', 'created_at', 'updated_at')
'mgmt_ip_address', 'error_reason', 'created_at',
'updated_at')
res.update((key, vnf_db[key]) for key in key_list)
return self._fields(res, fields)
@ -436,14 +437,15 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
# called internally, not by REST API
# intsance_id = None means error on creation
def _create_vnf_post(self, context, vnf_id, instance_id,
mgmt_url, vnf_dict):
mgmt_ip_address, vnf_dict):
LOG.debug('vnf_dict %s', vnf_dict)
with context.session.begin(subtransactions=True):
query = (self._model_query(context, VNF).
filter(VNF.id == vnf_id).
filter(VNF.status.in_(CREATE_STATES)).
one())
query.update({'instance_id': instance_id, 'mgmt_url': mgmt_url})
query.update({'instance_id': instance_id,
'mgmt_ip_address': mgmt_ip_address})
if instance_id is None or vnf_dict['status'] == constants.ERROR:
query.update({'status': constants.ERROR})
@ -453,7 +455,8 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
self._vnf_attribute_update_or_create(context, vnf_id,
key, value)
evt_details = ("Infra Instance ID created: %s and "
"Mgmt URL set: %s") % (instance_id, mgmt_url)
"Mgmt IP address set: %s") % (instance_id,
mgmt_ip_address)
self._cos_db_plg.create_event(
context, res_id=vnf_dict['id'],
res_type=constants.RES_TYPE_VNF,
@ -509,12 +512,12 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
policy,
previous_statuses,
status,
mgmt_url=None):
mgmt_ip_address=None):
with context.session.begin(subtransactions=True):
vnf_db = self._update_vnf_status_db(
context, policy['vnf']['id'], previous_statuses, status)
if mgmt_url:
vnf_db.update({'mgmt_url': mgmt_url})
if mgmt_ip_address:
vnf_db.update({'mgmt_ip_address': mgmt_ip_address})
updated_vnf_dict = self._make_vnf_dict(vnf_db)
self._cos_db_plg.create_event(
context, res_id=updated_vnf_dict['id'],
@ -547,7 +550,7 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
filter(VNF.status == vnf_status).
update({'status': new_status,
'updated_at': updated_time_stamp,
'mgmt_url': new_vnf_dict['mgmt_url']}))
'mgmt_ip_address': new_vnf_dict['mgmt_ip_address']}))
dev_attrs = new_vnf_dict.get('attributes', {})
(context.session.query(VNFAttribute).

2
tacker/extensions/nfvo.py

@ -803,7 +803,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'is_visible': True,
'default': None,
},
'mgmt_urls': {
'mgmt_ip_addresses': {
'allow_post': False,
'allow_put': False,
'convert_to': attr.convert_none_to_empty_dict,

2
tacker/extensions/vnfm.py

@ -327,7 +327,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {'type:string': None},
'is_visible': True,
},
'mgmt_url': {
'mgmt_ip_address': {
'allow_post': False,
'allow_put': False,
'validate': {'type:string': None},

12
tacker/nfvo/drivers/workflow/workflow_generator.py

@ -16,7 +16,7 @@ from tacker.mistral import workflow_generator
OUTPUT = {
'create_vnf': ['vnf_id', 'vim_id', 'mgmt_url', 'status'],
'create_vnf': ['vnf_id', 'vim_id', 'mgmt_ip_address', 'status'],
'create_vnffg': ['vnffg_id'],
}
@ -39,8 +39,9 @@ class WorkflowGenerator(workflow_generator.WorkflowGeneratorBase):
'%>'.format(task),
'vim_id_' + node: '<% task({0}).result.vnf.vim_id'
' %>'.format(task),
'mgmt_url_' + node: '<% task({0}).result.vnf.mgmt_url'
' %>'.format(task),
'mgmt_ip_address_' + node: '<% task({0}).result.vnf.'
'mgmt_ip_address '
'%>'.format(task),
'status_' + node: '<% task({0}).result.vnf.status'
' %>'.format(task),
},
@ -69,8 +70,9 @@ class WorkflowGenerator(workflow_generator.WorkflowGeneratorBase):
'%>'.format(node),
},
'publish': {
'mgmt_url_' + node: ' <% task({0}).result.vnf.'
'mgmt_url %>'.format(task),
'mgmt_ip_address_' + node: ' <% task({0}).result.'
'vnf.mgmt_ip_address '
'%>'.format(task),
'status_' + node: '<% task({0}).result.vnf.status'
' %>'.format(task),
},

3
tacker/tests/functional/base.py

@ -185,7 +185,8 @@ class BaseTackerTest(base.BaseTestCase):
constants.VNF_CIRROS_CREATE_TIMEOUT,
constants.ACTIVE_SLEEP_TIME)
self.validate_vnf_instance(vnfd_instance, vnf_instance)
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url'])
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf'][
'mgmt_ip_address'])
self.wait_until_vnf_dead(
vnf_id,

4
tacker/tests/functional/nfvo/test_nfvo.py

@ -142,7 +142,7 @@ class NsdTestCreate(base.BaseTackerTest):
constants.NS_CREATE_TIMEOUT,
constants.ACTIVE_SLEEP_TIME)
ns_show_out = self.client.show_ns(ns_id)['ns']
self.assertIsNotNone(ns_show_out['mgmt_urls'])
self.assertIsNotNone(ns_show_out['mgmt_ip_addresses'])
try:
self.client.delete_ns(ns_id)
@ -182,7 +182,7 @@ class NsdTestCreate(base.BaseTackerTest):
constants.ACTIVE_SLEEP_TIME)
ns_show_out = self.client.show_ns(ns_id)['ns']
self.assertIsNotNone(ns_show_out['mgmt_urls'])
self.assertIsNotNone(ns_show_out['mgmt_ip_addresses'])
vnffg = self.client.list_vnffgs()
self.assertIsNotNone(vnffg)
try:

14
tacker/tests/functional/vnfm/test_tosca_vnf.py

@ -63,7 +63,7 @@ class VnfTestToscaCreate(base.BaseTackerTest):
constants.VNF_CIRROS_CREATE_TIMEOUT,
constants.ACTIVE_SLEEP_TIME)
vnf_show_out = self.client.show_vnf(vnf_id)['vnf']
self.assertIsNotNone(vnf_show_out['mgmt_url'])
self.assertIsNotNone(vnf_show_out['mgmt_ip_address'])
input_dict = yaml.safe_load(values_str)
prop_dict = input_dict['topology_template']['node_templates'][
@ -71,10 +71,10 @@ class VnfTestToscaCreate(base.BaseTackerTest):
# Verify if ip_address is static, it is same as in show_vnf
if prop_dict.get('ip_address'):
mgmt_url_input = prop_dict.get('ip_address')
mgmt_ip_address_input = prop_dict.get('ip_address')
mgmt_info = yaml.safe_load(
vnf_show_out['mgmt_url'])
self.assertEqual(mgmt_url_input, mgmt_info['VDU1'])
vnf_show_out['mgmt_ip_address'])
self.assertEqual(mgmt_ip_address_input, mgmt_info['VDU1'])
# Verify anti spoofing settings
stack_id = vnf_show_out['instance_id']
@ -181,7 +181,8 @@ class VnfTestToscaCreateFlavorCreation(base.BaseTackerTest):
vnf_id,
constants.VNF_CIRROS_CREATE_TIMEOUT,
constants.ACTIVE_SLEEP_TIME)
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url'])
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf'][
'mgmt_ip_address'])
self.verify_vnf_crud_events(
vnf_id, evt_constants.RES_EVT_CREATE,
@ -245,7 +246,8 @@ class VnfTestToscaCreateImageCreation(base.BaseTackerTest):
vnf_id,
constants.VNF_CIRROS_CREATE_TIMEOUT,
constants.ACTIVE_SLEEP_TIME)
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url'])
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf'][
'mgmt_ip_address'])
self.verify_vnf_crud_events(
vnf_id, evt_constants.RES_EVT_CREATE,

3
tacker/tests/functional/vnfm/test_tosca_vnf_alarm.py

@ -53,7 +53,8 @@ class VnfTestAlarmMonitor(base.BaseTackerTest):
constants.ACTIVE_SLEEP_TIME)
vnf = self.client.show_vnf(vnf_id)['vnf']
# {"VDU1": ["10.0.0.14", "10.0.0.5"]}
self.assertEqual(count, len(json.loads(vnf['mgmt_url'])['VDU1']))
self.assertEqual(count, len(json.loads(vnf[
'mgmt_ip_address'])['VDU1']))
def trigger_vnf(vnf, policy_name, policy_action):
credential = 'g0jtsxu9'

8
tacker/tests/functional/vnfm/test_tosca_vnf_block_storage.py

@ -60,7 +60,7 @@ class VnfBlockStorageTestToscaCreate(base.BaseTackerTest):
constants.VNF_CIRROS_CREATE_TIMEOUT,
constants.ACTIVE_SLEEP_TIME)
vnf_show_out = self.client.show_vnf(vnf_id)['vnf']
self.assertIsNotNone(vnf_show_out['mgmt_url'])
self.assertIsNotNone(vnf_show_out['mgmt_ip_address'])
input_dict = yaml.safe_load(values_str)
prop_dict = input_dict['topology_template']['node_templates'][
@ -68,10 +68,10 @@ class VnfBlockStorageTestToscaCreate(base.BaseTackerTest):
# Verify if ip_address is static, it is same as in show_vnf
if prop_dict.get('ip_address'):
mgmt_url_input = prop_dict.get('ip_address')
mgmt_ip_address_input = prop_dict.get('ip_address')
mgmt_info = yaml.safe_load(
vnf_show_out['mgmt_url'])
self.assertEqual(mgmt_url_input, mgmt_info['VDU1'])
vnf_show_out['mgmt_ip_address'])
self.assertEqual(mgmt_ip_address_input, mgmt_info['VDU1'])
# Verify anti spoofing settings
stack_id = vnf_show_out['instance_id']

2
tacker/tests/functional/vnfm/test_tosca_vnf_floatingip.py

@ -86,7 +86,7 @@ class VnfTestToscaFloatingIp(base.BaseTackerTest):
constants.VNF_CIRROS_CREATE_TIMEOUT,
constants.ACTIVE_SLEEP_TIME)
vnf_show_out = self.client.show_vnf(vnf_id)['vnf']
self.assertIsNotNone(vnf_show_out['mgmt_url'])
self.assertIsNotNone(vnf_show_out['mgmt_ip_address'])
stack_id = vnf_show_out['instance_id']
fip_res = self.get_heat_stack_resource(stack_id, 'FIP1')

9
tacker/tests/functional/vnfm/test_tosca_vnf_multiple_vdu.py

@ -57,10 +57,11 @@ class VnfTestToscaMultipleVDU(base.BaseTackerTest):
self.verify_vnf_crud_events(
vnf_id, evt_constants.RES_EVT_CREATE, evt_constants.ACTIVE)
# Validate mgmt_url with input yaml file
mgmt_url = self.client.show_vnf(vnf_id)['vnf']['mgmt_url']
self.assertIsNotNone(mgmt_url)
mgmt_dict = yaml.safe_load(str(mgmt_url))
# Validate mgmt_ip_address with input yaml file
mgmt_ip_address = self.client.show_vnf(vnf_id)['vnf'][
'mgmt_ip_address']
self.assertIsNotNone(mgmt_ip_address)
mgmt_dict = yaml.safe_load(str(mgmt_ip_address))
input_dict = yaml.safe_load(input_yaml)
toscautils.updateimports(input_dict)

3
tacker/tests/functional/vnfm/test_tosca_vnf_scale.py

@ -59,7 +59,8 @@ class VnfTestToscaScale(base.BaseTackerTest):
vnf = self.client.show_vnf(vnf_id)['vnf']
# {"VDU1": ["10.0.0.14", "10.0.0.5"]}
self.assertEqual(count, len(json.loads(vnf['mgmt_url'])['VDU1']))
self.assertEqual(count, len(json.loads(vnf[
'mgmt_ip_address'])['VDU1']))
_wait(2)
# Get nested resources when vnf is in active state

9
tacker/tests/functional/vnfm/test_tosca_vnfc.py

@ -70,10 +70,11 @@ class VnfTestToscaVNFC(base.BaseTackerTest):
self.verify_vnf_crud_events(
vnf_id, evt_constants.RES_EVT_CREATE, evt_constants.ACTIVE)
# Validate mgmt_url with input yaml file
mgmt_url = self.client.show_vnf(vnf_id)['vnf']['mgmt_url']
self.assertIsNotNone(mgmt_url)
mgmt_dict = yaml.safe_load(str(mgmt_url))
# Validate mgmt_ip_address with input yaml file
mgmt_ip_address = self.client.show_vnf(vnf_id)['vnf'][
'mgmt_ip_address']
self.assertIsNotNone(mgmt_ip_address)
mgmt_dict = yaml.safe_load(str(mgmt_ip_address))
input_dict = yaml.safe_load(input_yaml)
toscautils.updateimports(input_dict)

3
tacker/tests/functional/vnfm/test_vnf.py

@ -48,7 +48,8 @@ class VnfTestCreate(base.BaseTackerTest):
vnf_id,
constants.VNF_CIRROS_CREATE_TIMEOUT,
constants.ACTIVE_SLEEP_TIME)
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url'])
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf'][
'mgmt_ip_address'])
if vim_id:
self.assertEqual(vim_id, vnf_instance['vnf']['vim_id'])

3
tacker/tests/functional/vnfm/test_vnfm_param.py

@ -66,7 +66,8 @@ class VnfmTestParam(base.BaseTackerTest):
vnf_id,
constants.VNF_CIRROS_CREATE_TIMEOUT,
constants.ACTIVE_SLEEP_TIME)
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url'])
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf'][
'mgmt_ip_address'])
vnf_instance = self.client.show_vnf(vnf_id)
self.verify_vnf_crud_events(

5
tacker/tests/unit/db/utils.py

@ -140,7 +140,7 @@ def get_dummy_vnf():
'attributes': {u'vnfd': tosca_vnfd_openwrt},
'id': u'fb048660-dc1b-4f0f-bd89-b023666650ec',
'name': u'openwrt_services'},
'mgmt_url': None, 'service_context': [],
'mgmt_ip_address': None, 'service_context': [],
'attributes': {u'param_values': u''},
'id': 'eb84260e-5ff7-4332-b032-50a14d6c1123',
'description': u'OpenWRT with services'}
@ -157,7 +157,8 @@ def get_dummy_vnf_config_attr():
'mgmt_driver': u'openwrt',
'attributes': {u'vnfd': tosca_vnfd_openwrt},
'id': u'fb048660-dc1b-4f0f-bd89-b023666650ec', 'name':
u'openwrt_services'}, 'mgmt_url': None, 'service_context': [],
u'openwrt_services'}, 'mgmt_ip_address': None,
'service_context': [],
'attributes': {u'config': config_data},
'id': 'eb84260e-5ff7-4332-b032-50a14d6c1123',
'description': u'OpenWRT with services'}

50
tacker/tests/unit/nfvo/drivers/workflow/test_workflow_generator.py

@ -121,8 +121,10 @@ def get_dummy_create_workflow():
'publish': {
'status_VNF2': '<% task(wait_vnf_active_VNF2).'
'result.vnf.status %>',
'mgmt_url_VNF2': ' <% task(wait_vnf_active_VNF2).'
'result.vnf.mgmt_url %>'},
'mgmt_ip_address_VNF2': ' <% task('
'wait_vnf_active_VNF2).'
'result.vnf.'
'mgmt_ip_address %>'},
'on-success': [{
'delete_vnf_VNF2': '<% $.status_VNF2='
'"ERROR" %>'}]},
@ -134,8 +136,10 @@ def get_dummy_create_workflow():
'result.vnf.status %>',
'vim_id_VNF2': '<% task(create_ns_VNF2).'
'result.vnf.vim_id %>',
'mgmt_url_VNF2': '<% task(create_ns_VNF2).'
'result.vnf.mgmt_url %>',
'mgmt_ip_address_VNF2': '<% task('
'create_ns_VNF2).'
'result.vnf.'
'mgmt_ip_address %>',
'vnf_id_VNF2': '<% task(create_ns_VNF2)'
'.result.vnf.id %>'},
'on-success': ['wait_vnf_active_VNF2']},
@ -147,8 +151,10 @@ def get_dummy_create_workflow():
'result.vnf.status %>',
'vnf_id_VNF1': '<% task(create_ns_VNF1).'
'result.vnf.id %>',
'mgmt_url_VNF1': '<% task(create_ns_VNF1).'
'result.vnf.mgmt_url %>',
'mgmt_ip_address_VNF1': '<% task('
'create_ns_VNF1).'
'result.vnf.'
'mgmt_ip_address %>',
'vim_id_VNF1': '<% task(create_ns_VNF1).'
'result.vnf.vim_id %>'},
'on-success': ['wait_vnf_active_VNF1']},
@ -161,8 +167,10 @@ def get_dummy_create_workflow():
'publish': {
'status_VNF1': '<% task(wait_vnf_active_VNF1).'
'result.vnf.status %>',
'mgmt_url_VNF1': ' <% task(wait_vnf_active_VNF1).'
'result.vnf.mgmt_url %>'},
'mgmt_ip_address_VNF1': ' <% task('
'wait_vnf_active_VNF1).'
'result.vnf.'
'mgmt_ip_address %>'},
'on-success': [{'delete_vnf_VNF1': '<% $.status_VNF1='
'"ERROR" %>'}]},
'delete_vnf_VNF1': {
@ -172,8 +180,8 @@ def get_dummy_create_workflow():
'type': 'direct', 'output': {
'status_VNF1': '<% $.status_VNF1 %>',
'status_VNF2': '<% $.status_VNF2 %>',
'mgmt_url_VNF2': '<% $.mgmt_url_VNF2 %>',
'mgmt_url_VNF1': '<% $.mgmt_url_VNF1 %>',
'mgmt_ip_address_VNF2': '<% $.mgmt_ip_address_VNF2 %>',
'mgmt_ip_address_VNF1': '<% $.mgmt_ip_address_VNF1 %>',
'vim_id_VNF2': '<% $.vim_id_VNF2 %>',
'vnf_id_VNF1': '<% $.vnf_id_VNF1 %>',
'vnf_id_VNF2': '<% $.vnf_id_VNF2 %>',
@ -199,9 +207,9 @@ def get_dummy_create_vnffg_ns_workflow():
'status_VNF2':
'<% task(wait_vnf_active_VNF2).result.'
'vnf.status %>',
'mgmt_url_VNF2':
'mgmt_ip_address_VNF2':
' <% task(wait_vnf_active_VNF2).result.'
'vnf.mgmt_url %>'},
'vnf.mgmt_ip_address %>'},
'on-success': [
{'delete_vnf_VNF2': '<% $.status_VNF2="ERROR" %>'},
'create_vnffg_VNFFG1']},
@ -225,9 +233,9 @@ def get_dummy_create_vnffg_ns_workflow():
'status_VNF1':
'<% task(wait_vnf_active_VNF1).result.'
'vnf.status %>',
'mgmt_url_VNF1':
'mgmt_ip_address_VNF1':
' <% task(wait_vnf_active_VNF1).result.'
'vnf.mgmt_url %>'},
'vnf.mgmt_ip_address %>'},
'on-success': [
{'delete_vnf_VNF1': '<% $.status_VNF1="ERROR" %>'},
'create_vnffg_VNFFG1']},
@ -239,8 +247,9 @@ def get_dummy_create_vnffg_ns_workflow():
'<% task(create_ns_VNF1).result.vnf.status %>',
'vnf_id_VNF1':
'<% task(create_ns_VNF1).result.vnf.id %>',
'mgmt_url_VNF1':
'<% task(create_ns_VNF1).result.vnf.mgmt_url %>',
'mgmt_ip_address_VNF1':
'<% task(create_ns_VNF1).result.'
'vnf.mgmt_ip_address %>',
'vim_id_VNF1':
'<% task(create_ns_VNF1).result.vnf.vim_id %>'},
'on-success': ['wait_vnf_active_VNF1']},
@ -252,8 +261,9 @@ def get_dummy_create_vnffg_ns_workflow():
'<% task(create_ns_VNF2).result.vnf.status %>',
'vim_id_VNF2':
'<% task(create_ns_VNF2).result.vnf.vim_id %>',
'mgmt_url_VNF2':
'<% task(create_ns_VNF2).result.vnf.mgmt_url %>',
'mgmt_ip_address_VNF2':
'<% task(create_ns_VNF2).result.'
'vnf.mgmt_ip_address %>',
'vnf_id_VNF2':
'<% task(create_ns_VNF2).result.vnf.id %>'},
'on-success': ['wait_vnf_active_VNF2']},
@ -265,8 +275,8 @@ def get_dummy_create_vnffg_ns_workflow():
'output': {
'status_VNF1': '<% $.status_VNF1 %>',
'status_VNF2': '<% $.status_VNF2 %>',
'mgmt_url_VNF2': '<% $.mgmt_url_VNF2 %>',
'mgmt_url_VNF1': '<% $.mgmt_url_VNF1 %>',
'mgmt_ip_address_VNF2': '<% $.mgmt_ip_address_VNF2 %>',
'mgmt_ip_address_VNF1': '<% $.mgmt_ip_address_VNF1 %>',
'vnffg_id_VNFFG1': '<% $.vnffg_id_VNFFG1 %>',
'vim_id_VNF2': '<% $.vim_id_VNF2 %>',
'vnf_id_VNF1': '<% $.vnf_id_VNF1 %>',

9
tacker/tests/unit/vnfm/infra_drivers/openstack/test_openstack.py

@ -171,7 +171,7 @@ class TestOpenStack(base.TestCase):
'attributes': {u'vnfd': self.tosca_vnfd_openwrt},
'id': u'fb048660-dc1b-4f0f-bd89-b023666650ec',
'name': u'OpenWRT'},
'mgmt_url': '{"vdu1": "192.168.120.31"}',
'mgmt_ip_address': '{"vdu1": "192.168.120.31"}',
'service_context': [],
'attributes': {u'param_values': param_values},
'id': 'eb84260e-5ff7-4332-b032-50a14d6c1123',
@ -188,7 +188,8 @@ class TestOpenStack(base.TestCase):
u'ad7ebc56538745a08ef7c5e97f8bd437', 'mgmt_driver': u'openwrt',
'attributes': {u'vnfd': self.tosca_vnfd_openwrt},
'id': u'fb048660-dc1b-4f0f-bd89-b023666650ec', 'name':
u'openwrt_services'}, 'mgmt_url': None, 'service_context': [],
u'openwrt_services'}, 'mgmt_ip_address': None,
'service_context': [],
'attributes': {'config': utils.update_config_data},
'id': 'eb84260e-5ff7-4332-b032-50a14d6c1123', 'description':
u'OpenWRT with services'}
@ -210,7 +211,7 @@ class TestOpenStack(base.TestCase):
'attributes': {u'vnfd': self.tosca_vnfd_openwrt},
'id': u'fb048660-dc1b-4f0f-bd89-b023666650ec',
'name': u'openwrt_services'},
'mgmt_url': '{"vdu1": "192.168.120.31"}',
'mgmt_ip_address': '{"vdu1": "192.168.120.31"}',
'service_context': [],
'id': 'eb84260e-5ff7-4332-b032-50a14d6c1123',
'description': u'OpenWRT with services'}
@ -279,7 +280,7 @@ class TestOpenStack(base.TestCase):
},
'id': 'eb84260e-5ff7-4332-b032-50a14d6c1123',
'instance_id': None,
'mgmt_url': None,
'mgmt_ip_address': None,
'name': u'test_openwrt',
'service_context': [],
'status': 'PENDING_CREATE',

2
tacker/tests/unit/vnfm/policy_actions/vdu_autoheal/test_vdu_autoheal.py

@ -27,7 +27,7 @@ from tacker.vnfm.policy_actions.vdu_autoheal import vdu_autoheal
vnf_dict = {
'id': uuidutils.generate_uuid(),
'mgmt_url': '{"VDU1": "a.b.c.d"}',
'mgmt_ip_address': '{"VDU1": "a.b.c.d"}',
'vim_id': '6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'instance_id': 'a737497c-761c-11e5-89c3-9cb6541d805d',
'attributes': {

22
tacker/tests/unit/vnfm/test_monitor.py

@ -25,7 +25,7 @@ from tacker.vnfm import monitor
MOCK_VNF_ID = 'a737497c-761c-11e5-89c3-9cb6541d805d'
MOCK_VNF = {
'id': MOCK_VNF_ID,
'management_ip_addresses': {
'mgmt_ip_addresses': {
'vdu1': 'a.b.c.d'
},
'monitoring_policy': {
@ -52,7 +52,7 @@ MOCK_VNF = {
MOCK_VNF_DEVICE_FOR_VDU_AUTOHEAL = {
'id': MOCK_VNF_ID,
'management_ip_addresses': {
'mgmt_ip_addresses': {
'vdu1': 'a.b.c.d'
},
'monitoring_policy': {
@ -93,17 +93,17 @@ class TestVNFMonitor(testtools.TestCase):
def test_to_hosting_vnf(self):
test_vnf_dict = {
'id': MOCK_VNF_ID,
'mgmt_url': '{"vdu1": "a.b.c.d"}',
'mgmt_ip_address': '{"vdu1": "a.b.c.d"}',
'attributes': {
'monitoring_policy': json.dumps(
MOCK_VNF['monitoring_policy'])
MOCK_VNF['monitoring_policy'])
}
}
action_cb = mock.MagicMock()
expected_output = {
'id': MOCK_VNF_ID,
'action_cb': action_cb,
'management_ip_addresses': {
'mgmt_ip_addresses': {
'vdu1': 'a.b.c.d'
},
'vnf': test_vnf_dict,
@ -117,10 +117,10 @@ class TestVNFMonitor(testtools.TestCase):
def test_add_hosting_vnf(self, mock_monitor_run):
test_vnf_dict = {
'id': MOCK_VNF_ID,
'mgmt_url': '{"vdu1": "a.b.c.d"}',
'mgmt_ip_address': '{"vdu1": "a.b.c.d"}',
'attributes': {
'monitoring_policy': json.dumps(
MOCK_VNF['monitoring_policy'])
MOCK_VNF['monitoring_policy'])
},
'status': 'ACTIVE'
}
@ -165,7 +165,7 @@ class TestVNFMonitor(testtools.TestCase):
test_device_dict = {
'status': 'ACTIVE',
'id': MOCK_VNF_ID,
'mgmt_url': '{"vdu1": "a.b.c.d"}',
'mgmt_ip_address': '{"vdu1": "a.b.c.d"}',
'attributes': {
'monitoring_policy': json.dumps(
MOCK_VNF_DEVICE_FOR_VDU_AUTOHEAL['monitoring_policy'])
@ -185,11 +185,11 @@ class TestVNFMonitor(testtools.TestCase):
test_vnfmonitor = monitor.VNFMonitor(test_boot_wait)
vnf_dict = {
'id': MOCK_VNF_ID,
'mgmt_url': '{"vdu1": "a.b.c.d"}',
'management_ip_addresses': 'a.b.c.d',
'mgmt_ip_address': '{"vdu1": "a.b.c.d"}',
'mgmt_ip_addresses': 'a.b.c.d',
'vnf': {
'id': MOCK_VNF_ID,
'mgmt_url': '{"vdu1": "a.b.c.d"}',
'mgmt_ip_address': '{"vdu1": "a.b.c.d"}',
'attributes': {
'monitoring_policy': json.dumps(
MOCK_VNF['monitoring_policy'])

14
tacker/tests/unit/vnfm/test_plugin.py

@ -107,9 +107,9 @@ class TestVNFMPluginMonitor(db_base.SqlTestCase):
'"interval": 1, "monitoring_delay": 45, "timeout": 2},'
'"monitoring_params": {"count": 3, "interval": 1,'
'"monitoring_delay": 45, "timeout": 2}}}}}'},
'mgmt_url': '{"VDU1": "a.b.c.d"}',
'mgmt_ip_address': '{"VDU1": "a.b.c.d"}',
'deleted_at': datetime.min,
'management_ip_addresses': 'a.b.c.d'
'mgmt_ip_addresses': 'a.b.c.d'
}]
mock_get_vnfs.return_value = vnfs
@ -122,7 +122,7 @@ class TestVNFMPluginMonitor(db_base.SqlTestCase):
vnfm_plugin = plugin.VNFMPlugin()
hosting_vnfs = vnfm_plugin._vnf_monitor._hosting_vnfs.values()
hosting_vnf = hosting_vnfs[0]['vnf']
self.assertEqual('{"VDU1": "a.b.c.d"}', hosting_vnf['mgmt_url'])
self.assertEqual('{"VDU1": "a.b.c.d"}', hosting_vnf['mgmt_ip_address'])
self.assertEqual(1, len(hosting_vnfs))
@ -370,7 +370,7 @@ class TestVNFMPlugin(db_base.SqlTestCase):
self.assertIn('instance_id', result)
self.assertIn('status', result)
self.assertIn('attributes', result)
self.assertIn('mgmt_url', result)
self.assertIn('mgmt_ip_address', result)
self.assertIn('created_at', result)
self.assertIn('updated_at', result)
self._vnf_manager.invoke.assert_called_with('test_vim',
@ -397,7 +397,7 @@ class TestVNFMPlugin(db_base.SqlTestCase):
self.assertIn('instance_id', result)