def create_ceilometer_alarm(resource_id=None, name=None, unic=True): if not name: name = '%s-%s' % ('test_', random.randrange(0, 100000, 1)) elif unic: name = '%s-%s' % (name, random.randrange(0, 100000, 1)) aodh_request = _aodh_request(resource_id=resource_id, name=name) TempestClients.ceilometer().alarms.create(**aodh_request) time.sleep(45)
def delete_all_ceilometer_alarms(): alarms = TempestClients.ceilometer().alarms.list() for alarm in alarms: TempestClients.ceilometer().alarms.delete(alarm.alarm_id) time.sleep(120)