From: tierno Date: Mon, 3 Jun 2019 17:22:12 +0000 (+0000) Subject: fix bug 734 allow NSD primitive actions X-Git-Tag: v6.0.0~18 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F96%2F7596%2F1;p=osm%2FNBI.git fix bug 734 allow NSD primitive actions Change-Id: Ieccddd121a50bc017432474988613a288172f0a1 Signed-off-by: tierno --- diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index f3418f7..8f2ac0d 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -515,11 +515,13 @@ class NsLcmOpTopic(BaseTopic): # check vnf_member_index if indata.get("vnf_member_index"): indata["member_vnf_index"] = indata.pop("vnf_member_index") # for backward compatibility - if not indata.get("member_vnf_index"): - raise EngineException("Missing 'member_vnf_index' parameter") - vnfd = check_valid_vnf_member_index(indata["member_vnf_index"]) + if indata.get("member_vnf_index"): + vnfd = check_valid_vnf_member_index(indata["member_vnf_index"]) + descriptor_configuration = vnfd.get("vnf-configuration", {}).get("config-primitive") + else: # use a NSD + descriptor_configuration = nsd.get("ns-configuration", {}).get("config-primitive") # check primitive - for config_primitive in get_iterable(vnfd.get("vnf-configuration", {}).get("config-primitive")): + for config_primitive in get_iterable(descriptor_configuration): if indata["primitive"] == config_primitive["name"]: # check needed primitive_params are provided if indata.get("primitive_params"): @@ -534,11 +536,11 @@ class NsLcmOpTopic(BaseTopic): paramd["name"], indata["primitive"])) # check no extra primitive params are provided if in_primitive_params_copy: - raise EngineException("parameter/s '{}' not present at vnfd for primitive '{}'".format( + raise EngineException("parameter/s '{}' not present at vnfd /nsd for primitive '{}'".format( list(in_primitive_params_copy.keys()), indata["primitive"])) break else: - raise EngineException("Invalid primitive '{}' is not present at vnfd".format(indata["primitive"])) + raise EngineException("Invalid primitive '{}' is not present at vnfd/nsd".format(indata["primitive"])) if operation == "scale": vnfd = check_valid_vnf_member_index(indata["scaleVnfData"]["scaleByStepData"]["member-vnf-index"]) for scaling_group in get_iterable(vnfd.get("scaling-group-descriptor")):