summaryrefslogtreecommitdiffstats
path: root/config_binding_service/controller.py
diff options
context:
space:
mode:
authorTommy Carpenter <tommy@research.att.com>2018-02-15 13:14:33 -0500
committerTommy Carpenter <tommy@research.att.com>2018-02-15 14:50:29 -0500
commit857c41af07fd88b50c2e960071611f425268e486 (patch)
tree6c70be46b3f7e04e6df5b56369a068814a6f5d51 /config_binding_service/controller.py
parente2f8b1019b0c64747d2dca8801f1c0c9b2fbb12a (diff)
Add DTI and Policy to ONAP CBS
Issue-ID: DCAEGEN2-341 Change-Id: Iead3b6568ec379988b840b5a01c7744c29b5fcf4 Signed-off-by: Tommy Carpenter <tommy@research.att.com>
Diffstat (limited to 'config_binding_service/controller.py')
-rw-r--r--config_binding_service/controller.py40
1 files changed, 35 insertions, 5 deletions
diff --git a/config_binding_service/controller.py b/config_binding_service/controller.py
index a74d60f..ec6f05e 100644
--- a/config_binding_service/controller.py
+++ b/config_binding_service/controller.py
@@ -1,14 +1,14 @@
# ============LICENSE_START=======================================================
# org.onap.dcae
# ================================================================================
-# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# 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
-#
+#
+# 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.
@@ -17,16 +17,46 @@
# ============LICENSE_END=========================================================
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
from config_binding_service import client, get_consul_uri, get_logger
import requests
from flask import request, Response
import json
+_logger = get_logger(__name__)
+
+def dtievents(service_component_name):
+ try:
+ dti = client.resolve_DTI(service_component_name)
+ return Response(response=json.dumps(dti),
+ status=200,
+ mimetype="application/json")
+ except client.CantGetConfig as e:
+ return Response(status=e.code,
+ response=e.response)
+ except Exception as e:
+ _logger.error(e)
+ return Response(response="Unknown error: please report",
+ status=500)
+
+def policies(service_component_name):
+ try:
+ dti = client.resolve_policies(service_component_name)
+ return Response(response=json.dumps(dti),
+ status=200,
+ mimetype="application/json")
+ except client.CantGetConfig as e:
+ return Response(status=e.code,
+ response=e.response)
+ except Exception as e:
+ _logger.error(e)
+ return Response(response="Unknown error: please report",
+ status=500)
def bind_config_for_scn(service_component_name):
try:
bound = client.resolve(service_component_name)
return Response(response=json.dumps(bound),
- status=200,
+ status=200,
mimetype="application/json")
except client.CantGetConfig as e:
return Response(status=e.code,