OSMENG-1092 Base Class for Delete NS Record Activity
[osm/common.git] / osm_common / temporal / activities / vnf.py
index 81f2982..2666f2b 100644 (file)
@@ -123,7 +123,7 @@ class GetVnfRecord(BaseActivity):
     """Gets the VNF record and VNF descriptor from Database.
 
     Collaborators:
-        DB read:           vnfrs, vnfds
+        DB read:           vnfrs
 
     Raises (retryable):
         DbException: If DB read operations fail, the collection or DB record ID does not exist.
@@ -160,9 +160,8 @@ class GetVnfRecord(BaseActivity):
 
         Attributes:
         -----------
-        vnf_details: list[(vnfr_ids: str, vnf_member_index_ref: str), .. ]
-            List of tuples including VNF details associated with the NS.
-            Tuple(VNF record IDs, vnf_member_index_ref)
+        vnfr: dict
+            The VNF record
         """
 
         vnfr: dict
@@ -418,3 +417,94 @@ class SetVnfModel(BaseActivity):
 
     async def __call__(self, activity_input: Input) -> None:
         raise NotImplementedError()
+
+
+class GetModelNames(BaseActivity):
+    """Gets the models of VNFs associated with the NS.
+
+    Collaborators:
+        DB read:           vnfrs
+
+    Raises (retryable):
+        DbException: If DB read operations fail
+
+    Activity Lifecycle:
+        This activity should complete relatively quickly (less than a second).
+
+        This activity will not report a heartbeat due to its
+        short-running nature.
+
+        This is an idempotent activity.
+    """
+
+    @dataclass
+    class Input:
+        """
+        Attributes:
+        -----------
+        ns_uuid : str
+            The UUID of the NS from which we are looking for the model names.
+        """
+
+        ns_uuid: str
+
+    @dataclass
+    class Output:
+        """
+        Attributes:
+        -----------
+        model_names: set[str]
+            The set of model names associated with the NS.
+        """
+
+        model_names: set[str]
+
+    def __init__(self, db: DbBase):
+        super().__init__()
+        self.db: DbBase = db
+
+    async def __call__(self, activity_input: Input) -> Output:
+        raise NotImplementedError()
+
+
+class DeleteVnfRecord(BaseActivity):
+    """Delete a VNF record from DB.
+
+    Collaborators:
+        DB Write:           vnfrs
+
+    Raises (retryable):
+        DbException: If DB access fails, the collection 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.
+
+        This operation is idempotent.
+
+    """
+
+    @dataclass
+    class Input:
+        """
+        Input dataclass for activity that deletes a VNF record.
+
+        Attributes:
+        -----------
+        vnfr_uuid : str
+            The UUID of the VNF to be deleted from the vnfrs
+            collection in Mongo.
+        """
+
+        vnfr_uuid: str
+
+    def __init__(self, db: DbBase):
+        super().__init__()
+        self.db: DbBase = db
+
+    async def __call__(self, activity_input: Input) -> None:
+        raise NotImplementedError()