Merge "Fix VFC swagger bug"
[vfc/nfvo/lcm.git] / lcm / workflows / views.py
1 # Copyright 2017 ZTE Corporation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import logging
16 import traceback
17
18 from rest_framework import status
19 from rest_framework.decorators import api_view
20 from rest_framework.response import Response
21
22 from lcm.pub.database import models
23 from lcm.pub.utils.syscomm import fun_name
24 from lcm.pub.utils.values import ignore_case_get
25
26
27 logger = logging.getLogger(__name__)
28
29
30 @api_view(http_method_names=['POST'])
31 def deploy_workflow(request, *args, **kwargs):
32     logger.debug("Enter %s", fun_name())
33     file_path = ignore_case_get(request.data, "filePath")
34     logger.debug("file_path is %s", file_path)
35     ret = None
36     try:
37         ret = [0, "TODO"]
38     except:
39         logger.error(traceback.format_exc())
40         return Response(data={'error': str(sys.exc_info())}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
41     logger.debug("Leave %s, Return value is %s", fun_name(), ret)
42     return Response(data=ret[1], status=status.HTTP_202_ACCEPTED)
43
44
45
46
47