Initial commit
[ta/config-manager.git] / cmframework / src / cmframework / utils / cmalarmwork.py
diff --git a/cmframework/src/cmframework/utils/cmalarmwork.py b/cmframework/src/cmframework/utils/cmalarmwork.py
new file mode 100644 (file)
index 0000000..b5eca06
--- /dev/null
@@ -0,0 +1,47 @@
+# Copyright 2019 Nokia
+
+# 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.
+
+
+class CMAlarmWork(object):
+    OPER_RAISE = 1
+    OPER_CANCEL = 2
+
+    OPER_NAMES = ('NONE', 'RAISE', 'CANCEL')
+
+    def __init__(self, operation, alarm_id, dn, supplementary_info):
+        self.operation = operation
+        self.alarm_id = alarm_id
+        self.dn = dn
+        self.supplementary_info = supplementary_info
+
+    def __str__(self):
+        return '(%r %r %r %r)' % (self._get_operation_name(),
+                                  self.alarm_id,
+                                  self.dn,
+                                  self.supplementary_info)
+
+    def _get_operation_name(self):
+        return CMAlarmWork.OPER_NAMES[self.operation]
+
+    def get_operation(self):
+        return self.operation
+
+    def get_alarm_id(self):
+        return self.alarm_id
+
+    def get_dn(self):
+        return self.dn
+
+    def get_supplementary_info(self):
+        return self.supplementary_info