summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2018-03-21 11:29:08 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2018-03-21 11:29:08 +0800
commite12434fe867b9e53555525c2548ee0200886a6df (patch)
tree4197cc1cb03582cde6ca5f6cb053ae4883be34f6
parent07163fee37f72a64c0ea6cfa94b7cd61a08c7a04 (diff)
Add test cases of vnf notify
Change-Id: I2e2036333270657a537837282495fb0733b4e22f Issue-ID: VFC-779 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--lcm/v2/tests.py117
-rw-r--r--lcm/v2/views.py1
2 files changed, 117 insertions, 1 deletions
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"