# -*- 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
step = ""
# look for nstd
self.logger.info(str(slice_request))
- step = "getting nstd id='{}' from database".format(slice_request.get("nstdId"))
- _filter = {"id": slice_request["nstdId"]}
+ step = "getting nstd id='{}' from database".format(slice_request.get("nstId"))
+ _filter = {"_id": slice_request["nstId"]}
_filter.update(BaseTopic._get_project_filter(session, write=False, show_all=True))
nstd = self.db.get_one("nsts", _filter)
nstd.pop("_admin", None)
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)