This commit does the following:
- Add a new option "keep_existing_alarm" when creating an alarm so,
if said alarm already exists, it won't be updated.
- Add a new method to clear alarms from a list. The input is a list
with each element being a tuple consisted of alarm_id and
entity_instance_id.
- Modified the existing method that created alarms from a list.
Previously, the client would loop through the list of alarms and send
requests to FM API. Now, alarms from the list are converted into
a vector of structs and passed to FM API in a single request.
Test plan (using FaultAPIsV2):
- PASS: Build package and install.
- PASS: Create a new alarm with keep_existing_alarm=True and verify
a new alarm was created.
- PASS: Create an existing alarm with keep_existing_alarm=True and
verify the original alarm was kept and the returned UUID
is correct.
- PASS: Create an existing alarm without keep_existing_alarm and
verify the original alarm was updated and the returned UUID
is correct.
- PASS: Create a list of alarms and verify they were correctly
created and it was faster than previous method.
- PASS: Clear a list of alarms that exist and verify they were
successfully cleared.
- PASS: Clear a list of alarms that don't exist and verify the API
didn't raise any errors.
- PASS: Stop pmond process and verify mtce raises the correct
200.006 alarm only once. Restart pmond and verify the alarm
is cleared.
Story: 2011311
Task: 52166
Change-Id: I2f901c4726c24f3522a8c5bae1d7d9b03ef24ce0
Signed-off-by: Victor Romano <victor.gluzromano@windriver.com>