Merge "Transfer data to nfv-lcm"
[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 = {
355             "jobId": "801",
356             "vnfInstanceId": "101"
357         }
358         vnfm_info = {
359             "userName": "admin",
360             "vendor": "ZTE",
361             "name": "ZTE_VNFM_237_62",
362             "vimId": "516cee95-e8ca-4d26-9268-38e343c2e31e",
363             "url": "http://192.168.237.165:2324",
364             "certificateUrl": "",
365             "version": "V1.0",
366             "vnfmId": "b0797c9b-3da9-459c-b25c-3813e9d8fd70",
367             "password": "admin",
368             "type": "ztevnfmdriver",
369             "createTime": "2016-10-31 11:08:39",
370             "description": ""
371         }
372
373         ret = [0, json.JSONEncoder().encode(job_info), "202"]
374         ret_vnfm = [0, json.JSONEncoder().encode(vnfm_info), "200"]
375         mock_call_req.side_effect = [ret_vnfm, ret]
376
377         vnfd_info = {
378             "vnf_flavours": [
379                 {
380                     "flavour_id": "flavour1",
381                     "description": "",
382                     "vdu_profiles": [
383                         {
384                             "vdu_id": "vdu1Id",
385                             "instances_minimum_number": 1,
386                             "instances_maximum_number": 4,
387                             "local_affinity_antiaffinity_rule": [
388                                 {
389                                     "affinity_antiaffinity": "affinity",
390                                     "scope": "node",
391
392                                 }
393                             ]
394                         }
395                     ],
396                     "scaling_aspects": [
397                         {
398                             "id": "demo_aspect",
399                             "name": "demo_aspect",
400                             "description": "demo_aspect",
401                             "associated_group": "elementGroup1",
402                             "max_scale_level": 5
403                         }
404                     ]
405                 }
406             ],
407             "element_groups": [
408                 {
409                     "group_id": "elementGroup1",
410                     "description": "",
411                     "properties": {
412                         "name": "elementGroup1"
413                     },
414                     "members": [
415                         "gsu_vm",
416                         "pfu_vm"
417                     ]
418                 }
419             ]
420         }
421
422         scale_vnf_data = {
423             "type": "SCALE_OUT",
424             "aspectId": "demo_aspect",
425             "numberOfSteps": "3",
426             "additionalParam": {
427                 "vnfdModel": vnfd_info
428             }
429         }
430
431         response = self.client.post(
432             "/api/ztevnfmdriver/v1/100/vnfs/101/scale",
433             data=json.dumps(scale_vnf_data),
434             content_type='application/json')
435         self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code)
436         self.assertDictEqual(job_info, response.data)
437
438     @mock.patch.object(restcall, 'call_req')
439     def test_heal(self, mock_call_req):
440         job_info = {
441             "jobId": "12234455",
442             "vnfInstanceId": "10144445666"
443         }
444         vnfm_info = {
445             "userName": "admin",
446             "vendor": "ZTE",
447             "name": "ZTE_VNFM_237_62",
448             "vimId": "516cee95-e8ca-4d26-9268-38e343c2e31e",
449             "url": "http://192.168.237.165:2324",
450             "certificateUrl": "",
451             "version": "V1.0",
452             "vnfmId": "b0797c9b-3da9-459c-b25c-3813e9d8fd70",
453             "password": "admin",
454             "type": "ztevnfmdriver",
455             "createTime": "2016-10-31 11:08:39",
456             "description": ""
457         }
458
459         ret = [0, json.JSONEncoder().encode(job_info), "202"]
460         ret_vnfm = [0, json.JSONEncoder().encode(vnfm_info), "200"]
461         mock_call_req.side_effect = [ret_vnfm, ret]
462
463         heal_vnf_data = {
464             'action': 'vmReset',
465             'affectedvm': [{
466                 'flavour': {
467
468                 },
469                 'extention': '',
470                 'vmid': '804cca71-9ae9-4511-8e30-d1387718caff',
471                 'changtype': 'changed',
472                 'vduid': 'vdu_100',
473                 'vmname': 'ZTE_SSS_111_PP_2_L'
474             }],
475             'lifecycleoperation': 'operate',
476             'isgrace': 'force'
477         }
478
479         response = self.client.post("/api/ztevnfmdriver/v1/200/vnfs/201/heal", data=json.dumps(heal_vnf_data),
480                                     content_type='application/json')
481
482         self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code)
483         self.assertDictEqual(job_info, response.data)
484
485
486 notify_req_data = {"vnfinstanceid": "1",
487                    "nfvoid": "3",
488                    "extension": {"openo_notification": {"status": "finished",
489                                                         "affectedService": [],
490                                                         "affectedVnfc": [{"changeType": "added",
491                                                                           "computeResource": {"resourceId": "e8ccc55a-3ebb-4e46-8260-dc4a1646ef4f",
492                                                                                               "tenant": "ZTE_ONAP_PRO",
493                                                                                               "vimId": "vmware_vio",
494                                                                                               "resourceName": "ZTE_xGW_39_CDB_1"},
495                                                                           "storageResource": [],
496                                                                           "vnfcInstanceId": "17502154-c5bf-11e7-904d-fa163eee1ffe",
497                                                                           "vduType": "CDB",
498                                                                           "vduId": "VDU_S_CDB_51"},
499                                                                          {"changeType": "added",
500                                                                           "computeResource": {"resourceId": "a9dd6a73-76ee-4d07-9554-08f14c17261f",
501                                                                                               "tenant": "ZTE_ONAP_PRO",
502                                                                                               "vimId": "vmware_vio",
503                                                                                               "resourceName": "ZTE_xGW_39_SLB_1"},
504                                                                           "storageResource": [],
505                                                                           "vnfcInstanceId": "1750d540-c5bf-11e7-904d-fa163eee1ffe",
506                                                                           "vduType": "SLB",
507                                                                           "vduId": "VDU_M_SLB_42"}],
508                                                         "nfvoInstanceId": "3",
509                                                         "affectedVirtualLink": [{"changeType": "added",
510                                                                                  "virtualLinkInstanceId": "1753b60c-c5bf-11e7-904d-fa163eee1ffe",
511                                                                                  "networkResource": {"resourceId": "c55e0788-3683-48a1-b88a-a0cb5e05bd44",
512                                                                                                      "tenant": None,
513                                                                                                      "vimId": "vmware_vio",
514                                                                                                      "resourceName": "ZTE_VGW_MGT_NET39"},
515                                                                                  "virtualLinkDescId": "ZTE_VGW_MGT_NET39_virtualLink",
516                                                                                  "tenant": "ZTE_ONAP_PRO",
517                                                                                  "subnetworkResource": {"resourceId": "33c8a03d-00c9-4c57-a348-26dae462b473",
518                                                                                                         "tenant": None,
519                                                                                                         "vimId": "vmware_vio",
520                                                                                                         "resourceName": "ZTE_VGW_MGT_NET39_s"}},
521                                                                                 {"changeType": "added",
522                                                                                  "virtualLinkInstanceId": "175472a4-c5bf-11e7-904d-fa163eee1ffe",
523                                                                                  "networkResource": {"resourceId": "2d22b6e4-340b-45a8-8757-5206aa056b92",
524                                                                                                      "tenant": None,
525                                                                                                      "vimId": "vmware_vio",
526                                                                                                      "resourceName": "ZTE_VGW_SERVICE_NET39"},
527                                                                                  "virtualLinkDescId": "ZTE_VGW_SERVICE_NET39_virtualLink",
528                                                                                  "tenant": "ZTE_ONAP_PRO",
529                                                                                  "subnetworkResource": {"resourceId": "2ea2acc0-a4ed-44f8-9d31-9cdc9e3ebe62",
530                                                                                                         "tenant": None,
531                                                                                                         "vimId": "vmware_vio",
532                                                                                                         "resourceName": "ZTE_VGW_SERVICE_NET39_s"}}],
533                                                         "affectedVirtualStorage": [],
534                                                         "jobId": "",
535                                                         "affectedcapacity": {"vcp": "72",
536                                                                              "vm": "9",
537                                                                              "localStorage": "0",
538                                                                              "sharedStorage": "288",
539                                                                              "vMemory": "233472",
540                                                                              "port": "27"},
541                                                         "additionalParam": {"vmList": [{"vmName": "ZTE_xGW_39_CDB_1",
542                                                                                         "vduId": "VDU_S_CDB_51"},
543                                                                                        {"vmName": "ZTE_xGW_39_CDB_2",
544                                                                                         "vduId": "VDU_S_CDB_51"},
545                                                                                        {"vmName": "ZTE_xGW_39_SLB_1",
546                                                                                         "vduId": "VDU_M_SLB_42"},
547                                                                                        {"vmName": "ZTE_xGW_39_SLB_2",
548                                                                                         "vduId": "VDU_M_SLB_42"},
549                                                                                        {"vmName": "ZTE_xGW_39_GSU_1",
550                                                                                         "vduId": "VDU_M_GSU_22"},
551                                                                                        {"vmName": "ZTE_xGW_39_GSU_2",
552                                                                                         "vduId": "VDU_M_GSU_22"},
553                                                                                        {"vmName": "ZTE_xGW_39_MPU_1",
554                                                                                         "vduId": "VDU_M_MPU_12"},
555                                                                                        {"vmName": "ZTE_xGW_39_PFU_1",
556                                                                                         "vduId": "VDU_M_PFU_32"},
557                                                                                        {"vmName": "ZTE_xGW_39_PFU_2",
558                                                                                         "vduId": "VDU_M_PFU_32"}]},
559                                                         "nfInstanceId": "1",
560                                                         "affectedCp": [{"changeType": "added",
561                                                                         "cPInstanceId": "175767d4-c5bf-11e7-904d-fa163eee1ffe",
562                                                                         "ownertype": 3,
563                                                                         "cpdId": "CP_NO_0_CDB_ZTE_VGW_MGT_NET39",
564                                                                         "portResource": {"resourceId": "3296b6d8-ebca-4d33-98f4-68d1bc63a3d0",
565                                                                                          "tenant": "ZTE_ONAP_PRO",
566                                                                                          "vimId": "vmware_vio",
567                                                                                          "resourceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_su1"},
568                                                                         "cpInstanceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_su1",
569                                                                         "ownerid": "17502154-c5bf-11e7-904d-fa163eee1ffe",
570                                                                         "virtualLinkInstanceId": "1753b60c-c5bf-11e7-904d-fa163eee1ffe"},
571                                                                        {"changeType": "added",
572                                                                         "cPInstanceId": "1758181e-c5bf-11e7-904d-fa163eee1ffe",
573                                                                         "ownertype": 3,
574                                                                         "cpdId": "CP_NO_1_CDB_ZTE_VGW_SERVICE_NET39",
575                                                                         "portResource": {"resourceId": "5e277a18-94de-469a-a336-2c01ab46387e",
576                                                                                          "tenant": "ZTE_ONAP_PRO",
577                                                                                          "vimId": "vmware_vio",
578                                                                                          "resourceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_su2"},
579                                                                         "cpInstanceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_su2",
580                                                                         "ownerid": "17502154-c5bf-11e7-904d-fa163eee1ffe",
581                                                                         "virtualLinkInstanceId": "175472a4-c5bf-11e7-904d-fa163eee1ffe"}],
582                                                         "vnfdmodule": {"volume_storages": [],
583                                                                        "inputs": {},
584                                                                        "vdus": [{"volume_storages": [],
585                                                                                  "description": "CDB",
586                                                                                  "vdu_id": "VDU_S_CDB_51",
587                                                                                  "local_storages": ["local_disk_root_10GB",
588                                                                                                     "local_disk_ephemeral_14GB"],
589                                                                                  "nfv_compute": {"flavor_extra_specs": {"hw:cpu_policy": "dedicated",
590                                                                                                                         "hw:mem_page_size": "large",
591                                                                                                                         "hw:numa_nodes": 1,
592                                                                                                                         "hw:cpu_max_sockets": 1},
593                                                                                                  "mem_size": 8192,
594                                                                                                  "num_cpus": 2},
595                                                                                  "artifacts": [],
596                                                                                  "dependencies": [],
597                                                                                  "vls": ["ZTE_VGW_MGT_NET39_virtualLink",
598                                                                                          "ZTE_VGW_SERVICE_NET39_virtualLink"],
599                                                                                  "image_file": "image_51",
600                                                                                  "cps": ["CP_ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_su1",
601                                                                                          "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_su2"],
602                                                                                  "properties": {"key_vd": True,
603                                                                                                 "support_scaling": True,
604                                                                                                 "vdu_type": "CDB",
605                                                                                                 "name": "ZTE_xGW_39_CDB_1",
606                                                                                                 "storage_policy": "Share_Service",
607                                                                                                 "inject_network_address": True,
608                                                                                                 "is_predefined": False,
609                                                                                                 "location_info": {"vimid": "",
610                                                                                                                   "availability_zone": "",
611                                                                                                                   "vdc": "OG_OrganizationDC",
612                                                                                                                   "host": "",
613                                                                                                                   "tenant": "",
614                                                                                                                   "vapp": "xgw"},
615                                                                                                 "use_shared_vm": False,
616                                                                                                 "inject_data_list": [],
617                                                                                                 "allow_scale_updown": True,
618                                                                                                 "action": "ADD",
619                                                                                                 "watchdog": {},
620                                                                                                 "template_id": 51,
621                                                                                                 "manual_scale_select_vim": False,
622                                                                                                 "config_drive": True}},
623                                                                                 {"volume_storages": [],
624                                                                                  "description": "SLB",
625                                                                                  "vdu_id": "VDU_M_SLB_42",
626                                                                                  "local_storages": ["local_disk_root_10GB",
627                                                                                                     "local_disk_ephemeral_14GB"],
628                                                                                  "nfv_compute": {"flavor_extra_specs": {"hw:cpu_policy": "dedicated",
629                                                                                                                         "hw:mem_page_size": "large",
630                                                                                                                         "hw:numa_nodes": 1,
631                                                                                                                         "hw:cpu_max_sockets": 1},
632                                                                                                  "mem_size": 24576,
633                                                                                                  "num_cpus": 8},
634                                                                                  "artifacts": [],
635                                                                                  "dependencies": [],
636                                                                                  "vls": ["ZTE_VGW_MGT_NET39_virtualLink",
637                                                                                          "ZTE_VGW_SERVICE_NET39_virtualLink",
638                                                                                          "ZTE_NET39_virtualLink",
639                                                                                          "ZTE_VGW_GTP_NET39_virtualLink"],
640                                                                                  "image_file": "image_51",
641                                                                                  "cps": ["CP_ZTE_xGW_39_SLB_1_ZTE_VGW_MGT_NET39_su1",
642                                                                                          "CP_ZTE_xGW_39_SLB_1_ZTE_VGW_SERVICE_NET39_su2",
643                                                                                          "CP_ZTE_xGW_39_SLB_1_zte-net-subnet393",
644                                                                                          "CP_ZTE_xGW_39_SLB_1_ZTE_VGW_GTP_NET39_su4"],
645                                                                                  "properties": {"key_vd": True,
646                                                                                                 "support_scaling": False,
647                                                                                                 "vdu_type": "SLB",
648                                                                                                 "name": "ZTE_xGW_39_SLB_1",
649                                                                                                 "storage_policy": "Share_Service",
650                                                                                                 "inject_network_address": True,
651                                                                                                 "is_predefined": False,
652                                                                                                 "location_info": {"vimid": "",
653                                                                                                                   "availability_zone": "",
654                                                                                                                   "vdc": "OG_OrganizationDC",
655                                                                                                                   "host": "",
656                                                                                                                   "tenant": "",
657                                                                                                                   "vapp": "xgw"},
658                                                                                                 "use_shared_vm": False,
659                                                                                                 "inject_data_list": [],
660                                                                                                 "allow_scale_updown": True,
661                                                                                                 "action": "ADD",
662                                                                                                 "watchdog": {},
663                                                                                                 "template_id": 42,
664                                                                                                 "manual_scale_select_vim": False,
665                                                                                                 "config_drive": True}}],
666                                                                        "vcloud": [],
667                                                                        "extvirtuallink": "",
668                                                                        "server_groups": [],
669                                                                        "image_files": [{"properties": {"vendor": "zte",
670                                                                                                        "name": "ZXUN_xGW_CGSL_QCOW2_OP_V6.17.10.B17.ova",
671                                                                                                        "image_extra_specs": {},
672                                                                                                        "disk_format": "vmdk",
673                                                                                                        "file_url": "SoftwareImages/ZXUN-xGW-CGSL-QCOW2-V6.17.10.B17-image.tar.gz",
674                                                                                                        "container_type": "bare",
675                                                                                                        "version": "V6.17.10.B17.ova"},
676                                                                                         "image_file_id": "image_51",
677                                                                                         "description": "xgw image file"}],
678                                                                        "routers": [],
679                                                                        "local_storages": [{"local_storage_id": "local_disk_ephemeral_38GB",
680                                                                                            "description": "local_disk_ephemeral_38GB",
681                                                                                            "properties": {"disk_type": "ephemeral",
682                                                                                                           "size": 38}},
683                                                                                           {"local_storage_id": "local_disk_root_10GB",
684                                                                                            "description": "local_disk_root_10GB",
685                                                                                            "properties": {"disk_type": "root",
686                                                                                                           "size": 10}},
687                                                                                           {"local_storage_id": "local_disk_ephemeral_14GB",
688                                                                                            "description": "local_disk_ephemeral_14GB",
689                                                                                            "properties": {"disk_type": "ephemeral",
690                                                                                                           "size": 14}}],
691                                                                        "vnf_flavours": [],
692                                                                        "vnf_exposed": {"external_cps": [{"key_name": "ZTE_NET39_virtualLink",
693                                                                                                          "cpd_id": "CP_NO_3_PFU_ZTE_NET39"},
694                                                                                                         {"key_name": "ZTE_NET39_virtualLink1",
695                                                                                                          "cpd_id": "CP_NO_2_PFU_ZTE_NET39"},
696                                                                                                         {"key_name": "ZTE_VGW_GTP_NET39_virtualLink",
697                                                                                                          "cpd_id": "CP_NO_3_SLB_ZTE_VGW_GTP_NET39"},
698                                                                                                         {"key_name": "ZTE_NET39_virtualLink2",
699                                                                                                          "cpd_id": "CP_NO_2_SLB_ZTE_NET39"},
700                                                                                                         {"key_name": "provider-zte_virtualLink",
701                                                                                                          "cpd_id": "CP_NO_2_MPU_provider-zte"}],
702                                                                                        "forward_cps": [{"key_name": "ZTE_VGW_GTP_NET39_forwarder",
703                                                                                                         "cpd_id": "CP_NO_3_SLB_ZTE_VGW_GTP_NET39"},
704                                                                                                        {"key_name": "ZTE_NET39_forwarder1",
705                                                                                                         "cpd_id": "CP_NO_2_PFU_ZTE_NET39"},
706                                                                                                        {"key_name": "ZTE_NET39_forwarder2",
707                                                                                                         "cpd_id": "CP_NO_3_PFU_ZTE_NET39"},
708                                                                                                        {"key_name": "provider-zte_forwarder",
709                                                                                                         "cpd_id": "CP_NO_2_MPU_provider-zte"},
710                                                                                                        {"key_name": "ZTE_NET39_forwarder",
711                                                                                                         "cpd_id": "CP_NO_2_SLB_ZTE_NET39"}]},
712                                                                        "reserved_total": {"portnum": 27,
713                                                                                           "vcpunum": 72,
714                                                                                           "memorysize": 233472,
715                                                                                           "shdsize": 288,
716                                                                                           "isreserve": 0,
717                                                                                           "vmnum": 9},
718                                                                        "policies": [{"scaling": [{"description": "zte vgw vnf policy",
719                                                                                                   "policy_id": "Policy_1",
720                                                                                                   "targets": ["VDU_S_CDB_51",
721                                                                                                               "VDU_M_CDB_52",
722                                                                                                               "VDU_M_SLB_42",
723                                                                                                               "VDU_M_GSU_22",
724                                                                                                               "VDU_M_MPU_12",
725                                                                                                               "VDU_L_MPU_13",
726                                                                                                               "VDU_M_PFU_32",
727                                                                                                               "VDU_L_PFU_33"],
728                                                                                                   "properties": {"policy_file": "Policies/zte-vcn-vnf-policy.xml"}}],
729                                                                                      "healing": []}],
730                                                                        "plugins": [],
731                                                                        "services": [],
732                                                                        "vcenter": [],
733                                                                        "cps": [{"vl_id": "ZTE_VGW_MGT_NET39_virtualLink",
734                                                                                 "description": "ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_s",
735                                                                                 "vdu_id": "VDU_S_CDB_51",
736                                                                                 "properties": {"service_port_created": False,
737                                                                                                "name": "ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_s",
738                                                                                                "allowed_address_pairs": [],
739                                                                                                "bandwidth": 0,
740                                                                                                "is_virtual": False,
741                                                                                                "guest_os_mt": 1400,
742                                                                                                "vnic_type": "normal",
743                                                                                                "floating_ip_address": {},
744                                                                                                "mac_address": "",
745                                                                                                "port_security_enabled": False,
746                                                                                                "ip_address": "192.168.39.247",
747                                                                                                "order": 1,
748                                                                                                "security_groups": [],
749                                                                                                "bond": "none"},
750                                                                                 "cp_id": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_su1",
751                                                                                 "cpd_id": "CP_NO_0_CDB_ZTE_VGW_MGT_NET39"},
752                                                                                {"vl_id": "ZTE_VGW_SERVICE_NET39_virtualLink",
753                                                                                 "description": "ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_s",
754                                                                                 "vdu_id": "VDU_S_CDB_51",
755                                                                                 "properties": {"service_port_created": False,
756                                                                                                "name": "ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_s",
757                                                                                                "allowed_address_pairs": [],
758                                                                                                "bandwidth": 0,
759                                                                                                "is_virtual": False,
760                                                                                                "guest_os_mt": 1400,
761                                                                                                "vnic_type": "normal",
762                                                                                                "floating_ip_address": {},
763                                                                                                "mac_address": "",
764                                                                                                "port_security_enabled": False,
765                                                                                                "ip_address": "192.168.40.247",
766                                                                                                "order": 2,
767                                                                                                "security_groups": [],
768                                                                                                "bond": "none"},
769                                                                                 "cp_id": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_su2",
770                                                                                 "cpd_id": "CP_NO_1_CDB_ZTE_VGW_SERVICE_NET39"}],
771                                                                        "vls": [{"route_external": False,
772                                                                                 "route_id": "",
773                                                                                 "vl_id": "ZTE_VGW_MGT_NET39_virtualLink",
774                                                                                 "description": "ZTE_VGW_MGT_NET39_s",
775                                                                                 "properties": {"gateway_ip": "",
776                                                                                                "vendor": "ZTE",
777                                                                                                "name": "ZTE_VGW_MGT_NET39_s",
778                                                                                                "location_info": {"vdc": "OG_OrganizationDC",
779                                                                                                                  "vimid": 1,
780                                                                                                                  "tenant": "",
781                                                                                                                  "vapp": "xgw"},
782                                                                                                "start_ip": "",
783                                                                                                "segmentation_id": "142",
784                                                                                                "dns_nameservers": [],
785                                                                                                "vds_name": "",
786                                                                                                "mt": 1400,
787                                                                                                "is_predefined": True,
788                                                                                                "ip_version": 4,
789                                                                                                "netmask": "255.255.255.0",
790                                                                                                "end_ip": "",
791                                                                                                "host_routes": [],
792                                                                                                "vlan_transparent": False,
793                                                                                                "physical_network": "physnet1",
794                                                                                                "cidr": "192.168.39.0/24",
795                                                                                                "dhcp_enabled": False,
796                                                                                                "network_name": "ZTE_VGW_MGT_NET39",
797                                                                                                "network_type": "vlan"}},
798                                                                                {"route_external": False,
799                                                                                 "route_id": "",
800                                                                                 "vl_id": "ZTE_VGW_SERVICE_NET39_virtualLink",
801                                                                                 "description": "ZTE_VGW_SERVICE_NET39_s",
802                                                                                 "properties": {"gateway_ip": "",
803                                                                                                "vendor": "ZTE",
804                                                                                                "name": "ZTE_VGW_SERVICE_NET39_s",
805                                                                                                "location_info": {"vdc": "OG_OrganizationDC",
806                                                                                                                  "vimid": 1,
807                                                                                                                  "tenant": "",
808                                                                                                                  "vapp": "xgw"},
809                                                                                                "start_ip": "",
810                                                                                                "segmentation_id": "128",
811                                                                                                "dns_nameservers": [],
812                                                                                                "vds_name": "",
813                                                                                                "mt": 1400,
814                                                                                                "is_predefined": True,
815                                                                                                "ip_version": 4,
816                                                                                                "netmask": "255.255.255.0",
817                                                                                                "end_ip": "",
818                                                                                                "host_routes": [],
819                                                                                                "vlan_transparent": False,
820                                                                                                "physical_network": "physnet1",
821                                                                                                "cidr": "192.168.40.0/24",
822                                                                                                "dhcp_enabled": False,
823                                                                                                "network_name": "ZTE_VGW_SERVICE_NET39",
824                                                                                                "network_type": "vlan"}}],
825                                                                        "element_groups": [],
826                                                                        "metadata": {"plugin_info": "cn_plugin_3.0",
827                                                                                     "vendor": "ZTE",
828                                                                                     "is_shared": False,
829                                                                                     "adjust_vnf_capacity": True,
830                                                                                     "paas_project": "",
831                                                                                     "description": "VMware",
832                                                                                     "vnf_extend_type": "driver",
833                                                                                     "domain_type": "CN",
834                                                                                     "resview": "dync",
835                                                                                     "script_info": "",
836                                                                                     "service_category": "EPC",
837                                                                                     "version": "ZTE",
838                                                                                     "vnf_type": "SAE-GW",
839                                                                                     "cross_dc": False,
840                                                                                     "vmnumber_overquota_alarm": True,
841                                                                                     "vnfd_version": "V00000001",
842                                                                                     "id": "NFAR-ZTE-40-ZTE",
843                                                                                     "name": 40}},
844                                                         "operation": "instantiate",
845                                                         "vnfmInstanceId": "31f8934e-c785-4fa5-9205-c5f374ada982"}},
846                    "vimid": "vmware_vio",
847                    "timestamp": "20171110105828",
848                    "affectedcp": [{"changeType": "added",
849                                    "cPInstanceId": "175767d4-c5bf-11e7-904d-fa163eee1ffe",
850                                    "ownertype": 3,
851                                    "cpdId": "CP_NO_0_CDB_ZTE_VGW_MGT_NET39",
852                                    "portResource": {"resourceId": "3296b6d8-ebca-4d33-98f4-68d1bc63a3d0",
853                                                     "tenant": "ZTE_ONAP_PRO",
854                                                     "vimId": "vmware_vio",
855                                                     "resourceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_su1"},
856                                    "cpInstanceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_MGT_NET39_su1",
857                                    "ownerid": "17502154-c5bf-11e7-904d-fa163eee1ffe",
858                                    "virtualLinkInstanceId": "1753b60c-c5bf-11e7-904d-fa163eee1ffe"},
859                                   {"changeType": "added",
860                                    "cPInstanceId": "1758181e-c5bf-11e7-904d-fa163eee1ffe",
861                                    "ownertype": 3,
862                                    "cpdId": "CP_NO_1_CDB_ZTE_VGW_SERVICE_NET39",
863                                    "portResource": {"resourceId": "5e277a18-94de-469a-a336-2c01ab46387e",
864                                                     "tenant": "ZTE_ONAP_PRO",
865                                                     "vimId": "vmware_vio",
866                                                     "resourceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_su2"},
867                                    "cpInstanceName": "CP_ZTE_xGW_39_CDB_1_ZTE_VGW_SERVICE_NET39_su2",
868                                    "ownerid": "17502154-c5bf-11e7-904d-fa163eee1ffe",
869                                    "virtualLinkInstanceId": "175472a4-c5bf-11e7-904d-fa163eee1ffe"}],
870                    "vmlist": [{"VMNumber": 1,
871                                "vdutype": "CDB",
872                                "VMFlavor": "VDU_S_CDB_51",
873                                "VMIDlist": [{"VMID": "e8ccc55a-3ebb-4e46-8260-dc4a1646ef4f",
874                                              "VMName": "ZTE_xGW_39_CDB_1",
875                                              "vimid": "vmware_vio",
876                                              "tenant": "ZTE_ONAP_PRO"}]},
877                               {"VMNumber": 1,
878                                "vdutype": "SLB",
879                                "VMFlavor": "VDU_M_SLB_42",
880                                "VMIDlist": [{"VMID": "a9dd6a73-76ee-4d07-9554-08f14c17261f",
881                                              "VMName": "ZTE_xGW_39_SLB_1",
882                                              "vimid": "vmware_vio",
883                                              "tenant": "ZTE_ONAP_PRO"}]}],
884                    "EventType": 1,
885                    "vnfmid": "31f8934e-c785-4fa5-9205-c5f374ada982",
886                    "affectedvirtuallink ": [{"changeType": "added",
887                                              "virtualLinkInstanceId": "1753b60c-c5bf-11e7-904d-fa163eee1ffe",
888                                              "networkResource": {"resourceId": "c55e0788-3683-48a1-b88a-a0cb5e05bd44",
889                                                                  "tenant": None,
890                                                                  "vimId": "vmware_vio",
891                                                                  "resourceName": "ZTE_VGW_MGT_NET39"},
892                                              "virtualLinkDescId": "ZTE_VGW_MGT_NET39_virtualLink",
893                                              "tenant": "ZTE_ONAP_PRO",
894                                              "subnetworkResource": {"resourceId": "33c8a03d-00c9-4c57-a348-26dae462b473",
895                                                                     "tenant": None,
896                                                                     "vimId": "vmware_vio",
897                                                                     "resourceName": "ZTE_VGW_MGT_NET39_s"}},
898                                             {"changeType": "added",
899                                              "virtualLinkInstanceId": "175472a4-c5bf-11e7-904d-fa163eee1ffe",
900                                              "networkResource": {"resourceId": "2d22b6e4-340b-45a8-8757-5206aa056b92",
901                                                                  "tenant": None,
902                                                                  "vimId": "vmware_vio",
903                                                                  "resourceName": "ZTE_VGW_SERVICE_NET39"},
904                                              "virtualLinkDescId": "ZTE_VGW_SERVICE_NET39_virtualLink",
905                                              "tenant": "ZTE_ONAP_PRO",
906                                              "subnetworkResource": {"resourceId": "2ea2acc0-a4ed-44f8-9d31-9cdc9e3ebe62",
907                                                                     "tenant": None,
908                                                                     "vimId": "vmware_vio",
909                                                                     "resourceName": "ZTE_VGW_SERVICE_NET39_s"}}]}