+ step = "creating nsi at database"
+ self.format_on_new(nsi_descriptor, session["project_id"], make_public=make_public)
+ nsi_descriptor["_admin"]["nsiState"] = "NOT_INSTANTIATED"
+ nsi_descriptor["_admin"]["netslice-subnet"] = None
+
+ # Creating netslice-vld for the RO.
+ step = "creating netslice-vld at database"
+ instantiation_parameters = slice_request
+
+ # Building the vlds list to be deployed
+ # From netslice descriptors, creating the initial list
+ nsi_vlds = []
+ if nstd.get("netslice-vld"):
+ # Building VLDs from NST
+ for netslice_vlds in nstd["netslice-vld"]:
+ nsi_vld = {}
+ # Adding nst vld name and global vimAccountId for netslice vld creation
+ nsi_vld["name"] = netslice_vlds["name"]
+ nsi_vld["vimAccountId"] = slice_request["vimAccountId"]
+ # Getting template Instantiation parameters from NST
+ for netslice_vld in netslice_vlds["nss-connection-point-ref"]:
+ for netslice_subnet in nstd["netslice-subnet"]:
+ nsi_vld["nsd-ref"] = netslice_subnet["nsd-ref"]
+ nsi_vld["nsd-connection-point-ref"] = netslice_vld["nsd-connection-point-ref"]
+ # Obtaining the vimAccountId from template instantiation parameter
+ if netslice_subnet.get("instantiation-parameters"):
+ # Taking the vimAccountId from NST netslice-subnet instantiation parameters
+ if netslice_subnet["instantiation-parameters"].get("vimAccountId"):
+ netsn = netslice_subnet["instantiation-parameters"]["vimAccountId"]
+ nsi_vld["vimAccountId"] = netsn
+ # Obtaining the vimAccountId from user instantiation parameter
+ if instantiation_parameters.get("netslice-subnet"):
+ for ins_param in instantiation_parameters["netslice-subnet"]:
+ if ins_param.get("id") == netslice_vld["nss-ref"]:
+ if ins_param.get("vimAccountId"):
+ nsi_vld["vimAccountId"] = ins_param["vimAccountId"]
+ # Adding vim-network-name defined by the user to vld
+ if instantiation_parameters.get("netslice-vld"):
+ for ins_param in instantiation_parameters["netslice-vld"]:
+ if ins_param["name"] == netslice_vlds["name"] and ins_param.get("vim-network-name"):
+ nsi_vld["vim-network-name"] = ins_param.get("vim-network-name")
+ nsi_vlds.append(nsi_vld)
+
+ nsi_descriptor["_admin"]["netslice-vld"] = nsi_vlds