summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lcm/lcm/samples/tests.py14
-rw-r--r--lcm/lcm/samples/urls.py1
-rw-r--r--lcm/lcm/samples/views.py9
3 files changed, 24 insertions, 0 deletions
diff --git a/lcm/lcm/samples/tests.py b/lcm/lcm/samples/tests.py
index 688e27cf..9f1069d2 100644
--- a/lcm/lcm/samples/tests.py
+++ b/lcm/lcm/samples/tests.py
@@ -390,3 +390,17 @@ class SampleViewTest(unittest.TestCase):
r0_data_delete]
resp = self.client.post(term_res_url, data=json.dumps(term_res_data), content_type='application/json')
self.failUnlessEqual(status.HTTP_204_NO_CONTENT, resp.status_code)
+
+
+class HealthCheckViewTest(unittest.TestCase):
+ def setUp(self):
+ self.client = APIClient()
+
+ def tearDown(self):
+ pass
+
+ def test_health_check(self):
+ response = self.client.get("/api/vnflcm/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/lcm/lcm/samples/urls.py b/lcm/lcm/samples/urls.py
index b468e27f..a8b37c39 100644
--- a/lcm/lcm/samples/urls.py
+++ b/lcm/lcm/samples/urls.py
@@ -18,4 +18,5 @@ from lcm.samples import views
urlpatterns = [
url(r'^api/vnflcm/v1/resources/(?P<action_type>(inst|term)+)$', views.ResourceList.as_view()),
url(r'^samples/$', views.SampleList.as_view()),
+ url(r'^api/vnflcm/v1/health_check$', views.HealthCheckView.as_view())
]
diff --git a/lcm/lcm/samples/views.py b/lcm/lcm/samples/views.py
index de4e1bdd..86b4b8ab 100644
--- a/lcm/lcm/samples/views.py
+++ b/lcm/lcm/samples/views.py
@@ -49,3 +49,12 @@ class ResourceList(APIView):
# ResDeleteThread(request.data).start()
adaptor.delete_vim_res(request.data, self.do_notify)
return Response(data=None, status=status.HTTP_204_NO_CONTENT)
+
+
+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"})