From c71ca9a01e4788311f99135bf978db3243b3e045 Mon Sep 17 00:00:00 2001 From: dharmendra Date: Thu, 11 Jan 2018 11:32:10 +0000 Subject: [PATCH] replace the class path uuid based stack names with vnf names Tacker uses the class path+file name+uuid as stack names to uniquely identify the stacks for vnf create and vnf respawn workflow. Tacker now mandates VNF names to be provided in API layer and will be made unique. It is useful to base stack names based on vnf names for debugging purposes. This affects the naming of nova instances as well. Change-Id: If043ad8c6c356f3fa1d2f5648d3d861ff5006602 Closes-Bug: #1590215 --- .../notes/bug-1590215-8b4bba0d0decc3f1.yaml | 5 +++++ .../functional/vnfm/test_tosca_vnf_alarm.py | 2 +- .../infra_drivers/openstack/test_openstack.py | 16 +++++----------- tacker/vnfm/infra_drivers/openstack/openstack.py | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 releasenotes/notes/bug-1590215-8b4bba0d0decc3f1.yaml diff --git a/releasenotes/notes/bug-1590215-8b4bba0d0decc3f1.yaml b/releasenotes/notes/bug-1590215-8b4bba0d0decc3f1.yaml new file mode 100644 index 000000000..14c1c4dd6 --- /dev/null +++ b/releasenotes/notes/bug-1590215-8b4bba0d0decc3f1.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Replace the class path uuid based stack names with vnf name plus vnf id + so that it is easy to find which stack is for which vnf. diff --git a/tacker/tests/functional/vnfm/test_tosca_vnf_alarm.py b/tacker/tests/functional/vnfm/test_tosca_vnf_alarm.py index 5da9b9691..c31de2cdb 100644 --- a/tacker/tests/functional/vnfm/test_tosca_vnf_alarm.py +++ b/tacker/tests/functional/vnfm/test_tosca_vnf_alarm.py @@ -142,7 +142,7 @@ class VnfTestAlarmMonitor(base.BaseTackerTest): def test_vnf_alarm_respawn(self): self._test_vnf_tosca_alarm( 'sample-tosca-alarm-respawn.yaml', - 'alarm and respawn vnf') + 'alarm and respawn-vnf') @unittest.skip("Skip and wait for releasing Heat Translator") def test_vnf_alarm_scale(self): diff --git a/tacker/tests/unit/vnfm/infra_drivers/openstack/test_openstack.py b/tacker/tests/unit/vnfm/infra_drivers/openstack/test_openstack.py index 4cf635879..9f5d8804a 100644 --- a/tacker/tests/unit/vnfm/infra_drivers/openstack/test_openstack.py +++ b/tacker/tests/unit/vnfm/infra_drivers/openstack/test_openstack.py @@ -87,20 +87,16 @@ class TestOpenStack(base.TestCase): def _get_expected_fields(self): return {'stack_name': - 'tacker.vnfm.infra_drivers.openstack.openstack_OpenStack' - '-eb84260e-5ff7-4332-b032-50a14d6c1123', 'template': - self.hot_template} + 'test_openwrt_eb84260e-5ff7-4332-b032-50a14d6c1123', + 'template': self.hot_template} def _get_expected_fields_user_data(self): return {'stack_name': - 'tacker.vnfm.infra_drivers.openstack.openstack_OpenStack' - '-18685f68-2b2a-4185-8566-74f54e548811', + 'test_userdata_18685f68-2b2a-4185-8566-74f54e548811', 'template': self.hot_param_template} def _get_expected_fields_ipaddr_data(self): - return {'stack_name': - 'tacker.vnfm.infra_drivers.openstack.openstack_OpenStack' - '-d1337add-d5a1-4fd4-9447-bb9243c8460b', + return {'stack_name': 'test_ip_d1337add-d5a1-4fd4-9447-bb9243c8460b', 'template': self.hot_ipparam_template} def _get_expected_vnf_wait_obj(self, param_values=''): @@ -187,9 +183,7 @@ class TestOpenStack(base.TestCase): def _get_expected_fields_tosca(self, template): return {'stack_name': - 'tacker.vnfm.infra_drivers.openstack.openstack_OpenStack' - '-eb84260e' - '-5ff7-4332-b032-50a14d6c1123', + 'test_openwrt_eb84260e-5ff7-4332-b032-50a14d6c1123', 'template': _get_template(template)} def _get_expected_tosca_vnf(self, diff --git a/tacker/vnfm/infra_drivers/openstack/openstack.py b/tacker/vnfm/infra_drivers/openstack/openstack.py index 1b7ba68e6..ce1378566 100644 --- a/tacker/vnfm/infra_drivers/openstack/openstack.py +++ b/tacker/vnfm/infra_drivers/openstack/openstack.py @@ -108,7 +108,7 @@ class OpenStack(abstract_driver.DeviceAbstractDriver, @log.log def _create_stack(self, heatclient, vnf, fields): if 'stack_name' not in fields: - name = __name__ + '_' + self.__class__.__name__ + '-' + vnf['id'] + name = vnf['name'].replace(' ', '_') + '_' + vnf['id'] if vnf['attributes'].get('failure_count'): name += ('-RESPAWN-%s') % str(vnf['attributes'][ 'failure_count'])