[SDC-29] Amdocs OnBoard 1707 initial commit.
[sdc.git] / openecomp-be / lib / openecomp-sdc-translator-lib / openecomp-sdc-translator-core / src / test / resources / mock / heattotoscatranslator / overallexample / inputs / nested2.yaml
1 heat_template_version: 2013-05-23
2
3 ##########################################################
4 #
5 #  Changes from MSO 
6 #  - Updated per OPENECOMP Feedback
7 #  
8 #
9 ##########################################################
10
11 description: This stack creates two ECA OAM VM and one ARB VM
12
13 parameters:
14   vnf_id:
15     type: string
16     description: Unique ID for this VNF instance
17     default: This_is_ths_MMSC-ECA_id
18   cmaui_names:
19     type: comma_delimited_list
20     label: oam servers names
21     description: the names of the OAM1,OAM2 VM instances
22   cmaui_image:
23     type: comma_delimited_list
24     label: oam servers names
25     description: the names of the OAM1,OAM2 VM instances
26   cmaui_flavor:
27     type: comma_delimited_list
28     label: oam servers names
29     description: the names of the OAM1,OAM2 VM instances
30   eca_names:
31     type: comma_delimited_list
32     label: oam servers names
33     description: the names of the OAM1,OAM2 VM instances
34   arb_names:
35     type: comma_delimited_list
36     label: arbiter server names
37     description: the names of the arbiter VM instances
38   oam_image_name:
39     type: string
40     label: image name
41     description: the OAM image name
42   oam_flavor:
43     type: string
44     label: flavor name
45     description: OAM flavor name
46   arbiter_flavor:
47     type: string
48     label: flavor name
49     description: arbiter flavor name
50   availability_zone_0:
51     type: string
52     label: availabilityzone name
53     description: availabilityzone name
54   oam_net_name:
55     type: string
56     label: oam network name
57     description: the name of the oam network
58   eca_mgmt_net_name:
59     type: string
60     label: internal network name
61     description: the name of the internal network
62   eca_oam_ips:
63     type: comma_delimited_list
64     label: oam network ips
65     description: the ips of oam networks for eca VM
66   eca_eca_mgmt_ips:
67     type: comma_delimited_list
68     label: eca_mgmt network ips for eca VM
69     description: internal eca_mgmt network ips for eca VM
70   arb_oam_ips:
71     type: comma_delimited_list
72     label: oam network ips for arb VM
73     description: oam network ips for eca VM
74   arb_eca_mgmt_ips:
75     type: comma_delimited_list
76     label: eca_mgmt network ips 
77     description:  internal eca_mgmt network ips for arb VM
78   eca_oam_gateway:
79     type: string
80     label: oam network gateway
81     description: oam network gateway
82   security_group_name:
83     type: string
84     label: security group name
85     description: the name of security group
86   oam_volume_size:
87     type: number
88     label: volume size
89     description: the size of the OAM volume
90   arb_volume_size:
91     type: number
92     label: volume size
93     description: the size of the ARB volume
94   swift_eca_url:
95     type: string
96     label: Swift URL
97     description: Base URL for eca swift object store
98   ECA_OAM_volume_type:
99     type: string
100     label: eca oam vm volume type
101     description: the name of the target volume backend
102   ARB_volume_type:
103     type: string
104     label: arb vm volume type
105     description: the name of the target volume backend
106
107 resources:
108   server_cmaui_nested:
109     type: eca_oam_nested.yaml
110     properties:
111       cmaui_name: { get_param: [cmaui_names, 0]}
112       cmaui_image: { get_param: cmaui_image }
113       availability_zone_0: { get_param: availability_zone_0 }
114       flavor: { get_param: cmaui_flavor }
115       networks:
116       - port: { get_resource: cmaui_port_0 }
117       metadata:
118         vnf_id: { get_param: vnf_id }
119       user_data:
120         str_replace:
121           template: |
122             cmaui.mgmt.ip=${cmaui.mgmt.ip}
123             cmaui.mgmt.netmask=${cmaui.mgmt.netmask}
124             cmaui.mgmt.gateway=${cmaui.mgmt.gateway}
125             cmaui.external.dns=${cmaui.external.dns}
126             cmaui.external.ntp=${cmaui.external.ntp}
127             cmaui.node=${cmaui.node}
128             cmaui.timezone=${cmaui.timezone}
129           params:
130             ${cmaui.mgmt.ip}: {get_param: [cmaui_oam_ips, 0]} 
131             ${cmaui.mgmt.netmask}: {get_param: oam_network_netmask}
132             ${cmaui.mgmt.gateway}: {get_param: oam_network_gateway}
133             ${cmaui.external.dns}: {get_param: external_dns}
134             ${cmaui.external.ntp}: {get_param: external_ntp}
135             ${cmaui.node}: {get_param: [cmaui_names, 0]} 
136             ${cmaui.timezone}: {get_param: timezone}
137       user_data_format: RAW 
138
139   oam1_instance:
140     type: OS::Nova::Server
141     properties:
142       name: {get_param: [eca_names, 0]}
143       image: {get_param: oam_image_name}
144       flavor: {get_param: oam_flavor}
145       availability_zone: {get_param: availability_zone_0}
146       networks:
147         - port: {get_resource: oam1_int_port}
148         - port: {get_resource: oam1_mgmt_port}
149       metadata:
150         vnf_id: { get_param: vnf_id }  
151       user_data:
152         str_replace:
153           template: |
154             #!/bin/bash
155             sed -i s/HOSTNAME.*/"HOSTNAME=oam1_hostname"/g /etc/sysconfig/network
156             eth1_ip_address='oam1_mgt_ip'
157             eth1_gateway='oam_gateway'
158             for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do
159               if [ "$interface" != "lo" ]; then
160                 DEVICE_NAME=$interface
161                 interface_ip_var="${DEVICE_NAME}_ip_address"
162                 gateway_var="${DEVICE_NAME}_gateway"
163                 var_name="$interface_ip_var"
164                 var_gateway="$gateway_var"
165                 if [ ! -z ${!var_name} ]; then
166                   IPADDR=${!var_name}
167                   BOOTPROTO="static"
168                   GATEWAY=${!var_gateway}
169                   IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no"
170                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO"
171                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR"
172                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0"
173                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY"
174                   printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME
175                 else
176                   if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then
177                     echo "Configuring $DEVICE_NAME to use DHCP"
178                     IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes"
179                     IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no"
180                     printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME
181                   fi
182                 fi
183                 ifdown $DEVICE_NAME
184                 ifup $DEVICE_NAME
185                 printf "$DEVICE_NAME\n" >> /tmp/network_config
186               fi
187             done
188             mkdir /etc/puppet/files/roles/transcoder
189             mkdir /etc/puppet/files/roles/oam_primary
190             curl swift_url/etc/puppet/manifests/roles/oam_primary.pp > /etc/puppet/manifests/roles/oam_primary.pp
191             curl swift_url/etc/puppet/manifests/roles/transcoder.pp > /etc/puppet/manifests/roles/transcoder.pp
192             curl swift_url/etc/puppet/files/roles/oam_primary/config.yaml > /etc/puppet/files/roles/oam_primary/config.yaml
193             curl swift_url/etc/puppet/files/roles/transcoder/config.yaml > /etc/puppet/files/roles/transcoder/config.yaml
194             curl swift_url/etc/puppet/files/roles/transcoder/hpm.conf > /etc/puppet/files/roles/transcoder/hpm.conf
195             curl swift_url/etc/puppet/files/roles/transcoder/trx.conf > /etc/puppet/files/roles/transcoder/trx.conf
196             curl swift_url/etc/puppet/files/roles/transcoder/plugins-mo.conf > /etc/puppet/files/roles/transcoder/plugins-mo.conf
197             curl swift_url/etc/puppet/files/global/11-customer.conf > /etc/puppet/files/global/11-customer.conf
198             curl swift_url/etc/puppet/manifests/site.pp > /etc/puppet/manifests/site.pp
199             curl swift_url/scripts/van-init-replicaset > /usr/sbin/van-init-replicaset
200             van-role oam_primary > /root/startup-van-role.out
201             curl swift_url/scripts/fdisk-keystrokes > /root/fdisk-keystrokes 
202             fdisk /dev/vdb < /root/fdisk-keystrokes 
203             curl swift_url/scripts/os-conf-cinder-vol > /root/os-conf-cinder-vol
204             chmod 755 /root/os-conf-cinder-vol
205             /root/os-conf-cinder-vol 2>> /tmp/cinder_volume.log
206           params:
207             oam1_mgt_ip: {get_param: [eca_oam_ips, 0] }
208             oam_gateway: {get_param: eca_oam_gateway }
209             oam1_hostname: {get_param: [eca_names, 0]}
210             swift_url: {get_param: swift_eca_url}
211
212   oam1_mgmt_port:
213     type: OS::Neutron::Port
214     properties:
215       network: {get_param: oam_net_name}
216       fixed_ips: [{"ip_address": {get_param: [eca_oam_ips, 0]}}]
217       security_groups: [{get_param: security_group_name}]
218       replacement_policy: AUTO
219
220
221   cmaui_port_0:
222     type: OS::Neutron::Port
223     properties:
224       network: {get_param: oam_net_name}
225       fixed_ips: [{"ip_address": {get_param: [eca_oam_ips, 0]}}]
226       security_groups: [{get_param: security_group_name}]
227       replacement_policy: AUTO
228
229   oam1_int_port:
230     type: OS::Neutron::Port
231     properties:
232       network: {get_param: eca_mgmt_net_name}
233       fixed_ips: [{"ip_address": {get_param: [eca_eca_mgmt_ips, 0]}}]
234       security_groups: [{get_param: security_group_name}]
235       replacement_policy: AUTO
236
237   oam1_volume:
238     type: OS::Cinder::Volume
239     properties:
240       size: {get_param: oam_volume_size}
241       volume_type: {get_param: ECA_OAM_volume_type}
242
243   oam1_volume_attachment:
244     type: OS::Cinder::VolumeAttachment
245     properties:
246       volume_id: {get_resource: oam1_volume}
247       instance_uuid: {get_resource: oam1_instance}
248
249   oam2_instance:
250     type: OS::Nova::Server
251     properties:
252       name: {get_param: [eca_names, 1]}
253       image: {get_param: oam_image_name}
254       flavor: {get_param: oam_flavor}
255       availability_zone: {get_param: availability_zone_0}
256       networks:
257         - port: {get_resource: oam2_int_port}
258         - port: {get_resource: oam2_mgmt_port}
259       metadata:
260         vnf_id: { get_param: vnf_id }
261       user_data:
262         str_replace:
263           template: |
264             #!/bin/bash
265             sed -i s/HOSTNAME.*/"HOSTNAME=oam2_hostname"/g /etc/sysconfig/network
266             eth1_ip_address='oam2_mgt_ip'
267             eth1_gateway='oam_gateway'
268             for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do
269               if [ "$interface" != "lo" ]; then
270                 DEVICE_NAME=$interface
271                 interface_ip_var="${DEVICE_NAME}_ip_address"
272                 gateway_var="${DEVICE_NAME}_gateway"
273                 var_name="$interface_ip_var"
274                 var_gateway="$gateway_var"
275                 if [ ! -z ${!var_name} ]; then
276                   IPADDR=${!var_name}
277                   BOOTPROTO="static"
278                   GATEWAY=${!var_gateway}
279                   IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no"
280                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO"
281                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR"
282                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0"
283                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY"
284                   printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME
285                 else
286                   if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then
287                     echo "Configuring $DEVICE_NAME to use DHCP"
288                     IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes"
289                     IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no"
290                     printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME
291                   fi
292                 fi
293                 ifdown $DEVICE_NAME
294                 ifup $DEVICE_NAME
295                 printf "$DEVICE_NAME\n" >> /tmp/network_config
296               fi
297             done
298             curl swift_url/etc/puppet/manifests/roles/oam_secondary.pp > /etc/puppet/manifests/roles/oam_secondary.pp
299             curl swift_url/etc/puppet/files/global/config.yaml > /etc/puppet/files/global/config.yaml
300             curl swift_url/etc/puppet/files/global/11-customer.conf > /etc/puppet/files/global/11-customer.conf
301             van-role oam_secondary > /root/startup-van-role.out
302             curl swift_url/scripts/fdisk-keystrokes > /root/fdisk-keystrokes 
303             fdisk /dev/vdb < /root/fdisk-keystrokes 
304             curl swift_url/scripts/os-conf-cinder-vol > /root/os-conf-cinder-vol
305             chmod 755 /root/os-conf-cinder-vol
306             /root/os-conf-cinder-vol 2>> /tmp/cinder_volume.log
307             
308           params:
309             oam2_mgt_ip: {get_param: [eca_oam_ips, 1] }
310             oam2_hostname: {get_param: [eca_names, 1]}
311             swift_url: {get_param: swift_eca_url}
312             oam_gateway: {get_param: eca_oam_gateway }
313
314   oam2_mgmt_port:
315     type: OS::Neutron::Port
316     properties:
317       network: {get_param: oam_net_name}
318       fixed_ips: [{"ip_address": {get_param: [eca_oam_ips, 1]}}]
319       security_groups: [{get_param: security_group_name}]
320       replacement_policy: AUTO
321
322   oam2_int_port:
323     type: OS::Neutron::Port
324     properties:
325       network: {get_param: eca_mgmt_net_name}
326       fixed_ips: [{"ip_address": {get_param: [eca_eca_mgmt_ips, 1]}}]
327       security_groups: [{get_param: security_group_name}]
328       replacement_policy: AUTO
329
330   oam2_volume:
331     type: OS::Cinder::Volume
332     properties:
333       size: {get_param: oam_volume_size}
334       volume_type: {get_param: ECA_OAM_volume_type}
335
336   oam2_volume_attachment:
337     type: OS::Cinder::VolumeAttachment
338     properties:
339       volume_id: {get_resource: oam2_volume}
340       instance_uuid: {get_resource: oam2_instance}
341
342   arb_instance:
343     type: OS::Nova::Server
344     properties:
345       name: {get_param: [arb_names, 0]}
346       image: {get_param: oam_image_name}
347       flavor: {get_param: arbiter_flavor}
348       availability_zone: {get_param: availability_zone_0}
349       networks:
350         - port: {get_resource: arb_int_port}
351         - port: {get_resource: arb_mgmt_port}
352       metadata:
353         vnf_id: { get_param: vnf_id }
354       user_data:
355         str_replace:
356           template: |
357             #!/bin/bash
358             sed -i s/HOSTNAME.*/"HOSTNAME=arb_hostname"/g /etc/sysconfig/network
359             eth1_ip_address='arb_mgt_ip'
360             eth1_gateway='oam_gateway'
361             for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do
362               if [ "$interface" != "lo" ]; then
363                 DEVICE_NAME=$interface
364                 interface_ip_var="${DEVICE_NAME}_ip_address"
365                 gateway_var="${DEVICE_NAME}_gateway"
366                 var_name="$interface_ip_var"
367                 var_gateway="$gateway_var"
368                 if [ ! -z ${!var_name} ]; then
369                   IPADDR=${!var_name}
370                   BOOTPROTO="static"
371                   GATEWAY=${!var_gateway}
372                   IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no"
373                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO"
374                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR"
375                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0"
376                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY"
377                   printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME
378                 else
379                   if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then
380                     echo "Configuring $DEVICE_NAME to use DHCP"
381                     IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes"
382                     IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no"
383                     printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME
384                   fi
385                 fi
386                 ifdown $DEVICE_NAME
387                 ifup $DEVICE_NAME
388                 printf "$DEVICE_NAME\n" >> /tmp/network_config
389               fi
390             done
391             curl swift_url/etc/puppet/manifests/roles/oam_arbiter.pp > /etc/puppet/manifests/roles/oam_arbiter.pp
392             curl swift_url/etc/puppet/files/global/config.yaml > /etc/puppet/files/global/config.yaml
393             curl swift_url/etc/puppet/files/global/11-customer.conf > /etc/puppet/files/global/11-customer.conf
394             van-role oam_arbiter > /root/startup-van-role.out
395             curl swift_url/scripts/fdisk-keystrokes > /root/fdisk-keystrokes 
396             fdisk /dev/vdb < /root/fdisk-keystrokes 
397             curl swift_url/scripts/os-conf-cinder-vol > /root/os-conf-cinder-vol
398             chmod 755 /root/os-conf-cinder-vol
399             /root/os-conf-cinder-vol 2>> /tmp/cinder_volume.log
400           params:
401             arb_mgt_ip: {get_param: [arb_oam_ips, 0] }
402             arb_hostname: {get_param: [arb_names, 0]}
403             swift_url: {get_param: swift_eca_url}
404             oam_gateway: {get_param: eca_oam_gateway }
405
406   arb_mgmt_port:
407     type: OS::Neutron::Port
408     properties:
409       network: {get_param: oam_net_name}
410       fixed_ips: [{"ip_address": {get_param: [arb_oam_ips, 0]}}]
411       security_groups: [{get_param: security_group_name}]
412       replacement_policy: AUTO
413
414   arb_int_port:
415     type: OS::Neutron::Port
416     properties:
417       network: {get_param: eca_mgmt_net_name}
418       fixed_ips: [{"ip_address": {get_param: [arb_eca_mgmt_ips, 0]}}]
419       security_groups: [{get_param: security_group_name}]
420       replacement_policy: AUTO
421
422   arb_volume:
423     type: OS::Cinder::Volume
424     properties:
425       size: {get_param: arb_volume_size}
426       volume_type: {get_param: ARB_volume_type}
427   arb_volume_attachment:
428     type: OS::Cinder::VolumeAttachment
429     properties:
430       volume_id: {get_resource: arb_volume}
431       instance_uuid: {get_resource: arb_instance}