* Update the check for timestamp to use state_timestamp instead
state_timestamp indicates the last change in state of the alarm,
timestamp is the last update to the alarm settings. This is not
what we're looking for with aodh tests, so check the state update
instead.
* Trigger an alarm state change before checking whether the alram
was updated. Notification in collectd aren't necessarily updated
at a regular interval, so we have to do some action and check whether
the alarm is updated.
JIRA: BAROMETER-91
Change-Id: I26d9bb1ec7e50e07053e69068d241e4c4cbc30dc
Signed-off-by: Emma Foley <emma.l.foley@intel.com>
return False, warning
return True, warning
return False, warning
return True, warning
+ def trigger_alarm_update(self, alarm, compute_node):
+ # TODO: move these actions to main, with criteria lists so that we can reference that
+ # i.e. test_plugin_with_aodh(self, compute, plugin.., logger, criteria_list, alarm_action)
+ if alarm == 'mcelog':
+ compute_node.run_cmd('sudo modprobe mce-inject')
+ compute_node.run_cmd('sudo ./mce-inject_ea < corrected')
+ if alarm == 'ovs_events':
+ compute_node.run_cmd('sudo ifconfig -a | grep br0')
+ compute_node.run_cmd('sudo ifconfig br0 down; sudo ifconfig br0 up')
+
def test_plugins_with_aodh(
self, compute, plugin_interval, logger,
criteria_list=[]):
def test_plugins_with_aodh(
self, compute, plugin_interval, logger,
criteria_list=[]):
timestamps1 = {}
timestamps2 = {}
nodes = get_apex_nodes()
timestamps1 = {}
timestamps2 = {}
nodes = get_apex_nodes()
+ compute_node = [node for node in nodes if node.get_dict()['name'] == compute][0]
for node in nodes:
if node.is_controller():
self.__logger.info('Getting AODH Alarm list on {}' .format(
(node.get_dict()['name'])))
node.put_file(constants.ENV_FILE, 'overcloudrc.v3')
for node in nodes:
if node.is_controller():
self.__logger.info('Getting AODH Alarm list on {}' .format(
(node.get_dict()['name'])))
node.put_file(constants.ENV_FILE, 'overcloudrc.v3')
+ self.trigger_alarm_update(criteria_list, compute_node)
stdout = node.run_cmd(
"source overcloudrc.v3;"
+ "aodh alarm list | grep {0} | grep {1}"
stdout = node.run_cmd(
"source overcloudrc.v3;"
+ "aodh alarm list | grep {0} | grep {1}"
return False
for line in stdout.splitlines()[3: -1]:
line = line.replace('|', "")
return False
for line in stdout.splitlines()[3: -1]:
line = line.replace('|', "")
- if line.split()[0] == 'timestamp':
+ if line.split()[0] == 'state_timestamp':
timestamps1 = line.split()[1]
timestamps1 = line.split()[1]
+ self.trigger_alarm_update(criteria_list, compute_node)
time.sleep(12)
stdout = node.run_cmd(
"source overcloudrc.v3; aodh alarm show {}" .format(
time.sleep(12)
stdout = node.run_cmd(
"source overcloudrc.v3; aodh alarm show {}" .format(
return False
for line in stdout.splitlines()[3:-1]:
line = line.replace('|', "")
return False
for line in stdout.splitlines()[3:-1]:
line = line.replace('|', "")
- if line.split()[0] == 'timestamp':
+ if line.split()[0] == 'state_timestamp':
timestamps2 = line.split()[1]
timestamps2 = line.split()[1]
if timestamps1 == timestamps2:
self.__logger.info(
"Data not updated after interval of 12 seconds")
if timestamps1 == timestamps2:
self.__logger.info(
"Data not updated after interval of 12 seconds")