-
- def get_credentials_for_alarm_id(self, alarm_id, vim_type):
- alarm = Alarm.select() \
- .where(Alarm.alarm_id == alarm_id) \
- .join(VimCredentials) \
- .where(VimCredentials.type == vim_type).get()
- return alarm.credentials
-
- def save_alarm(self, alarm_id, vim_uuid):
- """Saves alarm. If a record with same id and vim_uuid exists, overwrite it."""
+ return vim_credentials
+
+ def get_alarm(self, alarm_id) -> Alarm:
+ alarm = (Alarm.select()
+ .where(Alarm.alarm_id == alarm_id)
+ .get())
+ return alarm
+
+ def save_alarm(self, name, threshold, operation, severity, statistic, metric_name, vdur_name,
+ vnf_member_index, nsr_id) -> Alarm:
+ """Saves alarm."""
+ # TODO: Add uuid optional param and check if exists to handle updates (see self.save_credentials)