- self.vnfd_id = ignore_case_get(request.data, "vnfdId")
- self.vnf_instance_mame = ignore_case_get(request.data, "vnfInstanceName")
- self.description = ignore_case_get(request.data, "vnfInstanceDescription")
- self.nf_inst_id = str(uuid.uuid4())
- VnfInstModel(id=self.nf_inst_id, name=self.vnf_instance_mame, vnfd_id=self.vnfd_id,
- description=self.description, status='empty', create_time=now_time(), lastuptime=now_time()).save()
- vnf_inst = VnfInstModel.objects.get(id=self.nf_inst_id)
- logger.debug('id is [%s],name is [%s],vnfd_id is [%s],description is [%s],create_time is [%s],lastuptime is [%s],' %
- (vnf_inst.id, vnf_inst.name, vnf_inst.vnfd_id, vnf_inst.description, vnf_inst.create_time, vnf_inst.lastuptime))
- rsp = {"vnfInstanceId": self.nf_inst_id}
+ try:
+ nf_inst_id = CreateVnf(request.data).do_biz()
+ except NFLCMException as e:
+ logger.error(e.message)
+ return Response(data={'error': '%s' % e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ 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}