Add test cases of vnf notify 17/37317/1
authorfujinhua <fu.jinhua@zte.com.cn>
Wed, 21 Mar 2018 03:29:08 +0000 (11:29 +0800)
committerfujinhua <fu.jinhua@zte.com.cn>
Wed, 21 Mar 2018 03:29:08 +0000 (11:29 +0800)
Change-Id: I2e2036333270657a537837282495fb0733b4e22f
Issue-ID: VFC-779
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
lcm/v2/tests.py
lcm/v2/views.py

index fc4505a..406edad 100644 (file)
@@ -98,3 +98,120 @@ class VnfGrantViewTest(unittest.TestCase):
     def test_get_notify_vnf_normal(self):
         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_vnf_normal(self):
+        data = {
+            "id": "string",
+            "notificationType": "string",
+            "subscriptionId": "string",
+            "timeStamp": "string",
+            "notificationStatus": "START",
+            "operationState": "STARTING",
+            "vnfInstanceId": "string",
+            "operation": "INSTANTIATE",
+            "isAutomaticInvocation": True,
+            "vnfLcmOpOccId": "string",
+            "affectedVnfcs": [{
+                "vnfcInstanceId": "string",
+                "vduId": "string",
+                "changeType": "added",
+                "vimId": "string",
+                "vmId": "string",
+                "vmName": "string"
+            }],
+            "affectedVirtualLinks": [{
+                "vlInstanceId": "string",
+                "vldId": "string",
+                "changeType": "added",
+                "networkResource": {
+                    "resourceType": "network",
+                    "resourceId": "string",
+                    "resourceName": "string"
+                }
+            }],
+            "affectedVirtualStorages": [{}],
+            "changedInfo": {
+                "vnfInstanceName": "string",
+                "vnfInstanceDescription": "string",
+                "vnfConfigurableProperties": {
+                    "additionalProp1": "string",
+                    "additionalProp2": "string",
+                    "additionalProp3": "string"
+                },
+                "metadata": {
+                    "additionalProp1": "string",
+                    "additionalProp2": "string",
+                    "additionalProp3": "string"
+                },
+                "extensions": {
+                    "additionalProp1": "string",
+                    "additionalProp2": "string",
+                    "additionalProp3": "string"
+                },
+                "vimConnectionInfo": [{
+                    "id": "string",
+                    "vimId": "string",
+                    "vimType": "string",
+                    "interfaceInfo": {
+                        "additionalProp1": "string",
+                        "additionalProp2": "string",
+                        "additionalProp3": "string"
+                    },
+                    "accessInfo": {
+                        "additionalProp1": "string",
+                        "additionalProp2": "string",
+                        "additionalProp3": "string"
+                    },
+                    "extra": {
+                        "additionalProp1": "string",
+                        "additionalProp2": "string",
+                        "additionalProp3": "string"
+                    }
+                }],
+                "vnfPkgId": "string",
+                "vnfdId": "string",
+                "vnfProvider": "string",
+                "vnfProductName": "string",
+                "vnfSoftwareVersion": "string",
+                "vnfdVersion": "string"
+            },
+            "changedExtConnectivity": [{
+                "id": "string",
+                "resourceHandle": {
+                    "vimConnectionId": "string",
+                    "resourceProviderId": "string",
+                    "resourceId": "string",
+                    "vimLevelResourceType": "string"
+                },
+                "extLinkPorts": [{
+                    "id": "string",
+                    "resourceHandle": {
+                        "vimConnectionId": "string",
+                        "resourceProviderId": "string",
+                        "resourceId": "string",
+                        "vimLevelResourceType": "string"
+                    },
+                    "cpInstanceId": "string"
+                }]
+            }],
+            "error": {
+                "type": "string",
+                "title": "string",
+                "status": 0,
+                "detail": "string",
+                "instance": "string"
+            },
+            "_links": {
+                "vnfInstance": {
+                    "href": "string"
+                },
+                "subscription": {
+                    "href": "string"
+                },
+                "vnfLcmOpOcc": {
+                    "href": "string"
+                }
+            }
+        }
+        response = self.client.post("/api/nslcm/v2/ns/1/vnfs/2/Notify", data=data, format='json')
+        self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code, response.content)
index 23c59a4..e216022 100644 (file)
@@ -73,7 +73,6 @@ class VnfNotifyView(APIView):
         return Response(data={}, status=status.HTTP_204_NO_CONTENT)
 
     @swagger_auto_schema(
-        request_body=None,
         responses={
             status.HTTP_204_NO_CONTENT: "The notification endpoint was tested successfully.",
             status.HTTP_500_INTERNAL_SERVER_ERROR: "Inner error"