示例#1
0
    def test_notification_type_new_host(self):
        ret = GN._get_notification_type(None, forced_down_host, True)
        self.assertEqual(NType.ACTIVATE_MARK_DOWN_EVENT, self.get_first(ret),
                         'new host with forced_down should notify activate')

        ret = GN._get_notification_type(None, host, True)
        self.assertIsNone(self.get_first(ret), 'host without forced_down')
示例#2
0
    def test_notification_type_new_alarm(self):
        ret = GN._get_notification_type(None, deduced_alarm, True)
        self.assertEqual(NType.ACTIVATE_DEDUCED_ALARM_EVENT,
                         self.get_first(ret),
                         'new alarm should notify activate')

        ret = GN._get_notification_type(None, non_deduced_alarm, True)
        self.assertIsNone(self.get_first(ret),
                          'alarm that is not a deduced alarm')
示例#3
0
    def test_notification_type_updated_alarm(self):
        ret = GN._get_notification_type(deduced_alarm, deduced_alarm, True)
        self.assertIsNone(self.get_first(ret),
                          'A not new alarm vertex should be ignored')

        ret = GN._get_notification_type(deleted_alarm, deduced_alarm, True)
        self.assertEqual(
            NType.ACTIVATE_DEDUCED_ALARM_EVENT, self.get_first(ret),
            'old alarm become not deleted should notify activate')

        ret = GN._get_notification_type(placeholder_alarm, deduced_alarm, True)
        self.assertEqual(NType.ACTIVATE_DEDUCED_ALARM_EVENT,
                         self.get_first(ret),
                         'placeholder become active should notify activate')
示例#4
0
 def _add_graph_subscriptions(self):
     self.graph.subscribe(self.workers.submit_graph_update)
     vitrage_notifier = GraphNotifier()
     if vitrage_notifier.enabled:
         self.graph.subscribe(vitrage_notifier.notify_when_applicable)
         LOG.info('Subscribed vitrage notifier to graph changes')
     self.graph.subscribe(self.persist.persist_event, finalization=True)
示例#5
0
 def __init__(self, conf, initialization_status, e_graph):
     super(Processor, self).__init__()
     self.conf = conf
     self.transformer_manager = TransformerManager(self.conf)
     self.state_manager = DatasourceInfoMapper(self.conf)
     self._initialize_events_actions()
     self.initialization_status = initialization_status
     self.entity_graph = e_graph
     self._notifier = GraphNotifier(conf)
 def __init__(self, conf, e_graph=None, graph_persistor=None):
     super(Processor, self).__init__()
     self.conf = conf
     self.transformer_manager = TransformerManager(self.conf)
     self.info_mapper = DatasourceInfoMapper(self.conf)
     self._initialize_events_actions()
     self.entity_graph = e_graph
     self._notifier = GraphNotifier(conf)
     self._graph_persistor = graph_persistor
示例#7
0
 def __init__(self, conf, initialization_status, e_graph=None, uuid=False):
     super(Processor, self).__init__()
     self.conf = conf
     self.transformer_manager = TransformerManager(self.conf)
     self.state_manager = DatasourceInfoMapper(self.conf)
     self._initialize_events_actions()
     self.initialization_status = initialization_status
     self.entity_graph = e_graph if e_graph is not None\
         else NXGraph("Entity Graph", uuid=uuid)
     self._notifier = GraphNotifier(conf)
示例#8
0
    def test_notification_type_deleted_host(self):
        deleted_host = copy.deepcopy(forced_down_host)
        deleted_host[VProps.VITRAGE_IS_DELETED] = True
        ret = GN._get_notification_type(forced_down_host, deleted_host, True)
        self.assertEqual(
            NType.DEACTIVATE_MARK_DOWN_EVENT, self.get_first(ret),
            'deleted host with forced_down should notify deactivate')

        deleted_host = copy.deepcopy(host)
        deleted_host[VProps.VITRAGE_IS_DELETED] = True
        ret = GN._get_notification_type(forced_down_host, deleted_host, True)
        self.assertEqual(
            NType.DEACTIVATE_MARK_DOWN_EVENT, self.get_first(ret),
            'deleted host with forced_down should notify deactivate')

        deleted_host = copy.deepcopy(host)
        deleted_host[VProps.VITRAGE_IS_DELETED] = True
        ret = GN._get_notification_type(host, deleted_host, True)
        self.assertIsNone(
            self.get_first(ret),
            'deleted host without forced_down should not notify')
示例#9
0
    def test_notification_type_updated_host(self):
        ret = GN._get_notification_type(forced_down_host, forced_down_host,
                                        True)
        self.assertIsNone(self.get_first(ret),
                          'A not new host should be ignored')

        deleted_host = copy.deepcopy(forced_down_host)
        deleted_host[VProps.VITRAGE_IS_DELETED] = True
        ret = GN._get_notification_type(deleted_host, forced_down_host, True)
        self.assertEqual(NType.ACTIVATE_MARK_DOWN_EVENT, self.get_first(ret),
                         'old host become not deleted should notify activate')

        deleted_host = copy.deepcopy(forced_down_host)
        deleted_host[VProps.VITRAGE_IS_DELETED] = True
        ret = GN._get_notification_type(deleted_host, host, True)
        self.assertIsNone(self.get_first(ret),
                          'old host become not deleted should not notify')

        placeholder_host = copy.deepcopy(forced_down_host)
        placeholder_host[VProps.VITRAGE_IS_PLACEHOLDER] = True
        ret = GN._get_notification_type(placeholder_host, forced_down_host,
                                        True)
        self.assertEqual(NType.ACTIVATE_MARK_DOWN_EVENT, self.get_first(ret),
                         'placeholder become active should notify activate')
示例#10
0
 def test_notification_type_placeholder_host(self):
     placeholder_host = copy.deepcopy(forced_down_host)
     placeholder_host[VProps.VITRAGE_IS_PLACEHOLDER] = True
     ret = GN._get_notification_type(None, placeholder_host, True)
     self.assertIsNone(self.get_first(ret),
                       'A not new host vertex should be ignored')
示例#11
0
 def test_notification_type_placeholder_alarm(self):
     ret = GN._get_notification_type(None, placeholder_alarm, True)
     self.assertIsNone(self.get_first(ret),
                       'A not new alarm vertex should be ignored')
示例#12
0
 def test_notification_type_resource_vertex(self):
     ret = GN._get_notification_type(None, resource, True)
     self.assertIsNone(self.get_first(ret),
                       'any non alarm vertex should be ignored')
示例#13
0
 def test_notification_type_deleted_alarm(self):
     ret = GN._get_notification_type(deduced_alarm, deleted_alarm, True)
     self.assertEqual(NType.DEACTIVATE_DEDUCED_ALARM_EVENT,
                      self.get_first(ret),
                      'deleted alarm should notify deactivate')