Fix lcm notify api logic 64/72964/2
authorfujinhua <fu.jinhua@zte.com.cn>
Sat, 17 Nov 2018 06:32:06 +0000 (14:32 +0800)
committerfujinhua <fu.jinhua@zte.com.cn>
Sat, 17 Nov 2018 07:21:47 +0000 (15:21 +0800)
Change-Id: Ieba3b96335ab99050ae2bfb2de25a99726e0ad2f
Issue-ID: VFC-1163
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
lcm/ns_vnfs/biz/handle_notification.py
lcm/ns_vnfs/tests/vnf_tests.py
lcm/ns_vnfs/urls.py
lcm/ns_vnfs/views/vnf_views.py

index 2022508..aee6e9c 100644 (file)
@@ -41,7 +41,7 @@ class HandleVnfLcmOocNotification(object):
         self.vnf_instid = get_vnfinstid(self.m_vnfInstanceId, self.vnfmid)
         self.operation = ignore_case_get(data, 'operation')
         self.affectedVnfcs = ignore_case_get(data, 'affectedVnfcs')
-        self.affectedVls = ignore_case_get(data, 'affectedVls')
+        self.affectedVls = ignore_case_get(data, 'affectedVirtualLinks')
         self.affectedCps = ignore_case_get(data, 'changedExtConnectivity')
         self.affectedVirtualStorage = ignore_case_get(data, 'affectedVirtualStorages')
 
index 4c08894..fbdb531 100644 (file)
@@ -165,20 +165,20 @@ class VnfGrantViewTest(unittest.TestCase):
         self.assertEqual(expect_resp_data, resp_data)
 
     def test_get_notify_vnf_normal(self):
-        response = self.client.get("/api/nslcm/v2/ns/1/ns_vnfs/1/Notify")
+        response = self.client.get("/api/nslcm/v2/ns/1/vnfs/1/Notify")
         self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code, response.content)
 
     def test_notify_vnflcmopooc_normal(self):
         NfInstModel.objects.create(nfinstid='22',
                                    mnfinstid='2',
                                    vnfm_inst_id='1')
-        response = self.client.post("/api/nslcm/v2/ns/1/ns_vnfs/2/Notify",
+        response = self.client.post("/api/nslcm/v2/ns/1/vnfs/2/Notify",
                                     data=VNF_LCM_OP_OCC_NOTIFICATION_DATA,
                                     format='json')
         self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code)
 
     def test_notify_vnf_identifier_creation_normal(self):
-        response = self.client.post("/api/nslcm/v2/ns/1/ns_vnfs/2/Notify",
+        response = self.client.post("/api/nslcm/v2/ns/1/vnfs/2/Notify",
                                     data=VNF_IDENTIFIER_CREATION_NOTIFICATION_DATA,
                                     format='json')
         self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code)
@@ -187,7 +187,7 @@ class VnfGrantViewTest(unittest.TestCase):
         NfInstModel.objects.create(nfinstid='22',
                                    mnfinstid='2',
                                    vnfm_inst_id='1')
-        response = self.client.post("/api/nslcm/v2/ns/1/ns_vnfs/2/Notify",
+        response = self.client.post("/api/nslcm/v2/ns/1/vnfs/2/Notify",
                                     data=VNF_IDENTIFIER_DELETION_NOTIFICATION_DATA,
                                     format='json')
         self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code)
index ce972ef..49b4d14 100644 (file)
@@ -25,7 +25,7 @@ urlpatterns = [
     url(r'^api/nslcm/v1/ns/terminatevnf/(?P<vnfinstid>[0-9a-zA-Z_-]+)$', NfTerminate.as_view()),
     url(r'^api/nslcm/v1/ns/grantvnf$', NfGrant.as_view()),
     url(r'^api/nslcm/v1/ns/placevnf$', NfPlacement.as_view()),
-    url(r'^api/nslcm/v1/ns/(?P<vnfmid>[0-9a-zA-Z_-]+)/ns_vnfs/(?P<vnfInstanceId>[0-9a-zA-Z_-]+)/Notify$', LcmNotify.as_view()),
+    url(r'^api/nslcm/v1/ns/(?P<vnfmid>[0-9a-zA-Z_-]+)/vnfs/(?P<vnfInstanceId>[0-9a-zA-Z_-]+)/Notify$', LcmNotify.as_view()),
     url(r'^api/nslcm/v1/ns/ns_vnfs/(?P<vnfinstid>[0-9a-zA-Z_-]+)/scaling$', NfScaleView.as_view()),
     url(r'^api/nslcm/v1/vnfonboarding$', NfVerifyView.as_view()),
     url(r'^api/nslcm/v1/vnfms/(?P<vnfmid>[0-9a-zA-Z_-]+)', NfVnfmInfoView.as_view()),
@@ -33,7 +33,7 @@ urlpatterns = [
 
     # move form v2
     url(r'^api/nslcm/v2/grants$', VnfGrantView.as_view()),
-    url(r'^api/nslcm/v2/ns/(?P<vnfmId>[0-9a-zA-Z_-]+)/ns_vnfs/(?P<vnfInstanceId>[0-9a-zA-Z_-]+)/Notify$',
+    url(r'^api/nslcm/v2/ns/(?P<vnfmId>[0-9a-zA-Z_-]+)/vnfs/(?P<vnfInstanceId>[0-9a-zA-Z_-]+)/Notify$',
         VnfNotifyView.as_view()),
 ]
 
index 31906a2..c096c02 100644 (file)
@@ -77,17 +77,17 @@ 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.')