summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vio/vio/samples/tests.py2
-rw-r--r--vio/vio/samples/views.py9
2 files changed, 9 insertions, 2 deletions
diff --git a/vio/vio/samples/tests.py b/vio/vio/samples/tests.py
index 0dd2731..910ded6 100644
--- a/vio/vio/samples/tests.py
+++ b/vio/vio/samples/tests.py
@@ -28,4 +28,4 @@ class SampleViewTest(unittest.TestCase):
self.assertEqual(status.HTTP_200_OK,
response.status_code, response.content)
resp_data = json.loads(response.content)
- self.assertEqual({"status": "active"}, resp_data)
+ self.assertEqual("active", resp_data["status"])
diff --git a/vio/vio/samples/views.py b/vio/vio/samples/views.py
index 36670d1..4775e78 100644
--- a/vio/vio/samples/views.py
+++ b/vio/vio/samples/views.py
@@ -10,12 +10,14 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+import os
import logging
from rest_framework.views import APIView
from rest_framework.response import Response
logger = logging.getLogger(__name__)
+log_file = "/var/log/onap/multicloud/vio/vio.log"
class SampleList(APIView):
@@ -25,4 +27,9 @@ class SampleList(APIView):
def get(self, request, format=None):
logger.debug("get")
- return Response({"status": "active"})
+ output = ""
+ if os.path.exists(log_file):
+ with open("/var/log/onap/multicloud/vio/vio.log", "r") as f:
+ lines = f.readlines()
+ output = lines[-1]
+ return Response({"status": "active", "logs": output})