- for additionalParamsForVnf in get_iterable(ns_request.get("additionalParamsForVnf")):
- if additionalParamsForVnf["member-vnf-index"] == member_vnf_index:
- additional_params = copy(additionalParamsForVnf.get("additionalParams"))
- where_ = "additionalParamsForVnf[member-vnf-index={}]".format(
- additionalParamsForVnf["member-vnf-index"])
- break
+ where_ = "additionalParamsForVnf[member-vnf-index={}]".format(member_vnf_index)
+ item = next((x for x in ns_request["additionalParamsForVnf"] if x["member-vnf-index"] == member_vnf_index),
+ None)
+ if item:
+ if not vdu_id and not kdu_name:
+ other_params = item
+ additional_params = copy(item.get("additionalParams")) or {}
+ if vdu_id and item.get("additionalParamsForVdu"):
+ item_vdu = next((x for x in item["additionalParamsForVdu"] if x["vdu_id"] == vdu_id), None)
+ other_params = item_vdu
+ if item_vdu and item_vdu.get("additionalParams"):
+ where_ += ".additionalParamsForVdu[vdu_id={}]".format(vdu_id)
+ additional_params = item_vdu["additionalParams"]
+ if kdu_name:
+ additional_params = {}
+ if item.get("additionalParamsForKdu"):
+ item_kdu = next((x for x in item["additionalParamsForKdu"] if x["kdu_name"] == kdu_name), None)
+ other_params = item_kdu
+ if item_kdu and item_kdu.get("additionalParams"):
+ where_ += ".additionalParamsForKdu[kdu_name={}]".format(kdu_name)
+ additional_params = item_kdu["additionalParams"]
+