OSMENG-987: Implement PrepareVnfWorkflow

Change-Id: Icf3ccfd44160fbc3f2f2d9ec64e360c07fc9bbfa
Signed-off-by: Dario Faccin <dario.faccin@canonical.com>
diff --git a/osm_lcm/temporal/vnf_activities.py b/osm_lcm/temporal/vnf_activities.py
index 3e2155b..6e5abcb 100644
--- a/osm_lcm/temporal/vnf_activities.py
+++ b/osm_lcm/temporal/vnf_activities.py
@@ -22,12 +22,14 @@
     ACTIVITY_SEND_NOTIFICATION_FOR_VNF,
     ACTIVITY_GET_TASK_QUEUE,
     VIM_TYPE_TASK_QUEUE_MAPPINGS,
+    ACTIVITY_SET_VNF_MODEL,
 )
 from osm_common.dataclasses.temporal_dataclasses import (
     ChangeVnfInstantiationStateInput,
     ChangeVnfStateInput,
     GetTaskQueueInput,
     GetTaskQueueOutput,
+    VnfInstantiateInput,
 )
 
 
@@ -143,6 +145,36 @@
             f"VNF {vnf_instantiation_state_input.vnfr_uuid} state is updated to {vnf_instantiation_state_input.state}."
         )
 
+    @activity.defn(name=ACTIVITY_SET_VNF_MODEL)
+    async def set_vnf_model(self, set_vnf_model_input: VnfInstantiateInput) -> None:
+        """Updates the model name of VNF in VNFR.
+
+        Collaborators:
+            DB Access Object
+
+        Raises (retryable):
+            DbException: If DB access or update fails, the collection or DB record ID does not exist.
+
+        Activity Lifecycle:
+            This activity should complete relatively quickly (less than a
+            second). However, it would be reasonable to wait up to 10
+            seconds.
+
+            This activity will not report a heartbeat due to its
+            short-running nature.
+
+            It is not necessary to implement a back-off strategy for this
+            activity, the operation is idempotent.
+
+        """
+        update_namespace = {"namespace": set_vnf_model_input.model_name}
+        self.db.set_one(
+            "vnfrs", {"_id": set_vnf_model_input.vnfr_uuid}, update_namespace
+        )
+        self.logger.debug(
+            f"VNF {set_vnf_model_input.vnfr_uuid} model name is updated to {set_vnf_model_input.model_name}."
+        )
+
 
 class VnfSendNotifications:
     """Perform Notification operations."""