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