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