Fix INF-371 and INF-372 notification post data does not comply to spec
[pti/o2.git] / o2ims / domain / subscription_obj.py
index 846bf95..c23a9ea 100644 (file)
@@ -24,24 +24,17 @@ class Subscription(AgRoot, Serializer):
                  filter: str = '') -> None:
         super().__init__()
         self.subscriptionId = id
-        self.version_number = 0
         self.callback = callback
         self.consumerSubscriptionId = consumersubid
         self.filter = filter
 
-
-class Registration(AgRoot, Serializer):
-    def __init__(self, id: str, url: str) -> None:
-        super().__init__()
-        self.registrationId = id
-        self.callback = url
-        self.notified = False
+        self.version_number = 0
 
 
 class NotificationEventEnum(str, Enum):
-    CREATE = 'CREATE'
-    MODIFY = 'MODIFY'
-    DELETE = 'DELETE'
+    CREATE = 0
+    MODIFY = 1
+    DELETE = 2
 
 
 class Message2SMO(Serializer):
@@ -53,13 +46,19 @@ class Message2SMO(Serializer):
         self.updatetime = updatetime
 
 
+class RegistrationMessage(Serializer):
+    def __init__(self, eventtype: NotificationEventEnum, id: str = '') -> None:
+        self.notificationEventType = eventtype
+        self.id = id
+
+
 @dataclass
 class EventState():
     Initial = 0
-    NotInstalled = 1
+    NotInstalled = 1
     Installing = 2
     Installed = 3
     Updating = 4
     Uninstalling = 5
     Abnormal = 6
-    Deleted = 7
+    Deleting = 7