return ns_k8s_namespace
- def _add_flavor_to_nsr(self, vdu, vnfd, nsr_descriptor):
+ def _add_flavor_to_nsr(self, vdu, vnfd, nsr_descriptor, member_vnf_index, revision=None):
flavor_data = {}
guest_epa = {}
# Find this vdu compute and storage descriptors
if guest_epa:
flavor_data["guest-epa"] = guest_epa
- flavor_data["name"] = vdu["id"][:56] + "-flv"
+ revision = revision if revision is not None else 1
+ flavor_data["name"] = vdu["id"][:56] + "-" + member_vnf_index + "-" + str(revision) + "-flv"
flavor_data["id"] = str(len(nsr_descriptor["flavor"]))
nsr_descriptor["flavor"].append(flavor_data)
vnfd.pop("_admin")
for vdu in vnfd.get("vdu", ()):
- self._add_flavor_to_nsr(vdu, vnfd, nsr_descriptor)
+ member_vnf_index = vnf_profile.get("id")
+ self._add_flavor_to_nsr(vdu, vnfd, nsr_descriptor, member_vnf_index)
sw_image_id = vdu.get("sw-image-desc")
if sw_image_id:
image_data = self._get_image_data_from_vnfd(vnfd, sw_image_id)
nsr_descriptor,
ns_request,
ns_k8s_namespace,
+ revision=None,
):
vnfr_id = str(uuid4())
nsr_id = nsr_descriptor["id"]
alt_image_ids.append(nsr_sw_image_data["id"])
vdur["alt-image-ids"] = alt_image_ids
- flavor_data_name = vdu["id"][:56] + "-flv"
+ revision = revision if revision is not None else 1
+ flavor_data_name = vdu["id"][:56] + "-" + vnf_index + "-" + str(revision) + "-flv"
nsr_flavor_desc = utils.find_in_list(
nsr_descriptor["flavor"],
lambda flavor: flavor["name"] == flavor_data_name,
vnf_index = vnfr["member-vnf-index-ref"]
self.logger.info("nsr {}".format(nsr))
for vdu in vnfd["vdu"]:
- self.nsrtopic._add_flavor_to_nsr(vdu, vnfd, nsr)
+ self.nsrtopic._add_flavor_to_nsr(vdu, vnfd, nsr, vnf_index, latest_vnfd_revision)
sw_image_id = vdu.get("sw-image-desc")
if sw_image_id:
image_data = self.nsrtopic._get_image_data_from_vnfd(vnfd, sw_image_id)
nsr,
ns_request,
ns_k8s_namespace,
+ latest_vnfd_revision,
)
indata["newVdur"] = vnfr_descriptor["vdur"]
nslcmop_desc = self._create_nslcmop(nsInstanceId, operation, indata)