X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Fosmclient.git;a=blobdiff_plain;f=osmclient%2Fcommon%2Futils.py;fp=osmclient%2Fcommon%2Futils.py;h=94bd72f9c762c84cca5de6d24cb404301a715b66;hp=6d5ebd84414a6e5894fece666ef8ee75749b27eb;hb=db14795b9f18ccbf1982fbd6b51092b8c9392278;hpb=26741695890fc59378c9a21182d1c3b1f8ec4dbf diff --git a/osmclient/common/utils.py b/osmclient/common/utils.py index 6d5ebd8..94bd72f 100644 --- a/osmclient/common/utils.py +++ b/osmclient/common/utils.py @@ -73,6 +73,22 @@ def get_key_val_from_pkg(descriptor_file): result['type'] = 'nsd' else: result['type'] = 'vnfd' + if 'type' not in result: + for k1, v1 in list(dict.items()): + if not k1.endswith('-catalog'): + continue + for k2, v2 in v1.items(): + if not k2.endswith('nsd') and not k2.endswith('vnfd'): + continue + if 'nsd' in k2: + result['type'] = 'nsd' + else: + result['type'] = 'vnfd' + for entry in v2: + for k3, v3 in list(entry.items()): + # strip off preceeding chars before : + key_name = k3.split(':').pop() + result[key_name] = v3 tar.close() return result