From: fujinhua Date: Wed, 21 Mar 2018 03:29:08 +0000 (+0800) Subject: Add test cases of vnf notify X-Git-Tag: v1.1.0~42 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=e12434fe867b9e53555525c2548ee0200886a6df;p=vfc%2Fnfvo%2Flcm.git Add test cases of vnf notify Change-Id: I2e2036333270657a537837282495fb0733b4e22f Issue-ID: VFC-779 Signed-off-by: fujinhua --- diff --git a/lcm/v2/tests.py b/lcm/v2/tests.py index fc4505a3..406edadd 100644 --- a/lcm/v2/tests.py +++ b/lcm/v2/tests.py @@ -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) diff --git a/lcm/v2/views.py b/lcm/v2/views.py index 23c59a48..e216022d 100644 --- a/lcm/v2/views.py +++ b/lcm/v2/views.py @@ -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"