Add input validation in substitution_mapping class
[parser.git] / tosca2heat / tosca-parser / toscaparser / extensions / nfv / tests / data / vRNC / Definitions / vRNC.yaml
1 ##    Licensed under the Apache License, Version 2.0 (the "License"); you may
2 ##    not use this file except in compliance with the License. You may obtain
3 ##    a copy of the License at
4 ##
5 ##         http://www.apache.org/licenses/LICENSE-2.0
6 ##
7 ##    Unless required by applicable law or agreed to in writing, software
8 ##    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 ##    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 ##    License for the specific language governing permissions and limitations
11 ##    under the License.
12
13 tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
14
15 metadata:
16   template_name: tosca_simple_profile_for_nfv_vRNC
17   template_author: opnfv_parser_project_from_zte
18   template_version: tosca_simple_profile_for_nfv_1_0
19
20 # Optional description of the definitions inside the file.
21 description: >
22   TOSCA simple profile for RNC
23     1. Compute Node MM, CM, DM, LB...
24       1.1 MM: MaintainModule;
25       1.2 CM: Control Module;
26       1.3 DM: Data Module;
27       1.4 LB: LineCard Module
28     2. Network Node VL and CP
29
30 imports:
31   - rnc_definition.yaml
32
33 # list of YAML alias anchors (or macros)
34 dsl_definitions:
35   compute_props_os_DEF: &compute_props_os_DEF
36     architecture: x86_64
37     type: Linux
38     distribution: Cirros
39     version: 0.3.2
40
41   compute_props_host_MM: &compute_props_host_MM
42     disk_size: 1 GB
43     num_cpus: 2
44     mem_size: 64 MB
45
46   compute_props_host_CM: &compute_props_host_CM
47     disk_size: 0 GB
48     num_cpus: 2
49     mem_size: 64 MB
50
51   compute_props_host_DM: &compute_props_host_DM
52     disk_size: 0 GB
53     num_cpus: 2
54     mem_size: 64 MB
55
56   compute_props_host_LB: &compute_props_host_LB
57     disk_size: 0 GB
58     num_cpus: 2
59     mem_size: 64 MB
60
61 # topology template definition of the cloud application or service
62 topology_template:
63   # a description of the topology template
64   description: >
65     simple RNC template
66
67   inputs:
68     mm_storage_size:
69       type: integer
70       default: 1
71       description: mm additional block storage size
72       constraints:
73         - in_range: [ 1, 200 ]
74     id:
75       type: string
76       description: ID of this VNF
77       default: UMTS
78     vendor:
79       type: string
80       description: name of the vendor who generate this VNF
81       default: ZTE
82     version:
83       type: version
84       description: version of the software for this VNF
85       default: 1.0
86
87   substitution_mappings:
88     node_type: rnc.nodes.VNF
89     requirements:
90       virtualLink_VNFM: [ MM_Port_CTRL, virtualLink ]
91       virtualLink_EMS: [ MM_Port_EMS, virtualLink ]
92       virtualLink_TRAFFIC: [ LB_Port_EXTERMEDIA, virtualLink ]
93
94   # definition of the node templates of the topology
95   node_templates:
96     MM_Active:
97       type: tosca.nodes.SoftwareComponent
98       properties:
99         component_version: 1.0
100       requirements:
101         - host: MM_Active_Host
102       interfaces:
103         Standard:
104           create:
105             implementation: mm_install.sh
106           configure:
107             implementation: mm_active_configure.sh
108
109     MM_Active_Host:
110       type: rnc.nodes.compute.MM
111       properties:
112         activestatus: 1
113         id: MM_Active
114       capabilities:
115         os:
116           properties: *compute_props_os_DEF
117         host:
118           properties: *compute_props_host_MM
119       requirements:
120         - local_storage:
121             node: MM_BlockStorage
122             relationship: Storage_attachesto
123         - high_availability: MM_Passive
124       artifacts:
125         #the VM image of MM
126         vm_image: mm.image
127
128     MM_Passive:
129       type: tosca.nodes.SoftwareComponent
130       properties:
131         component_version: 1.0
132       requirements:
133         - host: MM_Passive_Host
134       interfaces:
135         Standard:
136           create:
137             implementation: mm_install.sh
138           configure:
139             implementation: mm_passvie_configure.sh
140
141     MM_Passive_Host:
142       type: rnc.nodes.compute.MM
143       properties:
144         activestatus: 0
145         id: MM_Passive
146       capabilities:
147         os:
148           properties: *compute_props_os_DEF
149         host:
150           properties: *compute_props_host_MM
151       requirements:
152         - local_storage:
153             node: MM_BlockStorage
154             relationship: Storage_attachesto
155         - high_availability: MM_Active
156       artifacts:
157         #the VM image of MM
158         vm_image: mm.image
159
160     CM_Active:
161       type: tosca.nodes.SoftwareComponent
162       properties:
163         component_version: 1.0
164       requirements:
165         - host: CM_Active_Host
166       interfaces:
167         Standard:
168           create:
169             implementation: cm_install.sh
170           configure:
171             implementation: cm_active_configure.sh
172
173     CM_Active_Host:
174       type: rnc.nodes.compute.CM
175       properties:
176         activestatus: 1
177       capabilities:
178         os:
179           properties: *compute_props_os_DEF
180         host:
181           properties: *compute_props_host_CM
182         scalable:
183           properties:
184             min_instances: 1
185             max_instances: 12
186             default_instances: 1
187       requirements:
188         - high_availability: CM_Passive
189       artifacts:
190         #the VM image of CM
191         vm_image: cm.image
192
193     CM_Passive:
194       type: tosca.nodes.SoftwareComponent
195       properties:
196         component_version: 1.0
197       requirements:
198         - host: CM_Passive_Host
199       interfaces:
200         Standard:
201           create:
202             implementation: cm_install.sh
203           configure:
204             implementation: cm_passvie_configure.sh
205
206     CM_Passive_Host:
207       type: rnc.nodes.compute.CM
208       properties:
209         activestatus: 0
210       capabilities:
211         os:
212           properties: *compute_props_os_DEF
213         host:
214           properties: *compute_props_host_CM
215         scalable:
216           properties:
217             min_instances: 1
218             max_instances: 12
219             default_instances: 1
220       requirements:
221         - high_availability: CM_Active
222       artifacts:
223         #the VM image of CM
224         vm_image: mm.image
225
226     DM:
227       type: tosca.nodes.SoftwareComponent
228       properties:
229         component_version: 1.0
230       requirements:
231         - host: DM_Host
232       interfaces:
233         Standard:
234           create:
235             implementation: dm_install.sh
236           configure:
237             implementation: dm_configure.sh
238
239     DM_Host:
240       type: rnc.nodes.compute.DM
241       capabilities:
242         os:
243           properties: *compute_props_os_DEF
244         host:
245           properties: *compute_props_host_DM
246         scalable:
247           properties:
248             min_instances: 1
249             max_instances: 12
250             default_instances: 1
251       artifacts:
252         vm_image: dm.image
253
254     LB:
255       type: tosca.nodes.SoftwareComponent
256       properties:
257         component_version: 1.0
258       requirements:
259         - host: LB_Host
260       interfaces:
261         Standard:
262           create:
263             implementation: lb_install.sh
264           configure:
265             implementation: lb_configure.sh
266
267     LB_Host:
268       type: rnc.nodes.compute.LB
269       capabilities:
270         os:
271           properties: *compute_props_os_DEF
272         host:
273           properties: *compute_props_host_LB
274         scalable:
275           properties:
276             min_instances: 1
277             max_instances: 2
278             default_instances: 1
279       artifacts:
280         #the VM image of LB
281         vm_image: lb.image
282
283     MM_BlockStorage:
284       type: rnc.nodes.BlockStorage
285       properties:
286         size: { get_input: mm_storage_size }
287       interfaces:
288         Configure:
289           post_configure_target:
290             implementation: default_script.sh
291
292     CTRL_Net:
293       type: rnc.nodes.VL
294       properties:
295         vendor: ZTE
296         cidr: "128.0.0.0/8"
297         network_name: Ctrl_Net
298         network_type: vlan
299         segmentation_id: 110
300         dhcp_enabled: false
301
302     INTERMEDIA_Net:
303       type: rnc.nodes.VL
304       properties:
305         vendor: ZTE
306         cidr: 10.0.0.0/8
307         start_ip: 10.1.0.1
308         end_ip: 10.1.2.254
309         network_name: InterMedia_Net
310         network_type: vlan
311         segmentation_id: 111
312         dhcp_enabled: false
313
314     EXTERMEDIA_Net:
315       type: rnc.nodes.VL
316       properties:
317         vendor: ZTE
318         cidr: 172.1.0.0/16
319         start_ip: 172.1.0.2
320         end_ip: 172.1.2.254
321         gateway_ip: 172.1.0.1
322         network_name: ExterMdedia_Net
323         network_type: vlan
324         segmentation_id: 100
325         dhcp_enabled: false
326
327     EMS_Net:
328       type: rnc.nodes.VL
329       properties:
330         vendor: ZTE
331         cidr: 129.0.0.0/24
332         start_ip: 129.0.0.2
333         end_ip: 129.0.0.64
334         gateway_ip: 129.0.0.1
335         network_name: Ems_Net
336         network_type: vlan
337         segmentation_id: 101
338         dhcp_enabled: false
339
340     MM_Active_Port_EMS:
341       type: rnc.nodes.CP.MM
342       properties:
343         order: 0
344         is_default: true
345       requirements:
346         - virtualBinding: MM_Active_Host
347         - virtualLink: EMS_Net
348
349     MM_Active_Port_EXTERMEDIA:
350       type: rnc.nodes.CP.MM
351       properties:
352         order: 1
353         is_default: true
354       requirements:
355         - virtualBinding: MM_Active_Host
356         - virtualLink: EMS_Net
357
358     MM_Active_Port_CTRL:
359       type: rnc.nodes.CP.MM
360       properties:
361         order: 2
362         is_default: false
363       requirements:
364         - virtualBinding: MM_Active_Host
365         - virtualLink: CTRL_Net
366
367     MM_Active_Port_INTERMEDIA:
368       type: rnc.nodes.CP.MM
369       properties:
370         order: 3
371         is_default: false
372       requirements:
373         - virtualBinding: MM_Active_Host
374         - virtualLink: EXTERMEDIA_Net
375
376     MM_Passive_Port_EMS:
377       type: rnc.nodes.CP.MM
378       properties:
379         order: 0
380         is_default: true
381       requirements:
382         - virtualBinding: MM_Passive_Host
383         - virtualLink: EMS_Net
384
385     MM_Passive_Port_EXTERMEDIA:
386       type: rnc.nodes.CP.MM
387       properties:
388         order: 1
389         is_default: true
390       requirements:
391         - virtualBinding: MM_Passive_Host
392         - virtualLink: EMS_Net
393
394     MM_Passive_Port_CTRL:
395       type: rnc.nodes.CP.MM
396       properties:
397         order: 2
398         is_default: false
399       requirements:
400         - virtualBinding: MM_Passive_Host
401         - virtualLink: CTRL_Net
402
403     MM_Passive_Port_INTERMEDIA:
404       type: rnc.nodes.CP.MM
405       properties:
406         order: 3
407         is_default: false
408       requirements:
409         - virtualBinding: MM_Passive_Host
410         - virtualLink: EXTERMEDIA_Net
411
412     CM_Active_Port_CTRL:
413       type: rnc.nodes.CP.CM
414       properties:
415         order: 0
416         is_default: true
417       requirements:
418         - virtualBinding: CM_Active_Host
419         - virtualLink: CTRL_Net
420
421     CM_Active_Port_INTERMEDIA:
422       type: rnc.nodes.CP.CM
423       properties:
424         order: 1
425         is_default: false
426       requirements:
427         - virtualBinding: CM_Active_Host
428         - virtualLink: INTERMEDIA_Net
429
430     CM_Passive_Port_CTRL:
431       type: rnc.nodes.CP.CM
432       properties:
433         order: 0
434         is_default: true
435       requirements:
436         - virtualBinding: CM_Passive_Host
437         - virtualLink: CTRL_Net
438
439     CM_Passive_Port_INTERMEDIA:
440       type: rnc.nodes.CP.CM
441       properties:
442         order: 1
443         is_default: false
444       requirements:
445         - virtualBinding: CM_Passive_Host
446         - virtualLink: INTERMEDIA_Net
447
448     DM_Port_CTRL:
449       type: rnc.nodes.CP.DM
450       properties:
451         order: 0
452         is_default: true
453       requirements:
454         - virtualBinding: DM_Host
455         - virtualLink: CTRL_Net
456
457     DM_Port_INTERMEDIA:
458       type: rnc.nodes.CP.DM
459       properties:
460         order: 1
461         is_default: false
462       requirements:
463         - virtualBinding: DM_Host
464         - virtualLink: INTERMEDIA_Net
465
466     LB_Port_CTRL:
467       type: rnc.nodes.CP.LB
468       properties:
469         order: 0
470         is_default: true
471       requirements:
472         - virtualBinding: LB_Host
473         - virtualLink: CTRL_Net
474
475     LB_Port_INTERMEDIA:
476       type: rnc.nodes.CP.LB
477       properties:
478         order: 1
479         is_default: false
480       requirements:
481         - virtualBinding: LB_Host
482         - virtualLink: INTERMEDIA_Net
483
484     LB_Port_EXTERMEDIA:
485       type: rnc.nodes.CP.LB
486       properties:
487         order: 2
488         is_default: false
489       requirements:
490         - virtualBinding: LB_Host
491         - virtualLink: EXTERMEDIA_Net
492
493   # definition of the relationship templates of the topology
494   relationship_templates:
495     Storage_attachesto:
496       type: tosca.relationships.AttachesTo
497       properties:
498         location: /data_location
499
500   # definition of output parameters for the topology template
501   outputs:
502     private_ip_of_MM:
503       description: The private IP address of the MM.
504       value: { get_attribute: [ MM_Active_Host, private_address ] }
505
506     private_ip_of_CM:
507       description: The private IP address of the CM.
508       value: { get_attribute: [ CM_Active_Host, private_address ] }
509
510     private_ip_of_DM:
511       description: The private IP address of the DM.
512       value: { get_attribute: [ DM_Host, private_address ] }
513
514     private_ip_of_LB:
515       description: The private IP address of the LB.
516       value: { get_attribute: [ LB_Host, private_address ] }
517
518   # definition of logical groups of node templates within the topology
519   # To be continue about this section
520   groups:
521     AnitAffinityServerGroup:
522       type: tosca.groups.Root
523       description: >
524          Logical component grouping for anti affinity placement,
525          MM_Acitve, MM_Passive, CM_Acitve, CM_Passive, LB must host
526          on different host to reduce the impact to each other.
527       members: [ MM_Active, MM_Passive, CM_Active, CM_Passive, LB ]
528
529     AffinityServerGroup:
530       type: tosca.groups.Root
531       description: >
532         Logical component grouping for affinity placement,
533         CM and DM will be host on the same host to get high performence
534       members: [ CM_Active, DM ]
535
536   policies:
537     - AnitAffinityPolicy:
538         type: tosca.policies.Placement.Antilocate
539         description: Apply anti-locate placement policy to group
540         targets: [ AnitAffinityServerGroup ]
541
542     - AffinityPolicy:
543         type: tosca.policies.Placement.Colocate
544         description: Apply anti-locate placement policy to group
545         targets: [ AffinityServerGroup ]
546
547   #  ServerGroupScaling_DM: # added future
548   #    members: [ DM, ]# only one, will be error
549   #    policies:
550   #      - name: MyScaleUpPolicy
551   #      - type: tosca.policy.scale.up | tosca.policy.scale.down
552   #      - rule: fn.utilizaton [ DM ], greater_than: 80
553   #      - trigger: script_dm
554
555   #  ServerGroupScaling_LB: # added future
556   #    members: [ LB, ] # only one, will be error
557   #    policies:
558   #      - name: MyScaleUpPolicy
559   #      - type: tosca.policy.scale.up | tosca.policy.scale.down
560   #      - rule: fn.utilizaton [ LB ], greater_than: 80
561   #      - trigger: script_lb