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