summaryrefslogtreecommitdiffstats
path: root/gvnfmadapter
diff options
context:
space:
mode:
Diffstat (limited to 'gvnfmadapter')
-rw-r--r--gvnfmadapter/driver/interfaces/tests.py6
-rw-r--r--gvnfmadapter/driver/interfaces/urls.py2
-rw-r--r--gvnfmadapter/driver/interfaces/views.py9
3 files changed, 17 insertions, 0 deletions
diff --git a/gvnfmadapter/driver/interfaces/tests.py b/gvnfmadapter/driver/interfaces/tests.py
index 4580680..427f872 100644
--- a/gvnfmadapter/driver/interfaces/tests.py
+++ b/gvnfmadapter/driver/interfaces/tests.py
@@ -913,3 +913,9 @@ class InterfacesTest(TestCase):
self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code)
self.assertEqual(None, response.data)
self.assertEqual("/vnf_lc_ops/NF-HEAL-12-2a3be946-b01d-11e8-9302-08002705b121", response['Location'])
+
+ def test_health_check(self):
+ response = self.client.get("/api/gvnfmdriver/v1/health_check")
+ self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
+ resp_data = json.loads(response.content)
+ self.assertEqual({"status": "active"}, resp_data)
diff --git a/gvnfmadapter/driver/interfaces/urls.py b/gvnfmadapter/driver/interfaces/urls.py
index 9a36463..368ea8e 100644
--- a/gvnfmadapter/driver/interfaces/urls.py
+++ b/gvnfmadapter/driver/interfaces/urls.py
@@ -16,6 +16,7 @@ from django.conf.urls import url
from driver.interfaces.views import VnfInstInfo, VnfTermInfo, VnfQueryInfo, VnfOperInfo
from driver.interfaces.views import Subscription
from driver.interfaces.views import VnfPkgsInfo, VnfGrantInfo, VnfNotifyInfo, QuerySingleVnfLcmOpOcc, VnfOperateView, VnfHealView
+from driver.interfaces.views import HealthCheckView
urlpatterns = [
url(r'^api/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/vnfs$', VnfInstInfo.as_view()),
@@ -32,4 +33,5 @@ urlpatterns = [
r'[0-9a-zA-Z\-\_]+)/operate$', VnfOperateView.as_view()),
url(r'^api/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/vnfs/(?P<vnfInstanceId>'
r'[0-9a-zA-Z\-\_]+)/heal$', VnfHealView.as_view()),
+ url(r'^api/gvnfmdriver/v1/health_check$', HealthCheckView.as_view()),
]
diff --git a/gvnfmadapter/driver/interfaces/views.py b/gvnfmadapter/driver/interfaces/views.py
index 71ec408..f399ab9 100644
--- a/gvnfmadapter/driver/interfaces/views.py
+++ b/gvnfmadapter/driver/interfaces/views.py
@@ -647,3 +647,12 @@ def do_subscription(data, vnfm_id):
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise GvnfmDriverException('Failed to subscribe.')
return json.JSONDecoder().decode(ret[1])
+
+
+class HealthCheckView(APIView):
+ @swagger_auto_schema(
+ responses={
+ status.HTTP_200_OK: 'Active'})
+ def get(self, request, format=None):
+ logger.debug("HealthCheck")
+ return Response({"status": "active"})