add rca api

Change-Id: I6c1301fbabd13e31b1a845e4e32fa4a8b6c147da
This commit is contained in:
Eyal 2016-02-01 15:47:11 +02:00
parent f53d6bbf2b
commit 091f80e150
3 changed files with 41 additions and 1 deletions

View File

@ -2,5 +2,6 @@
"get topology": "role:admin", "get topology": "role:admin",
"get resource": "role:admin", "get resource": "role:admin",
"list resources": "role:admin", "list resources": "role:admin",
"list alarms": "role:admin" "list alarms": "role:admin",
"get rca": "role:admin"
} }

View File

@ -0,0 +1,37 @@
# Copyright 2016 - Nokia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import pecan
from oslo_log import log
from pecan import rest
from vitrage.api.policy import enforce
# noinspection PyProtectedMember
from vitrage.i18n import _LI
LOG = log.getLogger(__name__)
class RCAController(rest.RestController):
@pecan.expose('json')
def get(self, alarm_id):
enforce("get rca", pecan.request.headers,
pecan.request.enforcer, {})
LOG.info(_LI('received show rca with alarm id %s') %
alarm_id)
pecan.request.context = dict(query=None, depth=None, root=None,
graph_type="graph")
# todo (eyalb1) need to figure how to redirect
# redirect('/v1/topology/', internal=True)

View File

@ -11,6 +11,7 @@
# under the License. # under the License.
from vitrage.api.controllers.v1 import alarms from vitrage.api.controllers.v1 import alarms
from vitrage.api.controllers.v1 import rca
from vitrage.api.controllers.v1 import resource from vitrage.api.controllers.v1 import resource
from vitrage.api.controllers.v1 import topology from vitrage.api.controllers.v1 import topology
@ -19,3 +20,4 @@ class V1Controller(object):
topology = topology.TopologyController() topology = topology.TopologyController()
resources = resource.ResourcesController() resources = resource.ResourcesController()
alarms = alarms.AlarmsController() alarms = alarms.AlarmsController()
rca = rca.RCAController()