def setUp(self): super(TestRPCAlarmNotifier, self).setUp() self.CONF = self.useFixture(fixture_config.Config()).conf self.setup_messaging(self.CONF) self.notifier_server = FakeNotifier(self.transport) self.notifier = rpc_alarm.RPCAlarmNotifier() self.alarms = [ alarms.Alarm(None, info={ 'name': 'instance_running_hot', 'meter_name': 'cpu_util', 'comparison_operator': 'gt', 'threshold': 80.0, 'evaluation_periods': 5, 'statistic': 'avg', 'state': 'ok', 'ok_actions': ['http://host:8080/path'], 'user_id': 'foobar', 'project_id': 'snafu', 'period': 60, 'alarm_id': str(uuid.uuid4()), 'severity': 'critical', 'matching_metadata': { 'resource_id': 'my_instance' } }), alarms.Alarm(None, info={ 'name': 'group_running_idle', 'meter_name': 'cpu_util', 'comparison_operator': 'le', 'threshold': 10.0, 'statistic': 'max', 'evaluation_periods': 4, 'state': 'insufficient data', 'insufficient_data_actions': ['http://other_host/path'], 'user_id': 'foobar', 'project_id': 'snafu', 'period': 300, 'alarm_id': str(uuid.uuid4()), 'severity': 'critical', 'matching_metadata': { 'metadata.user_metadata.AS': 'my_group' } }), ]
def __init__(self): super(SingletonAlarmService, self).__init__() self.extension_manager = extension.ExtensionManager( namespace=self.ALARM_NAMESPACE, invoke_on_load=True, invoke_args=(rpc_alarm.RPCAlarmNotifier(),) )
def _load_evaluators(self): self.evaluators = extension.ExtensionManager( namespace=self.EXTENSIONS_NAMESPACE, invoke_on_load=True, invoke_args=(rpc_alarm.RPCAlarmNotifier(), )) self.supported_evaluators = [ ext.name for ext in self.evaluators.extensions ]
def setUp(self): super(TestRPCAlarmNotifier, self).setUp() self.notified = [] self.useFixture( mockpatch.PatchObject(rpc, 'cast', side_effect=self.fake_cast)) self.notifier = rpc_alarm.RPCAlarmNotifier() self.alarms = [ alarms.Alarm(None, info={ 'name': 'instance_running_hot', 'meter_name': 'cpu_util', 'comparison_operator': 'gt', 'threshold': 80.0, 'evaluation_periods': 5, 'statistic': 'avg', 'state': 'ok', 'ok_actions': ['http://host:8080/path'], 'user_id': 'foobar', 'project_id': 'snafu', 'period': 60, 'alarm_id': str(uuid.uuid4()), 'matching_metadata': { 'resource_id': 'my_instance' } }), alarms.Alarm(None, info={ 'name': 'group_running_idle', 'meter_name': 'cpu_util', 'comparison_operator': 'le', 'threshold': 10.0, 'statistic': 'max', 'evaluation_periods': 4, 'state': 'insufficient data', 'insufficient_data_actions': ['http://other_host/path'], 'user_id': 'foobar', 'project_id': 'snafu', 'period': 300, 'alarm_id': str(uuid.uuid4()), 'matching_metadata': { 'metadata.user_metadata.AS': 'my_group' } }), ]