Merge "Fix invalid "is not {}" judgement of empty dict"

This commit is contained in:
Zuul 2020-12-14 02:44:01 +00:00 committed by Gerrit Code Review
commit 6bbcad5af7
3 changed files with 5 additions and 6 deletions

View File

@ -129,8 +129,7 @@ class TestUtils(testtools.TestCase):
def test_create_vdu_flavor_dict(self):
vnfd_dict = self._read_file('vnfd_lcm_user_data.yaml')
test_vnfd_dict = {'VNF': {}, 'VDU1':
{'ram': 512, 'vcpus': 1, 'disk': 1}, 'CP1': {}}
test_vnfd_dict = {'VDU1': {'ram': 512, 'vcpus': 1, 'disk': 1}}
vdu_flavor_dict = utils.create_vdu_flavor_dict(vnfd_dict)
self.assertEqual(test_vnfd_dict, vdu_flavor_dict)

View File

@ -840,7 +840,7 @@ def _extract_policy_info(tosca_policies, inst_level_dict,
aspect_delta_dict, aspect_id_dict,
aspect_vdu_dict, vdu_delta_dict):
default_inst_level_id = None
if tosca_policies is not []:
if tosca_policies:
for p in tosca_policies:
if p.type == ETSI_SCALING_ASPECT_DELTA:
vdu_list = p.targets

View File

@ -221,7 +221,7 @@ def create_vdu_flavor_dict(vnfd_dict):
vdu_flavor_props = val.get(
'capabilities', {}).get(
'virtual_compute', {}).get('properties', {})
if vdu_flavor_props is not {}:
if vdu_flavor_props:
flavor_dict = {}
for key, val in vdu_flavor_props.items():
if key == 'virtual_cpu':
@ -318,7 +318,7 @@ def create_vdu_flavor_capability_name_dict(vnfd_dict):
vdu_flavor_props = val.get(
'capabilities', {}).get(
'virtual_compute', {}).get('properties', {})
if vdu_flavor_props is not {}:
if vdu_flavor_props:
for key, val in vdu_flavor_props.items():
if key == 'requested_additional_capabilities':
capability_props = val.get('properties', {})
@ -347,7 +347,7 @@ def create_sw_image_dict(vnfd_dict):
for vdu_name, val in node_templates.items():
sw_image_data_props = val.get(
'properties', {}).get('sw_image_data', {})
if sw_image_data_props is not {}:
if sw_image_data_props:
if 'name' in sw_image_data_props.keys():
sw_image_data[vdu_name] = sw_image_data_props['name']