return ns_k8s_namespace
+ def _add_shared_volumes_to_nsr(
+ self, vdu, vnfd, nsr_descriptor, member_vnf_index, revision=None
+ ):
+ svsd = []
+ for vsd in vnfd.get("virtual-storage-desc", ()):
+ if vsd.get("vdu-storage-requirements"):
+ if (
+ vsd.get("vdu-storage-requirements")[0].get("key") == "multiattach"
+ and vsd.get("vdu-storage-requirements")[0].get("value") == "True"
+ ):
+ if "shared" not in vsd["id"]:
+ vsd["id"] = f"shared-{vsd['id']}-{vnfd['id']}"
+ svsd.append(vsd)
+ if svsd:
+ nsr_descriptor["shared-volumes"] = svsd
+
def _add_flavor_to_nsr(
self, vdu, vnfd, nsr_descriptor, member_vnf_index, revision=None
):
"flavor": [],
"image": [],
"affinity-or-anti-affinity-group": [],
+ "shared-volumes": [],
}
if "revision" in nsd["_admin"]:
nsr_descriptor["revision"] = nsd["_admin"]["revision"]
for vdu in vnfd.get("vdu", ()):
member_vnf_index = vnf_profile.get("id")
self._add_flavor_to_nsr(vdu, vnfd, nsr_descriptor, member_vnf_index)
+ self._add_shared_volumes_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)
)
vld["name"] = vld["id"]
nsr_descriptor["vld"] = nsr_vld
-
return nsr_descriptor
def _get_affinity_or_anti_affinity_group_data_from_vnfd(
if nsr_flavor_desc:
vdur["ns-flavor-id"] = nsr_flavor_desc["id"]
+ # Adding Shared Volume information to vdur
+ if vdur.get("virtual-storages"):
+ nsr_sv = []
+ for vsd in vdur["virtual-storages"]:
+ if vsd.get("vdu-storage-requirements"):
+ if (
+ vsd["vdu-storage-requirements"][0].get("key")
+ == "multiattach"
+ and vsd["vdu-storage-requirements"][0].get("value")
+ == "True"
+ ):
+ nsr_sv.append(vsd["id"])
+ if nsr_sv:
+ vdur["shared-volumes-id"] = nsr_sv
+
# Adding Affinity groups information to vdur
try:
vdu_profile_affinity_group = utils.find_in_list(
vdur["id"] = vdur["_id"]
vdur["count-index"] = index
vnfr_descriptor["vdur"].append(vdur)
-
return vnfr_descriptor
def vca_status_refresh(self, session, ns_instance_content, filter_q):
vnf_index = vnfr["member-vnf-index-ref"]
self.logger.info("nsr {}".format(nsr))
for vdu in vnfd["vdu"]:
+ self.nsrtopic._add_shared_volumes_to_nsr(
+ vdu, vnfd, nsr, vnf_index, latest_vnfd_revision
+ )
self.nsrtopic._add_flavor_to_nsr(
vdu, vnfd, nsr, vnf_index, latest_vnfd_revision
)
self.nsrtopic._add_image_to_nsr(nsr, image_data)
nsr_update["image"] = nsr["image"]
nsr_update["flavor"] = nsr["flavor"]
+ nsr_update["shared-volumes"] = nsr["shared-volumes"]
self.db.set_one("nsrs", {"_id": nsr["_id"]}, nsr_update)
ns_k8s_namespace = self.nsrtopic._get_ns_k8s_namespace(
nsd, ns_request, session