# See the License for the specific language governing permissions and
# limitations under the License.
-import json
import logging
-import os
import traceback
from rest_framework import status
class CreateVnfAndQueryVnfs(APIView):
def get(self, request):
- logger.debug("QuerySingleVnf--get::> %s" % request.data)
+ logger.debug("QueryMultiVnf--get::> %s" % request.data)
try:
resp_data = QueryVnf(request.data).query_multi_vnf()
except NFLCMException as e:
except Exception:
logger.error(traceback.format_exc())
return Response(data={'error': 'unexpected exception'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
- rsp = {"vnfInstanceId": nf_inst_id}
+ rsp = {
+ "vnfInstanceId": nf_inst_id
+ }
return Response(data=rsp, status=status.HTTP_201_CREATED)
except Exception:
logger.error(traceback.format_exc())
return Response(data={'error': 'unexpected exception'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
- rsp = {"jobId": job_id}
+ rsp = {
+ "jobId": job_id
+ }
return Response(data=rsp, status=status.HTTP_202_ACCEPTED)
except Exception:
logger.error(traceback.format_exc())
return Response(data={'error': 'unexpected exception'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
- rsp = {"jobId": job_id}
+ rsp = {
+ "jobId": job_id
+ }
return Response(data=rsp, status=status.HTTP_202_ACCEPTED)
-
-
-class SwaggerJsonView(APIView):
- def get(self, request):
- json_file = os.path.join(os.path.dirname(__file__), 'swagger.json')
- f = open(json_file)
- json_data = json.JSONDecoder().decode(f.read())
- f.close()
- return Response(json_data)