##
from osm_lcm.data_utils import list_utils
+from osm_lcm.lcm_utils import get_iterable
def get_lcm_operations_configuration(vnfd):
lambda vdu_profile: vdu_profile["id"] == vdu_profile_id)
-def get_kdu_profile(vnfd, kdu_profile_id):
- return list_utils.find_in_list(
- vnfd.get("df", ())[0]["kdu-profile"],
- lambda kdu_profile: kdu_profile["name"] == kdu_profile_id)
-
-
def get_vnf_configuration(vnfd):
if "vnf-configuration-id" not in vnfd.get("df")[0]:
return None
lambda vdu_configuration: vdu_configuration["id"] == vdu_profile["vdu-configuration-id"])
-def get_kdu_configuration(vnfd, kdu_id):
- kdu_profile = get_kdu_profile(vnfd, kdu_id)
- return list_utils.find_in_list(
- vnfd.get("kdu-configuration", ()),
- lambda kdu_configuration: kdu_configuration["id"] == kdu_profile["kdu-configuration-id"])
+def get_kdu_configuration(vnfd, kdu_name):
+ for kdu in get_iterable(vnfd, "kdu"):
+ if kdu_name == kdu["name"]:
+ return kdu.get("kdu-configuration")
def get_virtual_link_profiles(vnfd):
)
for kdud in get_kdu_list(vnfd):
kdu_name = kdud["name"]
- descriptor_config = get_kdu_configuration(vnfd, kdu_name)
+ descriptor_config = kdud.get('kdu-configuration')
if descriptor_config:
vdu_id = None
vdu_index = 0
kdud = next(kdud for kdud in vnfd_with_id["kdu"] if kdud["name"] == kdur["kdu-name"])
namespace = kdur.get("k8s-namespace")
if kdur.get("helm-chart"):
- kdumodel = kdur["helm-chart"]["kdu-model-locator"]
+ kdumodel = kdur["helm-chart"]
# Default version: helm3, if helm-version is v2 assign v2
k8sclustertype = "helm-chart-v3"
self.logger.debug("kdur: {}".format(kdur))
if kdur.get("helm-version") and kdur.get("helm-version") == "v2":
k8sclustertype = "helm-chart"
elif kdur.get("juju-bundle"):
- kdumodel = kdur["juju-bundle"]["kdu-model-locator"]
+ kdumodel = kdur["juju-bundle"]
k8sclustertype = "juju-bundle"
else:
raise LcmException("kdu type for kdu='{}.{}' is neither helm-chart nor "
k8s-cluster:
id: e7169dab-f71a-4f1f-b82b-432605e8c4b3
kdu-name: ldap
- helm-chart:
- kdu-model-locator:
- stable/openldap:1.2.1
+ helm-chart: stable/openldap:1.2.1
- ip-address: null
k8s-cluster:
id: e7169dab-f71a-4f1f-b82b-432605e8c4b3
kdu-name: mongo
- helm-chart:
- kdu-model-locator:
- stable/mongodb
+ helm-chart: stable/mongodb
member-vnf-index-ref: multikdu
nsr-id-ref: 0bcb701c-ee4d-41ab-8ee6-f4156f7f114d
vdur: []