[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_swmu_a.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   serv3_net_id:
160     type: string
161     description: Service network 3 network UUID
162   serv3_vips:
163     type: comma_delimited_list
164     description: List of service network 3 virtual IP addresses for all instances.
165   serv3_a_ips:
166     type: comma_delimited_list
167     description: List of fixed IP addresses to use as serv3 fixed IPs of A instances.
168   serv3_b_ips:
169     type: comma_delimited_list
170     description: List of fixed IP addresses to use as serv3 fixed IPs of B instances.
171   serv3_sec_groups:
172     type: comma_delimited_list
173     description: List of security groups to add on serv3 interfaces.
174   unused_net_id:
175     type: string
176     description: Service network unused port network UUID
177   perimeta_param_server_group:
178     type: string
179     description: Server group to use for these VMs - ignored
180   perimeta_config:
181     type: string
182     description: Orchestration template configuration for instance.
183
184 resources:
185
186   # Perimeta management ports
187   perimeta_a_mgmt_0_port:
188     type: OS::Neutron::Port
189     properties:
190       name:
191         str_replace:
192           template: $VM_mgmt_port
193           params:
194             $VM: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
195       network_id: { get_param: mgmt_net_id }
196       fixed_ips:
197         - ip_address: { get_param: [ mgmt_a_ips, { get_param: perimeta_instance_index } ] }
198       security_groups: { get_param: mgmt_sec_groups }
199       allowed_address_pairs:
200         - ip_address: { get_param: [ mgmt_vips, { get_param: perimeta_instance_index } ] }
201
202   # Perimeta HA ports
203   perimeta_a_ha_0_port:
204     type: OS::Neutron::Port
205     properties:
206       name:
207         str_replace:
208           template: $VM_ha_port
209           params:
210             $VM: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
211       network_id: { get_param: ha_net_id }
212       fixed_ips:
213         - ip_address: { get_param: [ ha_a_ips, { get_param: perimeta_instance_index } ] }
214       security_groups: { get_param: ha_sec_groups }
215
216   # Perimeta core/trusted service network ports
217   #
218   # Dual stack core network - if only IPv4 required, comment out second entry
219   # in fixed_ips and allowed_addrsess_pairs parameters.
220   perimeta_a_trusted_0_port:
221     type: OS::Neutron::Port
222     properties:
223       name:
224         str_replace:
225           template: $VM_trusted_port
226           params:
227             $VM: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
228       network_id: { get_param: trusted_net_id }
229       fixed_ips:
230         - ip_address: { get_param: [ trusted_a_ips, { get_param: perimeta_instance_index } ] }
231       security_groups: { get_param: trusted_sec_groups }
232       allowed_address_pairs:
233         - ip_address: { get_param: [ trusted_vips, { get_param: perimeta_instance_index } ] }
234
235   # Perimeta access/untrusted service network ports
236   #
237   # Dual stack access network - if only IPv4 required, comment out second entry
238   # in fixed_ips and allowed_addrsess_pairs parameters.
239   perimeta_a_untrusted_0_port:
240     type: OS::Neutron::Port
241     properties:
242       name:
243         str_replace:
244           template: $VM_untrusted_port
245           params:
246             $VM: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
247       network_id: { get_param: untrusted_net_id }
248       fixed_ips:
249         - ip_address: { get_param: [ untrusted_a_ips, { get_param: perimeta_instance_index } ] }
250         - ip_address: { get_param: [ untrusted_a_v6_ips, { get_param: perimeta_instance_index } ] }
251       security_groups: { get_param: untrusted_sec_groups }
252       allowed_address_pairs:
253         - ip_address: { get_param: [ untrusted_vips, { get_param: perimeta_instance_index } ] }
254         - ip_address: { get_param: [ untrusted_v6_vips, { get_param: perimeta_instance_index } ] }
255
256   # Contrail VLAN subinterfaces
257   perimeta_a_untrusted_0_vlan_ports:
258     type: OS::Heat::ResourceGroup
259     properties:
260       count: { get_param: untrusted_num_vlans }
261       resource_def:
262         type: vlan_subinterface_dual.yaml
263         properties:
264           subinterface_instance_index: "%index%"
265           subinterface_name_prefix:
266             str_replace:
267               template: $VM_untrusted_port_vlan_
268               params:
269                 $VM: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
270           parent_interface: { get_resource: perimeta_a_untrusted_0_port }
271           mac_address: { get_attr: [ perimeta_a_untrusted_0_port, mac_address ] }
272           ip_address: { get_param: [ untrusted_a_ips, { get_param: perimeta_instance_index } ] }
273           ipv6_address: { get_param: [ untrusted_a_v6_ips, { get_param: perimeta_instance_index } ] }
274           virtual_ip_address: { get_param: [ untrusted_vips, { get_param: perimeta_instance_index } ] }
275           virtual_ipv6_address: { get_param: [ untrusted_v6_vips, { get_param: perimeta_instance_index } ] }
276           vlan_ids: { get_param: untrusted_vlan_ids }
277           vlan_networks: { get_param: untrusted_vlan_networks }
278
279   # Perimeta Rf service network ports (SSC only)
280   #
281   # Dual stack access network - if only IPv4 required, comment out second entry
282   # in fixed_ips and allowed_addrsess_pairs parameters.
283   perimeta_a_serv3_0_port:
284     type: OS::Neutron::Port
285     properties:
286       name:
287         str_replace:
288           template: $VM_serv3_port
289           params:
290             $VM: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
291       network_id: { get_param: serv3_net_id }
292       fixed_ips:
293         - ip_address: { get_param: [ serv3_a_ips, { get_param: perimeta_instance_index } ] }
294       security_groups: { get_param: serv3_sec_groups }
295       allowed_address_pairs:
296         - ip_address: { get_param: [ serv3_vips, { get_param: perimeta_instance_index } ] }
297
298   perimeta_a_unused_0_port:
299     type: OS::Neutron::Port
300     properties:
301       name:
302         str_replace:
303           template: $VM_unused_port
304           params:
305             $VM: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
306       network: { get_param: unused_net_id }
307
308   # Add any additional service ports here.
309
310   perimeta_a_server_0:
311     type: OS::Nova::Server
312     #depends_on: perimeta_b_server_0
313     properties:
314       name: { get_param: [ vm_a_names, { get_param: perimeta_instance_index } ] }
315       image: { get_param: perimeta_image_name }
316       flavor: { get_param: perimeta_flavor_name }
317       key_name: { get_param: perimeta_keypair }
318       scheduler_hints: { group: { get_param: perimeta_param_server_group } }
319       metadata:
320         'vnf_id': { get_param: vnf_id }
321         'vm_role':
322             str_replace:
323               template: $ROLE_a
324               params:
325                 $ROLE: { get_param: vm_role }
326         'vf_module_id': { get_param: vf_module_id }
327       personality:
328         '/opt/MetaSwitch/init/custom.ini': { get_file: custom.ini }
329
330       networks:
331         - port: { get_resource: perimeta_a_mgmt_0_port }
332         - port: { get_resource: perimeta_a_ha_0_port }
333         - port: { get_resource: perimeta_a_trusted_0_port }
334         - port: { get_resource: perimeta_a_untrusted_0_port }
335         - port: { get_resource: perimeta_a_serv3_0_port }
336         - port: { get_resource: perimeta_a_unused_0_port }
337       availability_zone: { get_param: availability_zone_0 }
338       config_drive: True
339       user_data_format: RAW
340       user_data:
341         str_replace:
342           template: |
343             {
344               "vnic_assignment": {
345                 "IBG1mgmt": {"mac": "$MGMT_MACADDR"},
346                 "IPG1": {"mac": "$HA_MACADDR"},
347                 "RPG1": {"mac": "$TRUSTED_MACADDR"},
348                 "RPG2": {"mac": "$UNTRUSTED_MACADDR"},
349                 "RPG3": {"mac": "$SERV3_MACADDR"},
350                 "RPG4": {"mac": "$SERV4_MACADDR"}
351               },
352               "ip_ha_local": "$LOCAL_HA_IP_ADDR",
353               "ip_ha_remote": "$REMOTE_HA_IP_ADDR",
354               "ip_ha_plen": "$HA_NETWORK_PLEN"
355               // "ip_mgmt_local": "$LOCAL_MGMT_IP_ADDR",
356               // "ip_mgmt_remote": "$REMOTE_MGMT_IP_ADDR",
357               // "ip_mgmt_plen": "$MGMT_NETWORK_PLEN",
358               // "ip_mgmt_gway": "$MGMT_NETWORK_DEFAULT_GATEWAY"
359             }
360
361           params:
362             $MGMT_MACADDR: { get_attr: [perimeta_a_mgmt_0_port, mac_address] }
363             $HA_MACADDR: { get_attr: [perimeta_a_ha_0_port, mac_address] }
364             $TRUSTED_MACADDR: { get_attr: [perimeta_a_trusted_0_port, mac_address] }
365             $UNTRUSTED_MACADDR: { get_attr: [perimeta_a_untrusted_0_port, mac_address] }
366             $SERV3_MACADDR: { get_attr: [perimeta_a_serv3_0_port, mac_address] }
367             $SERV4_MACADDR: { get_attr: [perimeta_a_unused_0_port, mac_address] }
368             $LOCAL_HA_IP_ADDR: { get_param: [ ha_a_ips, { get_param: perimeta_instance_index } ] }
369             $REMOTE_HA_IP_ADDR: { get_param: [ ha_b_ips, { get_param: perimeta_instance_index } ] }
370             $HA_NETWORK_PLEN: { get_param: ha_network_plen }
371             $LOCAL_MGMT_IP_ADDR: { get_param: [ mgmt_a_ips, { get_param: perimeta_instance_index } ] }
372             $REMOTE_MGMT_IP_ADDR: { get_param: [ mgmt_b_ips, { get_param: perimeta_instance_index } ] }
373             $MGMT_NETWORK_PLEN: { get_param: mgmt_net_plen }
374             $MGMT_NETWORK_DEFAULT_GATEWAY: { get_param: mgmt_net_default_gateway }
375
376
377 outputs:
378
379   server_group_used:
380     description: Server group used for these VMs
381     value: { get_param: perimeta_param_server_group }