# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
import logging
import traceback
from rest_framework.views import APIView
from lcm.ns_vnfs.biz.grant_vnf import GrantVnf
-from lcm.ns_vnfs.biz.handle_notification import HandleVnfLcmOocNotification, HandleVnfIdentifierCreationNotification, HandleVnfIdentifierDeletionNotification
from lcm.ns_vnfs.serializers.grant_vnf_serializer import GrantRequestSerializer
from lcm.ns_vnfs.serializers.grant_vnf_serializer import GrantSerializer
+from lcm.ns_vnfs.biz.handle_notification import HandleVnfLcmOocNotification, HandleVnfIdentifierCreationNotification, HandleVnfIdentifierDeletionNotification
from lcm.ns_vnfs.serializers.grant_vnf_serializer import VnfLcmOperationOccurrenceNotificationSerializer, VnfIdentifierCreationNotificationSerializer, VnfIdentifierDeletionNotificationSerializer
logger = logging.getLogger(__name__)
return Response(data=resp_serializer.data, status=status.HTTP_201_CREATED)
except Exception as e:
logger.error(traceback.format_exc())
- logger.error("Exception in VnfGrant: %s", e.message)
- return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ logger.error("Exception in VnfGrant: %s", e.args[0])
+ return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
class VnfNotifyView(APIView):
if notification_type == 'VnfLcmOperationOccurrenceNotification':
notification = VnfLcmOperationOccurrenceNotificationSerializer(data=request.data)
if not notification.is_valid():
- raise Exception(notification.errors)
+ logger.warn(notification.errors)
HandleVnfLcmOocNotification(vnfmId, vnfInstanceId, notification.data).do_biz()
elif notification_type == 'VnfIdentifierCreationNotification':
notification = VnfIdentifierCreationNotificationSerializer(data=request.data)
if not notification.is_valid():
- raise Exception(notification.errors)
+ logger.warn(notification.errors)
HandleVnfIdentifierCreationNotification(vnfmId, vnfInstanceId, notification.data).do_biz()
elif notification_type == 'VnfIdentifierDeletionNotification':
notification = VnfIdentifierDeletionNotificationSerializer(data=request.data)
if not notification.is_valid():
- raise Exception(notification.errors)
+ logger.warn(notification.errors)
HandleVnfIdentifierDeletionNotification(vnfmId, vnfInstanceId, notification.data).do_biz()
else:
raise Exception('Unexpected noitifcation type value.')