X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_nbi%2Finstance_topics.py;h=b6e025f5d543095e34f073721dddef368a1318f4;hb=refs%2Fchanges%2F59%2F6959%2F1;hp=1301985138548184312e688bb09d7de62c7a31a9;hpb=cd65be33d44114e73936813eaf790e6a12b0df63;p=osm%2FNBI.git diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index 1301985..b6e025f 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -1,5 +1,18 @@ # -*- coding: utf-8 -*- +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # import logging from uuid import uuid4 from http import HTTPStatus @@ -817,17 +830,24 @@ class NsiTopic(BaseTopic): self.format_on_new(nsi_descriptor, session["project_id"], make_public=make_public) nsi_descriptor["_admin"]["nsiState"] = "NOT_INSTANTIATED" + ns_params = indata.get("ns") + # creates Network Services records (NSRs) step = "creating nsrs at database using NsrTopic.new()" nsrs_list = [] for service in services: indata_ns = {} indata_ns["nsdId"] = service["_id"] - indata_ns["nsName"] = service["name"] + indata_ns["nsName"] = service["id"] indata_ns["vimAccountId"] = indata.get("vimAccountId") indata_ns["nsDescription"] = service["description"] indata_ns["key-pair-ref"] = None # NsrTopic(rollback, session, indata_ns, kwargs, headers, force) + # Overwriting ns_params filtering by nsName == netslice-subnet.id + if ns_params: + for ns_param in ns_params: + if ns_param["nsName"] == service["id"]: + indata_ns.update(ns_param) _id_nsr = NsrTopic.new(self, rollback, session, indata_ns, kwargs, headers, force) nsrs_item = {"nsrId": _id_nsr} nsrs_list.append(nsrs_item)