b40b4513e6
The API allow the actions to be null. This allow the alarm to be deleted and updated in this case. Closes bug: #1479274 Change-Id: I0e53c39e9b6c9c80537ac646fb5695177eeb69d1
138 lines
3.4 KiB
YAML
138 lines
3.4 KiB
YAML
# Requests to cover the basic endpoints for alarms.
|
|
|
|
fixtures:
|
|
- ConfigFixture
|
|
|
|
tests:
|
|
- name: list alarms none
|
|
desc: Lists alarms, none yet exist
|
|
url: /v2/alarms
|
|
method: GET
|
|
response_strings:
|
|
- "[]"
|
|
|
|
- name: try to PUT an alarm
|
|
desc: what does PUT do
|
|
url: /v2/alarms
|
|
method: PUT
|
|
request_headers:
|
|
content-type: application/json
|
|
data:
|
|
name: added_alarm_defaults2
|
|
type: threshold
|
|
threshold_rule:
|
|
meter_name: ameter
|
|
threshold: 300.0
|
|
status: 405
|
|
response_headers:
|
|
allow: GET, POST
|
|
|
|
- name: createAlarm
|
|
desc: Creates an alarm.
|
|
url: /v2/alarms
|
|
method: POST
|
|
request_headers:
|
|
content-type: application/json
|
|
data:
|
|
ok_actions: null
|
|
name: added_alarm_defaults
|
|
type: threshold
|
|
threshold_rule:
|
|
meter_name: ameter
|
|
threshold: 300.0
|
|
status: 201
|
|
response_headers:
|
|
location: /$SCHEME://$NETLOC/v2/alarms/
|
|
content-type: application/json; charset=UTF-8
|
|
response_json_paths:
|
|
$.severity: low
|
|
$.threshold_rule.threshold: 300.0
|
|
$.threshold_rule.comparison_operator: eq
|
|
|
|
- name: showAlarm
|
|
desc: Shows information for a specified alarm.
|
|
url: /v2/alarms/$RESPONSE['$.alarm_id']
|
|
method: GET
|
|
response_json_paths:
|
|
$.severity: low
|
|
$.alarm_id: $RESPONSE['$.alarm_id']
|
|
$.threshold_rule.threshold: 300.0
|
|
$.threshold_rule.comparison_operator: eq
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
|
|
- name: updateAlarm
|
|
desc: Updates a specified alarm.
|
|
url: /v2/alarms/$RESPONSE['$.alarm_id']
|
|
method: PUT
|
|
request_headers:
|
|
content-type: application/json
|
|
data:
|
|
name: added_alarm_defaults
|
|
type: threshold
|
|
severity: moderate
|
|
threshold_rule:
|
|
meter_name: ameter
|
|
threshold: 200.0
|
|
# TODO(chdent): why do we have a response, why not status: 204?
|
|
# status: 204
|
|
response_json_paths:
|
|
$.threshold_rule.threshold: 200.0
|
|
$.severity: moderate
|
|
$.state: insufficient data
|
|
|
|
- name: showAlarmHistory
|
|
desc: Assembles the history for a specified alarm.
|
|
url: /v2/alarms/$RESPONSE['$.alarm_id']/history?q.field=type&q.op=eq&q.value=rule%20change
|
|
method: GET
|
|
response_json_paths:
|
|
$[0].type: rule change
|
|
|
|
- name: updateAlarmState
|
|
desc: Sets the state of a specified alarm.
|
|
url: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
|
|
request_headers:
|
|
content-type: application/json
|
|
data: '"alarm"'
|
|
method: PUT
|
|
# TODO(chdent): really? Of what possible use is this?
|
|
response_json_paths:
|
|
$: alarm
|
|
|
|
# Get a list of alarms so we can extract an id for the next test
|
|
- name: list alarms for data
|
|
desc: Lists alarms, only one
|
|
url: /v2/alarms
|
|
method: GET
|
|
response_json_paths:
|
|
$[0].name: added_alarm_defaults
|
|
|
|
- name: showAlarmState
|
|
desc: Gets the state of a specified alarm.
|
|
url: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
|
|
method: GET
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
response_json_paths:
|
|
$: alarm
|
|
|
|
- name: list alarms one
|
|
desc: Lists alarms, only one
|
|
url: /v2/alarms
|
|
method: GET
|
|
response_json_paths:
|
|
$[0].name: added_alarm_defaults
|
|
|
|
- name: deleteAlarm
|
|
desc: Deletes a specified alarm.
|
|
url: /v2/alarms/$RESPONSE['$[0].alarm_id']
|
|
method: DELETE
|
|
status: 204
|
|
|
|
- name: list alarms none end
|
|
desc: Lists alarms, none now exist
|
|
url: /v2/alarms
|
|
method: GET
|
|
response_strings:
|
|
- "[]"
|