summaryrefslogtreecommitdiffstats
path: root/zte
diff options
context:
space:
mode:
Diffstat (limited to 'zte')
-rw-r--r--zte/vmanager/driver/interfaces/tests.py6
-rw-r--r--zte/vmanager/driver/interfaces/urls.py3
-rw-r--r--zte/vmanager/driver/interfaces/views.py9
3 files changed, 17 insertions, 1 deletions
diff --git a/zte/vmanager/driver/interfaces/tests.py b/zte/vmanager/driver/interfaces/tests.py
index 5e975f04..ead550b7 100644
--- a/zte/vmanager/driver/interfaces/tests.py
+++ b/zte/vmanager/driver/interfaces/tests.py
@@ -486,6 +486,12 @@ class InterfacesTest(TestCase):
self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code)
self.assertDictEqual(job_info, response.data)
+ def test_health_check(self):
+ response = self.client.get("/api/ztevnfmdriver/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)
+
notify_req_data = {"vnfinstanceid": "1",
"nfvoid": "3",
diff --git a/zte/vmanager/driver/interfaces/urls.py b/zte/vmanager/driver/interfaces/urls.py
index 9732cacd..3a966df3 100644
--- a/zte/vmanager/driver/interfaces/urls.py
+++ b/zte/vmanager/driver/interfaces/urls.py
@@ -37,5 +37,6 @@ urlpatterns = [
url(r'^api/ztevnfmdriver/v1/vnfpkgs$', views.VnfPkgs.as_view(), name='VnfPkgs'),
url(r'^api/ztevnfmdriver/v1/vnfpkgs/(?P<packageId>[0-9a-zA-Z\-\_]+)/(?P<fileName>[0-9a-zA-Z\.\-\_]+)$', views.VnfPkg.as_view(), name='VnfPkg'),
url(r'^api/ztevnfmdriver/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/nfvo/info$', views.NfvoInfo.as_view(), name='NfvoInfo'),
- url(r'^samples/$', views.SampleList.as_view(), name='samples')
+ url(r'^samples/$', views.SampleList.as_view(), name='samples'),
+ url(r'^api/ztevnfmdriver/v1/health_check$', views.HealthCheckView.as_view()),
]
diff --git a/zte/vmanager/driver/interfaces/views.py b/zte/vmanager/driver/interfaces/views.py
index d3c5a831..b981c9a1 100644
--- a/zte/vmanager/driver/interfaces/views.py
+++ b/zte/vmanager/driver/interfaces/views.py
@@ -748,3 +748,12 @@ class NfvoInfo(APIView):
return Response(data={'error': ret[1]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
logger.debug("update nfvo info successfully.")
return Response(data={}, status=status.HTTP_200_OK)
+
+
+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"})