Add vnfd validity check
[vfc/gvnfm/vnflcm.git] / lcm / lcm / pub / verifyvnfd / const.py
1 # Copyright (C) 2019 ZTE. All Rights Reserved.
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
16 vnfd_model1 = {
17     'metadata': {
18         'vendor': 'zte',
19         'is_shared': False,
20         'description': '',
21         'domain_type': 'CN',
22         'version': 'v4.14.10',
23         'vmnumber_overquota_alarm': False,
24         'cross_dc': False,
25         'vnf_type': 'SSS',
26         'vnfd_version': 'V00000001',
27         'id': 'sss-vnf-template',
28         'name': 'sss-vnf-template'
29     },
30     'vdus': [
31         {
32             "vdu_id": "vdu1Id",
33             "description": "vdu description",
34             "properties": {
35                 "name": "vduinstname",
36                 "vdu_type": "OMP",
37                 "key_vdu": True,
38                 "support_scaling": True,
39                 "location_info": {
40                     "vimid": "vimid",
41                     "tenant": "tenantname",
42                     "availability_zone": "zone1",
43                     "host": "host1"
44                 },
45                 "local_affinity_antiaffinity_rule": [
46                     {
47                         "affinity_antiaffinity": "anti-affinity",
48                         "scope": "node"
49                     },
50                     {
51                         "affinity_antiaffinity": "affinity",
52                         "scope": "zone"
53                     }
54                 ],
55                 "inject_data_list": [
56                     {
57                         "file_name": "abc.xml",
58                         "file_data": "<a>xxx</a><b>ssss</b>"
59                     }
60                 ],
61                 "storage_policy": "HIGH",
62                 "template_id": "26",
63                 "manual_scale_select_vim": False,
64                 "watchdog": {
65                     "enabledelay": 600000,
66                     "action": "reset"
67                 },
68                 "is_predefined": False,
69                 "allow_scale_updown": False,
70                 "inject_network_address": True,
71                 "inner_hugepage_num": 100,
72                 "inner_hugepage_size": "2048",
73                 "action": "add"
74             },
75             "image_file": 'sss',
76             "local_storages": [
77                 "local_storage_id1",
78                 "local_storage_id2"
79             ],
80             "virtual_storages": [
81                 {
82                     "virtual_storage_id": "volume_storage1",
83                     "location": "/usr/data",
84                     "device": "/dev/hda1"
85                 }
86             ],
87             "dependencies": [
88                 "vdu1Id",
89                 "vduNId"
90             ],
91             "nfv_compute": {
92                 "num_cpus": 4,
93                 "mem_size": "1 GB",
94                 "cpu_frequency": "1GHz",
95                 "flavor_extra_specs": {
96                     "hw: cpu_policy": "shared",
97                     "hw: cpu_max_threads": 50,
98                     "hw: cpu_sockets": 10,
99                     "hw: cpu_max_sockets": 20,
100                     "hw: cpu_max_cores": 8,
101                     "hw: cpu_threads": 30,
102                     "hw: numa_mem.0": 12288,
103                     "hw: hugepage_num": 100,
104                     "hw: high_performance": "dvs_high",
105                     "hw: numa_nodes": 1,
106                     "hw: numa_cpus.0": "2,4,8",
107                     "hw: numa_pci": True,
108                     "hw: cpu_cores": 4,
109                     "pci_passthrough: alias": "ColetoCreek: 1",
110                     "hw: mem_page_size": "large",
111                     "hw: mem_paging_mechanism": "EPT"
112                 }
113             },
114             "vls": [
115                 "vlId1",
116             ],
117             "cps": [
118                 "cpId1",
119             ],
120             "scalable": {
121                 "min_instances": 1,
122                 "max_instances": 2,
123                 "default_instances": 1
124             },
125             "interfaces": {
126                 "Standard": {
127                     "create": {
128                         "implementation": "<implementationScript>",
129                         "inputs": {
130                             "param1Name": "value1",
131                             "paramNName": "valueN"
132                         }
133                     },
134                     "configure": {
135                         "implementation": "<implementationScript>",
136                         "inputs": {
137                             "param1Name": "value1",
138                             "paramNName": "valueN"
139                         }
140                     },
141                     "start": {
142                         "implementation": "<implementationScript>",
143                         "inputs": {
144                             "param1Name": "value1",
145                             "paramNName": "valueN"
146                         }
147                     },
148                     "stop": {
149                         "implementation": "<implementationScript>",
150                         "inputs": {
151                             "param1Name": "value1",
152                             "paramNName": "valueN"
153                         }
154                     },
155                     "delete": {
156                         "implementation": "<implementationScript>",
157                         "inputs": {
158                             "param1Name": "value1",
159                             "paramNName": "valueN"
160                         }
161                     }
162                 }
163             },
164             "artifacts": [
165             ]
166         }
167     ],
168     'volume_storages': [
169         {
170             "volume_storage_id": "volume_storage1",
171             "description": "",
172             "properties": {
173                 "size": "\"100 GB\"",
174                 "volume_id": "",
175                 "volume_name": "volumeStorage1",
176                 "custom_volume_type": "type1",
177                 "disk_type": "data",
178                 "delete_on_termination_vm": True,
179                 "location_info": {
180                     "vimid": "vimid_1",
181                     "tenant": "tenantname_1",
182                     "availability_zone": "zone1"
183                 },
184                 "is_predefined": False,
185                 "is_shared": False
186             },
187             "image_file": [
188                 "volume_image"
189             ]
190         }
191     ],
192     'policies': {
193         'scaling': {
194             'targets': {
195
196             },
197             'policy_id': 'policy_scale_sss-vnf-template',
198             'properties': {
199                 'policy_file': '*-vnfd.zip/*-vnf-policy.xml'
200             },
201             'description': ''
202         }
203     },
204     'image_files': [
205         {
206             'description': '',
207             'properties': {
208                 'name': 'opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
209                 'checksum': '',
210                 'disk_format': 'VMDK',
211                 'file_url': './zte-cn-sss-main-image/OMM/opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
212                 'container_type': 'vm',
213                 'version': '',
214                 'hypervisor_type': 'kvm'
215             },
216             'image_file_id': 'opencos_sss_omm_img_release_20150723-1-disk1'
217         },
218         {
219             'description': '',
220             'properties': {
221                 'name': 'sss.vmdk',
222                 'checksum': '',
223                 'disk_format': 'VMDK',
224                 'file_url': './zte-cn-sss-main-image/NE/sss.vmdk',
225                 'container_type': 'vm',
226                 'version': '',
227                 'hypervisor_type': 'kvm'
228             },
229             'image_file_id': 'sss'
230         }
231     ],
232     'vls': [
233         {
234             "vl_id": "vldId1",
235             "description": "",
236             "properties": {
237                 "name": "umac_241_control",
238                 "network_name": "umac_control",
239                 "is_predefined": False,
240                 "vendor": "zte",
241                 "netmask": "255.255.255.0",
242                 "mtu": 1500,
243                 "network_type": "vlan",
244                 "physical_network": "phynet01",
245                 "segmentation_id": "30",
246                 "vlan_transparent": False,
247                 "vds_name": "vds1",
248                 "cidr": "192.168.199.0/24",
249                 "ip_version": 4,
250                 "gateway_ip": "192.168.199.1",
251                 "dhcp_enabled": False,
252                 "dns_nameservers": [
253                     "192.168.0.4",
254                     "192.168.0.10"
255                 ],
256                 "start_ip": "192.168.199.2",
257                 "end_ip": "192.168.199.254",
258                 "host_routes": [
259                     {
260                         "destination": "10.43.26.0/24",
261                         "nexthop": "10.41.23.1"
262                     }
263                 ],
264                 "location_info": {
265                     "vimid": "vimid_1",
266                     "tenant": "tenantname_1"
267                 },
268                 "cloud_type": "IaaS",
269                 "vl_profile": {"networkName": "test"},
270                 "connectivity_type": {}
271             },
272             "route_id": "router01",
273             "route_external": False
274         }
275     ],
276     'cps': [
277         {
278             "cp_id": "cpId1",
279             "description": "",
280             "properties": {
281                 "name": "",
282                 "mac_address": "00:d9:00:82:11:e1",
283                 "ip_address:": "192.168.1.21",
284                 "ip_range_start": "192.168.1.20",
285                 "ip_range_end": "192.168.1.29",
286                 "floating_ip_address": {
287                     "external_network": "extnet01",
288                     "ip_address": "10.43.53.23"
289                 },
290                 "service_ip_address": "192.168.1.23",
291                 "order": 1,
292                 "bandwidth": 1000,
293                 "vnic_type": "normal",
294                 "allowed_address_pairs": [
295                     {
296                         "ip": "192.168.1.13",
297                         "mac": "00:f3:43:20:a2:a3"
298                     }
299                 ],
300                 "bond": "none",
301                 "bond_index": 1,
302                 "macbond": "00:d9:00:82:11:d1",
303                 "sfc_encapsulation": "",
304                 "direction": "",
305                 "gateway_ip": "192.168.199.1",
306                 "netmask": "255.255.255.0",
307                 "interface_name": "fe-01-02",
308                 "is_virtual": False,
309                 "function": "control",
310                 "protocol_data": [
311                     {
312                         "address_data": {
313                             "l3_address_data": {
314                                 "fixed_ip_address": "test"
315                             },
316                         },
317                     },
318                 ]
319
320             },
321             "vl_id": "vldId1",
322             "vdu_id": "vdu1Id"
323         }
324     ],
325     'local_storages': [
326
327     ],
328 }
329
330
331 vnfd_model2 = {
332     "volume_storages": [
333         {
334             "volume_storage_id": "test",
335             "properties": {
336                 "location_info": {
337                     "vimid": "vim_1",
338                     "tenant": "chinamobile",
339                     "availability_zone": "test",
340                 },
341                 "volume_name": "test",
342                 "custom_volume_type": "test",
343                 "size_of_storage": "\"10 GB\"",
344             },
345             "image_file": "test",
346         },
347     ],
348     "vls": [
349         {
350             "vl_id": "test",
351             "properties": {
352                 "location_info": {
353                     "vimid": "test",
354                     "tenant": "chinamobile",
355                 },
356                 "vl_profile": {
357                     "networkName": "test",
358                     "networkType": "test",
359                     "physicalNetwork": "test",
360                     "vlanTransparent": "test",
361                     "segmentationId": "1",
362                     "cidr": "test",
363                     "dhcpEnabled": "test",
364                     "gatewayIp": "test",
365                     "startIp": "test",
366                     "endIp": "test",
367                 },
368                 "connectivity_type": {
369                     "layer_protocol": "ipv4",
370                 },
371                 "dns_nameservers": "test",
372                 "host_routes": "test",
373             },
374             "route_external": "test",
375         }
376     ],
377     "cps": [
378         {
379             "vdu_id": "test",
380             "cp_id": "cp1",
381             "networkId": "",  # TODO
382             "subnetId": "",  # TODO
383             "vl_id": "test",
384             "properties": {
385                 "name": "test",
386                 "mac_address": "test",
387                 "protocol_data": [
388                     {
389                         "address_data": {
390                             "l3_address_data": {
391                                 "fixed_ip_address": "test"
392                             },
393                         },
394                     },
395                 ],
396                 "vnic_type": "direct",
397                 "role": "root",
398                 "virtual_network_interface_requirements": [
399                     {
400                         "network_interface_requirements": {
401                             "interfaceType": '{"schemaVersion": "0", "schemaLocation":"", "platformId": "generic", "mandatory": false, "configurationValue": "SR-IOV"}'
402                         },
403                         "support_mandatory": False,
404                         "name": "SRIOV_Port",
405                         "description": "sriov"
406                     }
407                 ]
408             }
409         }
410     ],
411     "vdus": [
412         {
413             "vdu_id": "test",
414             "properties": {
415                 "location_info": {
416                     "vimid": "test",
417                     "tenant": "chinamobile",
418                     "availability_zone": "test",
419                     "vnfId": "",
420                     "vnfName": "",
421                     "cloudOwner": "",
422                     "cloudRegionId": "",
423                     "vduInfo": [
424                         {
425                             "vduName": "VDU_vbng_0",
426                             "flavorId": "12345",
427                             "directive": ""
428                         }
429                     ]
430                 },
431                 "name": "test",
432                 "inject_files": [],
433                 "user_data": "test",
434                 "meta_data": {},
435             },
436             "cps": [],
437             "type": "tosca.nodes.nfv.Vdu.Compute",
438             "virtual_compute": {
439                 "virtual_cpu": {
440                     "num_virtual_cpu": "16",
441                 },
442                 "virtual_memory": {
443                     "virtual_mem_size": "8000 MB",
444                     "vdu_memory_requirements": {
445                         "memoryPageSize": "8 MB",
446                     },
447                 },
448             },
449             "virtual_storages": [{
450                 "virtual_storage_id": "test",
451                 "type_of_storage": "ephemeral",
452                 "size_of_storage": "10 GB",
453             }],
454             "type": "tosca.nodes.nfv.Vdu.Compute",
455             "artifacts": [
456                 {
457                     "artifact_name": "sw_image",
458                     "file": "sss.vmdk",
459                 },
460             ],
461             "volume_storages": [
462                 {
463                     "volume_storage_id": "test",
464                 }
465             ],
466         },
467     ],
468     "image_files": [],
469     "routers": [],
470     "local_storages": [],
471     "vnf_exposed": {
472         "external_cps": [],
473         "forward_cps": []
474     },
475     "inputs": {
476         "pe1_id": {
477             "type": "string",
478             "description": "pe1_idofunderlayvpn"
479         },
480         "pe2_id": {
481             "type": "string",
482             "description": "pe2_idofunderlayvpn"
483         },
484         "serviceType": {
485             "type": "string",
486             "description": "serviceTypeofunderlayvpn"
487         },
488         "description": {
489             "type": "string",
490             "description": "descriptionofunderlayvpn"
491         },
492         "ac2_route": {
493             "type": "string",
494             "description": "ac2_routeofunderlayvpn"
495         },
496         "ac1_route": {
497             "type": "string",
498             "description": "ac1_routeofunderlayvpn"
499         },
500         "ac1_svlan": {
501             "type": "integer",
502             "description": "ac1_svlanofunderlayvpn"
503         },
504         "ac2_ip": {
505             "type": "string",
506             "description": "ac2_ipofunderlayvpn"
507         },
508         "ac1_ip": {
509             "type": "string",
510             "description": "ac1_ipofunderlayvpn"
511         },
512         "ac2_port": {
513             "type": "string",
514             "description": "ac2_portofunderlayvpn"
515         },
516         "topology": {
517             "type": "string",
518             "description": "topologyofunderlayvpn"
519         },
520         "technology": {
521             "type": "string",
522             "description": "technologyofunderlayvpn"
523         },
524         "ac1_port": {
525             "type": "string",
526             "description": "ac1_portofunderlayvpn"
527         },
528         "ac2_svlan": {
529             "type": "integer",
530             "description": "ac2_svlanofunderlayvpn"
531         },
532         "name": {
533             "type": "string",
534             "description": "Nameofunderlayervpn"
535         }
536     },
537     "metadata": {
538         "designer": "sdno",
539         "name": "underlayervpn",
540         "csarVersion": "1.0",
541         "csarType": "SSAR",
542         "csarProvider": "huawei",
543         "version": "1.0",
544         "type": "SSAR",
545         "id": "ns_underlayervpn_1_0"
546     }
547 }
548
549 vnfd_model3 = {
550     "volume_storages": [
551         {
552             "volume_storage_id": "test",
553             "properties": {
554                 "location_info": {
555                     "vimid": "vim_1",
556                     "tenant": "chinamobile",
557                     "availability_zone": "test",
558                 },
559                 "volume_name": "test",
560                 "custom_volume_type": "test",
561                 "size_of_storage": "\"10 GB\"",
562             },
563             "image_file": "test",
564         },
565     ],
566     "vnf": {
567         "type": "tosca.nodes.nfv.VNF",
568         "requirements": {
569             "virtual_link": [
570                 "ext_cp",
571                 "virtual_link"
572             ]
573         },
574         "properties": {
575             "descriptor_id": "b1bb0ce7-1234-4fa7-95ed-4840d70a1179",
576             "flavour_description": "simple",
577             "descriptor_verison": "1.0",
578             "software_version": "1.0.0",
579             "template_name": "test",
580             "vnfm_info": [
581                 "vnfm"
582             ],
583             "descriptor_version": "1.0.0",
584             "provider": "zte",
585             "flavour_id": "simple",
586             "product_name": "test"
587         },
588         "capabilities": {
589
590         },
591         "metadata": {
592             "template_name": "test",
593             "template_version": "1.0",
594             "template_author": "ZTE"
595         }
596     },
597     "vdus": [
598         {
599             "description": "",
600             "virtual_storages": [
601                 {
602                     "virtual_storage_id": "test",
603                     "type_of_storage": "ephemeral",
604                     "size_of_storage": "10 GB",
605                 }
606             ],
607             "volume_storages": [
608                 {
609                     "volume_storage_id": "test",
610                 }
611             ],
612             "vdu_id": "sunshine",
613             "artifacts": [
614                 {
615                     "artifact_name": "sw_image",
616                     "type": "tosca.artifacts.nfv.SwImage",
617                     "file": "sss.vmdk"
618                 }
619             ],
620             "dependencies": [
621
622             ],
623             "virtual_compute": {
624                 "virtual_cpu": {
625                     "num_virtual_cpu": 2
626                 },
627                 "virtual_memory": {
628                     "virtual_mem_size": "4096 MB"
629                 },
630             },
631             "vls": [
632
633             ],
634             "cps": [
635                 "ext_cp"
636             ],
637             "type": "tosca.nodes.nfv.Vdu.Compute",
638             "properties": {
639                 "vdu_profile": {
640                     "max_number_of_instances": 3,
641                     "min_number_of_instances": 1
642                 },
643                 "name": "sunshine1234",
644                 "sw_image_data": {
645                     "operating_system": "linux",
646                     "name": "ubuntu",
647                     "checksum": {
648                         "hash": "d0e7828293355a07c2dccaaa765c80b507e60e6167067c950dc2e6b0da0dbd34",
649                         "algorithm": "SHA-256"
650                     },
651                     "min_ram": "2 GB",
652                     "disk_format": "qcow2",
653                     "version": 16.04,
654                     "container_format": "bare",
655                     "min_disk": "2 GB",
656                     "size": "2 GB"
657                 },
658                 "description": "vdu test",
659                 "location_info": {
660                     "vimid": "",
661                     "tenant": "",
662                     "availability_zone": "",
663                     "vnfId": "",
664                     "vnfName": "",
665                     "cloudOwner": "",
666                     "cloudRegionId": "",
667                     "vduInfo": [
668                         {
669                             "vduName": "sunshine1234",
670                             "flavorId": "12345",
671                             "directive": ""
672                         }
673                     ]
674                 }
675             }
676         }
677     ],
678     "description": "test",
679     "inputs": {
680
681     },
682     "graph": {
683         "sunshine": [
684             "ext_cp"
685         ],
686         "ext_cp": [
687
688         ]
689     },
690     "basepath": "/tmp/tmpil6wVG",
691     "vnf_exposed": {
692         "external_cps": [
693             {
694                 "key_name": "virtual_link",
695                 "cpd_id": "ext_cp"
696             }
697         ],
698         "forward_cps": [
699
700         ]
701     },
702     "policies": [
703         {
704             "type": "tosca.policies.nfv.InstantiationLevels",
705             "targets": "",
706             "properties": {
707                 "default_level": "instantiation_level_1",
708                 "levels": {
709                     "instantiation_level_1": {
710                         "scale_info": {
711                             "sunshine_aspect": {
712                                 "scale_level": 0
713                             }
714                         },
715                         "description": "vnf test instantiation_level_1"
716                     },
717                     "instantiation_level_2": {
718                         "scale_info": {
719                             "sunshine_aspect": {
720                                 "scale_level": 1
721                             }
722                         },
723                         "description": "vnf test instantiation_level_2"
724                     },
725                     "instantiation_level_3": {
726                         "scale_info": {
727                             "sunshine_aspect": {
728                                 "scale_level": 2
729                             }
730                         },
731                         "description": "vnf test instantiation_level_3"
732                     }
733                 }
734             }
735         },
736         {
737             "type": "tosca.policies.nfv.VduInstantiationLevels",
738             "targets": [
739                 "sunshine"
740             ],
741             "properties": {
742                 "levels": {
743                     "instantiation_level_1": {
744                         "number_of_instances": 1
745                     },
746                     "instantiation_level_2": {
747                         "number_of_instances": 2
748                     },
749                     "instantiation_level_3": {
750                         "number_of_instances": 3
751                     }
752                 }
753             }
754         },
755         {
756             "type": "tosca.policies.nfv.ScalingAspects",
757             "targets": "",
758             "properties": {
759                 "aspects": {
760                     "sunshine_aspect": {
761                         "max_scale_level": 2,
762                         "description": "sunshine aspect",
763                         "name": "sunshine_aspect",
764                         "step_deltas": [
765                             "sunshine_delta"
766                         ]
767                     }
768                 }
769             }
770         },
771         {
772             "type": "tosca.policies.nfv.VduInitialDelta",
773             "targets": [
774                 "sunshine"
775             ],
776             "properties": {
777                 "initial_delta": {
778                     "number_of_instances": 1
779                 }
780             }
781         },
782         {
783             "type": "tosca.policies.nfv.VduScalingAspectDeltas",
784             "targets": [
785                 "sunshine"
786             ],
787             "properties": {
788                 "deltas": {
789                     "sunshine_delta": {
790                         "number_of_instances": 1
791                     }
792                 },
793                 "aspect": "sunshine_aspect"
794             }
795         }
796     ],
797     "vls": [
798
799     ],
800     "cps": [
801         {
802             "vl_id": "",
803             "description": "",
804             "vdu_id": "sunshine",
805             "properties": {
806                 "trunk_mode": "false",
807                 "protocol_data": [{
808                     "address_data": {
809                         "address_type": "ip_address",
810                         "l3_address_data": {
811                             "floating_ip_activated": False,
812                             "ip_address_assignment": False
813                         }
814                     }
815                 }]
816             },
817             "cp_id": "ext_cp",
818             "cpd_id": "ext_cp"
819         }
820     ],
821     "metadata": {
822         "template_name": "test",
823         "template_version": "1.0",
824         "template_author": "ZTE"
825     }
826 }