[SDC-29] Amdocs OnBoard 1707 initial commit.
[sdc.git] / openecomp-be / lib / openecomp-sdc-translator-lib / openecomp-sdc-translator-core / src / test / resources / mock / services / heattotosca / subInterfaceToInterfaceConnection / vTSBC_AIC / inputfiles / perimeta_ha_sw.yaml
1 # Heat template which intstantiates a 1+1 HA Perimeta instance with 4 or 5
2 # vNICs.
3 #
4 # This is designed to be included in a higher level template.
5 #
6 # This template puts the Perimeta configuration in place using userdata
7 # injected via OpenStack's ConfigDrive mechanism.
8 #
9 # Host anti-affinity is achieved using different availability zones for
10 # the Perimeta instance or server group anti-affinity if they are in the
11 # same availability zone.
12 #
13 # Template requires Juno or above and has been tested on Kilo.
14 #
15 heat_template_version: 2014-10-16
16
17 description: >
18   HOT template to instantiate a Perimeta 1+1 HA instance with 4vNICs as part of a nested template
19
20 parameters:
21   vnf_id:
22     type: string
23     description: VNF ID of this deployment
24   vm_role:
25     type: string
26     description: Role of these VMs
27   vf_module_id:
28     type: string
29     description: Unique ID for this VF Module instance
30   system_names:
31     type: comma_delimited_list
32     description: List of system names of Perimeta instances.  Name of a specific instance is indexed by perimeta_instance_index
33   vm_a_names:
34     type: comma_delimited_list
35     description: List of names of Perimeta VM A instances, indexed by perimeta_instance_index
36   vm_b_names:
37     type: comma_delimited_list
38     description: List of names of Perimeta VM A instances, indexed by perimeta_instance_index
39   perimeta_instance_index:
40     type: number
41     description: Index of instance among multiple instances.  Use to retrieve correct parameter for this instance when passed all parameters for all instances.
42   perimeta_image_name:
43     type: string
44     description: Glance image for Perimeta instance
45     constraints:
46     - custom_constraint: glance.image
47   perimeta_flavor_name:
48     type: string
49     description: Flavor to use for creating VM instances
50     constraints:
51     - custom_constraint: nova.flavor
52   perimeta_keypair:
53     type: string
54     description: Keypair to use for accessing this Perimeta instance
55     constraints:
56     - custom_constraint: nova.keypair
57   availability_zone_0:
58     # Can be commented out along with references if always using a single availability zone
59     type: string
60     description: Availability zone for A instances.
61   availability_zone_1:
62     # Can be commented out along with references if always using a single availability zone
63     type: string
64     description: Availability zone for B instances.  May be the same as A instance.
65   mgmt_net_id:
66     type: string
67     description: Management network id
68     constraints:
69     - custom_constraint: neutron.network
70   mgmt_net_plen:
71     type: string
72     description: Prefix length of management network
73   mgmt_net_default_gateway:
74     type: string
75     description: IP address of management default gateway
76   mgmt_vips:
77     type: comma_delimited_list
78     description: List of management virtual IP addresses for all instances.
79   mgmt_a_ips:
80     type: comma_delimited_list
81     description: List of fixed IP addresses to use as management IPs of A instances.
82   mgmt_b_ips:
83     type: comma_delimited_list
84     description: List of fixed IP addresses to use as management IPs of B instances.
85   mgmt_sec_groups:
86     type: comma_delimited_list
87     description: List of security groups to add on management interfaces.
88   ha_net_id:
89     type: string
90     description: HA network id
91     constraints:
92     - custom_constraint: neutron.network
93   ha_network_plen:
94     type: number
95     constraints:
96     - range: { min: 0, max: 32 }
97       description: ha_network_plen must be between 0 and 32
98   ha_a_ips:
99     type: comma_delimited_list
100     description: List of fixed IP addresses to use as HA IPs of A instances.
101   ha_b_ips:
102     type: comma_delimited_list
103     description: List of fixed IP addresses to use as HA IPs of B instances.
104   ha_sec_groups:
105     type: comma_delimited_list
106     description: List of security groups to add on HA interfaces.
107   trusted_net_id:
108     type: string
109     description: Service network 1 network UUID
110     constraints:
111     - custom_constraint: neutron.network
112   trusted_vips:
113     type: comma_delimited_list
114     description: List of service network 1 virtual IP addresses for all instances.
115   trusted_a_ips:
116     type: comma_delimited_list
117     description: List of fixed IP addresses to use as trusted fixed IPs of A instances.
118   trusted_b_ips:
119     type: comma_delimited_list
120     description: List of fixed IP addresses to use as trusted fixed IPs of B instances.
121   trusted_sec_groups:
122     type: comma_delimited_list
123     description: List of security groups to add on trusted interfaces.
124   untrusted_net_id:
125     type: string
126     description: Service network 2 network UUID
127     constraints:
128     - custom_constraint: neutron.network
129   untrusted_vips:
130     type: comma_delimited_list
131     description: List of service network 2 virtual IP addresses for all instances.
132   untrusted_v6_vips:
133     type: comma_delimited_list
134     description: List of service network 2 alternate virtual IP addresses for all instances.
135   untrusted_a_ips:
136     type: comma_delimited_list
137     description: List of fixed IP addresses to use as untrusted fixed IPs of A instances.
138   untrusted_a_v6_ips:
139     type: comma_delimited_list
140     description: List of fixed IP addresses to use as untrusted alternate fixed IPs of A instances.
141   untrusted_b_ips:
142     type: comma_delimited_list
143     description: List of fixed IP addresses to use as untrusted fixed IPs of B instances.
144   untrusted_b_v6_ips:
145     type: comma_delimited_list
146     description: List of fixed IP addresses to use as untrusted alternate fixed IPs of B instances.
147   untrusted_sec_groups:
148     type: comma_delimited_list
149     description: List of security groups to add on untrusted interfaces.
150   untrusted_num_vlans:
151     type: number
152     description: Number of VLANs to connect to on the untrusted/access network
153   untrusted_vlan_ids:
154     type: comma_delimited_list
155     description: List of VLAN IDs to use on the untrusted/access network
156   untrusted_vlan_networks:
157     type: comma_delimited_list
158     description: List of Contrail VLAN networks to use on the untrusted/access network.   The order and number of these must match the VLAN ID list.
159   perimeta_param_server_group:
160     type: string
161     description: Server group to use for these VMs - ignored
162   perimeta_config:
163     type: string
164     description: Orchestration template configuration for instance.
165
166 resources:
167
168   # Perimeta management ports
169   perimeta_a_mgmt_0_port:
170     type: OS::Neutron::Port
171     properties:
172       name:
173         str_replace:
174           template: $VM_mgmt_port
175           params:
176             $VM: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
177       network_id: { get_param: mgmt_net_id }
178       fixed_ips:
179         - ip_address: { get_param: [ mgmt_a_ips, { get_param: perimeta_instance_index } ] }
180       security_groups: { get_param: mgmt_sec_groups }
181       allowed_address_pairs:
182         - ip_address: { get_param: [ mgmt_vips, { get_param: perimeta_instance_index } ] }
183
184   perimeta_b_mgmt_0_port:
185     type: OS::Neutron::Port
186     properties:
187       name:
188         str_replace:
189           template: $VM_mgmt_port
190           params:
191             $VM: { get_param: [ vm_b_names, { get_param: perimeta_instance_index } ] }
192       network_id: { get_param: mgmt_net_id }
193       fixed_ips:
194         - ip_address: { get_param: [ mgmt_b_ips, { get_param: perimeta_instance_index } ] }
195       security_groups: { get_param: mgmt_sec_groups }
196       allowed_address_pairs:
197         - ip_address: { get_param: [ mgmt_vips, { get_param: perimeta_instance_index } ] }
198
199   # Perimeta HA ports
200   perimeta_a_ha_0_port:
201     type: OS::Neutron::Port
202     properties:
203       name:
204         str_replace:
205           template: $VM_ha_port
206           params:
207             $VM: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
208       network_id: { get_param: ha_net_id }
209       fixed_ips:
210         - ip_address: { get_param: [ ha_a_ips, { get_param: perimeta_instance_index } ] }
211       security_groups: { get_param: ha_sec_groups }
212
213   perimeta_b_ha_0_port:
214     type: OS::Neutron::Port
215     properties:
216       name:
217         str_replace:
218           template: $VM_ha_port
219           params:
220             $VM: { get_param: [ vm_b_names, { get_param: perimeta_instance_index } ] }
221       network_id: { get_param: ha_net_id }
222       fixed_ips:
223         - ip_address: { get_param: [ ha_b_ips, { get_param: perimeta_instance_index } ] }
224       security_groups: { get_param: ha_sec_groups }
225
226   # Perimeta core/trusted service network ports
227   #
228   # Dual stack core network - if only IPv4 required, comment out second entry
229   # in fixed_ips and allowed_addrsess_pairs parameters.
230   perimeta_a_trusted_0_port:
231     type: OS::Neutron::Port
232     properties:
233       name:
234         str_replace:
235           template: $VM_trusted_port
236           params:
237             $VM: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
238       network_id: { get_param: trusted_net_id }
239       fixed_ips:
240         - ip_address: { get_param: [ trusted_a_ips, { get_param: perimeta_instance_index } ] }
241       security_groups: { get_param: trusted_sec_groups }
242       allowed_address_pairs:
243         - ip_address: { get_param: [ trusted_vips, { get_param: perimeta_instance_index } ] }
244
245   perimeta_b_trusted_0_port:
246     type: OS::Neutron::Port
247     properties:
248       name:
249         str_replace:
250           template: $VM_trusted_port
251           params:
252             $VM: { get_param: [ vm_b_names, { get_param: perimeta_instance_index } ] }
253       network_id: { get_param: trusted_net_id }
254       fixed_ips:
255         - ip_address: { get_param: [ trusted_b_ips, { get_param: perimeta_instance_index } ] }
256       security_groups: { get_param: trusted_sec_groups }
257       allowed_address_pairs:
258         - ip_address: { get_param: [ trusted_vips, { get_param: perimeta_instance_index } ] }
259
260   # Perimeta access/untrusted service network ports
261   #
262   # Dual stack access network - if only IPv4 required, comment out second entry
263   # in fixed_ips and allowed_addrsess_pairs parameters.
264   perimeta_a_untrusted_0_port:
265     type: OS::Neutron::Port
266     properties:
267       name:
268         str_replace:
269           template: $VM_untrusted_port
270           params:
271             $VM: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
272       network_id: { get_param: untrusted_net_id }
273       fixed_ips:
274         - ip_address: { get_param: [ untrusted_a_ips, { get_param: perimeta_instance_index } ] }
275         - ip_address: { get_param: [ untrusted_a_v6_ips, { get_param: perimeta_instance_index } ] }
276       security_groups: { get_param: untrusted_sec_groups }
277       allowed_address_pairs:
278         - ip_address: { get_param: [ untrusted_vips, { get_param: perimeta_instance_index } ] }
279         - ip_address: { get_param: [ untrusted_v6_vips, { get_param: perimeta_instance_index } ] }
280
281   # Contrail VLAN subinterfaces
282   perimeta_a_untrusted_0_vlan_ports:
283     type: OS::Heat::ResourceGroup
284     properties:
285       count: { get_param: untrusted_num_vlans }
286       resource_def:
287         type: vlan_subinterface_dual.yaml
288         properties:
289           subinterface_instance_index: "%index%"
290           subinterface_name_prefix:
291             str_replace:
292               template: $VM_untrusted_port_vlan_
293               params:
294                 $VM: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
295           parent_interface: { get_resource: perimeta_a_untrusted_0_port }
296           mac_address: { get_attr: [ perimeta_a_untrusted_0_port, mac_address ] }
297           ip_address: { get_param: [ untrusted_a_ips, { get_param: perimeta_instance_index } ] }
298           ipv6_address: { get_param: [ untrusted_a_v6_ips, { get_param: perimeta_instance_index } ] }
299           virtual_ip_address: { get_param: [ untrusted_vips, { get_param: perimeta_instance_index } ] }
300           virtual_ipv6_address: { get_param: [ untrusted_v6_vips, { get_param: perimeta_instance_index } ] }
301           vlan_ids: { get_param: untrusted_vlan_ids }
302           vlan_networks: { get_param: untrusted_vlan_networks }
303
304   perimeta_b_untrusted_0_port:
305     type: OS::Neutron::Port
306     properties:
307       name:
308         str_replace:
309           template: $VM_untrusted_port
310           params:
311             $VM: { get_param: [ vm_b_names, { get_param: perimeta_instance_index } ] }
312       network_id: { get_param: untrusted_net_id }
313       fixed_ips:
314         - ip_address: { get_param: [ untrusted_b_ips, { get_param: perimeta_instance_index } ] }
315         - ip_address: { get_param: [ untrusted_b_v6_ips, { get_param: perimeta_instance_index } ] }
316       security_groups: { get_param: untrusted_sec_groups }
317       allowed_address_pairs:
318         - ip_address: { get_param: [ untrusted_vips, { get_param: perimeta_instance_index } ] }
319         - ip_address: { get_param: [ untrusted_v6_vips, { get_param: perimeta_instance_index } ] }
320
321   # Contrail VLAN subinterfaces
322   perimeta_b_untrusted_0_vlan_ports:
323     type: OS::Heat::ResourceGroup
324     properties:
325       count: { get_param: untrusted_num_vlans }
326       resource_def:
327         type: vlan_subinterface_dual.yaml
328         properties:
329           subinterface_instance_index: "%index%"
330           subinterface_name_prefix:
331             str_replace:
332               template: $VM_untrusted_port_vlan_
333               params:
334                 $VM: { get_param: [ vm_b_names, { get_param: perimeta_instance_index } ] }
335           parent_interface: { get_resource: perimeta_b_untrusted_0_port }
336           mac_address: { get_attr: [ perimeta_b_untrusted_0_port, mac_address ] }
337           ip_address: { get_param: [ untrusted_b_ips, { get_param: perimeta_instance_index } ] }
338           ipv6_address: { get_param: [ untrusted_b_v6_ips, { get_param: perimeta_instance_index } ] }
339           virtual_ip_address: { get_param: [ untrusted_vips, { get_param: perimeta_instance_index } ] }
340           virtual_ipv6_address: { get_param: [ untrusted_v6_vips, { get_param: perimeta_instance_index } ] }
341           vlan_ids: { get_param: untrusted_vlan_ids }
342           vlan_networks: { get_param: untrusted_vlan_networks }
343
344   # Perimeta Rf service network ports (SSC only)
345   #
346   # Dual stack access network - if only IPv4 required, comment out second entry
347   # in fixed_ips and allowed_addrsess_pairs parameters.
348   # Add any additional service ports here.
349
350   # Only supported in Juno and beyond - used to enforce host anti-affinity
351   # Can be commented out along with references to it if always using
352   # different availability zones.
353   perimeta_server_group:
354     type: OS::Nova::ServerGroup
355     properties:
356       name:
357         str_replace:
358           template: $SYSTEM_server_group
359           params:
360             $SYSTEM: { get_param: [ system_names, { get_param: perimeta_instance_index } ] }
361       policies: ['anti-affinity']
362
363   perimeta_a_server_0:
364     type: OS::Nova::Server
365     depends_on: perimeta_b_server_0
366     properties:
367       name: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
368       image: { get_param: perimeta_image_name }
369       flavor: { get_param: perimeta_flavor_name }
370       key_name: { get_param: perimeta_keypair }
371       scheduler_hints: { group: { get_resource: perimeta_server_group } }
372       metadata:
373         'vnf_id': { get_param: vnf_id }
374         'vm_role':
375             str_replace:
376               template: $ROLE_a
377               params:
378                 $ROLE: { get_param: vm_role }
379         'vf_module_id': { get_param: vf_module_id }
380       personality:
381         '/opt/MetaSwitch/init/custom.ini': { get_file: custom.ini }
382
383       networks:
384         - port: { get_resource: perimeta_a_mgmt_0_port }
385         - port: { get_resource: perimeta_a_ha_0_port }
386         - port: { get_resource: perimeta_a_trusted_0_port }
387         - port: { get_resource: perimeta_a_untrusted_0_port }
388       availability_zone: { get_param: availability_zone_0 }
389       config_drive: True
390       user_data_format: RAW
391       user_data:
392         str_replace:
393           template: { get_param: perimeta_config }
394           params:
395             $MGMT_MACADDR: { get_attr: [perimeta_a_mgmt_0_port, mac_address] }
396             $HA_MACADDR: { get_attr: [perimeta_a_ha_0_port, mac_address] }
397             $TRUSTED_MACADDR: { get_attr: [perimeta_a_trusted_0_port, mac_address] }
398             $UNTRUSTED_MACADDR: { get_attr: [perimeta_a_untrusted_0_port, mac_address] }
399             $LOCAL_HA_IP_ADDR: { get_param: [ ha_a_ips, { get_param: perimeta_instance_index } ] }
400             $REMOTE_HA_IP_ADDR: { get_param: [ ha_b_ips, { get_param: perimeta_instance_index } ] }
401             $HA_NETWORK_PLEN: { get_param: ha_network_plen }
402             $LOCAL_MGMT_IP_ADDR: { get_param: [ mgmt_a_ips, { get_param: perimeta_instance_index } ] }
403             $REMOTE_MGMT_IP_ADDR: { get_param: [ mgmt_b_ips, { get_param: perimeta_instance_index } ] }
404             $MGMT_NETWORK_PLEN: { get_param: mgmt_net_plen }
405             $MGMT_NETWORK_DEFAULT_GATEWAY: { get_param: mgmt_net_default_gateway }
406             $VIRT_MGMT_IP_ADDR: { get_param: [ mgmt_vips, { get_param: perimeta_instance_index } ] }
407             $VIRT_TRUSTED_IP_ADDR: { get_param: [ trusted_vips, { get_param: perimeta_instance_index } ] }
408             $LOCAL_TRUSTED_IP_ADDR: { get_param: [ trusted_a_ips, { get_param: perimeta_instance_index } ] }
409             $REMOTE_TRUSTED_IP_ADDR: { get_param: [ trusted_b_ips, { get_param: perimeta_instance_index } ] }
410             $VIRT_UNTRUSTED_IP_ADDR: { get_param: [ untrusted_vips, { get_param: perimeta_instance_index } ] }
411             $VIRT_UNTRUSTED_ALT_IP_ADDR: { get_param: [ untrusted_v6_vips, { get_param: perimeta_instance_index } ] }
412             $LOCAL_UNTRUSTED_IP_ADDR: { get_param: [ untrusted_a_ips, { get_param: perimeta_instance_index } ] }
413             $LOCAL_UNTRUSTED_ALT_IP_ADDR: { get_param: [ untrusted_a_v6_ips, { get_param: perimeta_instance_index } ] }
414             $REMOTE_UNTRUSTED_IP_ADDR: { get_param: [ untrusted_b_ips, { get_param: perimeta_instance_index } ] }
415             $REMOTE_UNTRUSTED_ALT_IP_ADDR: { get_param: [ untrusted_b_v6_ips, { get_param: perimeta_instance_index } ] }
416             $VM_NAME_A: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
417             $VM_NAME_B: { get_param: [ vm_b_names, { get_param: perimeta_instance_index } ] }
418             $SYSTEM_NAME: { get_param: [ system_names, { get_param: perimeta_instance_index } ] }
419
420   perimeta_b_server_0:
421     type: OS::Nova::Server
422     properties:
423       name: { get_param: [ vm_b_names, { get_param: perimeta_instance_index } ] }
424       image: { get_param: perimeta_image_name }
425       flavor: { get_param: perimeta_flavor_name }
426       key_name: { get_param: perimeta_keypair }
427       scheduler_hints: { group: { get_resource: perimeta_server_group } }
428       metadata:
429         'vnf_id': { get_param: vnf_id }
430         'vm_role':
431             str_replace:
432               template: $ROLE_b
433               params:
434                 $ROLE: { get_param: vm_role }
435         'vf_module_id': { get_param: vf_module_id }
436       networks:
437         - port: { get_resource: perimeta_b_mgmt_0_port }
438         - port: { get_resource: perimeta_b_ha_0_port }
439         - port: { get_resource: perimeta_b_trusted_0_port }
440         - port: { get_resource: perimeta_b_untrusted_0_port }
441       availability_zone: { get_param: availability_zone_1 }
442       config_drive: True
443       user_data_format: RAW
444       user_data:
445         str_replace:
446           template: |
447             {
448               "vnic_assignment": {
449                 "IBG1mgmt": {"mac": "$MGMT_MACADDR"},
450                 "IPG1": {"mac": "$HA_MACADDR"},
451                 "RPG1": {"mac": "$TRUSTED_MACADDR"},
452                 "RPG2": {"mac": "$UNTRUSTED_MACADDR"}
453               },
454               "ip_ha_local": "$LOCAL_HA_IP_ADDR",
455               "ip_ha_remote": "$REMOTE_HA_IP_ADDR",
456               "ip_ha_plen": "$HA_NETWORK_PLEN"
457               //"ip_mgmt_local": "$LOCAL_MGMT_IP_ADDR",
458               //"ip_mgmt_remote": "$REMOTE_MGMT_IP_ADDR",
459               //"ip_mgmt_plen": "$MGMT_NETWORK_PLEN",
460               //"ip_mgmt_gway": "$MGMT_NETWORK_DEFAULT_GATEWAY"
461             }
462
463           params:
464             $MGMT_MACADDR: { get_attr: [perimeta_b_mgmt_0_port, mac_address] }
465             $HA_MACADDR: { get_attr: [perimeta_b_ha_0_port, mac_address] }
466             $TRUSTED_MACADDR: { get_attr: [perimeta_b_trusted_0_port, mac_address] }
467             $UNTRUSTED_MACADDR: { get_attr: [perimeta_b_untrusted_0_port, mac_address] }
468             $LOCAL_HA_IP_ADDR: { get_param: [ ha_b_ips, { get_param: perimeta_instance_index } ] }
469             $REMOTE_HA_IP_ADDR: { get_param: [ ha_a_ips, { get_param: perimeta_instance_index } ] }
470             $HA_NETWORK_PLEN: { get_param: ha_network_plen }
471             $LOCAL_MGMT_IP_ADDR: { get_param: [ mgmt_b_ips, { get_param: perimeta_instance_index } ] }
472             $REMOTE_MGMT_IP_ADDR: { get_param: [ mgmt_a_ips, { get_param: perimeta_instance_index } ] }
473             $MGMT_NETWORK_PLEN: { get_param: mgmt_net_plen }
474             $MGMT_NETWORK_DEFAULT_GATEWAY: { get_param: mgmt_net_default_gateway }
475
476 outputs:
477
478   server_group_used:
479     description: Server group used for these VMs
480     value: { get_resource: perimeta_server_group }