From e5ab89d1708271eecbdbc5bf361a2089b7ad6505 Mon Sep 17 00:00:00 2001 From: Wataru Juso Date: Fri, 5 Feb 2021 18:41:59 +0900 Subject: [PATCH] Modify notification request data This patch fix notification request data in following parameters. - _links -> vnfInstance, vnfLcmOpOcc : fixed because it was initialized before sending - changedInfo -> metadata : added Closes-Bug: #1905721 Change-Id: Icc2babb04ba67dd4b4fe20ff14e3e5dd2c65338e --- tacker/conductor/conductor_server.py | 2 -- tacker/objects/vnf_lcm_op_occs.py | 4 ++++ tacker/tests/unit/objects/fakes.py | 1 + tacker/tests/unit/vnflcm/fakes.py | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tacker/conductor/conductor_server.py b/tacker/conductor/conductor_server.py index 78dfb54a8..b9632f0d5 100644 --- a/tacker/conductor/conductor_server.py +++ b/tacker/conductor/conductor_server.py @@ -1490,13 +1490,11 @@ class Conductor(manager.Manager): notification['subscriptionId'] = line.id if (notification.get('notificationType') == 'VnfLcmOperationOccurrenceNotification'): - notification['_links'] = {} notification['_links']['subscription'] = {} notification['_links']['subscription']['href'] = \ CONF.vnf_lcm.endpoint_url + \ "/vnflcm/v1/subscriptions/" + line.id else: - notification['links'] = {} notification['links']['subscription'] = {} notification['links']['subscription']['href'] = \ CONF.vnf_lcm.endpoint_url + \ diff --git a/tacker/objects/vnf_lcm_op_occs.py b/tacker/objects/vnf_lcm_op_occs.py index c94427bc5..39bac6e9d 100644 --- a/tacker/objects/vnf_lcm_op_occs.py +++ b/tacker/objects/vnf_lcm_op_occs.py @@ -598,6 +598,7 @@ class VnfInfoModifications(base.TackerObject, fields = { 'vnf_instance_name': fields.StringField(nullable=True), 'vnf_instance_description': fields.StringField(nullable=True), + 'metadata': fields.DictOfStringsField(nullable=True, default={}), 'vim_connection_info': fields.ListOfObjectsField( 'VimConnectionInfo', nullable=True, default=[]), 'vim_connection_info_delete_ids': @@ -630,6 +631,7 @@ class VnfInfoModifications(base.TackerObject, def _from_dict(cls, data_dict): vnf_instance_name = data_dict.get('vnf_instance_name') vnf_instance_description = data_dict.get('vnf_instance_description') + metadata = data_dict.get('metadata') vim_connection_info = data_dict.get('vim_connection_info', []) vim_connection_info_delete_ids = data_dict.get( 'vim_connection_info_delete_ids') @@ -643,6 +645,7 @@ class VnfInfoModifications(base.TackerObject, obj = cls( vnf_instance_name=vnf_instance_name, vnf_instance_description=vnf_instance_description, + metadata=metadata, vim_connection_info=vim_connection_info, vim_connection_info_delete_ids=vim_connection_info_delete_ids, vnf_pkg_id=vnf_pkg_id, @@ -658,6 +661,7 @@ class VnfInfoModifications(base.TackerObject, return { 'vnf_instance_name': self.vnf_instance_name, 'vnf_instance_description': self.vnf_instance_description, + 'metadata': self.metadata, 'vim_connection_info': self.vim_connection_info, 'vim_connection_info_delete_ids': self.vim_connection_info_delete_ids, diff --git a/tacker/tests/unit/objects/fakes.py b/tacker/tests/unit/objects/fakes.py index bc7394bd9..ae7b7b322 100644 --- a/tacker/tests/unit/objects/fakes.py +++ b/tacker/tests/unit/objects/fakes.py @@ -490,6 +490,7 @@ def get_changed_info_data(): return { "vnf_instance_name": "", "vnf_instance_description": "", + "metadata": {"test:": "test_value"}, "vnf_configurable_properties": {"test": "test_value"}, "vnfc_info_modifications_delete_ids": ["test1"], "vnfd_id": "2c69a161-0000-4b0f-bcf8-391f8fc76600", diff --git a/tacker/tests/unit/vnflcm/fakes.py b/tacker/tests/unit/vnflcm/fakes.py index 05d80c2fe..126207234 100644 --- a/tacker/tests/unit/vnflcm/fakes.py +++ b/tacker/tests/unit/vnflcm/fakes.py @@ -1179,6 +1179,7 @@ VNFLCMOPOCC_RESPONSE = { }] }, 'changedInfo': { + 'metadata': {}, 'vimConnectionInfo': [], 'vimConnectionInfoDeleteIds': [], 'vnfPkgId': None,