summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaili <lai.li@zte.com.cn>2018-08-15 16:24:14 +0800
committerlaili <lai.li@zte.com.cn>2018-08-15 16:24:14 +0800
commitb50daffdf6d356000caa2e21f596b5948d55c916 (patch)
tree447f2fce06b474e5e22dc5c5a31ef2f40b44b4ee
parent54e235a7517b02c2e3df92881a5258825101564d (diff)
Deal with gvnfm adapter stuffs.
Modify VnfNotifyInfo and testcase. Change-Id: Ice747aa38bc9329a9ce3df3adedef3ceb6e72a51 Issue-ID: VFC-1020 Signed-off-by: laili <lai.li@zte.com.cn>
-rw-r--r--gvnfmadapter/driver/interfaces/tests.py106
-rw-r--r--gvnfmadapter/driver/interfaces/views.py6
2 files changed, 90 insertions, 22 deletions
diff --git a/gvnfmadapter/driver/interfaces/tests.py b/gvnfmadapter/driver/interfaces/tests.py
index 1eb72bd..f36cb82 100644
--- a/gvnfmadapter/driver/interfaces/tests.py
+++ b/gvnfmadapter/driver/interfaces/tests.py
@@ -305,28 +305,94 @@ class InterfacesTest(TestCase):
r2 = [0, json.JSONEncoder().encode(vim_info), "200"]
mock_call_req.side_effect = [r2]
req_data = {
- "nfvoid": "1",
- "vnfmid": "876543211",
- "vimid": "6543211",
- "timestamp": "1234567890",
- "vnfinstanceid": "1",
- "eventtype": "0",
- "vmlist": [
- {
- "vmflavor": "SMP",
- "vmnumber": "3",
- "vmidlist ": [
- "vmuuid"
- ]
+ "vnfmInstId": "876543211",
+ "notificationType": "string",
+ "subscriptionId": "string",
+ "timeStamp": "1234567890",
+ "notificationStatus": "START",
+ "operationState": "STARTING",
+ "vnfInstanceId": "string",
+ "operation": "INSTANTIATE",
+ "isAutomaticInvocation": True,
+ "vnfLcmOpOccId": "string",
+ "affectedVnfcs": [{
+ "id": "string",
+ "vduId": "string",
+ "changeType": "ADDED",
+ "computeResource": {
+ "vimConnectionId": "string",
+ "resourceProviderId": "string",
+ "resourceId": "string",
+ "vimLevelResourceType": "string"
},
- {
- "vmflavor": "CMP",
- "vmnumber": "3",
- "vmidlist ": [
- "vmuuid"
- ]
+ "metadata": {},
+ "affectedVnfcCpIds": [],
+ "addedStorageResourceIds": [],
+ "removedStorageResourceIds": [],
+ }],
+ "affectedVirtualLinks": [{
+ "id": "string",
+ "virtualLinkDescId": "string",
+ "changeType": "ADDED",
+ "networkResource": {
+ "vimConnectionId": "string",
+ "resourceProviderId": "string",
+ "resourceId": "string",
+ "vimLevelResourceType": "network",
}
- ]
+ }],
+ "affectedVirtualStorages": [{
+ "id": "string",
+ "virtualStorageDescId": "string",
+ "changeType": "ADDED",
+ "storageResource": {
+ "vimConnectionId": "string",
+ "resourceProviderId": "string",
+ "resourceId": "string",
+ "vimLevelResourceType": "network",
+ },
+ "metadata": {}
+ }],
+ "changedInfo": {
+ "vnfInstanceName": "string",
+ "vnfInstanceDescription": "string",
+ "vnfConfigurableProperties": {},
+ "metadata": {},
+ "extensions": {},
+ "vimConnectionInfo": [{
+ "id": "string",
+ "vimId": "string",
+ "vimType": "string",
+ "interfaceInfo": {},
+ "accessInfo": {},
+ "extra": {}
+ }],
+ "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"
+ }]
+ }]
}
response = self.client.post("/api/gvnfmdriver/v1/vnfs/lifecyclechangesnotification",
data=json.dumps(req_data),
diff --git a/gvnfmadapter/driver/interfaces/views.py b/gvnfmadapter/driver/interfaces/views.py
index 0cf46a0..65f3449 100644
--- a/gvnfmadapter/driver/interfaces/views.py
+++ b/gvnfmadapter/driver/interfaces/views.py
@@ -277,8 +277,10 @@ class VnfNotifyInfo(APIView):
def post(self, request, vnfmtype):
try:
logger.debug("[%s]req_data = %s", fun_name(), request.data)
- vnfinstanceid = ignorcase_get(request.data, 'vnfinstanceid')
- ret = req_by_msb("api/nslcm/v1/vnfs/%s/Notify" % vnfinstanceid, "POST",
+ vnfminstid = ignorcase_get(request.data, 'vnfmInstId')
+ vnfinstanceid = ignorcase_get(request.data, 'vnfInstanceId')
+ request.data.pop("vnfmInstId")
+ ret = req_by_msb("api/nslcm/v2/ns/%s/vnfs/%s/Notify" % (vnfminstid, vnfinstanceid), "POST",
json.JSONEncoder().encode(request.data))
logger.debug("[%s]data = %s", fun_name(), ret)
if ret[0] != 0: