X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_nbi%2Finstance_topics.py;h=43450d6b75af3142757840993e6df2162baf0465;hb=refs%2Ftags%2Fv12.0.8;hp=16bd4062ace93245f70359f3ef2ec2d7169a4a3e;hpb=0f6994cd5fc8f158b1795d53f6b77b9761f3017c;p=osm%2FNBI.git diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index 16bd406..43450d6 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -169,9 +169,14 @@ class NsrTopic(BaseTopic): ns_request, member_vnf_index=None, vdu_id=None, kdu_name=None, descriptor=None ): """ - Get and format user additional params for NS or VNF + Get and format user additional params for NS or VNF. + The vdu_id and kdu_name params are mutually exclusive! If none of them are given, then the method will + exclusively search for the VNF/NS LCM additional params. + :param ns_request: User instantiation additional parameters :param member_vnf_index: None for extract NS params, or member_vnf_index to extract VNF params + :vdu_id: VDU's ID against which we want to format the additional params + :kdu_name: KDU's name against which we want to format the additional params :param descriptor: If not None it check that needed parameters of descriptor are supplied :return: tuple with a formatted copy of additional params or None if not supplied, plus other parameters """ @@ -255,6 +260,9 @@ class NsrTopic(BaseTopic): if kdu_name: additional_params = json.dumps(additional_params) + # Select the VDU ID, KDU name or NS/VNF ID, depending on the method's call intent + selector = vdu_id if vdu_id else kdu_name if kdu_name else descriptor.get("id") + if descriptor: for df in descriptor.get("df", []): # check that enough parameters are supplied for the initial-config-primitive @@ -269,10 +277,13 @@ class NsrTopic(BaseTopic): for config in df["lcm-operations-configuration"][ "operate-vnf-op-config" ].get("day1-2", []): - for primitive in get_iterable( - config.get("initial-config-primitive") - ): - initial_primitives.append(primitive) + # Verify the target object (VNF|NS|VDU|KDU) where we need to populate + # the params with the additional ones given by the user + if config.get("id") == selector: + for primitive in get_iterable( + config.get("initial-config-primitive") + ): + initial_primitives.append(primitive) else: initial_primitives = deep_get( descriptor, ("ns-configuration", "initial-config-primitive") @@ -902,7 +913,7 @@ class NsrTopic(BaseTopic): # Name, mac-address and interface position is taken from VNFD # and included into VNFR. By this way RO can process this information # while creating the VDU. - iface_fields = ("name", "mac-address", "position") + iface_fields = ("name", "mac-address", "position", "ip-address") vdu_iface = { x: iface[x] for x in iface_fields if iface.get(x) is not None } @@ -1541,8 +1552,8 @@ class NsLcmOpTopic(BaseTopic): ivld.get("id"): set() for ivld in get_iterable(vnfd.get("int-virtual-link-desc")) } - for vdu in get_iterable(vnfd.get("vdu")): - for cpd in get_iterable(vnfd.get("int-cpd")): + for vdu in vnfd.get("vdu", {}): + for cpd in vdu.get("int-cpd", {}): if cpd.get("int-virtual-link-desc"): vnfd_ivlds_cpds[cpd.get("int-virtual-link-desc")] = cpd.get("id") @@ -1602,7 +1613,7 @@ class NsLcmOpTopic(BaseTopic): if wim_account in wim_accounts: return try: - db_filter = self._get_project_filter(session, write=False, show_all=True) + db_filter = self._get_project_filter(session) db_filter["_id"] = wim_account self.db.get_one("wim_accounts", db_filter) except Exception: