summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/pmsh_service/mod/api/controller.py
diff options
context:
space:
mode:
authorefiacor <fiachra.corcoran@est.tech>2020-05-20 15:18:41 +0100
committerefiacor <fiachra.corcoran@est.tech>2020-05-25 08:50:24 +0100
commit5ed9b7d3cad56c6438bca305b6d2931bd320352b (patch)
treeb05cbb4e7215e9b6b9aead2a1ae45d63330c0761 /components/pm-subscription-handler/pmsh_service/mod/api/controller.py
parent9a57e9a2e2357f267c6a7c804488011ac97beab5 (diff)
[PMSH] Adding 'subscriptions' api endpoint
Signed-off-by: efiacor <fiachra.corcoran@est.tech> Change-Id: I837045b3b618a98d4aabe190359d0ad47f27ca9f Issue-ID: DCAEGEN2-2154
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod/api/controller.py')
-rwxr-xr-xcomponents/pm-subscription-handler/pmsh_service/mod/api/controller.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/mod/api/controller.py b/components/pm-subscription-handler/pmsh_service/mod/api/controller.py
new file mode 100755
index 00000000..21d29caf
--- /dev/null
+++ b/components/pm-subscription-handler/pmsh_service/mod/api/controller.py
@@ -0,0 +1,42 @@
+# ============LICENSE_START===================================================
+# Copyright (C) 2019-2020 Nordix Foundation.
+# ============================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=====================================================
+
+from mod.subscription import Subscription
+
+
+def status():
+ """
+ Returns the health of the PMSH service
+ Args:
+ NA
+ Returns:
+ Dictionary detailing 'status' of either 'healthy' or 'unhealthy'.
+ Raises:
+ NA
+ """
+ return {'status': 'healthy'}
+
+
+def get_all_sub_to_nf_relations():
+ """ Retrieves all subscription to nf relations
+
+ Returns:
+ list: of Subscriptions and it's related Network Functions, else empty
+ """
+ subs_dict = [s.serialize() for s in Subscription.get_all()]
+ return subs_dict