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