from o2common.domain.base import AgRoot, Serializer
+from o2common.helper import o2logging
+logger = o2logging.get_logger(__name__)
+
class FaultGenericModel(AgRoot):
def __init__(self, type: str,
if api_response:
self.id = str(api_response.uuid)
self.name = self.id
- self.type = type
+ self.alarm_type = api_response.alarm_type
+ self.alarm_def_name = api_response.alarm_id
+ self.alarm_def_id = api_response.alarm_def_id
+ self.probable_cause_id = api_response.probable_cause_id
self.status = api_response.state
# TODO: time less than second
self.timestamp = datetime.datetime.strptime(
self.hash = content_hash if content_hash \
else str(hash((self.id, self.timestamp, self.status)))
self.content = json.dumps(api_response.to_dict())
+ if EventTypeEnum.ALARM == type:
+ pass
def is_outdated(self, newmodel) -> bool:
# return self.updatetime < newmodel.updatetime
self.content = newmodel.content
+class EventTypeEnum(Enum):
+ ALARM = 'alarm'
+ EVENT = 'event'
+
+
class PerceivedSeverityEnum(str, Enum):
CRITICAL = 0
MAJOR = 1