Removing system uuid from alarms summary

System UUID not required to be part of alarms summary.

This is also needed to allow non-admin users to read
alarms summary.

Story: 2009077
Task: 42995

Signed-off-by: Pablo Bovina <pablo.bovina@windriver.com>
Change-Id: I55c0cb297be7e86d31bce116e8ba20a2162d2f04
This commit is contained in:
Pablo Bovina 2021-08-10 16:14:09 -04:00
parent 092cd369b2
commit e8d00192c5
2 changed files with 3 additions and 13 deletions

View File

@ -332,7 +332,6 @@ unauthorized (401), forbidden (403), badMethod (405), overLimit (413)
:header: "Parameter", "Style", "Type", "Description"
:widths: 20, 20, 20, 60
"system_uuid (Optional)", "plain", "csapi:UUID", "UUID of the system."
"status (Optional)", "plain", "xsd:string", "Overall system status based on alarms present; ``critical``, ``degraded``, or ``OK``."
"critical (Optional)", "plain", "xsd:integer", "Count of critical alarms on the system"
"major (Optional)", "plain", "xsd:integer", "Count of major alarms on the system"
@ -345,7 +344,6 @@ unauthorized (401), forbidden (403), badMethod (405), overLimit (413)
"status": "OK",
"major": 0,
"warnings": 0,
"system_uuid": "6a314f63-4969-46f8-9221-b69b6b50424c",
"critical": 0,
"minor": 0
}

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2018-2019 Wind River Systems, Inc.
# Copyright (c) 2018-2021 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -27,7 +27,6 @@ from fm.common import exceptions
from fm.common import constants
from fm import objects
from fm.api.controllers.v1.query import Query
from fm.api.controllers.v1.sysinv import cgtsclient
from fm_api import constants as fm_constants
@ -191,18 +190,14 @@ class AlarmSummary(base.APIBase):
status = wsme.wsattr(wtypes.text, mandatory=True)
"The status of the system"
system_uuid = wsme.wsattr(types.uuid, mandatory=True)
"The UUID of the system (for distributed cloud use)"
@classmethod
def convert_with_links(cls, ialm_sum, uuid):
def convert_with_links(cls, ialm_sum):
summary = AlarmSummary()
summary.critical = ialm_sum[fm_constants.FM_ALARM_SEVERITY_CRITICAL]
summary.major = ialm_sum[fm_constants.FM_ALARM_SEVERITY_MAJOR]
summary.minor = ialm_sum[fm_constants.FM_ALARM_SEVERITY_MINOR]
summary.warnings = ialm_sum[fm_constants.FM_ALARM_SEVERITY_WARNING]
summary.status = ialm_sum['status']
summary.system_uuid = uuid
return summary
@ -238,10 +233,7 @@ class AlarmController(rest.RestController):
status = fm_constants.FM_ALARM_CRITICAL_STATUS
ialm_counts['status'] = status
system = cgtsclient(pecan.request.context).isystem.list()[0]
uuid = system.uuid
return AlarmSummary.convert_with_links(ialm_counts, uuid)
return AlarmSummary.convert_with_links(ialm_counts)
def _get_alarm_collection(self, marker, limit, sort_key, sort_dir,
expand=False, resource_url=None,