Merge "Fix: nested resources are ignored"
This commit is contained in:
commit
a907fe70fb
@ -61,6 +61,15 @@ class VnfTestToscaScale(base.BaseTackerTest):
|
|||||||
self.assertEqual(count, len(json.loads(vnf['mgmt_url'])['VDU1']))
|
self.assertEqual(count, len(json.loads(vnf['mgmt_url'])['VDU1']))
|
||||||
|
|
||||||
_wait(2)
|
_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):
|
def _scale(type, count):
|
||||||
body = {"scale": {'type': type, 'policy': 'SP1'}}
|
body = {"scale": {'type': type, 'policy': 'SP1'}}
|
||||||
@ -93,4 +102,4 @@ class VnfTestToscaScale(base.BaseTackerTest):
|
|||||||
# Delete vnfd_instance
|
# Delete vnfd_instance
|
||||||
self.addCleanup(self.client.delete_vnfd, vnfd_id)
|
self.addCleanup(self.client.delete_vnfd, vnfd_id)
|
||||||
self.addCleanup(self.wait_until_vnf_delete, vnf_id,
|
self.addCleanup(self.wait_until_vnf_delete, vnf_id,
|
||||||
constants.VNF_CIRROS_DELETE_TIMEOUT)
|
constants.VNF_CIRROS_DELETE_TIMEOUT)
|
||||||
|
@ -391,14 +391,17 @@ class OpenStack(abstract_driver.DeviceAbstractDriver,
|
|||||||
@log.log
|
@log.log
|
||||||
def get_resource_info(self, plugin, context, vnf_info, auth_attr,
|
def get_resource_info(self, plugin, context, vnf_info, auth_attr,
|
||||||
region_name=None):
|
region_name=None):
|
||||||
stack_id = vnf_info['instance_id']
|
instance_id = vnf_info['instance_id']
|
||||||
heatclient = hc.HeatClient(auth_attr, region_name)
|
heatclient = hc.HeatClient(auth_attr, region_name)
|
||||||
try:
|
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:
|
details_dict = {resource.resource_name:
|
||||||
{"id": resource.physical_resource_id,
|
{"id": resource.physical_resource_id,
|
||||||
"type": resource.resource_type}
|
"type": resource.resource_type}
|
||||||
for resource in resources_ids}
|
for resource in resources_ids}
|
||||||
return details_dict
|
return details_dict
|
||||||
# Raise exception when Heat API service is not available
|
# Raise exception when Heat API service is not available
|
||||||
except Exception:
|
except Exception:
|
||||||
|
Loading…
Reference in New Issue
Block a user