Modify test case of apply_grant
[vfc/gvnfm/vnflcm.git] / lcm / lcm / nf / vnfs / tests / test_vnf_create.py
1 # Copyright 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 import json
15 import uuid
16
17 import mock
18 from django.test import TestCase, Client
19 from rest_framework import status
20
21 from lcm.nf.vnfs.vnf_create.inst_vnf import InstVnf
22 from lcm.pub.database.models import NfInstModel, JobStatusModel, VmInstModel, NetworkInstModel, \
23     SubNetworkInstModel, PortInstModel
24 from lcm.pub.utils import restcall
25 from lcm.pub.utils.jobutil import JobUtil
26 from lcm.pub.utils.timeutil import now_time
27
28
29 class TestNFInstantiate(TestCase):
30     def setUp(self):
31         self.client = Client()
32         VmInstModel.objects.create(vmid="1", vimid="1", resouceid="11", insttype=0, instid="1", vmname="test_01",
33                                    operationalstate=1)
34         VmInstModel.objects.create(vmid="2", vimid="2", resouceid="22", insttype=0, instid="2",
35                                    vmname="test_02", operationalstate=1)
36         NetworkInstModel.objects.create(networkid='1', vimid='1', resouceid='1', name='pnet_network',
37                                         tenant='admin', insttype=0, instid='1')
38         SubNetworkInstModel.objects.create(subnetworkid='1', vimid='1', resouceid='1', networkid='1',
39                                            name='sub_pnet', tenant='admin', insttype=0, instid='1')
40         PortInstModel.objects.create(portid='1', networkid='1', subnetworkid='1', vimid='1', resouceid='1',
41                                      name='aaa_pnet_cp', tenant='admin', insttype=0, instid='1')
42
43     def tearDown(self):
44         pass
45         VmInstModel.objects.all().delete()
46         NetworkInstModel.objects.all().delete()
47         SubNetworkInstModel.objects.all().delete()
48         PortInstModel.objects.all().delete()
49
50     def assert_job_result(self, job_id, job_progress, job_detail):
51         jobs = JobStatusModel.objects.filter(
52             jobid=job_id,
53             progress=job_progress,
54             descp=job_detail)
55         self.assertEqual(1, len(jobs))
56
57     def test_swagger_ok(self):
58         response = self.client.get("/openoapi/vnflcm/v1/swagger.json", format='json')
59         self.assertEqual(response.status_code, status.HTTP_200_OK)
60
61     @mock.patch.object(restcall, 'call_req')
62     def test_create_vnf_identifier(self, mock_call_req):
63         r1 = [0, json.JSONEncoder().encode({'package_id':'222', 'csar_id':'2222'}), '200']  # get csar_id from nslcm by vnfd_id
64         r2 = [0, json.JSONEncoder().encode(vnfd_raw_data), '200']  # get rawdata from catalog by csar_id
65         mock_call_req.side_effect = [r1, r2]
66         data = {
67             "vnfdId": "111",
68             "vnfInstanceName": "vFW_01",
69             "vnfInstanceDescription": "vFW in Nanjing TIC Edge"}
70         response = self.client.post("/openoapi/vnflcm/v1/vnf_instances", data=data, format='json')
71         self.failUnlessEqual(status.HTTP_201_CREATED, response.status_code)
72         context = json.loads(response.content)
73         self.assertTrue(NfInstModel.objects.filter(nfinstid=context['vnfInstanceId']).exists())
74
75     @mock.patch.object(InstVnf, 'run')
76     def test_instantiate_vnf(self, mock_run):
77         mock_run.re.return_value = None
78         response = self.client.post("/openoapi/vnflcm/v1/vnf_instances/12/instantiate", data={}, format='json')
79         self.failUnlessEqual(status.HTTP_202_ACCEPTED, response.status_code)
80
81     def test_instantiate_vnf_when_inst_id_not_exist(self):
82         self.nf_inst_id = str(uuid.uuid4())
83         self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id)
84         JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY")
85         data = inst_req_data
86         InstVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run()
87         self.assert_job_result(self.job_id, 255, "VNF nf_inst_id is not exist.")
88
89     @mock.patch.object(restcall, 'call_req')
90     def test_instantiate_vnf_when_get_package_info_by_vnfdid_failed(self, mock_call_req):
91         NfInstModel.objects.create(nfinstid='1111', nf_name='vFW_01', package_id='222',
92                                    version='', vendor='', netype='', vnfd_model='', status='NOT_INSTANTIATED',
93                                    nf_desc='vFW in Nanjing TIC Edge', vnfdid='111', create_time=now_time())
94         r1 = [1, json.JSONEncoder().encode({'package_id':'222', 'csar_id':'2222'}), '200']  # get csar_id from nslcm by vnfd_id
95         mock_call_req.side_effect = [r1]
96         self.nf_inst_id = '1111'
97         self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id)
98         JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY")
99         data = inst_req_data
100         InstVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run()
101         self.assert_job_result(self.job_id, 255, "Failed to query package_info of vnfdid(111) from nslcm.")
102
103     @mock.patch.object(restcall, 'call_req')
104     def test_instantiate_vnf_when_get_rawdata_by_csarid_failed(self, mock_call_req):
105         NfInstModel.objects.create(nfinstid='1111', nf_name='vFW_01', package_id='222',
106                                    version='', vendor='', netype='', vnfd_model='', status='NOT_INSTANTIATED',
107                                    nf_desc='vFW in Nanjing TIC Edge', vnfdid='111', create_time=now_time())
108         r1 = [0, json.JSONEncoder().encode({'package_id':'222', 'csar_id':'2222'}), '200']  # get csar_id from nslcm by vnfd_id
109         r2 = [1, json.JSONEncoder().encode(vnfd_raw_data), '200']  # get rawdata from catalog by csar_id
110         mock_call_req.side_effect = [r1, r2]
111         self.nf_inst_id = '1111'
112         self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id)
113         JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY")
114         data = inst_req_data
115         InstVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run()
116         self.assert_job_result(self.job_id, 255, "Failed to query rawdata of CSAR(2222) from catalog.")
117
118     @mock.patch.object(restcall, 'call_req')
119     def test_instantiate_vnf_when_applay_grant_failed(self, mock_call_req):
120         NfInstModel.objects.create(nfinstid='1111', nf_name='vFW_01', package_id='222',
121                                    version='', vendor='', netype='', vnfd_model='', status='NOT_INSTANTIATED',
122                                    nf_desc='vFW in Nanjing TIC Edge', vnfdid='111', create_time=now_time())
123         r1 = [0, json.JSONEncoder().encode({'package_id': '222', 'csar_id': '2222'}), '200']  # get csar_id from nslcm by vnfd_id
124         r2 = [0, json.JSONEncoder().encode(vnfd_raw_data), '200']  # get rawdata from catalog by csar_id
125         r3 = [1, json.JSONEncoder().encode({"vim":
126                                                 {
127                                                     "vimid": '1',
128                                                     "accessinfo": {"tenant": '2'}
129                                                  }
130                                             }), '200']  # apply_grant_to_nfvo
131         mock_call_req.side_effect = [r1, r2, r3]
132         self.nf_inst_id = '1111'
133         self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id)
134         JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY")
135         data = inst_req_data
136         InstVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run()
137         self.assert_job_result(self.job_id, 255, "Nf instancing apply grant exception")
138
139     # @mock.patch.object(restcall, 'call_req')
140     # def test_instantiate_vnf_when_(self, mock_call_req):
141     #     NfInstModel.objects.create(nfinstid='1111', nf_name='vFW_01', package_id='222',
142     #                                version='', vendor='', netype='', vnfd_model='', status='NOT_INSTANTIATED',
143     #                                nf_desc='vFW in Nanjing TIC Edge', vnfdid='111', create_time=now_time())
144     #     r1 = [0, json.JSONEncoder().encode({'package_id': '222', 'csar_id': '2222'}),
145     #           '200']  # get csar_id from nslcm by vnfd_id
146     #     r2 = [0, json.JSONEncoder().encode(vnfd_raw_data), '200']  # get rawdata from catalog by csar_id
147     #     r3 = [0, json.JSONEncoder().encode({"vim":{"vimid": '1', "accessinfo": {"tenant": '2'}}}), '200']  # apply_grant_to_nfvo
148     #     mock_call_req.side_effect = [r1, r2, r3]
149     #     self.nf_inst_id = '1111'
150     #     self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id)
151     #     JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY")
152     #     data = inst_req_data
153     #     InstVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run()
154     #     self.assert_job_result(self.job_id, 255, "Nf instancing apply grant exception")
155
156
157
158     # @mock.patch.object(restcall, 'call_req')
159     # # @mock.patch.object(adaptor, 'create_vim_res')
160     # def test_instantiate_vnf_when_create_res_failed(self, mock_call_req):
161     #     NfvoRegInfoModel.objects.create(nfvoid='nfvo111', vnfminstid='vnfm111', apiurl='http://10.74.44.11',
162     #                                     nfvouser='root', nfvopassword='root123')
163     #     r1 = [0, json.JSONEncoder().encode(vnfd_model_dict), '200']
164     #     r2 = [0, json.JSONEncoder().encode(vnfd_model_dict), '200']
165     #     r3 = [0, json.JSONEncoder().encode('Nf instancing apply grant'), '200']
166     #     # r4 = [0, json.JSONEncoder().encode('Nf instancing apply resource'), '200']
167     #     mock_call_req.side_effect = [r1, r2, r3]
168     #     # mock_create_vim_res.re.return_value = None
169     #     create_data = {
170     #         "vnfdId": "111",
171     #         "vnfInstanceName": "vFW_01",
172     #         "vnfInstanceDescription": " vFW in Nanjing TIC Edge"}
173     #     self.nf_inst_id = CreateVnf(create_data).do_biz()
174     #     self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id)
175     #     JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY")
176     #     data = inst_req_data
177     #     InstVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run()
178     #     self.assert_job_result(self.job_id, 255, "Create resource failed")
179
180     # @mock.patch.object(restcall, 'call_req')
181     # # @mock.patch.object(adaptor, 'create_vim_res')
182     # def test_instantiate_vnf_success(self, mock_call_req):
183     #     NfvoRegInfoModel.objects.create(nfvoid='nfvo111', vnfminstid='vnfm111', apiurl='http://10.74.44.11',
184     #                                     nfvouser='root', nfvopassword='root123')
185     #     r1 = [0, json.JSONEncoder().encode(vnfd_model_dict), '200']
186     #     r2 = [0, json.JSONEncoder().encode(vnfd_model_dict), '200']
187     #     r3 = [0, json.JSONEncoder().encode('Nf instancing apply grant'), '200']
188     #     r4 = [0, json.JSONEncoder().encode('None'), '200']
189     #     mock_call_req.side_effect = [r1, r2, r3, r4]
190     #     # mock_create_vim_res.re.return_value = None
191     #     create_data = {
192     #         "vnfdId": "111",
193     #         "vnfInstanceName": "vFW_01",
194     #         "vnfInstanceDescription": " vFW in Nanjing TIC Edge"}
195     #     self.nf_inst_id = CreateVnf(create_data).do_biz()
196     #     self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id)
197     #     JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY")
198     #     data = inst_req_data
199     #     InstVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run()
200     #     self.assert_job_result(self.job_id, 100, "Instantiate Vnf success.")
201
202 inst_req_data = {
203     "flavourId": "flavour_1",
204     "instantiationLevelId": "instantiationLevel_1",
205     "extVirtualLinks": [
206         {
207             "vlInstanceId": "1",
208             "vim": {
209                 "vimInfoId": "1",
210                 "vimId": "1",
211                 "interfaceInfo": {
212                     "vimType": "vim",
213                     "apiVersion": "v2",
214                     "protocolType": "http"
215                 },
216                 "accessInfo": {
217                     "tenant": "tenant_vCPE",
218                     "username": "vCPE",
219                     "password": "vCPE_321"
220                 },
221                 "interfaceEndpoint": "http://10.43.21.105:80/"
222             },
223             "resourceId": "1246",
224             "extCps": [
225                 {
226                     "cpdId": "11",
227                     "addresses": [
228                         {
229                             "addressType": "MAC",
230                             "l2AddressData": "00:f3:43:20:a2:a3"
231                         },
232                         {
233                             "addressType": "IP",
234                             "l3AddressData": {
235                                 "iPAddressType": "IPv4",
236                                 "iPAddress": "192.168.104.2"
237                             }
238                         }
239                     ],
240                     "numDynamicAddresses": 0
241                 }
242             ]
243         }
244     ],
245     "localizationLanguage": "en_US",
246     "additionalParams": {}
247 }
248
249 vnfd_model_dict = {
250     'local_storages': [],
251     'vdus': [
252         {
253             'volumn_storages': [],
254             'nfv_compute': {
255                 'mem_size': '',
256                 'num_cpus': u'2'},
257             'local_storages': [],
258             'vdu_id': u'vdu_omm.001',
259             'image_file': u'opencos_sss_omm_img_release_20150723-1-disk1',
260             'dependencies': [],
261             'vls': [],
262             'cps': [],
263             'properties': {
264                 'key_vdu': '',
265                 'support_scaling': False,
266                 'vdu_type': '',
267                 'name': '',
268                 'storage_policy': '',
269                 'location_info': {
270                     'vimId': '',
271                     'availability_zone': '',
272                     'region': '',
273                     'dc': '',
274                     'host': '',
275                     'tenant': ''},
276                 'inject_data_list': [],
277                 'watchdog': {
278                     'action': '',
279                     'enabledelay': ''},
280                 'local_affinity_antiaffinity_rule': {},
281                 'template_id': u'omm.001',
282                 'manual_scale_select_vim': False},
283             'description': u'singleommvm'},
284         {
285             'volumn_storages': [],
286             'nfv_compute': {
287                 'mem_size': '',
288                 'num_cpus': u'4'},
289             'local_storages': [],
290             'vdu_id': u'vdu_1',
291             'image_file': u'sss',
292             'dependencies': [],
293             'vls': [],
294             'cps': [],
295             'properties': {
296                 'key_vdu': '',
297                 'support_scaling': False,
298                 'vdu_type': '',
299                 'name': '',
300                 'storage_policy': '',
301                 'location_info': {
302                     'vimId': '',
303                     'availability_zone': '',
304                     'region': '',
305                     'dc': '',
306                     'host': '',
307                     'tenant': ''},
308                 'inject_data_list': [],
309                 'watchdog': {
310                     'action': '',
311                     'enabledelay': ''},
312                 'local_affinity_antiaffinity_rule': {},
313                 'template_id': u'1',
314                 'manual_scale_select_vim': False},
315             'description': u'ompvm'},
316         {
317             'volumn_storages': [],
318             'nfv_compute': {
319                 'mem_size': '',
320                 'num_cpus': u'14'},
321             'local_storages': [],
322             'vdu_id': u'vdu_2',
323             'image_file': u'sss',
324             'dependencies': [],
325             'vls': [],
326             'cps': [],
327             'properties': {
328                 'key_vdu': '',
329                 'support_scaling': False,
330                 'vdu_type': '',
331                 'name': '',
332                 'storage_policy': '',
333                 'location_info': {
334                     'vimId': '',
335                     'availability_zone': '',
336                     'region': '',
337                     'dc': '',
338                     'host': '',
339                     'tenant': ''},
340                 'inject_data_list': [],
341                 'watchdog': {
342                     'action': '',
343                     'enabledelay': ''},
344                 'local_affinity_antiaffinity_rule': {},
345                 'template_id': u'2',
346                 'manual_scale_select_vim': False},
347             'description': u'ompvm'},
348         {
349             'volumn_storages': [],
350             'nfv_compute': {
351                 'mem_size': '',
352                 'num_cpus': u'14'},
353             'local_storages': [],
354             'vdu_id': u'vdu_3',
355             'image_file': u'sss',
356             'dependencies': [],
357             'vls': [],
358             'cps': [],
359             'properties': {
360                 'key_vdu': '',
361                 'support_scaling': False,
362                 'vdu_type': '',
363                 'name': '',
364                 'storage_policy': '',
365                 'location_info': {
366                     'vimId': '',
367                     'availability_zone': '',
368                     'region': '',
369                     'dc': '',
370                     'host': '',
371                     'tenant': ''},
372                 'inject_data_list': [],
373                 'watchdog': {
374                     'action': '',
375                     'enabledelay': ''},
376                 'local_affinity_antiaffinity_rule': {},
377                 'template_id': u'3',
378                 'manual_scale_select_vim': False},
379             'description': u'ompvm'},
380         {
381             'volumn_storages': [],
382             'nfv_compute': {
383                 'mem_size': '',
384                 'num_cpus': u'4'},
385             'local_storages': [],
386             'vdu_id': u'vdu_10',
387             'image_file': u'sss',
388             'dependencies': [],
389             'vls': [],
390             'cps': [],
391             'properties': {
392                 'key_vdu': '',
393                 'support_scaling': False,
394                 'vdu_type': '',
395                 'name': '',
396                 'storage_policy': '',
397                 'location_info': {
398                     'vimId': '',
399                     'availability_zone': '',
400                     'region': '',
401                     'dc': '',
402                     'host': '',
403                     'tenant': ''},
404                 'inject_data_list': [],
405                 'watchdog': {
406                     'action': '',
407                     'enabledelay': ''},
408                 'local_affinity_antiaffinity_rule': {},
409                 'template_id': u'10',
410                 'manual_scale_select_vim': False},
411             'description': u'ppvm'},
412         {
413             'volumn_storages': [],
414             'nfv_compute': {
415                 'mem_size': '',
416                 'num_cpus': u'14'},
417             'local_storages': [],
418             'vdu_id': u'vdu_11',
419             'image_file': u'sss',
420             'dependencies': [],
421             'vls': [],
422             'cps': [],
423             'properties': {
424                 'key_vdu': '',
425                 'support_scaling': False,
426                 'vdu_type': '',
427                 'name': '',
428                 'storage_policy': '',
429                 'location_info': {
430                     'vimId': '',
431                     'availability_zone': '',
432                     'region': '',
433                     'dc': '',
434                     'host': '',
435                     'tenant': ''},
436                 'inject_data_list': [],
437                 'watchdog': {
438                     'action': '',
439                     'enabledelay': ''},
440                 'local_affinity_antiaffinity_rule': {},
441                 'template_id': u'11',
442                 'manual_scale_select_vim': False},
443             'description': u'ppvm'},
444         {
445             'volumn_storages': [],
446             'nfv_compute': {
447                 'mem_size': '',
448                 'num_cpus': u'14'},
449             'local_storages': [],
450             'vdu_id': u'vdu_12',
451             'image_file': u'sss',
452             'dependencies': [],
453             'vls': [],
454             'cps': [],
455             'properties': {
456                 'key_vdu': '',
457                 'support_scaling': False,
458                 'vdu_type': '',
459                 'name': '',
460                 'storage_policy': '',
461                 'location_info': {
462                     'vimId': '',
463                     'availability_zone': '',
464                     'region': '',
465                     'dc': '',
466                     'host': '',
467                     'tenant': ''},
468                 'inject_data_list': [],
469                 'watchdog': {
470                     'action': '',
471                     'enabledelay': ''},
472                 'local_affinity_antiaffinity_rule': {},
473                 'template_id': u'12',
474                 'manual_scale_select_vim': False},
475             'description': u'ppvm'}],
476     'volumn_storages': [],
477     'policies': {
478         'scaling': {
479             'targets': {},
480             'policy_id': u'policy_scale_sss-vnf-template',
481             'properties': {
482                 'policy_file': '*-vnfd.zip/*-vnf-policy.xml'},
483             'description': ''}},
484     'image_files': [
485         {
486             'description': '',
487             'properties': {
488                 'name': u'opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
489                 'checksum': '',
490                 'disk_format': u'VMDK',
491                 'file_url': u'./zte-cn-sss-main-image/OMM/opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
492                 'container_type': 'vm',
493                 'version': '',
494                 'hypervisor_type': 'kvm'},
495             'image_file_id': u'opencos_sss_omm_img_release_20150723-1-disk1'},
496         {
497             'description': '',
498             'properties': {
499                 'name': u'sss.vmdk',
500                 'checksum': '',
501                 'disk_format': u'VMDK',
502                 'file_url': u'./zte-cn-sss-main-image/NE/sss.vmdk',
503                 'container_type': 'vm',
504                 'version': '',
505                 'hypervisor_type': 'kvm'},
506             'image_file_id': u'sss'}],
507     'vls': [],
508     'cps': [],
509     'metadata': {
510         'vendor': u'zte',
511         'is_shared': False,
512         'description': '',
513         'domain_type': u'CN',
514         'version': u'v4.14.10',
515         'vmnumber_overquota_alarm': False,
516         'cross_dc': False,
517         'vnf_type': u'SSS',
518         'vnfd_version': u'V00000001',
519         'id': u'sss-vnf-template',
520         'name': u'sss-vnf-template'},
521     "flavourId": "flavour_1",
522     "instantiationLevelId": "instantiationLevel_1",
523     "extVirtualLinks": [
524         {
525             "vlInstanceId": "1",
526             "vim": {
527                 "vimInfoId": "1",
528                 "vimId": "1",
529                 "interfaceInfo": {
530                     "vimType": "vim",
531                     "apiVersion": "v2",
532                     "protocolType": "http"
533                 },
534                 "accessInfo": {
535                     "tenant": "tenant_vCPE",
536                     "username": "vCPE",
537                     "password": "vCPE_321"
538                 },
539                 "interfaceEndpoint": "http://10.43.21.105:80/"
540             },
541             "resourceId": "1246",
542             "extCps": [
543                 {
544                     "cpdId": "11",
545                     "addresses": [
546                         {
547                             "addressType": "MAC",
548                             "l2AddressData": "00:f3:43:20:a2:a3"
549                         },
550                         {
551                             "addressType": "IP",
552                             "l3AddressData": {
553                                 "iPAddressType": "IPv4",
554                                 "iPAddress": "192.168.104.2"
555                             }
556                         }
557                     ],
558                     "numDynamicAddresses": 0
559                 }
560             ]
561         }
562     ],
563     "localizationLanguage": "en_US",
564     "additionalParams": {}
565 }
566
567 vnfd_raw_data = {
568     "rawData": {
569         "instance": {
570             "metadata": {
571                 "is_shared": False,
572                 "plugin_info": "vbrasplugin_1.0",
573                 "vendor": "zte",
574                 "request_reclassification": False,
575                 "name": "vbras",
576                 "version": 1,
577                 "vnf_type": "vbras",
578                 "cross_dc": False,
579                 "vnfd_version": "1.0.0",
580                 "id": "zte_vbras_1.0",
581                 "nsh_aware": True
582             },
583             "nodes": [
584                 {
585                     "id": "aaa_dnet_cp_0xu2j5sbigxc8h1ega3if0ld1",
586                     "type_name": "tosca.nodes.nfv.ext.zte.CP",
587                     "template_name": "aaa_dnet_cp",
588                     "properties": {
589                         "bandwidth": {
590                             "type_name": "integer",
591                             "value": 0
592                         },
593                         "direction": {
594                             "type_name": "string",
595                             "value": "bidirectional"
596                         },
597                         "vnic_type": {
598                             "type_name": "string",
599                             "value": "normal"
600                         },
601                         "sfc_encapsulation": {
602                             "type_name": "string",
603                             "value": "mac"
604                         },
605                         "order": {
606                             "type_name": "integer",
607                             "value": 2
608                         }
609                     },
610                     "relationships": [
611                         {
612                             "name": "guest_os",
613                             "source_requirement_index": 0,
614                             "target_node_id": "AAA_image_d8aseebr120nbm7bo1ohkj194",
615                             "target_capability_name": "feature"
616                         }
617                     ]
618                 },
619                 {
620                     "id": "LB_Image_oj5l2ay8l2g6vcq6fsswzduha",
621                     "type_name": "tosca.nodes.nfv.ext.ImageFile",
622                     "template_name": "LB_Image",
623                     "properties": {
624                         "disk_format": {
625                             "type_name": "string",
626                             "value": "qcow2"
627                         },
628                         "file_url": {
629                             "type_name": "string",
630                             "value": "/SoftwareImages/image-lb"
631                         },
632                         "name": {
633                             "type_name": "string",
634                             "value": "image-lb"
635                         }
636                     }
637                 }
638             ]
639         },
640         "model": {
641             "metadata": {
642                 "is_shared": False,
643                 "plugin_info": "vbrasplugin_1.0",
644                 "vendor": "zte",
645                 "request_reclassification": False,
646                 "name": "vbras",
647                 "version": 1,
648                 "vnf_type": "vbras",
649                 "cross_dc": False,
650                 "vnfd_version": "1.0.0",
651                 "id": "zte_vbras_1.0",
652                 "nsh_aware": True
653             },
654             "node_templates": [
655                 {
656                     "name": "aaa_dnet_cp",
657                     "type_name": "tosca.nodes.nfv.ext.zte.CP",
658                     "default_instances": 1,
659                     "min_instances": 0,
660                     "properties": {
661                         "bandwidth": {
662                             "type_name": "integer",
663                             "value": 0
664                         }
665                     },
666                     "requirement_templates": [
667                         {
668                             "name": "virtualbinding",
669                             "target_node_template_name": "AAA",
670                             "target_capability_name": "virtualbinding"
671                         }
672                     ]
673                 }
674             ]
675         }
676     }
677 }