Initial commit
[ta/config-manager.git] / cmframework / src / cmframework / utils / cmalarmwork.py
1 # Copyright 2019 Nokia
2
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15
16 class CMAlarmWork(object):
17     OPER_RAISE = 1
18     OPER_CANCEL = 2
19
20     OPER_NAMES = ('NONE', 'RAISE', 'CANCEL')
21
22     def __init__(self, operation, alarm_id, dn, supplementary_info):
23         self.operation = operation
24         self.alarm_id = alarm_id
25         self.dn = dn
26         self.supplementary_info = supplementary_info
27
28     def __str__(self):
29         return '(%r %r %r %r)' % (self._get_operation_name(),
30                                   self.alarm_id,
31                                   self.dn,
32                                   self.supplementary_info)
33
34     def _get_operation_name(self):
35         return CMAlarmWork.OPER_NAMES[self.operation]
36
37     def get_operation(self):
38         return self.operation
39
40     def get_alarm_id(self):
41         return self.alarm_id
42
43     def get_dn(self):
44         return self.dn
45
46     def get_supplementary_info(self):
47         return self.supplementary_info