:return: Files and Folders not found. In case of override, it will return all file list
"""
self._logger.debug("")
- listCharms = []
+ charms_set = set()
descriptor_file = False
descriptors_paths = [f for f in glob.glob(package_folder + "/*.yaml")]
for file in descriptors_paths:
if file.endswith("nfd.yaml"):
descriptor_file = True
- listCharms = self.charms_search(file, "vnf")
+ charms_set = self.charms_search(file, "vnf")
if file.endswith("nsd.yaml"):
descriptor_file = True
- listCharms = self.charms_search(file, "ns")
- print("List of charms in the descriptor: {}".format(listCharms))
+ charms_set = self.charms_search(file, "ns")
+ print("List of charms in the descriptor: {}".format(charms_set))
if not descriptor_file:
raise ClientException(
'Descriptor filename is not correct in: {}. It should end with "nfd.yaml" or "nsd.yaml"'.format(
package_folder
)
)
- if listCharms and not skip_charm_build:
- for charmName in listCharms:
+ if charms_set and not skip_charm_build:
+ for charmName in charms_set:
if os.path.isdir(
"{}/charms/layers/{}".format(package_folder, charmName)
):
charmName, package_folder, package_folder
)
)
- self._logger.debug("Return list of charms: {}".format(listCharms))
- return listCharms
+ self._logger.debug("Return list of charms: {}".format(charms_set))
+ return charms_set
def discover_folder_structure(self, base_directory, name, override):
"""
self._logger.debug(
"descriptor_file: {}, desc_type: {}".format(descriptor_file, desc_type)
)
+ charms_set = set()
with open("{}".format(descriptor_file)) as yaml_desc:
descriptor_dict = yaml.safe_load(yaml_desc)
# self._logger.debug("\n"+yaml.safe_dump(descriptor_dict, indent=4, default_flow_style=False))
or "nsd-catalog" in descriptor_dict
)
):
- charms_list = self._charms_search_on_osm_im_dict(
+ charms_set = self._charms_search_on_osm_im_dict(
descriptor_dict, desc_type
)
else:
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
+ charms_set = get_charm_list(descriptor_dict)
+ return charms_set
def _charms_search_on_osm_im_dict(self, osm_im_dict, desc_type):
self._logger.debug("")
- charms_list = []
+ charms_set = []
for k1, v1 in osm_im_dict.items():
for k2, v2 in v1.items():
for entry in v2:
vnf_config = entry["{}-configuration".format(desc_type)]
for k3, v3 in vnf_config.items():
if "charm" in v3:
- charms_list.append((v3["charm"]))
+ charms_set.add((v3["charm"]))
if "vdu" in entry:
vdus = entry["vdu"]
for vdu in vdus:
if "vdu-configuration" in vdu:
for k4, v4 in vdu["vdu-configuration"].items():
if "charm" in v4:
- charms_list.append((v4["charm"]))
- return charms_list
+ charms_set.add((v4["charm"]))
+ return charms_set
def _charms_search_on_vnfd_sol006_dict(self, sol006_dict):
self._logger.debug("")
- charms_list = []
+ charms_set = set()
dfs = sol006_dict.get("vnfd", {}).get("df", [])
for df in dfs:
day_1_2s = (
exec_env_list = day_1_2.get("execution-environment-list", [])
for exec_env in exec_env_list:
if "juju" in exec_env and "charm" in exec_env["juju"]:
- charms_list.append(exec_env["juju"]["charm"])
- return charms_list
+ charms_set.add(exec_env["juju"]["charm"])
+ return charms_set
def _charms_search_on_nsd_sol006_dict(self, sol006_dict):
self._logger.debug("")
- charms_list = []
+ charms_set = set()
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
+ charms_set.add(charm)
+ return charms_set