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