Coverage for watcher/decision_engine/rpcapi.py: 100%
39 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
1# -*- encoding: utf-8 -*-
2# Copyright (c) 2015 b<>com
3# Copyright (c) 2016 Intel Corp
4#
5# Authors: Jean-Emile DARTOIS <jean-emile.dartois@b-com.com>
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16# implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
19#
21from watcher.common import exception
22from watcher.common import service
23from watcher.common import service_manager
24from watcher.common import utils
26from watcher import conf
28CONF = conf.CONF
31class DecisionEngineAPI(service.Service):
33 def __init__(self):
34 super(DecisionEngineAPI, self).__init__(DecisionEngineAPIManager)
36 def trigger_audit(self, context, audit_uuid=None):
37 if not utils.is_uuid_like(audit_uuid):
38 raise exception.InvalidUuidOrName(name=audit_uuid)
40 self.conductor_client.cast(
41 context, 'trigger_audit', audit_uuid=audit_uuid)
43 def get_strategy_info(self, context, strategy_name):
44 return self.conductor_client.call(
45 context, 'get_strategy_info', strategy_name=strategy_name)
47 def get_data_model_info(self, context, data_model_type, audit):
48 return self.conductor_client.call(
49 context, 'get_data_model_info',
50 data_model_type=data_model_type, audit=audit)
53class DecisionEngineAPIManager(service_manager.ServiceManager):
55 @property
56 def service_name(self):
57 return None
59 @property
60 def api_version(self):
61 return '1.0'
63 @property
64 def publisher_id(self):
65 return CONF.watcher_decision_engine.publisher_id
67 @property
68 def conductor_topic(self):
69 return CONF.watcher_decision_engine.conductor_topic
71 @property
72 def notification_topics(self):
73 return []
75 @property
76 def conductor_endpoints(self):
77 return []
79 @property
80 def notification_endpoints(self):
81 return []