partial removal of gerrit credentials
[demo.git] / heat / OpenECOMP / onap_openstack.yaml
1 heat_template_version: 2015-10-15
2
3 description: Heat template to install ONAP components
4
5 ##############
6 #            #
7 # PARAMETERS #
8 #            #
9 ##############
10
11 parameters:
12
13   # Generic parameters used across all ONAP components
14   public_net_id:
15     type: string
16     description: Public network for floating IP address allocation
17
18   ubuntu_1404_image:
19     type: string
20     description: Name of the Ubuntu 14.04 image
21
22   ubuntu_1604_image:
23     type: string
24     description: Name of the Ubuntu 16.04 image
25
26   flavor_small:
27     type: string
28     description: Name of the Small Flavor supported by the cloud provider
29
30   flavor_medium:
31     type: string
32     description: Name of the Medium Flavor supported by the cloud provider
33
34   flavor_large:
35     type: string
36     description: Name of the Large Flavor supported by the cloud provider
37
38   flavor_xlarge:
39     type: string
40     description: Name of the Extra Large Flavor supported by the cloud provider
41     
42   vm_base_name:
43     type: string
44     description: Base name of ONAP VMs
45
46   key_name:
47     type: string
48     description: Public/Private key pair name
49
50   pub_key:
51     type: string
52     description: Public key to be installed on the compute instance
53
54   nexus_repo:
55     type: string
56     description: Complete URL for the Nexus repository.
57
58   nexus_docker_repo:
59     type: string
60     description: Complete URL for the Nexus repository for docker images.
61
62   nexus_username:
63     type: string
64     description: Nexus Repository username
65
66   nexus_password:
67     type: string
68     description: Nexus Repository Password
69
70   gitlab_username:
71     type: string
72     description: Gitlab Repository username
73
74   gitlab_password:
75     type: string
76     description: Gitlab Repository Password
77     
78   artifacts_version:
79     type: string
80     description: Artifacts version of ONAP components
81     
82   docker_version:
83     type: string
84     label: Version number of ONAP docker images
85     
86   gerrit_branch:
87     type: string
88     label: Gerrit code branch
89     description: Gerrit branch where to download the code from
90
91   dmaap_topic:
92     type: string
93     description: DmaaP Topic name
94     
95   openstack_tenant_id:
96     type: string
97     description: Openstack tenant ID
98
99   openstack_username:
100     type: string
101     description: Openstack username
102
103   openstack_api_key:
104     type: string
105     description: Openstack API Key
106     
107   horizon_url:
108     type: string
109     description: URL of Openstack Horizon
110
111   keystone_url:
112     type: string
113     description: URL of Openstack Keystone
114     
115   # Network parameters
116   external_dns:
117     type: comma_delimited_list
118     description: External DNS for OAM ONAP network
119
120   oam_network_cidr:
121     type: string
122     description: CIDR of the OAM ONAP network
123     
124   aai_ip_addr:
125     type: string
126     description: A&AI IP Address
127     
128   appc_ip_addr: 
129     type: string
130     description: APP-C IP Address
131     
132   dcae_ip_addr:
133     type: string
134     description: DCAE IP Address
135     
136   dns_ip_addr:
137     type: string
138     description: DNS IP Address
139     
140   mso_ip_addr: 
141     type: string
142     description: MSO IP Address
143     
144   mr_ip_addr: 
145     type: string
146     description: Message Router IP Address
147     
148   policy_ip_addr:
149     type: string
150     description: Policy Engine IP Address
151     
152   portal_ip_addr:
153     type: string
154     description: Portal IP Address
155     
156   robot_ip_addr: 
157     type: string
158     description: Robot Framework IP Address
159
160   sdc_ip_addr:
161     type: string
162     description: SDC IP Address
163     
164   sdnc_ip_addr:
165     type: string
166     description: SDN-C IP Address
167     
168   vid_ip_addr:
169     type: string
170     description: VID IP Address
171
172   # Parameters for DCAE instantiation
173   dcae_zone:
174     type: string
175     description: DCAE Zone to use in VM names created by DCAE controller
176
177   dcae_state:
178     type: string
179     description: DCAE State to use in VM names created by DCAE controller
180
181   nexus_repo_root:
182     type: string
183     description: Root URL of Nexus repository
184     
185   nexus_url_snapshot:
186     type: string
187     description: Snapshot of Maven repository for DCAE deployment
188
189   openstack_region:
190     type: string
191     description: Region where the DCAE controller will spin the VMs
192
193   gitlab_branch:
194     type: string
195     description: Branch of the Gitlab repository
196
197
198 #############
199 #           #
200 # RESOURCES #
201 #           #
202 #############
203
204 resources:
205   random-str:
206     type: OS::Heat::RandomString
207     properties:
208       length: 4
209
210
211   # Public key used to access ONAP components
212   vm_key:
213     type: OS::Nova::KeyPair
214     properties:
215       name: 
216         str_replace:
217           template: base_rand
218           params:
219             base: { get_param: key_name }
220             rand: { get_resource: random-str }         
221       public_key: { get_param: pub_key }
222       save_private_key: false
223
224
225   # ONAP management private network
226   oam_ecomp:
227     type: OS::Neutron::Net
228     properties:
229       name: 
230         str_replace:
231           template: oam_ecomp_rand
232           params:
233             rand: { get_resource: random-str }
234
235   oam_ecomp_subnet:
236     type: OS::Neutron::Subnet
237     properties:
238       name: 
239         str_replace:
240           template: oam_ecomp_rand
241           params:
242             rand: { get_resource: random-str }
243       network_id: { get_resource: oam_ecomp }
244       cidr: { get_param: oam_network_cidr }
245       dns_nameservers: { get_param: external_dns }
246
247   router:
248     type: OS::Neutron::Router
249     properties:
250       external_gateway_info:
251         network: { get_param: public_net_id }
252
253   router_interface:
254     type: OS::Neutron::RouterInterface
255     properties:
256       router_id: { get_resource: router }
257       subnet_id: { get_resource: oam_ecomp_subnet }
258
259
260   # DNS Server instantiation
261   dns_private_port:
262     type: OS::Neutron::Port
263     properties:
264       network: { get_resource: oam_ecomp }
265       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": { get_param: dns_ip_addr }}]
266
267   dns_floating_ip:
268     type: OS::Neutron::FloatingIP
269     properties:
270       floating_network_id: { get_param: public_net_id }
271       port_id: { get_resource: dns_private_port }
272
273   dns_vm:
274     type: OS::Nova::Server
275     properties:
276       image: { get_param: ubuntu_1404_image }
277       flavor: { get_param: flavor_small }
278       name: 
279         str_replace:
280           template: base-dns-server
281           params:
282             base: { get_param: vm_base_name }
283       key_name: { get_resource: vm_key }
284       networks:
285         - port: { get_resource: dns_private_port }
286       user_data_format: RAW
287       user_data:
288         str_replace:
289           params:
290             __nexus_repo__: { get_param: nexus_repo }
291             __artifacts_version__: { get_param: artifacts_version }
292             __oam_network_cidr__: { get_attr: [oam_ecomp_subnet, cidr] }
293             __dns_ip_addr__: { get_param: dns_ip_addr }
294             __aai_ip_addr__: { get_param: aai_ip_addr }
295             __appc_ip_addr__: { get_param: appc_ip_addr }
296             __dcae_ip_addr__: { get_param: dcae_ip_addr }
297             __mso_ip_addr__: { get_param: mso_ip_addr }
298             __mr_ip_addr__: { get_param: mr_ip_addr }
299             __policy_ip_addr__: { get_param: policy_ip_addr }
300             __portal_ip_addr__: { get_param: portal_ip_addr }
301             __robot_ip_addr__: { get_param: robot_ip_addr }
302             __sdc_ip_addr__: { get_param: sdc_ip_addr }
303             __sdnc_ip_addr__: { get_param: sdnc_ip_addr }
304             __vid_ip_addr__: { get_param: vid_ip_addr }
305
306           template: |
307             #!/bin/bash
308
309             hn=`hostname`
310             echo 127.0.0.1 $hn >> /etc/hosts
311             
312             # Download dependencies
313             add-apt-repository -y ppa:openjdk-r/ppa
314             apt-get update
315             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk bind9 bind9utils bind9-doc ntp ntpdate
316
317             # Download script
318             mkdir /etc/bind/zones
319             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/bind_zones -o /etc/bind/zones/db.simpledemo.openecomp.org
320             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/bind_options -o /etc/bind/named.conf.options
321             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/named.conf.local -o /etc/bind/named.conf.local
322
323             # Configure bind
324             #NETMASK=$(echo "__oam_network_cidr__" | cut -d"/" -f2)
325             #if [[ $NETMASK == "8" ]]
326             #then
327             #  ADDR=$(echo "__dns_ip_addr__" | cut -d"." -f1)
328             #elif [[ $NETMASK == "16" ]]
329             #then
330             #  ADDR=$(echo "__dns_ip_addr__" | cut -d"." -f1).$(echo "__dns_ip_addr__" | cut -d"." -f2)
331             #elif [[ $NETMASK == "24" ]]
332             #then
333             #  ADDR=$(echo "__dns_ip_addr__" | cut -d"." -f1).$(echo "__dns_ip_addr__" | cut -d"." -f2).$(echo "__dns_ip_addr__" | cut -d"." -f3)
334             #fi
335
336             #sed -i "s/netmask/$ADDR\/$NETMASK/g" /etc/bind/named.conf.options
337             sed -i "s/dns_ip_addr/"__dns_ip_addr__"/g" /etc/bind/named.conf.options
338
339             A=$(echo "__dcae_ip_addr__" | cut -d"." -f1)
340             B=$(echo "__dcae_ip_addr__" | cut -d"." -f2)
341             C=$(echo "__dcae_ip_addr__" | cut -d"." -f3)
342             sed -i "s/aai_ip_addr/"__aai_ip_addr__"/g" /etc/bind/zones/db.simpledemo.openecomp.org
343             sed -i "s/appc_ip_addr/"__appc_ip_addr__"/g" /etc/bind/zones/db.simpledemo.openecomp.org
344             sed -i "s/dcae_ip_addr/"__dcae_ip_addr__"/g" /etc/bind/zones/db.simpledemo.openecomp.org
345             sed -i "s/dns_ip_addr/"__dns_ip_addr__"/g" /etc/bind/zones/db.simpledemo.openecomp.org
346             sed -i "s/mso_ip_addr/"__mso_ip_addr__"/g" /etc/bind/zones/db.simpledemo.openecomp.org
347             sed -i "s/mr_ip_addr/"__mr_ip_addr__"/g" /etc/bind/zones/db.simpledemo.openecomp.org
348             sed -i "s/policy_ip_addr/"__policy_ip_addr__"/g" /etc/bind/zones/db.simpledemo.openecomp.org
349             sed -i "s/portal_ip_addr/"__portal_ip_addr__"/g" /etc/bind/zones/db.simpledemo.openecomp.org
350             sed -i "s/robot_ip_addr/"__robot_ip_addr__"/g" /etc/bind/zones/db.simpledemo.openecomp.org
351             sed -i "s/sdc_ip_addr/"__sdc_ip_addr__"/g" /etc/bind/zones/db.simpledemo.openecomp.org
352             sed -i "s/sdnc_ip_addr/"__sdnc_ip_addr__"/g" /etc/bind/zones/db.simpledemo.openecomp.org
353             sed -i "s/vid_ip_addr/"__vid_ip_addr__"/g" /etc/bind/zones/db.simpledemo.openecomp.org
354             sed -i "s/dcae_coll_ip_addr/"$A.$B.$C"/g" /etc/bind/zones/db.simpledemo.openecomp.org
355
356             modprobe ip_gre
357             sed -i "s/OPTIONS=.*/OPTIONS=\"-4 -u bind\"/g" /etc/default/bind9
358             
359             # Restart bind to pick up configuration changes
360             service bind9 restart
361
362
363   # A&AI instantiation
364   aai_private_port:
365     type: OS::Neutron::Port
366     properties:
367       network: { get_resource: oam_ecomp }
368       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": { get_param: aai_ip_addr }}]
369       
370   aai_floating_ip:
371     type: OS::Neutron::FloatingIP
372     properties:
373       floating_network_id: { get_param: public_net_id }
374       port_id: { get_resource: aai_private_port }
375
376   aai_vm:
377     type: OS::Nova::Server
378     depends_on: sdc_vm
379     properties:
380       image: { get_param: ubuntu_1404_image }
381       flavor: { get_param: flavor_xlarge }
382       name: 
383         str_replace:
384           template: base-aai
385           params:
386             base: { get_param: vm_base_name }      
387       key_name: { get_resource: vm_key }
388       networks:
389         - port: { get_resource: aai_private_port }
390       user_data_format: RAW
391       user_data:
392         str_replace:
393           params:
394             __nexus_repo__: { get_param: nexus_repo }
395             __nexus_docker_repo__: { get_param: nexus_docker_repo }
396             __nexus_username__: { get_param: nexus_username }
397             __nexus_password__: { get_param: nexus_password }
398             __gitlab_username__: { get_param: gitlab_username }
399             __gitlab_password__: { get_param: gitlab_password }
400             __dmaap_topic__: { get_param: dmaap_topic }
401             __artifacts_version__: { get_param: artifacts_version }
402             __dns_ip_addr__: { get_param: dns_ip_addr }
403             __docker_version__: { get_param: docker_version }
404           template: |
405             #!/bin/bash
406
407             hn=`hostname`
408             echo 127.0.0.1 $hn >> /etc/hosts
409             
410             # Download dependencies
411             add-apt-repository -y ppa:openjdk-r/ppa
412             apt-get update
413             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate
414
415             # Download scripts from Nexus
416             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/aai_vm_init.sh -o /opt/aai_vm_init.sh
417             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/aai_serv.sh -o /opt/aai_serv.sh
418             chmod +x /opt/aai_vm_init.sh
419             chmod +x /opt/aai_serv.sh
420             mv /opt/aai_serv.sh /etc/init.d
421             update-rc.d aai_serv.sh defaults
422
423             # Download and install docker-engine and docker-compose
424             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
425             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
426             apt-get update
427             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
428             apt-get install -y docker-engine
429             service docker start
430
431             mkdir /opt/openecomp
432             mkdir /opt/openecomp/aai
433             mkdir /opt/openecomp/aai/logs
434             mkdir /opt/openecomp/aai/data
435             mkdir /opt/docker
436             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
437             chmod +x /opt/docker/docker-compose
438             
439             # Store credentials in files
440             mkdir -p /opt/config
441             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
442             echo "__nexus_username__" > /opt/config/nexus_username.txt
443             echo "__nexus_password__" > /opt/config/nexus_password.txt
444             echo "__dmaap_topic__" > /opt/config/dmaap_topic.txt
445             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
446             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
447             echo "gerrit.onap.org" > /opt/config/gitlab_certname.txt
448             echo "__docker_version__" > /opt/config/docker_version.txt
449
450             # DNS/GW IP address configuration
451             echo "nameserver __dns_ip_addr__" >> /etc/resolvconf/resolv.conf.d/head
452             resolvconf -u
453
454             # Reboot the VM to pick up configuration changes
455             reboot
456
457
458   # MSO instantiation
459   mso_private_port:
460     type: OS::Neutron::Port
461     properties:
462       network: { get_resource: oam_ecomp }
463       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": { get_param: mso_ip_addr }}]
464
465   mso_floating_ip:
466     type: OS::Neutron::FloatingIP
467     properties:
468       floating_network_id: { get_param: public_net_id }
469       port_id: { get_resource: mso_private_port }
470
471   mso_vm:
472     type: OS::Nova::Server
473     properties:
474       image: { get_param: ubuntu_1604_image }
475       flavor: { get_param: flavor_large }
476       name: 
477         str_replace:
478           template: base-mso
479           params:
480             base: { get_param: vm_base_name }      
481       key_name: { get_resource: vm_key }
482       networks:
483         - port: { get_resource: mso_private_port }
484       user_data_format: RAW
485       user_data:
486         str_replace:
487           params:
488             __nexus_repo__: { get_param: nexus_repo }
489             __nexus_docker_repo__: { get_param: nexus_docker_repo }
490             __nexus_username__: { get_param: nexus_username }
491             __nexus_password__: { get_param: nexus_password }
492             __openstack_username__: { get_param: openstack_username }
493             __openstack_tenant_id__: { get_param: openstack_tenant_id }
494             __openstack_api_key__: { get_param: openstack_api_key }
495             __keystone_url__: { get_param: keystone_url }
496             __dmaap_topic__: { get_param: dmaap_topic }
497             __artifacts_version__: { get_param: artifacts_version }
498             __dns_ip_addr__: { get_param: dns_ip_addr }
499             __docker_version__: { get_param: docker_version }
500             __gerrit_branch__: { get_param: gerrit_branch }
501           template: |
502             #!/bin/bash
503
504             hn=`hostname`
505             echo 127.0.0.1 $hn >> /etc/hosts
506
507             # Download dependencies
508             add-apt-repository -y ppa:openjdk-r/ppa
509             apt-get update
510             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate
511
512             # Download scripts from Nexus
513             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mso_vm_init.sh -o /opt/mso_vm_init.sh
514             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mso_serv.sh -o /opt/mso_serv.sh
515             chmod +x /opt/mso_vm_init.sh
516             chmod +x /opt/mso_serv.sh
517             mv /opt/mso_serv.sh /etc/init.d
518             update-rc.d mso_serv.sh defaults
519
520             # Download and install docker-engine and docker-compose
521             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
522             echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
523             apt-get update
524             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
525             apt-get install -y docker-engine
526             service docker start
527
528             mkdir /opt/docker
529             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
530             chmod +x /opt/docker/docker-compose
531
532             # Store credentials in files
533             mkdir -p /opt/config
534             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
535             echo "__nexus_username__" > /opt/config/nexus_username.txt
536             echo "__nexus_password__" > /opt/config/nexus_password.txt
537             echo "__openstack_username__" > /opt/config/openstack_username.txt
538             echo "__openstack_tenant_id__" > /opt/config/tenant_id.txt
539             echo "__keystone_url__" > /opt/config/keystone.txt
540             echo "__dmaap_topic__" > /opt/config/dmaap_topic.txt
541             echo "__docker_version__" > /opt/config/docker_version.txt
542
543             # Clone Gerrit repository
544             cd /opt
545             git clone -b __gerrit_branch__ --single-branch http://gerrit.onap.org/r/mso/docker-config.git test_lab
546             MSO_ENCRYPTION_KEY=$(cat /opt/test_lab/encryption.key)
547             echo -n "__openstack_api_key__" | openssl aes-128-ecb -e -K $MSO_ENCRYPTION_KEY -nosalt | xxd -c 256 -p > /opt/config/api_key.txt
548
549             # Rename network interface
550             sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
551             grub-mkconfig -o /boot/grub/grub.cfg
552             sed -i "s/ens3/eth0/g" /etc/network/interfaces.d/*.cfg
553             
554             # DNS/GW IP address configuration
555             echo "nameserver __dns_ip_addr__" >> /etc/resolvconf/resolv.conf.d/head
556             resolvconf -u
557             
558             # Reboot the VM to pick up configuration changes
559             reboot
560
561
562   # Message Router instantiation
563   mrouter_private_port:
564     type: OS::Neutron::Port
565     properties:
566       network: { get_resource: oam_ecomp }
567       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": { get_param: mr_ip_addr }}]
568
569   mrouter_floating_ip:
570     type: OS::Neutron::FloatingIP
571     properties:
572       floating_network_id: { get_param: public_net_id }
573       port_id: { get_resource: mrouter_private_port }
574
575   mrouter_vm:
576     type: OS::Nova::Server
577     properties:
578       image: { get_param: ubuntu_1404_image }
579       flavor: { get_param: flavor_large }
580       name: 
581         str_replace: 
582           template: base-message-router
583           params:
584             base: { get_param: vm_base_name }
585       key_name: { get_resource: vm_key }
586       networks:
587         - port: { get_resource: mrouter_private_port }
588       user_data_format: RAW
589       user_data:
590         str_replace:
591           params:
592             __nexus_repo__: { get_param: nexus_repo }
593             __nexus_docker_repo__: { get_param: nexus_docker_repo }
594             __nexus_username__: { get_param: nexus_username }
595             __nexus_password__: { get_param: nexus_password }
596             __artifacts_version__: { get_param: artifacts_version }
597             __dns_ip_addr__: { get_param: dns_ip_addr }
598             __gerrit_branch__: { get_param: gerrit_branch }
599           template: |
600             #!/bin/bash
601
602             hn=`hostname`
603             echo 127.0.0.1 $hn >> /etc/hosts
604
605             # Download dependencies
606             add-apt-repository -y ppa:openjdk-r/ppa
607             apt-get update
608             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate
609             
610             # Download scripts from Nexus
611             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mr_vm_init.sh -o /opt/mr_vm_init.sh
612             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mr_serv.sh -o /opt/mr_serv.sh
613             chmod +x /opt/mr_vm_init.sh
614             chmod +x /opt/mr_serv.sh
615             mv /opt/mr_serv.sh /etc/init.d
616             update-rc.d mr_serv.sh defaults
617
618             # Download and install docker-engine and docker-compose
619             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
620             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
621             apt-get update
622             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
623             apt-get install -y docker-engine
624             service docker start
625
626             mkdir /opt/docker
627             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
628             chmod +x /opt/docker/docker-compose
629
630             # Store credentials in files
631             mkdir -p /opt/config
632             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
633             echo "__nexus_username__" > /opt/config/nexus_username.txt
634             echo "__nexus_password__" > /opt/config/nexus_password.txt
635
636             # Clone Gerrit repository
637             cd /opt
638             git clone -b __gerrit_branch__ --single-branch http://gerrit.onap.org/r/dcae/demo/startup/message-router.git dcae-startup-vm-message-router
639             
640             # DNS/GW IP address configuration
641             echo "nameserver __dns_ip_addr__" >> /etc/resolvconf/resolv.conf.d/head
642             resolvconf -u
643
644             # Reboot the VM to pick up configuration changes
645             reboot
646
647
648   # Robot Framework instantiation
649   robot_private_port:
650     type: OS::Neutron::Port
651     properties:
652       network: { get_resource: oam_ecomp }
653       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": { get_param: robot_ip_addr }}]
654
655   robot_floating_ip:
656     type: OS::Neutron::FloatingIP
657     properties:
658       floating_network_id: { get_param: public_net_id }
659       port_id: { get_resource: robot_private_port }
660  
661   robot_vm:
662     type: OS::Nova::Server
663     properties:
664       image: { get_param: ubuntu_1604_image }
665       flavor: { get_param: flavor_small }
666       name: 
667         str_replace: 
668           template: base-robot
669           params:
670             base: { get_param: vm_base_name }
671       key_name: { get_resource: vm_key }
672       networks:
673         - port: { get_resource: robot_private_port }
674       user_data_format: RAW
675       user_data:
676         str_replace:
677           params:
678             __nexus_repo__: { get_param: nexus_repo }
679             __nexus_docker_repo__: { get_param: nexus_docker_repo }
680             __nexus_username__: { get_param: nexus_username }
681             __nexus_password__: { get_param: nexus_password }
682             __network_name__: { get_attr: [oam_ecomp, name] }
683             __openstack_username__: { get_param: openstack_username }
684             __openstack_api_key__: { get_param : openstack_api_key }
685             __artifacts_version__: { get_param: artifacts_version }
686             __openstack_region__: { get_param: openstack_region }
687             __dns_ip_addr__: { get_param: dns_ip_addr }
688             __docker_version__: { get_param: docker_version }
689             __gerrit_branch__: { get_param: gerrit_branch }
690           template: |
691             #!/bin/bash
692
693             hn=`hostname`
694             echo 127.0.0.1 $hn >> /etc/hosts
695  
696             # Download dependencies
697             add-apt-repository -y ppa:openjdk-r/ppa
698             apt-get update
699             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate
700             echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
701
702             # Download scripts from Nexus
703             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/robot_vm_init.sh -o /opt/robot_vm_init.sh
704             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/robot_serv.sh -o /opt/robot_serv.sh
705             chmod +x /opt/robot_vm_init.sh
706             chmod +x /opt/robot_serv.sh
707             mv /opt/robot_serv.sh /etc/init.d
708             update-rc.d robot_serv.sh defaults
709  
710             # Download and install docker-engine and docker-compose
711             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
712             echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
713             apt-get update
714             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
715             apt-get install -y docker-engine
716             service docker start
717  
718             mkdir /opt/docker
719             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
720             chmod +x /opt/docker/docker-compose
721  
722             # Store credentials in files
723             mkdir -p /opt/config
724             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
725             echo "__nexus_repo__" > /opt/config/nexus_repo.txt
726             echo "__nexus_username__" > /opt/config/nexus_username.txt
727             echo "__nexus_password__" > /opt/config/nexus_password.txt
728             echo "__network_name__" > /opt/config/network.txt
729             echo "__openstack_username__" > /opt/config/openstack_username.txt
730             echo "__openstack_api_key__" > /opt/config/openstack_password.txt
731             echo "__openstack_region__" > /opt/config/region.txt
732             echo "__artifacts_version__" > /opt/config/artifacts_version.txt
733             echo "__docker_version__" > /opt/config/docker_version.txt
734
735             # Execute RobotETE-specific instructions: create share folder to run as a docker volume
736             mkdir -p /opt/eteshare/logs
737             mkdir -p /opt/eteshare/config
738
739             # Clone Gerrit repository
740             cd /opt
741             git clone -b __gerrit_branch__ --single-branch http://gerrit.onap.org/r/testsuite/properties.git testsuite/properties
742             
743             # Rename network interface
744             sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
745             grub-mkconfig -o /boot/grub/grub.cfg
746             sed -i "s/ens3/eth0/g" /etc/network/interfaces.d/*.cfg
747             
748             # DNS/GW IP address configuration
749             echo "nameserver __dns_ip_addr__" >> /etc/resolvconf/resolv.conf.d/head
750             resolvconf -u
751             
752             # Reboot the VM to pick up configuration changes
753             reboot
754
755
756   # VID instantiation
757   vid_private_port:
758     type: OS::Neutron::Port
759     properties:
760       network: { get_resource: oam_ecomp }
761       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": { get_param: vid_ip_addr }}]
762
763   vid_floating_ip:
764     type: OS::Neutron::FloatingIP
765     properties:
766       floating_network_id: { get_param: public_net_id }
767       port_id: { get_resource: vid_private_port }
768
769   vid_vm:
770     type: OS::Nova::Server
771     properties:
772       image: { get_param: ubuntu_1404_image }
773       flavor: { get_param: flavor_medium }
774       name: 
775         str_replace: 
776           template: base-vid
777           params:
778             base: { get_param: vm_base_name }
779       key_name: { get_resource: vm_key }
780       networks:
781         - port: { get_resource: vid_private_port }
782       user_data_format: RAW
783       user_data:
784         str_replace:
785           params:
786             __nexus_repo__: { get_param: nexus_repo }
787             __nexus_docker_repo__: { get_param: nexus_docker_repo }
788             __nexus_username__: { get_param: nexus_username }
789             __nexus_password__: { get_param: nexus_password }
790             __artifacts_version__: { get_param: artifacts_version }
791             __dns_ip_addr__: { get_param: dns_ip_addr }
792             __docker_version__: { get_param: docker_version }
793             __gerrit_branch__: { get_param: gerrit_branch }
794           template: |
795             #!/bin/bash
796
797             hn=`hostname`
798             echo 127.0.0.1 $hn >> /etc/hosts
799
800             # Download dependencies
801             add-apt-repository -y ppa:openjdk-r/ppa
802             apt-get update
803             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk make git ntp ntpdate
804
805             # Download scripts from Nexus
806             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/vid_vm_init.sh -o /opt/vid_vm_init.sh
807             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/vid_serv.sh -o /opt/vid_serv.sh
808             chmod +x /opt/vid_vm_init.sh
809             chmod +x /opt/vid_serv.sh
810             mv /opt/vid_serv.sh /etc/init.d
811             update-rc.d vid_serv.sh defaults
812
813             # Download and install docker-engine and docker-compose
814             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
815             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
816             apt-get update
817             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
818             apt-get install -y docker-engine
819             service docker start
820
821             mkdir /opt/docker
822             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
823             chmod +x /opt/docker/docker-compose
824
825             # Store credentials in files
826             mkdir -p /opt/config
827             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
828             echo "__nexus_username__" > /opt/config/nexus_username.txt
829             echo "__nexus_password__" > /opt/config/nexus_password.txt
830             echo "__docker_version__" > /opt/config/docker_version.txt
831
832             # Clone Gerrit repository
833             cd /opt
834             git clone -b __gerrit_branch__ --single-branch http://gerrit.onap.org/r/vid.git
835             
836             # DNS/GW IP address configuration
837             echo "nameserver __dns_ip_addr__" >> /etc/resolvconf/resolv.conf.d/head
838             resolvconf -u
839             
840             # Reboot the VM to pick up configuration changes
841             reboot
842             
843             
844   # SDN-C instantiation
845   sdnc_private_port:
846     type: OS::Neutron::Port
847     properties:
848       network: { get_resource: oam_ecomp }
849       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": { get_param: sdnc_ip_addr }}]
850
851   sdnc_floating_ip:
852     type: OS::Neutron::FloatingIP
853     properties:
854       floating_network_id: { get_param: public_net_id }
855       port_id: { get_resource: sdnc_private_port }
856
857   sdnc_vm:
858     type: OS::Nova::Server
859     properties:
860       image: { get_param: ubuntu_1404_image }
861       flavor: { get_param: flavor_large }
862       name: 
863         str_replace: 
864           template: base-sdnc
865           params:
866             base: { get_param: vm_base_name }
867       key_name: { get_resource: vm_key }
868       networks:
869         - port: { get_resource: sdnc_private_port }
870       user_data_format: RAW
871       user_data:
872         str_replace:
873           params:
874             __nexus_repo__: { get_param: nexus_repo }
875             __nexus_docker_repo__: { get_param: nexus_docker_repo }
876             __nexus_username__: { get_param: nexus_username }
877             __nexus_password__: { get_param: nexus_password }
878             __artifacts_version__: { get_param: artifacts_version }
879             __dns_ip_addr__: { get_param: dns_ip_addr }
880             __docker_version__: { get_param: docker_version }
881             __gerrit_branch__: { get_param: gerrit_branch }
882           template: |
883             #!/bin/bash
884
885             hn=`hostname`
886             echo 127.0.0.1 $hn >> /etc/hosts
887
888             # Download dependencies
889             add-apt-repository -y ppa:openjdk-r/ppa
890             apt-get update
891             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate
892
893             # Download scripts from Nexus
894             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/sdnc_vm_init.sh -o /opt/sdnc_vm_init.sh
895             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/sdnc_serv.sh -o /opt/sdnc_serv.sh
896             chmod +x /opt/sdnc_vm_init.sh
897             chmod +x /opt/sdnc_serv.sh
898             mv /opt/sdnc_serv.sh /etc/init.d
899             update-rc.d sdnc_serv.sh defaults
900             
901             # Download and install docker-engine and docker-compose
902             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
903             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
904             apt-get update
905             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
906             apt-get install -y docker-engine
907             service docker start
908
909             mkdir /opt/docker
910             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
911             chmod +x /opt/docker/docker-compose
912             
913             # Store credentials in files
914             mkdir -p /opt/config
915             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
916             echo "__nexus_username__" > /opt/config/nexus_username.txt
917             echo "__nexus_password__" > /opt/config/nexus_password.txt
918             echo "__docker_version__" > /opt/config/docker_version.txt
919
920             # Clone Gerrit repository
921             cd /opt
922             git clone -b __gerrit_branch__ --single-branch http://gerrit.onap.org/r/sdnc/oam.git sdnc
923             
924             # DNS/GW IP address configuration
925             echo "nameserver __dns_ip_addr__" >> /etc/resolvconf/resolv.conf.d/head
926             resolvconf -u
927             
928             # Reboot the VM to pick up configuration changes
929             reboot
930
931             
932   # SDC instantiation
933   sdc_private_port:
934     type: OS::Neutron::Port
935     properties:
936       network: { get_resource: oam_ecomp }
937       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": { get_param: sdc_ip_addr }}]
938
939   sdc_floating_ip:
940     type: OS::Neutron::FloatingIP
941     properties:
942       floating_network_id: { get_param: public_net_id }
943       port_id: { get_resource: sdc_private_port }
944
945   sdc_volume_data:
946     type: OS::Cinder::Volume
947     properties:
948       name: vol1-sdc-data
949       size: 100
950
951   sdc_volume_attachment:
952     type: OS::Cinder::VolumeAttachment
953     properties:
954       volume_id: { get_resource: sdc_volume_data }
955       instance_uuid: { get_resource: sdc_vm }
956       mountpoint: /dev/vdb
957
958   sdc_vm:
959     type: OS::Nova::Server
960     properties:
961       image: { get_param: ubuntu_1604_image }
962       flavor: { get_param: flavor_xlarge }
963       name: 
964         str_replace: 
965           template: base-sdc
966           params:
967             base: { get_param: vm_base_name }
968       key_name: { get_resource: vm_key }
969       networks:
970         - port: { get_resource: sdc_private_port }
971       user_data_format: RAW
972       user_data:
973         str_replace:
974           params:
975             __nexus_repo__: { get_param: nexus_repo }
976             __nexus_docker_repo__: { get_param: nexus_docker_repo }
977             __nexus_username__: { get_param: nexus_username }
978             __nexus_password__: { get_param: nexus_password }
979             __env_name__: { get_param: dmaap_topic }
980             __artifacts_version__: { get_param: artifacts_version }
981             __dns_ip_addr__: { get_param: dns_ip_addr }
982             __mr_ip_addr__: { get_param: mr_ip_addr }
983             __public_ip__: { get_attr: [sdc_floating_ip, floating_ip_address] }
984             __docker_version__: { get_param: docker_version }
985             __gerrit_branch__: { get_param: gerrit_branch }
986           template: |
987             #!/bin/bash
988             
989             hn=`hostname`        
990             echo 127.0.0.1 $hn >> /etc/hosts
991           
992             # Download dependencies
993             add-apt-repository -y ppa:openjdk-r/ppa
994             apt-get update
995             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate
996
997             # Download scripts from Nexus
998             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/asdc_vm_init.sh -o /opt/asdc_vm_init.sh
999             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/asdc_serv.sh -o /opt/asdc_serv.sh
1000             chmod +x /opt/asdc_vm_init.sh
1001             chmod +x /opt/asdc_serv.sh
1002             mv /opt/asdc_serv.sh /etc/init.d
1003             update-rc.d asdc_serv.sh defaults
1004             
1005             # Download and install docker-engine and docker-compose
1006             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
1007             echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
1008             apt-get update
1009             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
1010             apt-get install -y docker-engine
1011             service docker start
1012             mkdir /opt/docker
1013             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
1014             chmod +x /opt/docker/docker-compose
1015
1016             # Create partition and mount the external volume
1017             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/asdc_ext_volume_partitions.txt -o /opt/asdc_ext_volume_partitions.txt
1018             sfdisk /dev/vdb < /opt/asdc_ext_volume_partitions.txt
1019             mkfs -t ext4 /dev/vdb1
1020             mkdir -p /data
1021             mount /dev/vdb1 /data
1022             echo "/dev/vdb1  /data           ext4    errors=remount-ro,noatime,barrier=0 0       1" >> /etc/fstab
1023
1024             # Store credentials in files
1025             mkdir -p /opt/config
1026             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1027             echo "__nexus_username__" > /opt/config/nexus_username.txt
1028             echo "__nexus_password__" > /opt/config/nexus_password.txt
1029             echo "__env_name__" > /opt/config/env_name.txt
1030             echo "__mr_ip_addr__" > /opt/config/mr_ip_addr.txt
1031             echo "__public_ip__" > /opt/config/public_ip.txt
1032             echo "__docker_version__" > /opt/config/docker_version.txt
1033
1034             # Run SDC-specific instructions
1035             cd /opt
1036             mkdir -p /data/environments
1037             mkdir -p /data/scripts
1038             mkdir -p /data/logs/BE
1039             mkdir -p /data/logs/FE
1040             chmod 777 /data
1041             chmod 777 /data/logs/BE
1042             chmod 777 /data/logs/FE
1043
1044             # Clone Gerrit repository
1045             git clone -b __gerrit_branch__ --single-branch http://gerrit.onap.org/r/sdc.git
1046
1047             cat > /root/.bash_aliases << EOF
1048             alias dcls='/data/scripts/docker_clean.sh \$1'
1049             alias dlog='/data/scripts/docker_login.sh \$1'
1050             alias rund='/data/scripts/docker_run.sh'
1051             alias health='/data/scripts/docker_health.sh'
1052             EOF
1053             
1054             # Rename network interface
1055             sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
1056             grub-mkconfig -o /boot/grub/grub.cfg
1057             sed -i "s/ens3/eth0/g" /etc/network/interfaces.d/*.cfg
1058             
1059             # DNS/GW IP address configuration
1060             echo "nameserver __dns_ip_addr__" >> /etc/resolvconf/resolv.conf.d/head
1061             resolvconf -u
1062             
1063             # Reboot the VM to pick up configuration changes
1064             reboot
1065             
1066             
1067   # PORTAL instantiation
1068   portal_private_port:
1069     type: OS::Neutron::Port
1070     properties:
1071       network: { get_resource: oam_ecomp }
1072       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": { get_param: portal_ip_addr }}]
1073
1074   portal_floating_ip:
1075     type: OS::Neutron::FloatingIP
1076     properties:
1077       floating_network_id: { get_param: public_net_id }
1078       port_id: { get_resource: portal_private_port }
1079
1080   portal_vm:
1081     type: OS::Nova::Server
1082     properties:
1083       image: { get_param: ubuntu_1404_image }
1084       flavor: { get_param: flavor_large }
1085       name: 
1086         str_replace: 
1087           template: base-portal
1088           params:
1089             base: { get_param: vm_base_name }
1090       key_name: { get_resource: vm_key }
1091       networks:
1092         - port: { get_resource: portal_private_port }
1093       user_data_format: RAW
1094       user_data:
1095         str_replace:
1096           params:
1097             __nexus_repo__: { get_param: nexus_repo }
1098             __nexus_docker_repo__: { get_param: nexus_docker_repo }
1099             __nexus_username__: { get_param: nexus_username }
1100             __nexus_password__: { get_param: nexus_password }
1101             __artifacts_version__: { get_param: artifacts_version }
1102             __dns_ip_addr__: { get_param: dns_ip_addr }
1103             __public_ip__: { get_attr: [portal_floating_ip, floating_ip_address] }
1104             __docker_version__: { get_param: docker_version }
1105             __gerrit_branch__: { get_param: gerrit_branch }
1106           template: |
1107             #!/bin/bash
1108             
1109             hn=`hostname`
1110             echo 127.0.0.1 $hn >> /etc/hosts
1111             
1112             # Download dependencies
1113             add-apt-repository -y ppa:openjdk-r/ppa
1114             apt-get update
1115             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk git unzip mysql-client-core-5.6 ntp ntpdate
1116
1117             # Download scripts from Nexus
1118             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/portal_vm_init.sh -o /opt/portal_vm_init.sh
1119             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/portal_serv.sh -o /opt/portal_serv.sh
1120             chmod +x /opt/portal_vm_init.sh
1121             chmod +x /opt/portal_serv.sh
1122             mv /opt/portal_serv.sh /etc/init.d
1123             update-rc.d portal_serv.sh defaults
1124             
1125             # Download and install docker-engine and docker-compose
1126             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
1127             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
1128             apt-get update
1129             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
1130             apt-get install -y docker-engine
1131             service docker start
1132             mkdir /opt/docker
1133             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
1134             chmod +x /opt/docker/docker-compose
1135
1136             # Store credentials in files
1137             mkdir -p /opt/config
1138             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1139             echo "__nexus_username__" > /opt/config/nexus_username.txt
1140             echo "__nexus_password__" > /opt/config/nexus_password.txt
1141             echo "__public_ip__" > /opt/config/public_ip.txt
1142             echo "__docker_version__" > /opt/config/docker_version.txt
1143
1144             # Clone Gerrit repository
1145             mkdir -p /PROJECT/OpenSource/UbuntuEP/logs
1146             cd /opt
1147             git clone -b __gerrit_branch__ --single-branch http://gerrit.onap.org/r/portal.git
1148             
1149             # DNS/GW IP address configuration
1150             echo "nameserver __dns_ip_addr__" >> /etc/resolvconf/resolv.conf.d/head
1151             resolvconf -u
1152
1153             # Reboot the VM to pick up configuration changes
1154             reboot
1155             
1156             
1157   # DCAE Controller instantiation
1158   dcae_c_private_port:
1159     type: OS::Neutron::Port
1160     properties:
1161       network: { get_resource: oam_ecomp }
1162       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": { get_param: dcae_ip_addr }}]
1163
1164   dcae_c_floating_ip:
1165     type: OS::Neutron::FloatingIP
1166     properties:
1167       floating_network_id: { get_param: public_net_id }
1168       port_id: { get_resource: dcae_c_private_port }
1169
1170   dcae_c_vm:
1171     type: OS::Nova::Server
1172     properties:
1173       image: { get_param: ubuntu_1404_image }
1174       flavor: { get_param: flavor_medium }
1175       name: 
1176         str_replace: 
1177           template: base-dcae-controller
1178           params:
1179             base: { get_param: vm_base_name }
1180       key_name: { get_resource: vm_key }
1181       networks:
1182         - port: { get_resource: dcae_c_private_port }
1183       user_data_format: RAW
1184       user_data: 
1185         str_replace:
1186           params:
1187             __nexus_repo__: { get_param: nexus_repo }
1188             __nexus_docker_repo__: { get_param: nexus_docker_repo }
1189             __nexus_username__: { get_param: nexus_username }
1190             __nexus_password__: { get_param: nexus_password }
1191             __nexus_url_snapshots__: { get_param: nexus_url_snapshot }
1192             __gitlab_branch__: { get_param: gitlab_branch }
1193             __dns_ip_addr__: { get_param: dns_ip_addr }
1194             __dcae_zone__: { get_param: dcae_zone }
1195             __dcae_state__: { get_param: dcae_state }
1196             __artifacts_version__: { get_param: artifacts_version }
1197             __tenant_id__: { get_param: openstack_tenant_id }
1198             __openstack_private_network_name__: { get_attr: [oam_ecomp, name] }
1199             __openstack_user__: { get_param: openstack_username }
1200             __openstack_password__: { get_param: openstack_api_key }
1201             __key_name__: { get_param: key_name }
1202             __rand_str__: { get_resource: random-str }
1203             __pub_key__: { get_param: pub_key }
1204             __nexus_repo_root__: { get_param: nexus_repo_root }
1205             __openstack_region__: { get_param: openstack_region }
1206             __horizon_url__ : { get_param: horizon_url }
1207             __keystone_url__ : { get_param: keystone_url }
1208             __docker_version__: { get_param: docker_version }
1209             __gerrit_branch__: { get_param: gerrit_branch }
1210           template: |
1211             #!/bin/bash
1212             
1213             hn=`hostname`
1214             echo 127.0.0.1 $hn >> /etc/hosts
1215
1216             # Download dependencies
1217             add-apt-repository -y ppa:openjdk-r/ppa
1218             apt-get update
1219             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk make git ntp ntpdate
1220
1221             # Download scripts from Nexus
1222             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/dcae_vm_init.sh -o /opt/dcae_vm_init.sh
1223             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/dcae_serv.sh -o /opt/dcae_serv.sh
1224             chmod +x /opt/dcae_vm_init.sh
1225             chmod +x /opt/dcae_serv.sh
1226             mv /opt/dcae_serv.sh /etc/init.d
1227             update-rc.d dcae_serv.sh defaults
1228
1229             # Download and install docker-engine and docker-compose
1230             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
1231             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
1232             apt-get update
1233             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
1234             apt-get install -y docker-engine
1235             service docker start
1236             mkdir /opt/docker
1237             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
1238             chmod +x /opt/docker/docker-compose
1239             
1240             # Clone Gerrit repository
1241             cd /opt
1242             git clone -b __gerrit_branch__ --single-branch http://gerrit.onap.org/r/dcae/demo/startup/controller.git dcae-startup-vm-controller
1243             
1244             # DCAE Controller specific deployment
1245             cd /opt/dcae-startup-vm-controller
1246             mkdir -p /opt/app/dcae-controller
1247             cat > /opt/app/dcae-controller/config.yaml << EOF_CONFIG
1248             ZONE: __dcae_zone__
1249             STATE: __dcae_state__
1250             DCAE-VERSION: __artifacts_version__
1251             HORIZON-URL: __horizon_url__/__openstack_user__
1252             KEYSTONE-URL: __keystone_url__
1253             OPENSTACK-TENANT-ID: __tenant_id__
1254             OPENSTACK-TENANT-NAME: OPEN-ECOMP
1255             OPENSTACK-REGION: __openstack_region__
1256             OPENSTACK-PRIVATE-NETWORK: __openstack_private_network_name__
1257             OPENSTACK-USER: __openstack_user__
1258             OPENSTACK-PASSWORD: __openstack_password__
1259             OPENSTACK-KEYNAME: __key_name_____rand_str___dcae
1260             OPENSTACK-PUBKEY: __pub_key__
1261             
1262             NEXUS-URL-ROOT: __nexus_repo_root__
1263             NEXUS-USER: __nexus_username__
1264             NEXUS-PASSWORD: __nexus_password__
1265             NEXUS-URL-SNAPSHOTS: __nexus_url_snapshots__
1266             NEXUS-RAWURL: __nexus_repo__
1267             
1268             DOCKER-REGISTRY: __nexus_docker_repo__
1269
1270             GIT-MR-REPO: http://gerrit.onap.org/r/dcae/demo/startup/message-router.git
1271             EOF_CONFIG
1272
1273             # Store credentials in files
1274             mkdir -p /opt/config
1275             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1276             echo "__nexus_username__" > /opt/config/nexus_username.txt
1277             echo "__nexus_password__" > /opt/config/nexus_password.txt
1278             echo "__gitlab_branch__" > /opt/config/gitlab_branch.txt
1279             echo "__docker_version__" > /opt/config/docker_version.txt
1280             
1281             # DNS/GW IP address configuration
1282             echo "nameserver __dns_ip_addr__" >> /etc/resolvconf/resolv.conf.d/head
1283             resolvconf -u
1284
1285             # Reboot the VM to pick up configuration changes
1286             reboot
1287             
1288             
1289   # Policy Engine instantiation
1290   policy_private_port:
1291     type: OS::Neutron::Port
1292     properties:
1293       network: { get_resource: oam_ecomp }
1294       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": { get_param: policy_ip_addr }}]
1295
1296   policy_floating_ip:
1297     type: OS::Neutron::FloatingIP
1298     properties:
1299       floating_network_id: { get_param: public_net_id }
1300       port_id: { get_resource: policy_private_port }
1301
1302   policy_vm:
1303     type: OS::Nova::Server
1304     properties:
1305       image: { get_param: ubuntu_1404_image }
1306       flavor: { get_param: flavor_xlarge }
1307       name: 
1308         str_replace: 
1309           template: base-policy
1310           params:
1311             base: { get_param: vm_base_name }
1312       key_name: { get_resource: vm_key }
1313       networks:
1314         - port: { get_resource: policy_private_port }
1315       user_data_format: RAW
1316       user_data:
1317         str_replace:
1318           params:
1319             __nexus_repo__: { get_param: nexus_repo }
1320             __nexus_docker_repo__: { get_param: nexus_docker_repo }
1321             __nexus_username__: { get_param: nexus_username }
1322             __nexus_password__: { get_param: nexus_password }
1323             __artifacts_version__: { get_param: artifacts_version }
1324             __dns_ip_addr__: { get_param: dns_ip_addr }
1325             __public_ip__: { get_attr: [policy_floating_ip, floating_ip_address] }
1326             __docker_version__: { get_param: docker_version }
1327             __gerrit_branch__: { get_param: gerrit_branch }
1328           template: |
1329             #!/bin/bash
1330             
1331             hn=`hostname`
1332             echo 127.0.0.1 $hn >> /etc/hosts
1333
1334             # Download dependencies
1335             add-apt-repository -y ppa:openjdk-r/ppa
1336             apt-get update
1337             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate
1338
1339             # Download scripts from Nexus
1340             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/policy_vm_init.sh -o /opt/policy_vm_init.sh
1341             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/policy_serv.sh -o /opt/policy_serv.sh
1342             chmod +x /opt/policy_vm_init.sh
1343             chmod +x /opt/policy_serv.sh
1344             mv /opt/policy_serv.sh /etc/init.d
1345             update-rc.d policy_serv.sh defaults
1346
1347             # Download and install docker-engine and docker-compose
1348             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
1349             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
1350             apt-get update
1351             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
1352             apt-get install -y docker-engine
1353             service docker start
1354             mkdir /opt/docker
1355             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
1356             chmod +x /opt/docker/docker-compose
1357
1358             # Store credentials in files
1359             mkdir -p /opt/config
1360             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1361             echo "__nexus_username__" > /opt/config/nexus_username.txt
1362             echo "__nexus_password__" > /opt/config/nexus_password.txt
1363             echo "__public_ip__" > /opt/config/public_ip.txt
1364             echo "__docker_version__" > /opt/config/docker_version.txt
1365
1366             # Clone Gerrit repository
1367             cd /opt
1368             git clone -b __gerrit_branch__ --single-branch http://gerrit.onap.org/r/policy/docker.git policy
1369             
1370             # DNS/GW IP address configuration
1371             echo "nameserver __dns_ip_addr__" >> /etc/resolvconf/resolv.conf.d/head
1372             resolvconf -u
1373             
1374             # Reboot the VM to pick up configuration changes
1375             reboot
1376             
1377             
1378   # APP-C instantiation
1379   appc_private_port:
1380     type: OS::Neutron::Port
1381     properties:
1382       network: { get_resource: oam_ecomp }
1383       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": { get_param: appc_ip_addr }}]
1384
1385   appc_floating_ip:
1386     type: OS::Neutron::FloatingIP
1387     properties:
1388       floating_network_id: { get_param: public_net_id }
1389       port_id: { get_resource: appc_private_port }
1390
1391   appc_vm:
1392     type: OS::Nova::Server
1393     properties:
1394       image: { get_param: ubuntu_1404_image }
1395       flavor: { get_param: flavor_large }
1396       name: 
1397         str_replace: 
1398           template: base-appc
1399           params:
1400             base: { get_param: vm_base_name }
1401       key_name: { get_resource: vm_key }
1402       networks:
1403         - port: { get_resource: appc_private_port }
1404       user_data_format: RAW
1405       user_data:
1406         str_replace:
1407           params:
1408             __nexus_repo__: { get_param: nexus_repo }
1409             __nexus_docker_repo__: { get_param: nexus_docker_repo }
1410             __nexus_username__: { get_param: nexus_username }
1411             __nexus_password__: { get_param: nexus_password }
1412             __dmaap_topic__: { get_param: dmaap_topic }
1413             __artifacts_version__: { get_param: artifacts_version }
1414             __dns_ip_addr__: { get_param: dns_ip_addr }
1415             __docker_version__: { get_param: docker_version }
1416             __gerrit_branch__: { get_param: gerrit_branch }
1417           template: |
1418             #!/bin/bash
1419             
1420             hn=`hostname`
1421             echo 127.0.0.1 $hn >> /etc/hosts
1422
1423             # Download dependencies
1424             add-apt-repository -y ppa:openjdk-r/ppa
1425             apt-get update
1426             apt-get install -y apt-transport-https ca-certificates wget openjdk-7-jdk git ntp ntpdate
1427
1428             # Download scripts from Nexus
1429             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/appc_vm_init.sh -o /opt/appc_vm_init.sh
1430             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/appc_serv.sh -o /opt/appc_serv.sh
1431             chmod +x /opt/appc_vm_init.sh
1432             chmod +x /opt/appc_serv.sh
1433             mv /opt/appc_serv.sh /etc/init.d
1434             update-rc.d appc_serv.sh defaults
1435             
1436             # Download and install docker-engine and docker-compose
1437             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
1438             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
1439             apt-get update
1440             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
1441             apt-get install -y docker-engine
1442             service docker start
1443
1444             mkdir /opt/docker
1445             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
1446             chmod +x /opt/docker/docker-compose
1447             
1448             # Store credentials in files
1449             mkdir -p /opt/config
1450             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1451             echo "__nexus_username__" > /opt/config/nexus_username.txt
1452             echo "__nexus_password__" > /opt/config/nexus_password.txt
1453             echo "__dmaap_topic__" > /opt/config/dmaap_topic.txt
1454             echo "__docker_version__" > /opt/config/docker_version.txt
1455
1456             # Clone Gerrit repository
1457             cd /opt
1458             git clone -b __gerrit_branch__ --single-branch http://gerrit.onap.org/r/appc/deployment.git appc
1459             
1460             # DNS/GW IP address configuration
1461             echo "nameserver __dns_ip_addr__" >> /etc/resolvconf/resolv.conf.d/head
1462             resolvconf -u
1463             
1464             # Reboot the VM to pick up configuration changes
1465             reboot
1466