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
This commit is contained in:
venkatamahesh 2017-08-03 18:36:25 +05:30 committed by dharmendra
parent bb45c4852b
commit 5a1e4a1ccb
49 changed files with 231 additions and 167 deletions

View File

@ -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

View File

@ -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

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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

View File

@ -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 |

View File

@ -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 |

View File

@ -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 |

View File

@ -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 |
+--------------------------------------+------+----------------------------+--------+--------------------------------------+--------------------------------------+

View File

@ -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 |

View File

@ -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 |

View File

@ -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' %>

View File

@ -1 +1 @@
13ecc2dd6f7f
cd04a8335c18

View File

@ -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)

View File

@ -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()})

View File

@ -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).

View File

@ -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,

View File

@ -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},

View File

@ -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),
},

View File

@ -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,

View File

@ -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:

View File

@ -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,

View File

@ -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'

View File

@ -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']

View File

@ -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')

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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'])

View File

@ -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(

View File

@ -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'}

View File

@ -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 %>',

View File

@ -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',

View File

@ -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': {

View File

@ -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'])

View File

@ -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)
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)
mock_create_vnfd.assert_called_once_with(mock.ANY, mock.ANY)
@ -521,7 +521,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('updated_at', result)
self._pool.spawn_n.assert_called_once_with(mock.ANY, mock.ANY,
mock.ANY, mock.ANY,
@ -676,7 +676,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('updated_at', result)
self._vnf_manager.invoke.assert_called_with(

View File

@ -163,7 +163,7 @@ class Kubernetes(abstract_driver.VnfAbstractDriver,
get("vdu_name").split("-")[1]
mgmt_ip = service_info.spec.cluster_ip
mgmt_ips.update({vdu_name: mgmt_ip})
vnf_dict['mgmt_url'] = jsonutils.dumps(mgmt_ips)
vnf_dict['mgmt_ip_address'] = jsonutils.dumps(mgmt_ips)
except Exception as e:
LOG.error('Creating wait VNF got an error due to %s', e)
raise

View File

@ -159,7 +159,7 @@ class OpenStack(abstract_driver.VnfAbstractDriver,
mgmt_ips = self._find_mgmt_ips(stack.outputs)
if mgmt_ips:
vnf_dict['mgmt_url'] = jsonutils.dumps(mgmt_ips)
vnf_dict['mgmt_ip_address'] = jsonutils.dumps(mgmt_ips)
def _wait_until_stack_ready(self, vnf_id, auth_attr, wait_status,
region_name=None):
@ -253,7 +253,7 @@ class OpenStack(abstract_driver.VnfAbstractDriver,
mgmt_ips = self._find_mgmt_ips(stack.outputs)
if mgmt_ips:
vnf_dict['mgmt_url'] = jsonutils.dumps(mgmt_ips)
vnf_dict['mgmt_ip_address'] = jsonutils.dumps(mgmt_ips)
@log.log
def delete(self, plugin, context, vnf_id, auth_attr, region_name=None):

View File

@ -73,7 +73,7 @@ class VnfMGMTAbstractDriver(extensions.PluginInterface):
return {}
@abc.abstractmethod
def mgmt_url(self, plugin, context, vnf):
def mgmt_ip_address(self, plugin, context, vnf):
pass
@abc.abstractmethod

View File

@ -32,8 +32,8 @@ class VnfMgmtNoop(abstract_driver.VnfMGMTAbstractDriver):
def get_description(self):
return 'Tacker VNFMgmt Noop Driver'
def mgmt_url(self, plugin, context, vnf):
LOG.debug('mgmt_url %s', vnf)
def mgmt_ip_address(self, plugin, context, vnf):
LOG.debug('mgmt_ip_address %s', vnf)
return 'noop-mgmt-url'
def mgmt_call(self, plugin, context, vnf, kwargs):

View File

@ -48,9 +48,9 @@ class VnfMgmtOpenWRT(abstract_driver.VnfMGMTAbstractDriver):
def get_description(self):
return 'Tacker VNFMgmt OpenWRT Driver'
def mgmt_url(self, plugin, context, vnf):
LOG.debug('mgmt_url %s', vnf)
return vnf.get('mgmt_url', '')
def mgmt_ip_address(self, plugin, context, vnf):
LOG.debug('mgmt_ip_address %s', vnf)
return vnf.get('mgmt_ip_address', '')
@log.log
def _config_service(self, mgmt_ip_address, service, config):
@ -82,8 +82,8 @@ class VnfMgmtOpenWRT(abstract_driver.VnfMGMTAbstractDriver):
return
dev_attrs = vnf.get('attributes', {})
mgmt_url = jsonutils.loads(vnf.get('mgmt_url', '{}'))
if not mgmt_url:
mgmt_ip_address = jsonutils.loads(vnf.get('mgmt_ip_address', '{}'))
if not mgmt_ip_address:
return
vdus_config = dev_attrs.get('config', '')
@ -97,7 +97,7 @@ class VnfMgmtOpenWRT(abstract_driver.VnfMGMTAbstractDriver):
KNOWN_SERVICES = ('firewall', 'network', 'dhcp', 'qos')
if key not in KNOWN_SERVICES:
continue
mgmt_ip_address = mgmt_url.get(vdu, '')
mgmt_ip_address = mgmt_ip_address.get(vdu, '')
if not mgmt_ip_address:
LOG.warning('tried to configure unknown mgmt '
'address on VNF %(vnf)s VDU %(vdu)s',

View File

@ -105,8 +105,8 @@ class VNFMonitor(object):
def to_hosting_vnf(vnf_dict, action_cb):
return {
'id': vnf_dict['id'],
'management_ip_addresses': jsonutils.loads(
vnf_dict['mgmt_url']),
'mgmt_ip_addresses': jsonutils.loads(
vnf_dict['mgmt_ip_address']),
'action_cb': action_cb,
'vnf': vnf_dict,
'monitoring_policy': jsonutils.loads(
@ -116,7 +116,7 @@ class VNFMonitor(object):
def add_hosting_vnf(self, new_vnf):
LOG.debug('Adding host %(id)s, Mgmt IP %(ips)s',
{'id': new_vnf['id'],
'ips': new_vnf['management_ip_addresses']})
'ips': new_vnf['mgmt_ip_addresses']})
new_vnf['boot_at'] = timeutils.utcnow()
with self._lock:
VNFMonitor._hosting_vnfs[new_vnf['id']] = new_vnf
@ -136,7 +136,7 @@ class VNFMonitor(object):
if hosting_vnf:
LOG.debug('deleting vnf_id %(vnf_id)s, Mgmt IP %(ips)s',
{'vnf_id': vnf_id,
'ips': hosting_vnf['management_ip_addresses']})
'ips': hosting_vnf['mgmt_ip_addresses']})
def update_hosting_vnf(self, updated_vnf_dict, evt_details=None):
with self._lock:
@ -145,8 +145,8 @@ class VNFMonitor(object):
if vnf_to_update:
updated_vnf = copy.deepcopy(updated_vnf_dict)
vnf_to_update['vnf'] = updated_vnf
vnf_to_update['management_ip_addresses'] = jsonutils.loads(
updated_vnf_dict['mgmt_url'])
vnf_to_update['mgmt_ip_addresses'] = jsonutils.loads(
updated_vnf_dict['mgmt_ip_address'])
if evt_details is not None:
vnfm_utils.log_events(t_context.get_admin_context(),
@ -155,7 +155,7 @@ class VNFMonitor(object):
evt_details=evt_details)
def run_monitor(self, hosting_vnf):
mgmt_ips = hosting_vnf['management_ip_addresses']
mgmt_ips = hosting_vnf['mgmt_ip_addresses']
vdupolicies = hosting_vnf['monitoring_policy']['vdus']
vnf_delay = hosting_vnf['monitoring_policy'].get(
@ -227,20 +227,20 @@ class VNFAppMonitor(object):
'tacker.tacker.app_monitor.drivers',
cfg.CONF.tacker.app_monitor_driver)
def _create_app_monitoring_dict(self, dev_attrs, mgmt_url):
def _create_app_monitoring_dict(self, dev_attrs, mgmt_ip_address):
app_policy = 'app_monitoring_policy'
appmonitoring_dict = ast.literal_eval(dev_attrs[app_policy])
vdulist = appmonitoring_dict['vdus'].keys()
for vduname in vdulist:
temp = ast.literal_eval(mgmt_url)
temp = ast.literal_eval(mgmt_ip_address)
appmonitoring_dict['vdus'][vduname]['mgmt_ip'] = temp[vduname]
return appmonitoring_dict
def create_app_dict(self, context, vnf_dict):
dev_attrs = vnf_dict['attributes']
mgmt_url = vnf_dict['mgmt_url']
return self._create_app_monitoring_dict(dev_attrs, mgmt_url)
mgmt_ip_address = vnf_dict['mgmt_ip_address']
return self._create_app_monitoring_dict(dev_attrs, mgmt_ip_address)
def _invoke(self, driver, **kwargs):
method = inspect.stack()[1][3]

View File

@ -99,7 +99,7 @@ class VNFMMgmtMixin(object):
return self._invoke(
vnf_dict, plugin=self, context=context, vnf=vnf_dict)
def mgmt_url(self, context, vnf_dict):
def mgmt_ip_address(self, context, vnf_dict):
return self._invoke(
vnf_dict, plugin=self, context=context, vnf=vnf_dict)
@ -237,8 +237,8 @@ class VNFMPlugin(vnfm_db.VNFMPluginDb, VNFMMgmtMixin):
def add_vnf_to_monitor(self, context, vnf_dict):
dev_attrs = vnf_dict['attributes']
mgmt_url = vnf_dict['mgmt_url']
if 'monitoring_policy' in dev_attrs and mgmt_url:
mgmt_ip_address = vnf_dict['mgmt_ip_address']
if 'monitoring_policy' in dev_attrs and mgmt_ip_address:
def action_cb(action, **kwargs):
LOG.debug('policy action: %s', action)
self._vnf_action.invoke(
@ -305,20 +305,20 @@ class VNFMPlugin(vnfm_db.VNFMPluginDb, VNFMMgmtMixin):
six.text_type(e))
if instance_id is None or create_failed:
mgmt_url = None
mgmt_ip_address = None
else:
# mgmt_url = self.mgmt_url(context, vnf_dict)
# mgmt_ip_address = self.mgmt_ip_address(context, vnf_dict)
# FIXME(yamahata):
mgmt_url = vnf_dict['mgmt_url']
mgmt_ip_address = vnf_dict['mgmt_ip_address']
self._create_vnf_post(
context, vnf_id, instance_id, mgmt_url, vnf_dict)
context, vnf_id, instance_id, mgmt_ip_address, vnf_dict)
self.mgmt_create_post(context, vnf_dict)
if instance_id is None or create_failed:
return
vnf_dict['mgmt_url'] = mgmt_url
vnf_dict['mgmt_ip_address'] = mgmt_ip_address
kwargs = {
mgmt_constants.KEY_ACTION: mgmt_constants.ACTION_CREATE_VNF,
@ -471,7 +471,7 @@ class VNFMPlugin(vnfm_db.VNFMPluginDb, VNFMMgmtMixin):
evt_details = ("Ends the heal vnf request for VNF '%s'" %
vnf_dict['id'])
self._vnf_monitor.update_hosting_vnf(vnf_dict, evt_details)
# _update_vnf_post() method updates vnf_status and mgmt_url
# _update_vnf_post() method updates vnf_status and mgmt_ip_address
self._update_vnf_post(context, vnf_dict['id'],
new_status, vnf_dict,
constants.PENDING_HEAL,
@ -662,13 +662,13 @@ class VNFMPlugin(vnfm_db.VNFMPluginDb, VNFMMgmtMixin):
return result
# post
def _handle_vnf_scaling_post(new_status, mgmt_url=None):
def _handle_vnf_scaling_post(new_status, mgmt_ip_address=None):
status = _get_status()
result = self._update_vnf_scaling_status(context,
policy,
[status],
new_status,
mgmt_url)
mgmt_ip_address)
LOG.debug("Policy %(policy)s vnf is at %(status)s",
{'policy': policy['name'],
'status': new_status})
@ -705,7 +705,7 @@ class VNFMPlugin(vnfm_db.VNFMPluginDb, VNFMMgmtMixin):
try:
LOG.debug("Policy %s action is in progress",
policy['name'])
mgmt_url = self._vnf_manager.invoke(
mgmt_ip_address = self._vnf_manager.invoke(
infra_driver,
'scale_wait',
plugin=self,
@ -717,7 +717,7 @@ class VNFMPlugin(vnfm_db.VNFMPluginDb, VNFMMgmtMixin):
)
LOG.debug("Policy %s action is completed successfully",
policy['name'])
_handle_vnf_scaling_post(constants.ACTIVE, mgmt_url)
_handle_vnf_scaling_post(constants.ACTIVE, mgmt_ip_address)
# TODO(kanagaraj-manickam): Add support for config and mgmt
except Exception as e:
LOG.error("Policy %s action is failed to complete",