1 # Copyright 2016 ZTE Corporation.
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 from rest_framework import status
16 from rest_framework.response import Response
17 from rest_framework.views import APIView
19 from lcm.ns.sfcs.delete_sfcs import DeleteSfcs
20 from lcm.ns.sfcs.get_sfcs import GetSfcs
23 class SfcDetailView(APIView):
24 def get(self, request, sfc_inst_id):
25 print "SfcCreateView--get::> %s" % sfc_inst_id
26 sfc_inst_info = GetSfcs(sfc_inst_id).do()
28 return Response(status=status.HTTP_404_NOT_FOUND)
29 return Response(status=status.HTTP_200_OK, data={'sfcInstId': sfc_inst_id,
31 'sfcStatus': sfc_inst_info[0].status})
33 def delete(self, request_paras, sfc_inst_id):
34 resp = DeleteSfcs(sfc_inst_id).do()
35 return Response(data=resp, status=status.HTTP_202_ACCEPTED)
38 class SfcCreateView(APIView):
39 def post(self, request):
40 print "SfcCreateView--post::> %s" % request.stream.body
41 return Response(data={"jobId": "1234", "sfcInstId": "1"}, status=status.HTTP_201_CREATED)