Get model names activity implementation
Change-Id: I4f80ad212b61ccc3f5d01e646cf74ecb7f31a5f2
Signed-off-by: Daniel Arndt <daniel.arndt@canonical.com>
diff --git a/osm_lcm/temporal/vnf_activities.py b/osm_lcm/temporal/vnf_activities.py
index d47318f..3ea8c64 100644
--- a/osm_lcm/temporal/vnf_activities.py
+++ b/osm_lcm/temporal/vnf_activities.py
@@ -21,6 +21,7 @@
GetVimCloud,
GetVnfDescriptor,
GetVnfRecord,
+ GetModelNames,
ChangeVnfState,
ChangeVnfInstantiationState,
SetVnfModel,
@@ -171,3 +172,20 @@
class SendNotificationForVnfImpl(SendNotificationForVnf):
async def __call__(self, activity_input: SendNotificationForVnf.Input) -> None:
self.logger.debug("Send notification for VNF not implemented.")
+
+
+@activity.defn(name=GetModelNames.__name__)
+class GetModelNamesImpl(GetModelNames):
+ async def __call__(
+ self, activity_input: GetModelNames.Input
+ ) -> GetModelNames.Output:
+ ns_id = activity_input.ns_uuid
+
+ vnfrs = self.db.get_list("vnfrs", {"nsr-id-ref": ns_id})
+ self.logger.debug(
+ f"Retrieved {len(vnfrs)} vnf records matching {ns_id} from database."
+ )
+
+ return GetModelNames.Output(
+ model_names={vnfr["namespace"] for vnfr in vnfrs if "namespace" in vnfr}
+ )