Merge changes Id9dbcfd9,If42870aa
[vfc/nfvo/driver/vnfm/svnfm.git] / zte / vmanager / driver / interfaces / tests.py
1 # Copyright 2016-2017 ZTE Corporation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import json
16 import mock
17 from django.test import Client
18 from django.test import TestCase
19 from rest_framework import status
20 from driver.pub.utils import restcall
21
22
23 class InterfacesTest(TestCase):
24     def setUp(self):
25         self.client = Client()
26
27     def tearDown(self):
28         pass
29
30     @mock.patch.object(restcall, 'call_req')
31     def test_instantiate_vnf_001(self, mock_call_req):
32         vnfm_info = {
33             "userName": "admin",
34             "vendor": "ZTE",
35             "name": "ZTE_VNFM_237_62",
36             "vimId": "516cee95-e8ca-4d26-9268-38e343c2e31e",
37             "url": "http://192.168.237.165:2324",
38             "certificateUrl": "",
39             "version": "V1.0",
40             "vnfmId": "b0797c9b-3da9-459c-b25c-3813e9d8fd70",
41             "password": "admin",
42             "type": "ztevnfmdriver",
43             "createTime": "2016-10-31 11:08:39",
44             "description": ""
45         }
46         vnfd_info = {
47             "vnfInstanceInfo": [
48                 {
49                     "vnfInstanceId": "59b79a9f-9e37-4f6c-acaf-5f41d9cb3f76",
50                     "vnfInstanceName": "VFW_59b79a9f-9e37-4f6c-acaf-5f41d9cb3f76"
51                 },
52                 {
53                     "vnfInstanceId": "6c5e4bd3-e8a6-42d8-a7a4-53a8ef74c6ac",
54                     "vnfInstanceName": "VFW_6c5e4bd3-e8a6-42d8-a7a4-53a8ef74c6ac"
55                 },
56                 {
57                     "vnfInstanceId": "930de5c9-8043-41df-ace8-ede2262a3713",
58                     "vnfInstanceName": "VFW_930de5c9-8043-41df-ace8-ede2262a3713"
59                 },
60                 {
61                     "vnfInstanceId": "c677a305-a7bd-4baf-9eee-c383c588bb3c",
62                     "vnfInstanceName": "VFW_c677a305-a7bd-4baf-9eee-c383c588bb3c"
63                 },
64                 {
65                     "vnfInstanceId": "e708e5c5-bdf4-436a-b928-826887806d82",
66                     "vnfInstanceName": "VFW_e708e5c5-bdf4-436a-b928-826887806d82"
67                 }
68             ],
69             "csarId": "d852e1be-0aac-48f1-b1a4-cd825f6cdf9a",
70             "imageInfo": [
71                 {
72                     "status": "Enable",
73                     "index": "0",
74                     "vimId": "516cee95-e8ca-4d26-9268-38e343c2e31e",
75                     "fileName": "VFW_IMAGE_VCPE_ZTE",
76                     "vimUser": "admin",
77                     "imageId": "d2b73154-0414-466a-a1e6-51b9461b753a",
78                     "tenant": "admin"
79                 }
80             ],
81             "packageInfo": {
82                 "usageState": "NotInUse",
83                 "onBoardState": "onBoarded",
84                 "name": "VFW",
85                 "format": "yaml",
86                 "provider": "ZTE",
87                 "vnfdProvider": "zte",
88                 "vnfdId": "vcpe_vfw_zte_1_0",
89                 "deletionPending": False,
90                 "version": "v1.0",
91                 "vnfVersion": "1.0",
92                 "vnfdVersion": "1.0.0",
93                 "processState": "normal",
94                 "modifyTime": "2016-10-3116: 21: 32",
95                 "downloadUri": "http: //192.168.233.226: 80/",
96                 "operationalState": "Disabled",
97                 "createTime": "2016-10-3116: 21: 11",
98                 "size": "12.1MB"
99             }
100         }
101         packageInfo = {
102             "size": "12.1 MB",
103             "usageState": "NotInUse",
104             "onBoardState": "onBoarded",
105             "name": "VFW",
106             "format": "yaml",
107             "packageInfo": {
108                 "vnfdModel": json.dumps({"metadata": {"name": "ZTE-MME-FIX-VL"}})
109             },
110             "modifyTime": "2016-10-31 16:21:32",
111             "vnfdProvider": "zte",
112             "vnfdId": "vcpe_vfw_zte_1_0",
113             "deletionPending": False,
114             "version": "v1.0",
115             "vnfVersion": "1.0",
116             "vnfdVersion": "1.0.0",
117             "processState": "normal",
118             "provider": "ZTE",
119             "operationalState": "Disabled",
120             "createTime": "2016-10-31 16:21:11",
121             "downloadUri": "http://192.168.233.226:80/files/catalog-http/NFAR/ZTE/VFW/v1.0/VFW.csar"
122         }
123
124         inst_response = {
125             "vnfInstanceId": "8",
126             "jobid": "NF-CREATE-8-b384535c-9f45-11e6-8749-fa163e91c2f9"
127         }
128         ret = [0, json.JSONEncoder().encode(inst_response), '200']
129         r1 = [0, json.JSONEncoder().encode(vnfm_info), "200"]
130         r2 = [0, json.JSONEncoder().encode(vnfd_info), "200"]
131         r3 = [0, json.JSONEncoder().encode(packageInfo), "200"]
132         mock_call_req.side_effect = [r1, r2, r3, ret]
133
134         req_data = {
135             'vnfInstanceName': 'VFW_f88c0cb7-512a-44c4-bd09-891663f19367',
136             'vnfPackageId': 'd852e1be-0aac-48f1-b1a4-cd825f6cdf9a',
137             'vnfDescriptorId': 'vcpe_vfw_zte_1_0',
138             'additionalParam': {
139                 'sdncontroller': 'e4d637f1-a4ec-4c59-8b20-4e8ab34daba9',
140                 'NatIpRange': '192.167.0.10-192.168.0.20',
141                 'm6000_mng_ip': '192.168.11.11',
142                 'externalPluginManageNetworkName': 'plugin_net_2014',
143                 'location': '516cee95-e8ca-4d26-9268-38e343c2e31e',
144                 'externalManageNetworkName': 'mng_net_2017',
145                 'sfc_data_network': 'sfc_data_net_2016',
146                 'externalDataNetworkName': 'Flow_out_net',
147                 'inputs': {}
148             }
149         }
150
151         response = self.client.post(
152             "/api/ztevnfmdriver/v1/ztevnfmid/vnfs",
153             data=json.dumps(req_data),
154             content_type="application/json")
155         self.assertEqual(status.HTTP_200_OK, response.status_code)
156         expect_resp_data = {
157             "jobId": "NF-CREATE-8-b384535c-9f45-11e6-8749-fa163e91c2f9",
158             "vnfInstanceId": "8"}
159         self.assertEqual(expect_resp_data, response.data)
160
161     @mock.patch.object(restcall, 'call_req')
162     def test_terminate_vnf__002(self, mock_call_req):
163         r1 = [0, json.JSONEncoder().encode({
164             "vnfmId": "19ecbb3a-3242-4fa3-9926-8dfb7ddc29ee",
165             "name": "g_vnfm",
166             "type": "vnfm",
167             "vimId": "",
168             "vendor": "ZTE",
169             "version": "v1.0",
170             "description": "vnfm",
171             "certificateUrl": "",
172             "url": "http://10.74.44.11",
173             "userName": "admin",
174             "password": "admin",
175             "createTime": "2016-07-06 15:33:18"}), "200"]
176
177         r2 = [0, json.JSONEncoder().encode(
178             {"vnfInstanceId": "1", "jobId": "1"}), "200"]
179         mock_call_req.side_effect = [r1, r2]
180
181         response = self.client.post(
182             "/api/ztevnfmdriver/v1/ztevnfmid/vnfs/vbras_innstance_id/terminate")
183
184         self.assertEqual(status.HTTP_200_OK, response.status_code)
185         expect_resp_data = {"jobId": "1", "vnfInstanceId": "1"}
186         self.assertEqual(expect_resp_data, response.data)
187
188     @mock.patch.object(restcall, 'call_req')
189     def test_query_vnf_003(self, mock_call_req):
190         r1 = [0, json.JSONEncoder().encode({
191             "vnfmId": "19ecbb3a-3242-4fa3-9926-8dfb7ddc29ee",
192             "name": "g_vnfm",
193             "type": "vnfm",
194             "vimId": "",
195             "vendor": "ZTE",
196             "version": "v1.0",
197             "description": "vnfm",
198             "certificateUrl": "",
199             "url": "http://10.74.44.11",
200             "userName": "admin",
201             "password": "admin",
202             "createTime": "2016-07-06 15:33:18"}), "200"]
203
204         r2 = [0, json.JSONEncoder().encode({"vnfinstancestatus": "1"}), "200"]
205         mock_call_req.side_effect = [r1, r2]
206
207         response = self.client.get(
208             "/api/ztevnfmdriver/v1/ztevnfmid/vnfs/vbras_innstance_id")
209
210         self.assertEqual(status.HTTP_200_OK, response.status_code)
211
212         expect_resp_data = {"vnfInfo": {"vnfStatus": "1"}}
213         self.assertEqual(expect_resp_data, response.data)
214
215     @mock.patch.object(restcall, 'call_req')
216     def test_operation_status_004(self, mock_call_req):
217         vnfm_info = {
218             "userName": "admin",
219             "vendor": "ZTE",
220             "name": "ZTE_VNFM_237_62",
221             "vimId": "516cee95-e8ca-4d26-9268-38e343c2e31e",
222             "url": "http://192.168.237.165:2324",
223             "certificateUrl": "",
224             "version": "V1.0",
225             "vnfmId": "b0797c9b-3da9-459c-b25c-3813e9d8fd70",
226             "password": "admin",
227             "type": "ztevnfmdriver",
228             "createTime": "2016-10-31 11:08:39",
229             "description": ""
230         }
231         resp_body = {
232             "responsedescriptor": {
233                 "status": "processing",
234                 "responsehistorylist": [
235                     {
236                         "status": "error",
237                         "progress": 255,
238                         "errorcode": "",
239                         "responseid": 20,
240                         "statusdescription": "'JsonParser' object has no attribute 'parser_info'"}],
241                 "responseid": 21,
242                 "errorcode": "",
243                 "progress": 40,
244                 "statusdescription": "Create nf apply resource failed"},
245             "jobid": "NF-CREATE-11-ec6c2f2a-9f48-11e6-9405-fa163e91c2f9"}
246         r1 = [0, json.JSONEncoder().encode(vnfm_info), '200']
247         r2 = [0, json.JSONEncoder().encode(resp_body), '200']
248         mock_call_req.side_effect = [r1, r2]
249         response = self.client.get(
250             "/api/ztevnfmdriver/v1/{vnfmid}/jobs/{jobid}?responseId={responseId}".format(
251                 vnfmid=vnfm_info["vnfmId"],
252                 jobid=resp_body["jobid"],
253                 responseId=resp_body["responsedescriptor"]["responseid"]))
254
255         self.assertEqual(status.HTTP_200_OK, response.status_code)
256
257         expect_resp_data = resp_body
258         self.assertDictEqual(expect_resp_data, response.data)
259
260     @mock.patch.object(restcall, 'call_req')
261     def test_grantvnf_005(self, mock_call_req):
262         grant_data = {
263             "vim": {
264                 "accessinfo": {
265                     "tenant": "admin"
266                 },
267                 "vimid": "516cee95-e8ca-4d26-9268-38e343c2e31e"
268             }
269         }
270         ret = [0, json.JSONEncoder().encode(grant_data), '201']
271
272         req_data = {
273             "vnfmid": "13232222",
274             "nfvoid": "03212234",
275             "vimid": "12345678",
276             "exvimidlist ": [
277                 "exvimid"
278             ],
279             "tenant": " tenant1",
280             "vnfistanceid": "1234",
281             "operationright": "0",
282             "vmlist": [
283                 {
284                     "vmflavor": "SMP",
285                     "vmnumber": "3"
286                 },
287                 {
288                     "vmflavor": "CMP",
289                     "vmnumber": "3"
290                 }
291             ]
292         }
293
294         mock_call_req.return_value = ret
295         response = self.client.put(
296             "/api/ztevnfmdriver/v1/resource/grant",
297             data=json.dumps(req_data),
298             content_type='application/json')
299
300         self.assertEqual(status.HTTP_201_CREATED, response.status_code)
301
302         expect_resp_data = {
303             "vimid": "516cee95-e8ca-4d26-9268-38e343c2e31e",
304             "tenant": "admin"}
305         self.assertDictEqual(expect_resp_data, response.data)
306
307     @mock.patch.object(restcall, 'call_req')
308     def test_notify_006(self, mock_call_req):
309         r1 = [0, json.JSONEncoder().encode(
310             {"vim":
311                 {
312                     "vimInfoId": "111111",
313                     "vimId": "12345678",
314                     "interfaceInfo": {
315                         "vimType": "vnf",
316                         "apiVersion": "v1",
317                         "protocolType": "None"},
318                     "accessInfo": {
319                         "tenant": "tenant1",
320                         "username": "admin",
321                         "password": "password"},
322                     "interfaceEndpoint": "http://127.0.0.1/api/v1"},
323                 "zone": "",
324                 "addResource": {
325                     "resourceDefinitionId": "xxxxx",
326                     "vimId": "12345678",
327                     "zoneId": "000"},
328                 "removeResource": "",
329                 "vimAssets": {
330                     "computeResourceFlavour": {
331                         "vimId": "12345678",
332                         "vduId": "sdfasdf",
333                         "vimFlavourId": "12"},
334                     "softwareImage": {
335                         "vimId": "12345678",
336                         "imageName": "AAA",
337                         "vimImageId": ""}},
338                 "additionalParam": ""
339              }), "200"]
340
341         mock_call_req.side_effect = [r1]
342         response = self.client.post(
343             "/api/ztevnfmdriver/v1/vnfs/lifecyclechangesnotification",
344             data=json.dumps(notify_req_data),
345             content_type='application/json')
346
347         self.assertEqual(status.HTTP_200_OK, response.status_code)
348
349         expect_resp_data = None
350         self.assertEqual(expect_resp_data, response.data)
351
352     @mock.patch.object(restcall, 'call_req')
353     def test_scale(self, mock_call_req):
354         job_info = {"jobid": "801", "nfInstanceId": "101"}
355         vnfm_info = {
356             "userName": "admin",
357             "vendor": "ZTE",
358             "name": "ZTE_VNFM_237_62",
359             "vimId": "516cee95-e8ca-4d26-9268-38e343c2e31e",
360             "url": "http://192.168.237.165:2324",
361             "certificateUrl": "",
362             "version": "V1.0",
363             "vnfmId": "b0797c9b-3da9-459c-b25c-3813e9d8fd70",
364             "password": "admin",
365             "type": "ztevnfmdriver",
366             "createTime": "2016-10-31 11:08:39",
367             "description": ""
368         }
369
370         ret = [0, json.JSONEncoder().encode(job_info), "202"]
371         ret_vnfm = [0, json.JSONEncoder().encode(vnfm_info), "200"]
372         mock_call_req.side_effect = [ret_vnfm, ret]
373
374         vnfd_info = {
375             "vnf_flavours": [
376                 {
377                     "flavour_id": "flavour1",
378                     "description": "",
379                     "vdu_profiles": [
380                         {
381                             "vdu_id": "vdu1Id",
382                             "instances_minimum_number": 1,
383                             "instances_maximum_number": 4,
384                             "local_affinity_antiaffinity_rule": [
385                                 {
386                                     "affinity_antiaffinity": "affinity",
387                                     "scope": "node",
388
389                                 }
390                             ]
391                         }
392                     ],
393                     "scaling_aspects": [
394                         {
395                             "id": "demo_aspect",
396                             "name": "demo_aspect",
397                             "description": "demo_aspect",
398                             "associated_group": "elementGroup1",
399                             "max_scale_level": 5
400                         }
401                     ]
402                 }
403             ],
404             "element_groups": [
405                 {
406                     "group_id": "elementGroup1",
407                     "description": "",
408                     "properties": {
409                         "name": "elementGroup1"
410                     },
411                     "members": [
412                         "gsu_vm",
413                         "pfu_vm"
414                     ]
415                 }
416             ]
417         }
418
419         scale_vnf_data = {
420             "type": "SCALE_OUT",
421             "aspectId": "demo_aspect",
422             "numberOfSteps": "3",
423             "additionalParam": {
424                 "vnfdModel": vnfd_info
425             }
426         }
427
428         response = self.client.post(
429             "/api/ztevnfmdriver/v1/100/vnfs/101/scale",
430             data=json.dumps(scale_vnf_data),
431             content_type='application/json')
432         self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code)
433         self.assertDictEqual(job_info, response.data)
434
435     @mock.patch.object(restcall, 'call_req')
436     def test_heal(self, mock_call_req):
437         job_info = {
438             "jobid": "12234455",
439             "nfInstanceId": "10144445666"
440         }
441         vnfm_info = {
442             "userName": "admin",
443             "vendor": "ZTE",
444             "name": "ZTE_VNFM_237_62",
445             "vimId": "516cee95-e8ca-4d26-9268-38e343c2e31e",
446             "url": "http://192.168.237.165:2324",
447             "certificateUrl": "",
448             "version": "V1.0",
449             "vnfmId": "b0797c9b-3da9-459c-b25c-3813e9d8fd70",
450             "password": "admin",
451             "type": "ztevnfmdriver",
452             "createTime": "2016-10-31 11:08:39",
453             "description": ""
454         }
455
456         ret = [0, json.JSONEncoder().encode(job_info), "202"]
457         ret_vnfm = [0, json.JSONEncoder().encode(vnfm_info), "200"]
458         mock_call_req.side_effect = [ret_vnfm, ret]
459
460         heal_vnf_data = {
461             'action': 'vmReset',
462             'affectedvm': [{
463                 'flavour': {
464
465                 },
466                 'extention': '',
467                 'vmid': '804cca71-9ae9-4511-8e30-d1387718caff',
468                 'changtype': 'changed',
469                 'vduid': 'vdu_100',
470                 'vmname': 'ZTE_SSS_111_PP_2_L'
471             }],
472             'lifecycleoperation': 'operate',
473             'isgrace': 'force'
474         }
475
476         response = self.client.post("/api/ztevnfmdriver/v1/200/vnfs/201/heal", data=json.dumps(heal_vnf_data),
477                                     content_type='application/json')
478
479         self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code)
480         self.assertDictEqual(job_info, response.data)
481
482
483 notify_req_data = {"vnfinstanceid": "1",
484                    "nfvoid": "3",
485                    "extension": {"openo_notification": {"status": "finished",
486                                                         "affectedService": [],
487                                                         "affectedVnfc": [{"changeType": "added",
488                                                                           "computeResource": {"resourceId": "e8ccc55a-3ebb-4e46-8260-dc4a1646ef4f",
489                                                                                               "tenant": "ZTE_ONAP_PRO",
490                                                                                               "vimId": "vmware_vio",
491                                                                                               "resourceName": "ZTE_xGW_39_CDB_1"},
492                                                                           "storageResource": [],
493                                                                           "vnfcInstanceId": "17502154-c5bf-11e7-904d-fa163eee1ffe",
494                                                                           "vduType": "CDB",
495                                                                           "vduId": "VDU_S_CDB_51"},
496                                                                          {"changeType": "added",
497                                                                           "computeResource": {"resourceId": "a9dd6a73-76ee-4d07-9554-08f14c17261f",
498                                                                                               "tenant": "ZTE_ONAP_PRO",
499                                                                                               "vimId": "vmware_vio",
500                                                                                               "resourceName": "ZTE_xGW_39_SLB_1"},
501                                                                           "storageResource": [],
502                                                                           "vnfcInstanceId": "1750d540-c5bf-11e7-904d-fa163eee1ffe",
503                                                                           "vduType": "SLB",
504                                                                           "vduId": "VDU_M_SLB_42"}],
505                                                         "nfvoInstanceId": "3",
506                                                         "affectedVirtualLink": [{"changeType": "added",
507                                                                                  "virtualLinkInstanceId": "1753b60c-c5bf-11e7-904d-fa163eee1ffe",
508                                                                                  "networkResource": {"resourceId": "c55e0788-3683-48a1-b88a-a0cb5e05bd44",
509                                                                                                      "tenant": None,
510                                                                                                      "vimId": "vmware_vio",
511                                                                                                      "resourceName": "ZTE_VGW_MGT_NET39"},
512                                                                                  "virtualLinkDescId": "ZTE_VGW_MGT_NET39_virtualLink",
513                                                                                  "tenant": "ZTE_ONAP_PRO",
514                                                                                  "subnetworkResource": {"resourceId": "33c8a03d-00c9-4c57-a348-26dae462b473",
515                                                                                                         "tenant": None,
516                                                                                                         "vimId": "vmware_vio",
517                                                                                                         "resourceName": "ZTE_VGW_MGT_NET39_s"}},
518                                                                                 {"changeType": "added",
519                                                                                  "virtualLinkInstanceId": "175472a4-c5bf-11e7-904d-fa163eee1ffe",
520                                                                                  "networkResource": {"resourceId": "2d22b6e4-340b-45a8-8757-5206aa056b92",
521                                                                                                      "tenant": None,
522                                                                                                      "vimId": "vmware_vio",
523                                                                                                      "resourceName": "ZTE_VGW_SERVICE_NET39"},
524                                                                                  "virtualLinkDescId": "ZTE_VGW_SERVICE_NET39_virtualLink",
525                                                                                  "tenant": "ZTE_ONAP_PRO",
526                                                                                  "subnetworkResource": {"resourceId": "2ea2acc0-a4ed-44f8-9d31-9cdc9e3ebe62",
527                                                                                                         "tenant": None,
528                                                                                                         "vimId": "vmware_vio",
529                                                                                                         "resourceName": "ZTE_VGW_SERVICE_NET39_s"}}],
530                                                         "affectedVirtualStorage": [],
531                                                         "jobId": "",
532                                                         "affectedcapacity": {"vcp": "72",
533                                                                              "vm": "9",
534                                                                              "localStorage": "0",
535                                                                              "sharedStorage": "288",
536                                                                              "vMemory": "233472",
537                                                                              "port": "27"},
538                                                         "additionalParam": {"vmList": [{"vmName": "ZTE_xGW_39_CDB_1",
539                                                                                         "vduId": "VDU_S_CDB_51"},
540                                                                                        {"vmName": "ZTE_xGW_39_CDB_2",
541                                                                                         "vduId": "VDU_S_CDB_51"},
542                                                                                        {"vmName": "ZTE_xGW_39_SLB_1",
543                                                                                         "vduId": "VDU_M_SLB_42"},
544                                                                                        {"vmName": "ZTE_xGW_39_SLB_2",
545                                                                                         "vduId": "VDU_M_SLB_42"},
546                                                                                        {"vmName": "ZTE_xGW_39_GSU_1",
547                                                                                         "vduId": "VDU_M_GSU_22"},
548                                                                                        {"vmName": "ZTE_xGW_39_GSU_2",
549                                                                                         "vduId": "VDU_M_GSU_22"},
550                                                                                        {"vmName": "ZTE_xGW_39_MPU_1",
551                                                                                         "vduId": "VDU_M_MPU_12"},
552                                                                                        {"vmName": "ZTE_xGW_39_PFU_1",
553                                                                                         "vduId": "VDU_M_PFU_32"},
554                                                                                        {"vmName": "ZTE_xGW_39_PFU_2",
555                                                                                         "vduId": "VDU_M_PFU_32"}]},
556                                                         "nfInstanceId": "1",
557                                                         "affectedCp": [{"changeType": "added",
558                                                                         "cPInstanceId": "175767d4-c5bf-11e7-904d-fa163eee1ffe",
559                                                                         "ownertype": 3,
560                                                                         "cpdId": "CP_NO_0_CDB_ZTE_VGW_MGT_NET39",
561                                                                         "portResource": {"resourceId": "3296b6d8-ebca-4d33-98f4-68d1bc63a3d0",
562                                                                                          "tenant": "ZTE_ONAP_PRO",
563                                                                                          "vimId": "vmware_vio",
564                                                                                          "resourceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_su1"},
565                                                                         "cpInstanceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_su1",
566                                                                         "ownerid": "17502154-c5bf-11e7-904d-fa163eee1ffe",
567                                                                         "virtualLinkInstanceId": "1753b60c-c5bf-11e7-904d-fa163eee1ffe"},
568                                                                        {"changeType": "added",
569                                                                         "cPInstanceId": "1758181e-c5bf-11e7-904d-fa163eee1ffe",
570                                                                         "ownertype": 3,
571                                                                         "cpdId": "CP_NO_1_CDB_ZTE_VGW_SERVICE_NET39",
572                                                                         "portResource": {"resourceId": "5e277a18-94de-469a-a336-2c01ab46387e",
573                                                                                          "tenant": "ZTE_ONAP_PRO",
574                                                                                          "vimId": "vmware_vio",
575                                                                                          "resourceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_su2"},
576                                                                         "cpInstanceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_su2",
577                                                                         "ownerid": "17502154-c5bf-11e7-904d-fa163eee1ffe",
578                                                                         "virtualLinkInstanceId": "175472a4-c5bf-11e7-904d-fa163eee1ffe"}],
579                                                         "vnfdmodule": {"volume_storages": [],
580                                                                        "inputs": {},
581                                                                        "vdus": [{"volume_storages": [],
582                                                                                  "description": "CDB",
583                                                                                  "vdu_id": "VDU_S_CDB_51",
584                                                                                  "local_storages": ["local_disk_root_10GB",
585                                                                                                     "local_disk_ephemeral_14GB"],
586                                                                                  "nfv_compute": {"flavor_extra_specs": {"hw:cpu_policy": "dedicated",
587                                                                                                                         "hw:mem_page_size": "large",
588                                                                                                                         "hw:numa_nodes": 1,
589                                                                                                                         "hw:cpu_max_sockets": 1},
590                                                                                                  "mem_size": 8192,
591                                                                                                  "num_cpus": 2},
592                                                                                  "artifacts": [],
593                                                                                  "dependencies": [],
594                                                                                  "vls": ["ZTE_VGW_MGT_NET39_virtualLink",
595                                                                                          "ZTE_VGW_SERVICE_NET39_virtualLink"],
596                                                                                  "image_file": "image_51",
597                                                                                  "cps": ["CP_ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_su1",
598                                                                                          "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_su2"],
599                                                                                  "properties": {"key_vd": True,
600                                                                                                 "support_scaling": True,
601                                                                                                 "vdu_type": "CDB",
602                                                                                                 "name": "ZTE_xGW_39_CDB_1",
603                                                                                                 "storage_policy": "Share_Service",
604                                                                                                 "inject_network_address": True,
605                                                                                                 "is_predefined": False,
606                                                                                                 "location_info": {"vimid": "",
607                                                                                                                   "availability_zone": "",
608                                                                                                                   "vdc": "OG_OrganizationDC",
609                                                                                                                   "host": "",
610                                                                                                                   "tenant": "",
611                                                                                                                   "vapp": "xgw"},
612                                                                                                 "use_shared_vm": False,
613                                                                                                 "inject_data_list": [],
614                                                                                                 "allow_scale_updown": True,
615                                                                                                 "action": "ADD",
616                                                                                                 "watchdog": {},
617                                                                                                 "template_id": 51,
618                                                                                                 "manual_scale_select_vim": False,
619                                                                                                 "config_drive": True}},
620                                                                                 {"volume_storages": [],
621                                                                                  "description": "SLB",
622                                                                                  "vdu_id": "VDU_M_SLB_42",
623                                                                                  "local_storages": ["local_disk_root_10GB",
624                                                                                                     "local_disk_ephemeral_14GB"],
625                                                                                  "nfv_compute": {"flavor_extra_specs": {"hw:cpu_policy": "dedicated",
626                                                                                                                         "hw:mem_page_size": "large",
627                                                                                                                         "hw:numa_nodes": 1,
628                                                                                                                         "hw:cpu_max_sockets": 1},
629                                                                                                  "mem_size": 24576,
630                                                                                                  "num_cpus": 8},
631                                                                                  "artifacts": [],
632                                                                                  "dependencies": [],
633                                                                                  "vls": ["ZTE_VGW_MGT_NET39_virtualLink",
634                                                                                          "ZTE_VGW_SERVICE_NET39_virtualLink",
635                                                                                          "ZTE_NET39_virtualLink",
636                                                                                          "ZTE_VGW_GTP_NET39_virtualLink"],
637                                                                                  "image_file": "image_51",
638                                                                                  "cps": ["CP_ZTE_xGW_39_SLB_1_ZTE_VGW_MGT_NET39_su1",
639                                                                                          "CP_ZTE_xGW_39_SLB_1_ZTE_VGW_SERVICE_NET39_su2",
640                                                                                          "CP_ZTE_xGW_39_SLB_1_zte-net-subnet393",
641                                                                                          "CP_ZTE_xGW_39_SLB_1_ZTE_VGW_GTP_NET39_su4"],
642                                                                                  "properties": {"key_vd": True,
643                                                                                                 "support_scaling": False,
644                                                                                                 "vdu_type": "SLB",
645                                                                                                 "name": "ZTE_xGW_39_SLB_1",
646                                                                                                 "storage_policy": "Share_Service",
647                                                                                                 "inject_network_address": True,
648                                                                                                 "is_predefined": False,
649                                                                                                 "location_info": {"vimid": "",
650                                                                                                                   "availability_zone": "",
651                                                                                                                   "vdc": "OG_OrganizationDC",
652                                                                                                                   "host": "",
653                                                                                                                   "tenant": "",
654                                                                                                                   "vapp": "xgw"},
655                                                                                                 "use_shared_vm": False,
656                                                                                                 "inject_data_list": [],
657                                                                                                 "allow_scale_updown": True,
658                                                                                                 "action": "ADD",
659                                                                                                 "watchdog": {},
660                                                                                                 "template_id": 42,
661                                                                                                 "manual_scale_select_vim": False,
662                                                                                                 "config_drive": True}}],
663                                                                        "vcloud": [],
664                                                                        "extvirtuallink": "",
665                                                                        "server_groups": [],
666                                                                        "image_files": [{"properties": {"vendor": "zte",
667                                                                                                        "name": "ZXUN_xGW_CGSL_QCOW2_OP_V6.17.10.B17.ova",
668                                                                                                        "image_extra_specs": {},
669                                                                                                        "disk_format": "vmdk",
670                                                                                                        "file_url": "SoftwareImages/ZXUN-xGW-CGSL-QCOW2-V6.17.10.B17-image.tar.gz",
671                                                                                                        "container_type": "bare",
672                                                                                                        "version": "V6.17.10.B17.ova"},
673                                                                                         "image_file_id": "image_51",
674                                                                                         "description": "xgw image file"}],
675                                                                        "routers": [],
676                                                                        "local_storages": [{"local_storage_id": "local_disk_ephemeral_38GB",
677                                                                                            "description": "local_disk_ephemeral_38GB",
678                                                                                            "properties": {"disk_type": "ephemeral",
679                                                                                                           "size": 38}},
680                                                                                           {"local_storage_id": "local_disk_root_10GB",
681                                                                                            "description": "local_disk_root_10GB",
682                                                                                            "properties": {"disk_type": "root",
683                                                                                                           "size": 10}},
684                                                                                           {"local_storage_id": "local_disk_ephemeral_14GB",
685                                                                                            "description": "local_disk_ephemeral_14GB",
686                                                                                            "properties": {"disk_type": "ephemeral",
687                                                                                                           "size": 14}}],
688                                                                        "vnf_flavours": [],
689                                                                        "vnf_exposed": {"external_cps": [{"key_name": "ZTE_NET39_virtualLink",
690                                                                                                          "cpd_id": "CP_NO_3_PFU_ZTE_NET39"},
691                                                                                                         {"key_name": "ZTE_NET39_virtualLink1",
692                                                                                                          "cpd_id": "CP_NO_2_PFU_ZTE_NET39"},
693                                                                                                         {"key_name": "ZTE_VGW_GTP_NET39_virtualLink",
694                                                                                                          "cpd_id": "CP_NO_3_SLB_ZTE_VGW_GTP_NET39"},
695                                                                                                         {"key_name": "ZTE_NET39_virtualLink2",
696                                                                                                          "cpd_id": "CP_NO_2_SLB_ZTE_NET39"},
697                                                                                                         {"key_name": "provider-zte_virtualLink",
698                                                                                                          "cpd_id": "CP_NO_2_MPU_provider-zte"}],
699                                                                                        "forward_cps": [{"key_name": "ZTE_VGW_GTP_NET39_forwarder",
700                                                                                                         "cpd_id": "CP_NO_3_SLB_ZTE_VGW_GTP_NET39"},
701                                                                                                        {"key_name": "ZTE_NET39_forwarder1",
702                                                                                                         "cpd_id": "CP_NO_2_PFU_ZTE_NET39"},
703                                                                                                        {"key_name": "ZTE_NET39_forwarder2",
704                                                                                                         "cpd_id": "CP_NO_3_PFU_ZTE_NET39"},
705                                                                                                        {"key_name": "provider-zte_forwarder",
706                                                                                                         "cpd_id": "CP_NO_2_MPU_provider-zte"},
707                                                                                                        {"key_name": "ZTE_NET39_forwarder",
708                                                                                                         "cpd_id": "CP_NO_2_SLB_ZTE_NET39"}]},
709                                                                        "reserved_total": {"portnum": 27,
710                                                                                           "vcpunum": 72,
711                                                                                           "memorysize": 233472,
712                                                                                           "shdsize": 288,
713                                                                                           "isreserve": 0,
714                                                                                           "vmnum": 9},
715                                                                        "policies": [{"scaling": [{"description": "zte vgw vnf policy",
716                                                                                                   "policy_id": "Policy_1",
717                                                                                                   "targets": ["VDU_S_CDB_51",
718                                                                                                               "VDU_M_CDB_52",
719                                                                                                               "VDU_M_SLB_42",
720                                                                                                               "VDU_M_GSU_22",
721                                                                                                               "VDU_M_MPU_12",
722                                                                                                               "VDU_L_MPU_13",
723                                                                                                               "VDU_M_PFU_32",
724                                                                                                               "VDU_L_PFU_33"],
725                                                                                                   "properties": {"policy_file": "Policies/zte-vcn-vnf-policy.xml"}}],
726                                                                                      "healing": []}],
727                                                                        "plugins": [],
728                                                                        "services": [],
729                                                                        "vcenter": [],
730                                                                        "cps": [{"vl_id": "ZTE_VGW_MGT_NET39_virtualLink",
731                                                                                 "description": "ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_s",
732                                                                                 "vdu_id": "VDU_S_CDB_51",
733                                                                                 "properties": {"service_port_created": False,
734                                                                                                "name": "ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_s",
735                                                                                                "allowed_address_pairs": [],
736                                                                                                "bandwidth": 0,
737                                                                                                "is_virtual": False,
738                                                                                                "guest_os_mt": 1400,
739                                                                                                "vnic_type": "normal",
740                                                                                                "floating_ip_address": {},
741                                                                                                "mac_address": "",
742                                                                                                "port_security_enabled": False,
743                                                                                                "ip_address": "192.168.39.247",
744                                                                                                "order": 1,
745                                                                                                "security_groups": [],
746                                                                                                "bond": "none"},
747                                                                                 "cp_id": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_su1",
748                                                                                 "cpd_id": "CP_NO_0_CDB_ZTE_VGW_MGT_NET39"},
749                                                                                {"vl_id": "ZTE_VGW_SERVICE_NET39_virtualLink",
750                                                                                 "description": "ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_s",
751                                                                                 "vdu_id": "VDU_S_CDB_51",
752                                                                                 "properties": {"service_port_created": False,
753                                                                                                "name": "ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_s",
754                                                                                                "allowed_address_pairs": [],
755                                                                                                "bandwidth": 0,
756                                                                                                "is_virtual": False,
757                                                                                                "guest_os_mt": 1400,
758                                                                                                "vnic_type": "normal",
759                                                                                                "floating_ip_address": {},
760                                                                                                "mac_address": "",
761                                                                                                "port_security_enabled": False,
762                                                                                                "ip_address": "192.168.40.247",
763                                                                                                "order": 2,
764                                                                                                "security_groups": [],
765                                                                                                "bond": "none"},
766                                                                                 "cp_id": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_su2",
767                                                                                 "cpd_id": "CP_NO_1_CDB_ZTE_VGW_SERVICE_NET39"}],
768                                                                        "vls": [{"route_external": False,
769                                                                                 "route_id": "",
770                                                                                 "vl_id": "ZTE_VGW_MGT_NET39_virtualLink",
771                                                                                 "description": "ZTE_VGW_MGT_NET39_s",
772                                                                                 "properties": {"gateway_ip": "",
773                                                                                                "vendor": "ZTE",
774                                                                                                "name": "ZTE_VGW_MGT_NET39_s",
775                                                                                                "location_info": {"vdc": "OG_OrganizationDC",
776                                                                                                                  "vimid": 1,
777                                                                                                                  "tenant": "",
778                                                                                                                  "vapp": "xgw"},
779                                                                                                "start_ip": "",
780                                                                                                "segmentation_id": "142",
781                                                                                                "dns_nameservers": [],
782                                                                                                "vds_name": "",
783                                                                                                "mt": 1400,
784                                                                                                "is_predefined": True,
785                                                                                                "ip_version": 4,
786                                                                                                "netmask": "255.255.255.0",
787                                                                                                "end_ip": "",
788                                                                                                "host_routes": [],
789                                                                                                "vlan_transparent": False,
790                                                                                                "physical_network": "physnet1",
791                                                                                                "cidr": "192.168.39.0/24",
792                                                                                                "dhcp_enabled": False,
793                                                                                                "network_name": "ZTE_VGW_MGT_NET39",
794                                                                                                "network_type": "vlan"}},
795                                                                                {"route_external": False,
796                                                                                 "route_id": "",
797                                                                                 "vl_id": "ZTE_VGW_SERVICE_NET39_virtualLink",
798                                                                                 "description": "ZTE_VGW_SERVICE_NET39_s",
799                                                                                 "properties": {"gateway_ip": "",
800                                                                                                "vendor": "ZTE",
801                                                                                                "name": "ZTE_VGW_SERVICE_NET39_s",
802                                                                                                "location_info": {"vdc": "OG_OrganizationDC",
803                                                                                                                  "vimid": 1,
804                                                                                                                  "tenant": "",
805                                                                                                                  "vapp": "xgw"},
806                                                                                                "start_ip": "",
807                                                                                                "segmentation_id": "128",
808                                                                                                "dns_nameservers": [],
809                                                                                                "vds_name": "",
810                                                                                                "mt": 1400,
811                                                                                                "is_predefined": True,
812                                                                                                "ip_version": 4,
813                                                                                                "netmask": "255.255.255.0",
814                                                                                                "end_ip": "",
815                                                                                                "host_routes": [],
816                                                                                                "vlan_transparent": False,
817                                                                                                "physical_network": "physnet1",
818                                                                                                "cidr": "192.168.40.0/24",
819                                                                                                "dhcp_enabled": False,
820                                                                                                "network_name": "ZTE_VGW_SERVICE_NET39",
821                                                                                                "network_type": "vlan"}}],
822                                                                        "element_groups": [],
823                                                                        "metadata": {"plugin_info": "cn_plugin_3.0",
824                                                                                     "vendor": "ZTE",
825                                                                                     "is_shared": False,
826                                                                                     "adjust_vnf_capacity": True,
827                                                                                     "paas_project": "",
828                                                                                     "description": "VMware",
829                                                                                     "vnf_extend_type": "driver",
830                                                                                     "domain_type": "CN",
831                                                                                     "resview": "dync",
832                                                                                     "script_info": "",
833                                                                                     "service_category": "EPC",
834                                                                                     "version": "ZTE",
835                                                                                     "vnf_type": "SAE-GW",
836                                                                                     "cross_dc": False,
837                                                                                     "vmnumber_overquota_alarm": True,
838                                                                                     "vnfd_version": "V00000001",
839                                                                                     "id": "NFAR-ZTE-40-ZTE",
840                                                                                     "name": 40}},
841                                                         "operation": "instantiate",
842                                                         "vnfmInstanceId": "31f8934e-c785-4fa5-9205-c5f374ada982"}},
843                    "vimid": "vmware_vio",
844                    "timestamp": "20171110105828",
845                    "affectedcp": [{"changeType": "added",
846                                    "cPInstanceId": "175767d4-c5bf-11e7-904d-fa163eee1ffe",
847                                    "ownertype": 3,
848                                    "cpdId": "CP_NO_0_CDB_ZTE_VGW_MGT_NET39",
849                                    "portResource": {"resourceId": "3296b6d8-ebca-4d33-98f4-68d1bc63a3d0",
850                                                     "tenant": "ZTE_ONAP_PRO",
851                                                     "vimId": "vmware_vio",
852                                                     "resourceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_su1"},
853                                    "cpInstanceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_su1",
854                                    "ownerid": "17502154-c5bf-11e7-904d-fa163eee1ffe",
855                                    "virtualLinkInstanceId": "1753b60c-c5bf-11e7-904d-fa163eee1ffe"},
856                                   {"changeType": "added",
857                                    "cPInstanceId": "1758181e-c5bf-11e7-904d-fa163eee1ffe",
858                                    "ownertype": 3,
859                                    "cpdId": "CP_NO_1_CDB_ZTE_VGW_SERVICE_NET39",
860                                    "portResource": {"resourceId": "5e277a18-94de-469a-a336-2c01ab46387e",
861                                                     "tenant": "ZTE_ONAP_PRO",
862                                                     "vimId": "vmware_vio",
863                                                     "resourceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_su2"},
864                                    "cpInstanceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_su2",
865                                    "ownerid": "17502154-c5bf-11e7-904d-fa163eee1ffe",
866                                    "virtualLinkInstanceId": "175472a4-c5bf-11e7-904d-fa163eee1ffe"}],
867                    "vmlist": [{"VMNumber": 1,
868                                "vdutype": "CDB",
869                                "VMFlavor": "VDU_S_CDB_51",
870                                "VMIDlist": [{"VMID": "e8ccc55a-3ebb-4e46-8260-dc4a1646ef4f",
871                                              "VMName": "ZTE_xGW_39_CDB_1",
872                                              "vimid": "vmware_vio",
873                                              "tenant": "ZTE_ONAP_PRO"}]},
874                               {"VMNumber": 1,
875                                "vdutype": "SLB",
876                                "VMFlavor": "VDU_M_SLB_42",
877                                "VMIDlist": [{"VMID": "a9dd6a73-76ee-4d07-9554-08f14c17261f",
878                                              "VMName": "ZTE_xGW_39_SLB_1",
879                                              "vimid": "vmware_vio",
880                                              "tenant": "ZTE_ONAP_PRO"}]}],
881                    "EventType": 1,
882                    "vnfmid": "31f8934e-c785-4fa5-9205-c5f374ada982",
883                    "affectedvirtuallink ": [{"changeType": "added",
884                                              "virtualLinkInstanceId": "1753b60c-c5bf-11e7-904d-fa163eee1ffe",
885                                              "networkResource": {"resourceId": "c55e0788-3683-48a1-b88a-a0cb5e05bd44",
886                                                                  "tenant": None,
887                                                                  "vimId": "vmware_vio",
888                                                                  "resourceName": "ZTE_VGW_MGT_NET39"},
889                                              "virtualLinkDescId": "ZTE_VGW_MGT_NET39_virtualLink",
890                                              "tenant": "ZTE_ONAP_PRO",
891                                              "subnetworkResource": {"resourceId": "33c8a03d-00c9-4c57-a348-26dae462b473",
892                                                                     "tenant": None,
893                                                                     "vimId": "vmware_vio",
894                                                                     "resourceName": "ZTE_VGW_MGT_NET39_s"}},
895                                             {"changeType": "added",
896                                              "virtualLinkInstanceId": "175472a4-c5bf-11e7-904d-fa163eee1ffe",
897                                              "networkResource": {"resourceId": "2d22b6e4-340b-45a8-8757-5206aa056b92",
898                                                                  "tenant": None,
899                                                                  "vimId": "vmware_vio",
900                                                                  "resourceName": "ZTE_VGW_SERVICE_NET39"},
901                                              "virtualLinkDescId": "ZTE_VGW_SERVICE_NET39_virtualLink",
902                                              "tenant": "ZTE_ONAP_PRO",
903                                              "subnetworkResource": {"resourceId": "2ea2acc0-a4ed-44f8-9d31-9cdc9e3ebe62",
904                                                                     "tenant": None,
905                                                                     "vimId": "vmware_vio",
906                                                                     "resourceName": "ZTE_VGW_SERVICE_NET39_s"}}]}