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