from cgtsclient.exc import EndpointException
from dcmanagerclient.api.client import client as get_dc_client
from fmclient.client import get_client as get_fm_client
-from fmclient.common.exceptions import HTTPNotFound
+from fmclient.common.exceptions import HTTPNotFound, HttpServerError
from o2app.adapter import unit_of_work
from o2common.config import config
logger.debug('alarm {} not in this resource pool {}'
.format(alarm, self._pool_id))
continue
+ except HttpServerError:
+ # TODO(jon): This exception needs to be removed when the
+ # INF-457 related FM client upgrade and issue fix occur.
+ logger.debug('alarm {} query failed'.format(alarm))
+ continue
ret.append(event)
return ret
return config_client
def getSubcloudList(self):
+ self.dcclient = self.getDcmanagerClient()
subs = self.dcclient.subcloud_manager.list_subclouds()
known_subs = [sub for sub in subs if sub.sync_status != 'unknown']
return known_subs
@ staticmethod
def _alarmconverter(alarm):
+ selected_keys = [
+ 'alarm_id', 'alarm_state', 'entity_type_id', 'entity_instance_id',
+ 'reason_text', 'alarm_type', 'probable_cause',
+ 'proposed_repair_action', 'service_affecting', 'suppression',
+ 'suppression_status', 'mgmt_affecting', 'degrade_affecting'
+ ]
+ content = alarm.to_dict()
+ filtered = dict(
+ filter(lambda item: item[0] in selected_keys, content.items()))
+ setattr(alarm, 'filtered', filtered)
# setattr(alarm, 'alarm_def_id', uuid.uuid3(
# uuid.NAMESPACE_URL, alarm.alarm_id))
setattr(alarm, 'state', alarm.alarm_state)
@ staticmethod
def _eventconverter(event, clear=False):
+ selected_keys = [
+ 'event_log_id', 'state', 'entity_type_id',
+ 'entity_instance_id', 'reason_text', 'event_log_type',
+ 'probable_cause', 'proposed_repair_action',
+ 'service_affecting', 'suppression', 'suppression_status'
+ ]
+ content = event.to_dict()
+ filtered = dict(
+ filter(lambda item: item[0] in selected_keys, content.items()))
+ setattr(event, 'filtered', filtered)
setattr(event, 'alarm_id', event.event_log_id)
setattr(event, 'alarm_type', event.event_log_type)
if clear: