[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 / nested1.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   cmaui_port_0:
221     type: OS::Neutron::Port
222     properties:
223       network: {get_param: oam_net_name}
224       fixed_ips: [{"ip_address": {get_param: [eca_oam_ips, 0]}}]
225       security_groups: [{get_param: security_group_name}]
226       replacement_policy: AUTO
227
228   oam1_int_port:
229     type: OS::Neutron::Port
230     properties:
231       network: {get_param: eca_mgmt_net_name}
232       fixed_ips: [{"ip_address": {get_param: [eca_eca_mgmt_ips, 0]}}]
233       security_groups: [{get_param: security_group_name}]
234       replacement_policy: AUTO
235
236   oam1_volume:
237     type: OS::Cinder::Volume
238     properties:
239       size: {get_param: oam_volume_size}
240       volume_type: {get_param: ECA_OAM_volume_type}
241
242   oam1_volume_attachment:
243     type: OS::Cinder::VolumeAttachment
244     properties:
245       volume_id: {get_resource: oam1_volume}
246       instance_uuid: {get_resource: oam1_instance}
247
248   oam2_instance:
249     type: OS::Nova::Server
250     properties:
251       name: {get_param: [eca_names, 1]}
252       image: {get_param: oam_image_name}
253       flavor: {get_param: oam_flavor}
254       availability_zone: {get_param: availability_zone_0}
255       networks:
256         - port: {get_resource: oam2_int_port}
257         - port: {get_resource: oam2_mgmt_port}
258       metadata:
259         vnf_id: { get_param: vnf_id }
260       user_data:
261         str_replace:
262           template: |
263             #!/bin/bash
264             sed -i s/HOSTNAME.*/"HOSTNAME=oam2_hostname"/g /etc/sysconfig/network
265             eth1_ip_address='oam2_mgt_ip'
266             eth1_gateway='oam_gateway'
267             for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do
268               if [ "$interface" != "lo" ]; then
269                 DEVICE_NAME=$interface
270                 interface_ip_var="${DEVICE_NAME}_ip_address"
271                 gateway_var="${DEVICE_NAME}_gateway"
272                 var_name="$interface_ip_var"
273                 var_gateway="$gateway_var"
274                 if [ ! -z ${!var_name} ]; then
275                   IPADDR=${!var_name}
276                   BOOTPROTO="static"
277                   GATEWAY=${!var_gateway}
278                   IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no"
279                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO"
280                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR"
281                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0"
282                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY"
283                   printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME
284                 else
285                   if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then
286                     echo "Configuring $DEVICE_NAME to use DHCP"
287                     IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes"
288                     IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no"
289                     printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME
290                   fi
291                 fi
292                 ifdown $DEVICE_NAME
293                 ifup $DEVICE_NAME
294                 printf "$DEVICE_NAME\n" >> /tmp/network_config
295               fi
296             done
297             curl swift_url/etc/puppet/manifests/roles/oam_secondary.pp > /etc/puppet/manifests/roles/oam_secondary.pp
298             curl swift_url/etc/puppet/files/global/config.yaml > /etc/puppet/files/global/config.yaml
299             curl swift_url/etc/puppet/files/global/11-customer.conf > /etc/puppet/files/global/11-customer.conf
300             van-role oam_secondary > /root/startup-van-role.out
301             curl swift_url/scripts/fdisk-keystrokes > /root/fdisk-keystrokes 
302             fdisk /dev/vdb < /root/fdisk-keystrokes 
303             curl swift_url/scripts/os-conf-cinder-vol > /root/os-conf-cinder-vol
304             chmod 755 /root/os-conf-cinder-vol
305             /root/os-conf-cinder-vol 2>> /tmp/cinder_volume.log
306             
307           params:
308             oam2_mgt_ip: {get_param: [eca_oam_ips, 1] }
309             oam2_hostname: {get_param: [eca_names, 1]}
310             swift_url: {get_param: swift_eca_url}
311             oam_gateway: {get_param: eca_oam_gateway }
312
313   oam2_mgmt_port:
314     type: OS::Neutron::Port
315     properties:
316       network: {get_param: oam_net_name}
317       fixed_ips: [{"ip_address": {get_param: [eca_oam_ips, 1]}}]
318       security_groups: [{get_param: security_group_name}]
319       replacement_policy: AUTO
320
321   oam2_int_port:
322     type: OS::Neutron::Port
323     properties:
324       network: {get_param: eca_mgmt_net_name}
325       fixed_ips: [{"ip_address": {get_param: [eca_eca_mgmt_ips, 1]}}]
326       security_groups: [{get_param: security_group_name}]
327       replacement_policy: AUTO
328
329   oam2_volume:
330     type: OS::Cinder::Volume
331     properties:
332       size: {get_param: oam_volume_size}
333       volume_type: {get_param: ECA_OAM_volume_type}
334
335   oam2_volume_attachment:
336     type: OS::Cinder::VolumeAttachment
337     properties:
338       volume_id: {get_resource: oam2_volume}
339       instance_uuid: {get_resource: oam2_instance}
340
341   arb_instance:
342     type: OS::Nova::Server
343     properties:
344       name: {get_param: [arb_names, 0]}
345       image: {get_param: oam_image_name}
346       flavor: {get_param: arbiter_flavor}
347       availability_zone: {get_param: availability_zone_0}
348       networks:
349         - port: {get_resource: arb_int_port}
350         - port: {get_resource: arb_mgmt_port}
351       metadata:
352         vnf_id: { get_param: vnf_id }
353       user_data:
354         str_replace:
355           template: |
356             #!/bin/bash
357             sed -i s/HOSTNAME.*/"HOSTNAME=arb_hostname"/g /etc/sysconfig/network
358             eth1_ip_address='arb_mgt_ip'
359             eth1_gateway='oam_gateway'
360             for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do
361               if [ "$interface" != "lo" ]; then
362                 DEVICE_NAME=$interface
363                 interface_ip_var="${DEVICE_NAME}_ip_address"
364                 gateway_var="${DEVICE_NAME}_gateway"
365                 var_name="$interface_ip_var"
366                 var_gateway="$gateway_var"
367                 if [ ! -z ${!var_name} ]; then
368                   IPADDR=${!var_name}
369                   BOOTPROTO="static"
370                   GATEWAY=${!var_gateway}
371                   IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no"
372                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO"
373                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR"
374                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0"
375                   IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY"
376                   printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME
377                 else
378                   if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then
379                     echo "Configuring $DEVICE_NAME to use DHCP"
380                     IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes"
381                     IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no"
382                     printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME
383                   fi
384                 fi
385                 ifdown $DEVICE_NAME
386                 ifup $DEVICE_NAME
387                 printf "$DEVICE_NAME\n" >> /tmp/network_config
388               fi
389             done
390             curl swift_url/etc/puppet/manifests/roles/oam_arbiter.pp > /etc/puppet/manifests/roles/oam_arbiter.pp
391             curl swift_url/etc/puppet/files/global/config.yaml > /etc/puppet/files/global/config.yaml
392             curl swift_url/etc/puppet/files/global/11-customer.conf > /etc/puppet/files/global/11-customer.conf
393             van-role oam_arbiter > /root/startup-van-role.out
394             curl swift_url/scripts/fdisk-keystrokes > /root/fdisk-keystrokes 
395             fdisk /dev/vdb < /root/fdisk-keystrokes 
396             curl swift_url/scripts/os-conf-cinder-vol > /root/os-conf-cinder-vol
397             chmod 755 /root/os-conf-cinder-vol
398             /root/os-conf-cinder-vol 2>> /tmp/cinder_volume.log
399           params:
400             arb_mgt_ip: {get_param: [arb_oam_ips, 0] }
401             arb_hostname: {get_param: [arb_names, 0]}
402             swift_url: {get_param: swift_eca_url}
403             oam_gateway: {get_param: eca_oam_gateway }
404
405   arb_mgmt_port:
406     type: OS::Neutron::Port
407     properties:
408       network: {get_param: oam_net_name}
409       fixed_ips: [{"ip_address": {get_param: [arb_oam_ips, 0]}}]
410       security_groups: [{get_param: security_group_name}]
411       replacement_policy: AUTO
412
413   arb_int_port:
414     type: OS::Neutron::Port
415     properties:
416       network: {get_param: eca_mgmt_net_name}
417       fixed_ips: [{"ip_address": {get_param: [arb_eca_mgmt_ips, 0]}}]
418       security_groups: [{get_param: security_group_name}]
419       replacement_policy: AUTO
420
421   arb_volume:
422     type: OS::Cinder::Volume
423     properties:
424       size: {get_param: arb_volume_size}
425       volume_type: {get_param: ARB_volume_type}
426   arb_volume_attachment:
427     type: OS::Cinder::VolumeAttachment
428     properties:
429       volume_id: {get_resource: arb_volume}
430       instance_uuid: {get_resource: arb_instance}