diff --git a/tacker/tests/functional/vnfm/test_tosca_vnf_scale.py b/tacker/tests/functional/vnfm/test_tosca_vnf_scale.py index ac468aedb..0b06a6b83 100644 --- a/tacker/tests/functional/vnfm/test_tosca_vnf_scale.py +++ b/tacker/tests/functional/vnfm/test_tosca_vnf_scale.py @@ -61,6 +61,15 @@ class VnfTestToscaScale(base.BaseTackerTest): self.assertEqual(count, len(json.loads(vnf['mgmt_url'])['VDU1'])) _wait(2) + # Get nested resources when vnf is in active state + vnf_details = self.client.list_vnf_resources(vnf_id)['resources'] + resources_list = list() + for vnf_detail in vnf_details: + resources_list.append(vnf_detail['name']) + self.assertIn('VDU1', resources_list) + + self.assertIn('CP1', resources_list) + self.assertIn('G1', resources_list) def _scale(type, count): body = {"scale": {'type': type, 'policy': 'SP1'}} @@ -93,4 +102,4 @@ class VnfTestToscaScale(base.BaseTackerTest): # Delete vnfd_instance self.addCleanup(self.client.delete_vnfd, vnfd_id) self.addCleanup(self.wait_until_vnf_delete, vnf_id, - constants.VNF_CIRROS_DELETE_TIMEOUT) + constants.VNF_CIRROS_DELETE_TIMEOUT) diff --git a/tacker/vnfm/infra_drivers/openstack/openstack.py b/tacker/vnfm/infra_drivers/openstack/openstack.py index d13e6e60a..e479fb522 100644 --- a/tacker/vnfm/infra_drivers/openstack/openstack.py +++ b/tacker/vnfm/infra_drivers/openstack/openstack.py @@ -391,14 +391,17 @@ class OpenStack(abstract_driver.DeviceAbstractDriver, @log.log def get_resource_info(self, plugin, context, vnf_info, auth_attr, region_name=None): - stack_id = vnf_info['instance_id'] + instance_id = vnf_info['instance_id'] heatclient = hc.HeatClient(auth_attr, region_name) try: - resources_ids = heatclient.resource_get_list(stack_id) + # nested_depth=2 is used to get VDU resources + # in case of nested template + resources_ids =\ + heatclient.resource_get_list(instance_id, nested_depth=2) details_dict = {resource.resource_name: - {"id": resource.physical_resource_id, - "type": resource.resource_type} - for resource in resources_ids} + {"id": resource.physical_resource_id, + "type": resource.resource_type} + for resource in resources_ids} return details_dict # Raise exception when Heat API service is not available except Exception: