X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=o2ims%2Fdomain%2Fsubscription_obj.py;fp=o2ims%2Fdomain%2Fsubscription_obj.py;h=dc3145f70ab431f92547b65da128a63c1623a72d;hb=9625c5b766377f641d9641471f10dd491a61447f;hp=0000000000000000000000000000000000000000;hpb=d14329a57d8d01d443e4158fa5030a5b5ada4060;p=pti%2Fo2.git diff --git a/o2ims/domain/subscription_obj.py b/o2ims/domain/subscription_obj.py new file mode 100644 index 0000000..dc3145f --- /dev/null +++ b/o2ims/domain/subscription_obj.py @@ -0,0 +1,57 @@ +# Copyright (C) 2021 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations +from enum import Enum +from dataclasses import dataclass + +from o2common.domain.base import AgRoot, Serializer + + +class Subscription(AgRoot, Serializer): + def __init__(self, id: str, callback: str, consumersubid: str = '', + filter: str = '') -> None: + super().__init__() + self.subscriptionId = id + self.version_number = 0 + self.callback = callback + self.consumerSubscriptionId = consumersubid + self.filter = filter + + +class NotificationEventEnum(str, Enum): + CREATE = 'CREATE' + MODIFY = 'MODIFY' + DELETE = 'DELETE' + + +class Message2SMO(Serializer): + def __init__(self, eventtype: NotificationEventEnum, + id: str, ref: str, updatetime: str) -> None: + self.notificationEventType = eventtype + self.objectRef = ref + self.id = id + self.updatetime = updatetime + + +@dataclass +class EventState(): + Initial = 0 + NotInstalled = 1 + Installing = 2 + Installed = 3 + Updating = 4 + Uninstalling = 5 + Abnormal = 6 + Deleted = 7