(desc_type=="ns" and ( "nsd:nsd-catalog" in descriptor_dict or "nsd-catalog" in descriptor_dict)) ):
charms_list = self._charms_search_on_osm_im_dict(descriptor_dict, desc_type)
else:
- charms_list = self._charms_search_on_sol006_dict(descriptor_dict, desc_type)
-
+ if desc_type == "ns":
+ get_charm_list = self._charms_search_on_nsd_sol006_dict
+ elif desc_type == "vnf":
+ get_charm_list = self._charms_search_on_vnfd_sol006_dict
+ else:
+ raise Exception("Bad descriptor type")
+ charms_list = get_charm_list(descriptor_dict)
return charms_list
def _charms_search_on_osm_im_dict(self, osm_im_dict, desc_type):
charms_list.append((v4['charm']))
return charms_list
- def _charms_search_on_sol006_dict(self, sol006_dict, desc_type):
+ def _charms_search_on_vnfd_sol006_dict(self, sol006_dict):
self._logger.debug("")
charms_list = []
for k1, v1 in sol006_dict.items():
for k2, v2 in v1.items():
- if '{}-configuration'.format(desc_type) in k2:
+ if 'vnf-configuration' in k2:
for vnf_config in v2:
for k3, v3 in vnf_config.items():
if 'charm' in v3:
if 'charm' in v3:
charms_list.append((v3['charm']))
return charms_list
+
+ def _charms_search_on_nsd_sol006_dict(self, sol006_dict):
+ self._logger.debug("")
+ charms_list = []
+ nsd_list = sol006_dict.get("nsd", {}).get("nsd", [])
+ for nsd in nsd_list:
+ charm = nsd.get("ns-configuration", {}).get("juju", {}).get("charm")
+ if charm:
+ charms_list.append(charm)
+ return charms_list