update docker image tags
[demo.git] / heat / OpenECOMP / openecomp_rackspace.yaml
1 heat_template_version: 2013-05-23
2
3 description: Heat template to deploy ONAP components
4
5 parameters:
6
7   # Generic parameters used across all ONAP components
8   public_net_id:
9     type: string
10     label: Public network name or ID
11     description: Public network that enables remote connection to the compute instance
12
13   key_name:
14     type: string
15     label: Key pair name
16     description: Public/Private key pair name
17
18   pub_key:
19     type: string
20     label: Public key
21     description: Public key or SSL certificate to be installed on the compute instance
22
23   nexus_repo:
24     type: string
25     label: Nexus Repository
26     description: Complete URL for the Nexus repository.
27
28   nexus_docker_repo:
29     type: string
30     label: Nexus Docker Images Repository
31     description: Complete URL for the Nexus repository for docker images.
32
33   nexus_username:
34     type: string
35     label: Nexus Repository Username
36     description: Nexus Repository username
37
38   nexus_password:
39     type: string
40     label: Nexus Repository Password
41     description: Nexus Repository Password
42     
43   gitlab_username:
44     type: string
45     label: Gitlab Repository Username
46     description: Gitlab Repository username
47
48   gitlab_password:
49     type: string
50     label: Gitlab Repository Password
51     description: Gitlab Repository Password
52
53   dmaap_topic:
54     type: string
55     label: DmaaP Topic
56     description: DmaaP Topic that MSO and A&AI listen to
57
58   artifacts_version:
59     type: string
60     label: Artifacts Version
61     description: Artifacts version of ONAP components
62     
63   docker_version:
64     type: string
65     label: Docker Version
66     description: Docker version of ONAP docker images
67
68   gerrit_branch:
69     type: string
70     label: Gerrit code branch
71     description: Gerrit branch where to download the code from
72
73   # Parameters for DCAE instantiation
74   dcae_zone:
75     type: string
76     label: DCAE Zone
77     description: DCAE Zone to use in VM names created by DCAE controller
78
79   dcae_state:
80     type: string
81     label: DCAE State
82     description: DCAE State to use in VM names created by DCAE controller
83
84   openstack_tenant_id:
85     type: string
86     label: Rackspace tenant ID
87     description: Rackspace tenant ID
88
89   openstack_username:
90     type: string
91     label: Rackspace username
92     description: Rackspace username
93
94   openstack_api_key:
95     type: string
96     label: Rackspace API Key
97     description: Rackspace API Key
98
99   openstack_password:
100     type: string
101     label: Rackspace Password
102     description: Rackspace Password
103
104   nexus_repo_root:
105     type: string
106     label: Root URL of nexus repository
107     description: Root URL of nexus repository
108     
109   nexus_url_snapshot:
110     type: string
111     label: Snapshot of Maven repository for DCAE deployment
112     description: Snapshot of Maven repository
113
114   openstack_region:
115     type: string
116     label: Rackspace Region
117     description: Rackspace region where the DCAE controller will spin the VMs
118
119   gitlab_branch:
120     type: string
121     label: Branch of the Gitlab repository
122     description: Branch of the Gitlab repository
123     
124
125 resources:
126   random-str:
127     type: OS::Heat::RandomString
128     properties:
129       length: 4
130
131   # Public key used to access ONAP components
132   vm_key:
133     type: OS::Nova::KeyPair
134     properties:
135       name: 
136         str_replace:
137           template: base_rand
138           params:
139             base: { get_param: key_name }
140             rand: { get_resource: random-str }         
141       public_key: { get_param: pub_key }
142       save_private_key: false
143
144
145   # ONAP management private network
146   oam_ecomp:
147     type: OS::Neutron::Net
148     properties:
149       name: 
150         str_replace:
151           template: oam_ecomp_rand
152           params:
153             rand: { get_resource: random-str }
154
155   oam_ecomp_subnet:
156     type: OS::Neutron::Subnet
157     properties:
158       name: 
159         str_replace:
160           template: oam_ecomp_rand
161           params:
162             rand: { get_resource: random-str }
163       network_id: { get_resource: oam_ecomp }
164       cidr: 10.0.0.0/8
165     #value: { get_attr: [oam_ecomp, name] }
166
167
168   # DNS Server instantiation
169   dns_private_port:
170     type: OS::Neutron::Port
171     properties:
172       network: { get_resource: oam_ecomp }
173       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.0.1}]
174
175   dns_vm:
176     type: OS::Nova::Server
177     properties:
178       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
179       flavor: 4 GB General Purpose v1
180       name: vm1-dns-server
181       key_name: { get_resource: vm_key }
182       networks:
183         - network: { get_param: public_net_id }
184         - port: { get_resource: dns_private_port }
185       user_data_format: RAW
186       user_data:
187         str_replace:
188           params:
189             __nexus_repo__: { get_param: nexus_repo }
190             __artifacts_version__: { get_param: artifacts_version }
191           template: |
192             #!/bin/bash
193
194             # Download dependencies
195             add-apt-repository -y ppa:openjdk-r/ppa
196             apt-get update
197             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk bind9 bind9utils bind9-doc ntp ntpdate
198
199             # Download script
200             mkdir /etc/bind/zones
201
202             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/db_simpledemo_openecomp_org -o /etc/bind/zones/db.simpledemo.openecomp.org
203             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/named.conf.options -o /etc/bind/named.conf.options
204             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/named.conf.local -o /etc/bind/named.conf.local
205
206             # Configure Bind
207             modprobe ip_gre
208             sed -i "s/OPTIONS=.*/OPTIONS=\"-4 -u bind\"/g" /etc/default/bind9
209             service bind9 restart
210
211
212   # A&AI instantiation
213   aai_private_port:
214     type: OS::Neutron::Port
215     properties:
216       network: { get_resource: oam_ecomp }
217       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.1.1}]
218
219   aai_volume:
220     type: OS::Cinder::Volume
221     properties:
222       name: vol1-aai
223       size: 50
224       volume_type: SSD
225       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
226
227   aai_vm:
228     type: OS::Nova::Server
229     depends_on: sdc_vm
230     properties:
231       flavor: 15 GB Compute v1
232       name: vm1-aai
233       key_name: { get_resource: vm_key }
234       block_device_mapping:
235         - volume_id: { get_resource: aai_volume }
236           device_name: vda
237       networks:
238         - network: { get_param: public_net_id }
239         - port: { get_resource: aai_private_port }
240       user_data_format: RAW
241       user_data:
242         str_replace:
243           params:
244             __nexus_repo__: { get_param: nexus_repo }
245             __nexus_docker_repo__: { get_param: nexus_docker_repo }
246             __nexus_username__: { get_param: nexus_username }
247             __nexus_password__: { get_param: nexus_password }
248             __gitlab_username__: { get_param: gitlab_username }
249             __gitlab_password__: { get_param: gitlab_password }
250             __dmaap_topic__: { get_param: dmaap_topic }
251             __artifacts_version__: { get_param: artifacts_version }
252             __docker_version__: { get_param: docker_version }
253           template: |
254             #!/bin/bash
255
256             # DNS/GW IP address configuration
257             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
258             resolvconf -u
259             
260             # Download dependencies
261             add-apt-repository -y ppa:openjdk-r/ppa
262             apt-get update
263             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
264
265             # Download scripts from Nexus
266             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/aai_vm_init.sh -o /opt/aai_vm_init.sh
267             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/aai_serv.sh -o /opt/aai_serv.sh
268             chmod +x /opt/aai_vm_init.sh
269             chmod +x /opt/aai_serv.sh
270             mv /opt/aai_serv.sh /etc/init.d
271             update-rc.d aai_serv.sh defaults
272
273             # Download and install docker-engine and docker-compose
274             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
275             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
276             apt-get update
277             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
278             apt-get install -y docker-engine
279             service docker start
280
281             mkdir -p /opt/openecomp/aai/logs
282             mkdir -p /opt/openecomp/aai/data
283             mkdir /opt/docker
284             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
285             chmod +x /opt/docker/docker-compose
286             
287             # Store credentials in files
288             mkdir -p /opt/config
289             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
290             echo "__nexus_username__" > /opt/config/nexus_username.txt
291             echo "__nexus_password__" > /opt/config/nexus_password.txt
292             echo "__dmaap_topic__" > /opt/config/dmaap_topic.txt
293             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
294             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
295             echo "gerrit.openecomp.org" > /opt/config/gitlab_certname.txt
296             echo "__docker_version__" > /opt/config/docker_version.txt
297             
298             # Execute docker instructions
299             cd /opt
300             ./aai_vm_init.sh
301
302
303   # MSO instantiation
304   mso_private_port:
305     type: OS::Neutron::Port
306     properties:
307       network: { get_resource: oam_ecomp }
308       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.5.1}]
309
310   mso_vm:
311     type: OS::Nova::Server
312     properties:
313       image: Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)
314       flavor: 4 GB General Purpose v1
315       name: vm1-mso
316       key_name: { get_resource: vm_key }
317       networks:
318         - network: { get_param: public_net_id }
319         - port: { get_resource: mso_private_port }
320       user_data_format: RAW
321       user_data:
322         str_replace:
323           params:
324             __nexus_repo__: { get_param: nexus_repo }
325             __nexus_docker_repo__: { get_param: nexus_docker_repo }
326             __nexus_username__: { get_param: nexus_username }
327             __nexus_password__: { get_param: nexus_password }
328             __gitlab_username__: { get_param: gitlab_username }
329             __gitlab_password__: { get_param: gitlab_password }
330             __openstack_username__: { get_param: openstack_username }
331             __openstack_tenant_id__: { get_param: openstack_tenant_id }
332             __openstack_api_key__: { get_param: openstack_api_key }
333             __dmaap_topic__: { get_param: dmaap_topic }
334             __artifacts_version__: { get_param: artifacts_version }
335             __docker_version__: { get_param: docker_version }
336             __gerrit_branch__: { get_param: gerrit_branch }
337           template: |
338             #!/bin/bash
339
340             # DNS/GW IP address configuration
341             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
342             resolvconf -u
343
344             # Download dependencies
345             add-apt-repository -y ppa:openjdk-r/ppa
346             apt-get update
347             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate
348
349             # Download scripts from Nexus
350             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mso_vm_init.sh -o /opt/mso_vm_init.sh
351             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mso_serv.sh -o /opt/mso_serv.sh
352             chmod +x /opt/mso_vm_init.sh
353             chmod +x /opt/mso_serv.sh
354             mv /opt/mso_serv.sh /etc/init.d
355             update-rc.d mso_serv.sh defaults
356
357             # Download and install docker-engine and docker-compose
358             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
359             echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
360             apt-get update
361             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
362             apt-get install -y docker-engine
363             service docker start
364
365             mkdir /opt/docker
366             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
367             chmod +x /opt/docker/docker-compose
368
369             # Store credentials in files
370             mkdir -p /opt/config
371             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
372             echo "__nexus_username__" > /opt/config/nexus_username.txt
373             echo "__nexus_password__" > /opt/config/nexus_password.txt
374             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
375             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
376             echo "__openstack_username__" > /opt/config/openstack_username.txt
377             echo "__openstack_tenant_id__" > /opt/config/tenant_id.txt
378             echo "__dmaap_topic__" > /opt/config/dmaap_topic.txt
379             echo "__docker_version__" > /opt/config/docker_version.txt
380
381             # Run docker-compose to spin up containers
382             cd /opt
383             git clone -b __gerrit_branch__ --single-branch https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/mso/docker-config.git test_lab
384             MSO_ENCRYPTION_KEY=$(cat /opt/test_lab/encryption.key)
385             echo -n "__openstack_api_key__" | openssl aes-128-ecb -e -K $MSO_ENCRYPTION_KEY -nosalt | xxd -c 256 -p > /opt/config/api_key.txt
386             ./mso_vm_init.sh
387
388
389   # Message Router instantiation
390   mrouter_private_port:
391     type: OS::Neutron::Port
392     properties:
393       network: { get_resource: oam_ecomp }
394       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.11.1}]
395
396   mrouter_vm:
397     type: OS::Nova::Server
398     properties:
399       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
400       flavor: 15 GB I/O v1
401       name: vm1-message-router
402       key_name: { get_resource: vm_key }
403       networks:
404         - network: { get_param: public_net_id }
405         - port: { get_resource: mrouter_private_port }
406       user_data_format: RAW
407       user_data:
408         str_replace:
409           params:
410             __nexus_repo__: { get_param: nexus_repo }
411             __nexus_docker_repo__: { get_param: nexus_docker_repo }
412             __nexus_username__: { get_param: nexus_username }
413             __nexus_password__: { get_param: nexus_password }
414             __gitlab_username__: { get_param: gitlab_username }
415             __gitlab_password__: { get_param: gitlab_password }
416             __artifacts_version__: { get_param: artifacts_version }
417             __gerrit_branch__: { get_param: gerrit_branch }
418           template: |
419             #!/bin/bash
420
421             # DNS/GW IP address configuration
422             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
423             resolvconf -u
424
425             # Download dependencies
426             add-apt-repository -y ppa:openjdk-r/ppa
427             apt-get update
428             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
429             
430             # Download scripts from Nexus
431             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mr_vm_init.sh -o /opt/mr_vm_init.sh
432             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mr_serv.sh -o /opt/mr_serv.sh
433             chmod +x /opt/mr_vm_init.sh
434             chmod +x /opt/mr_serv.sh
435             mv /opt/mr_serv.sh /etc/init.d
436             update-rc.d mr_serv.sh defaults
437
438             # Download and install docker-engine and docker-compose
439             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
440             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
441             apt-get update
442             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
443             apt-get install -y docker-engine
444             service docker start
445
446             mkdir /opt/docker
447             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
448             chmod +x /opt/docker/docker-compose
449
450             # Store credentials in files
451             mkdir -p /opt/config
452             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
453             echo "__nexus_username__" > /opt/config/nexus_username.txt
454             echo "__nexus_password__" > /opt/config/nexus_password.txt
455             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
456             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
457
458             # Run docker-compose to spin up containers
459             cd /opt
460             git clone -b __gerrit_branch__ --single-branch https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/dcae/demo/startup/message-router.git dcae-startup-vm-message-router
461             ./mr_vm_init.sh
462
463
464   # RobotE2E instantiation
465   robot_private_port:
466     type: OS::Neutron::Port
467     properties:
468       network: { get_resource: oam_ecomp }
469       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.10.1}]
470  
471   robot_vm:
472     type: OS::Nova::Server
473     properties:
474       image: Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)
475       flavor: 2 GB General Purpose v1
476       name: vm1-robot
477       key_name: { get_resource: vm_key }
478       networks:
479         - network: { get_param: public_net_id }
480         - port: { get_resource: robot_private_port }
481       user_data_format: RAW
482       user_data:
483         str_replace:
484           params:
485             __nexus_repo__: { get_param: nexus_repo }
486             __nexus_docker_repo__: { get_param: nexus_docker_repo }
487             __nexus_username__: { get_param: nexus_username }
488             __nexus_password__: { get_param: nexus_password }
489             __gitlab_username__: { get_param: gitlab_username }
490             __gitlab_password__: { get_param: gitlab_password }
491             __network_name__: { get_attr: [oam_ecomp, name] }
492             __openstack_username__: { get_param: openstack_username }
493             __openstack_api_key__: { get_param : openstack_api_key }
494             __openstack_password__: { get_param: openstack_password }
495             __artifacts_version__: { get_param: artifacts_version }
496             __openstack_region__: { get_param: openstack_region }
497             __docker_version__: { get_param: docker_version }
498             __gerrit_branch__: { get_param: gerrit_branch }
499           template: |
500             #!/bin/bash
501
502             # DNS/GW IP address configuration
503             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
504             resolvconf -u
505  
506             # Download dependencies
507             add-apt-repository -y ppa:openjdk-r/ppa
508             apt-get update
509             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
510             echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
511
512             # Download scripts from Nexus
513             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/robot_vm_init.sh -o /opt/robot_vm_init.sh
514             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/robot_serv.sh -o /opt/robot_serv.sh
515             chmod +x /opt/robot_vm_init.sh
516             chmod +x /opt/robot_serv.sh
517             mv /opt/robot_serv.sh /etc/init.d
518             update-rc.d robot_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_repo__" > /opt/config/nexus_repo.txt
536             echo "__nexus_username__" > /opt/config/nexus_username.txt
537             echo "__nexus_password__" > /opt/config/nexus_password.txt
538             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
539             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
540             echo "__network_name__" > /opt/config/network.txt
541             echo "__openstack_username__" > /opt/config/openstack_username.txt
542             echo "__openstack_password__" > /opt/config/openstack_password.txt
543             echo "__openstack_api_key__" > /opt/config/openstack_api_key.txt
544             echo "__openstack_region__" > /opt/config/region.txt
545             echo "__artifacts_version__" > /opt/config/artifacts_version.txt
546             echo "__docker_version__" > /opt/config/docker_version.txt
547
548             # Execute RobotETE-specific instructions: create share folder to run as a docker volume
549             mkdir -p /opt/eteshare/logs
550             mkdir -p /opt/eteshare/config
551
552             # Run docker-compose to spin up containers
553             cd /opt
554             git clone -b __gerrit_branch__ --single-branch https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/testsuite/properties.git testsuite/properties
555             ./robot_vm_init.sh
556
557
558   # VID instantiation
559   vid_private_port:
560     type: OS::Neutron::Port
561     properties:
562       network: { get_resource: oam_ecomp }
563       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.8.1}]
564
565   vid_vm:
566     type: OS::Nova::Server
567     properties:
568       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
569       flavor: 2 GB General Purpose v1
570       name: vm1-vid
571       key_name: { get_resource: vm_key }
572       networks:
573         - network: { get_param: public_net_id }
574         - port: { get_resource: vid_private_port }
575       user_data_format: RAW
576       user_data:
577         str_replace:
578           params:
579             __nexus_repo__: { get_param: nexus_repo }
580             __nexus_docker_repo__: { get_param: nexus_docker_repo }
581             __nexus_username__: { get_param: nexus_username }
582             __nexus_password__: { get_param: nexus_password }
583             __gitlab_username__: { get_param: gitlab_username }
584             __gitlab_password__: { get_param: gitlab_password }
585             __artifacts_version__: { get_param: artifacts_version }
586             __docker_version__: { get_param: docker_version }
587             __gerrit_branch__: { get_param: gerrit_branch }
588           template: |
589             #!/bin/bash
590
591             # DNS/GW IP address configuration
592             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
593             resolvconf -u
594
595             # Download dependencies
596             add-apt-repository -y ppa:openjdk-r/ppa
597             apt-get update
598             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk make git ntp ntpdate
599
600             # Download scripts from Nexus
601             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/vid_vm_init.sh -o /opt/vid_vm_init.sh
602             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/vid_serv.sh -o /opt/vid_serv.sh
603             chmod +x /opt/vid_vm_init.sh
604             chmod +x /opt/vid_serv.sh
605             mv /opt/vid_serv.sh /etc/init.d
606             update-rc.d vid_serv.sh defaults
607
608             # Download and install docker-engine and docker-compose
609             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
610             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
611             apt-get update
612             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
613             apt-get install -y docker-engine
614             service docker start
615
616             mkdir /opt/docker
617             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
618             chmod +x /opt/docker/docker-compose
619
620             # Store credentials in files
621             mkdir -p /opt/config
622             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
623             echo "__nexus_username__" > /opt/config/nexus_username.txt
624             echo "__nexus_password__" > /opt/config/nexus_password.txt
625             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
626             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
627             echo "__docker_version__" > /opt/config/docker_version.txt
628
629             # Run script to spin up containers
630             cd /opt
631             git clone -b __gerrit_branch__ --single-branch https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/vid.git
632             ./vid_vm_init.sh
633
634
635   # SDN-C instantiation
636   sdnc_private_port:
637     type: OS::Neutron::Port
638     properties:
639       network: { get_resource: oam_ecomp }
640       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.7.1}]
641
642   sdnc_vm:
643     type: OS::Nova::Server
644     properties:
645       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
646       flavor: 4 GB General Purpose v1
647       name: vm1-sdnc
648       key_name: { get_resource: vm_key }
649       networks:
650         - network: { get_param: public_net_id }
651         - port: { get_resource: sdnc_private_port }
652       user_data_format: RAW
653       user_data:
654         str_replace:
655           params:
656             __nexus_repo__: { get_param: nexus_repo }
657             __nexus_docker_repo__: { get_param: nexus_docker_repo }
658             __nexus_username__: { get_param: nexus_username }
659             __nexus_password__: { get_param: nexus_password }
660             __gitlab_username__: { get_param: gitlab_username }
661             __gitlab_password__: { get_param: gitlab_password }
662             __artifacts_version__: { get_param: artifacts_version }
663             __docker_version__: { get_param: docker_version }
664             __gerrit_branch__: { get_param: gerrit_branch }
665           template: |
666             #!/bin/bash
667
668             # DNS/GW IP address configuration
669             mkdir /opt/config
670             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
671             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
672             resolvconf -u
673
674             # Download dependencies
675             add-apt-repository -y ppa:openjdk-r/ppa
676             apt-get update
677             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
678
679             # Download scripts from Nexus
680             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/sdnc_vm_init.sh -o /opt/sdnc_vm_init.sh
681             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/sdnc_serv.sh -o /opt/sdnc_serv.sh
682             chmod +x /opt/sdnc_vm_init.sh
683             chmod +x /opt/sdnc_serv.sh
684             mv /opt/sdnc_serv.sh /etc/init.d
685             update-rc.d sdnc_serv.sh defaults
686             
687             # Download and install docker-engine and docker-compose
688             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
689             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
690             apt-get update
691             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
692             apt-get install -y docker-engine
693             service docker start
694
695             mkdir /opt/docker
696             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
697             chmod +x /opt/docker/docker-compose
698             
699             # Store credentials in files
700             mkdir -p /opt/config
701             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
702             echo "__nexus_username__" > /opt/config/nexus_username.txt
703             echo "__nexus_password__" > /opt/config/nexus_password.txt
704             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
705             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
706             echo "__docker_version__" > /opt/config/docker_version.txt
707
708             # Run docker-compose to spin up containers
709             cd /opt
710             git clone -b __gerrit_branch__ --single-branch https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/sdnc/oam.git sdnc
711             ./sdnc_vm_init.sh
712
713
714   # SDC instantiation
715   sdc_private_port:
716     type: OS::Neutron::Port
717     properties:
718       network: { get_resource: oam_ecomp }
719       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.3.1}]
720
721   sdc_volume_local:
722     type: OS::Cinder::Volume
723     properties:
724       name: vol1-sdc-local
725       size: 50
726       volume_type: SSD
727       image: Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)
728
729   sdc_volume_data:
730     type: OS::Cinder::Volume
731     properties:
732       name: vol1-sdc-data
733       size: 100
734       volume_type: SSD
735
736   sdc_volume_attachment:
737     type: OS::Cinder::VolumeAttachment
738     properties:
739       volume_id: { get_resource: sdc_volume_data }
740       instance_uuid: { get_resource: sdc_vm }
741       mountpoint: /dev/xvdb
742
743   sdc_vm:
744     type: OS::Nova::Server
745     properties:
746       flavor: 15 GB Compute v1
747       name: vm1-sdc
748       key_name: { get_resource: vm_key }
749       block_device_mapping:
750         - volume_id: { get_resource: sdc_volume_local }
751           device_name: vda
752       networks:
753         - network: { get_param: public_net_id }
754         - port: { get_resource: sdc_private_port }
755       user_data_format: RAW
756       user_data:
757         str_replace:
758           params:
759             __nexus_repo__: { get_param: nexus_repo }
760             __nexus_docker_repo__: { get_param: nexus_docker_repo }
761             __nexus_username__: { get_param: nexus_username }
762             __nexus_password__: { get_param: nexus_password }
763             __gitlab_username__: { get_param: gitlab_username }
764             __gitlab_password__: { get_param: gitlab_password }
765             __env_name__: { get_param: dmaap_topic }
766             __artifacts_version__: { get_param: artifacts_version }
767             __docker_version__: { get_param: docker_version }
768             __gerrit_branch__: { get_param: gerrit_branch }
769           template: |
770             #!/bin/bash
771             
772             # DNS/GW IP address configuration
773             mkdir /opt/config
774             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
775             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
776             resolvconf -u
777           
778             # Download dependencies
779             add-apt-repository -y ppa:openjdk-r/ppa
780             apt-get update
781             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
782             
783             # Download scripts from Nexus
784             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/asdc_vm_init.sh -o /opt/asdc_vm_init.sh
785             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/asdc_serv.sh -o /opt/asdc_serv.sh
786             chmod +x /opt/asdc_vm_init.sh
787             chmod +x /opt/asdc_serv.sh
788             mv /opt/asdc_serv.sh /etc/init.d
789             update-rc.d asdc_serv.sh defaults
790             
791             # Download and install docker-engine and docker-compose
792             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
793             echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
794             apt-get update
795             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
796             apt-get install -y docker-engine
797             service docker start
798             mkdir /opt/docker
799             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
800             chmod +x /opt/docker/docker-compose
801
802             # Create partition and mount the external volume
803             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/asdc_ext_volume_partitions.txt -o /opt/asdc_ext_volume_partitions.txt
804             sfdisk /dev/xvdb < /opt/asdc_ext_volume_partitions.txt
805             mkfs -t ext4 /dev/xvdb1
806             mkdir -p /data
807             mount /dev/xvdb1 /data
808             echo "/dev/xvdb1  /data           ext4    errors=remount-ro,noatime,barrier=0 0       1" >> /etc/fstab
809
810             # Store credentials in files
811             mkdir -p /opt/config
812             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
813             echo "__nexus_username__" > /opt/config/nexus_username.txt
814             echo "__nexus_password__" > /opt/config/nexus_password.txt
815             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
816             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
817             echo "__env_name__" > /opt/config/env_name.txt
818             echo "10.0.11.1" > /opt/config/mr_ip_addr.txt
819             echo "__docker_version__" > /opt/config/docker_version.txt
820
821             # Run SDC-specific instructions
822             cd /opt
823             mkdir -p /data/environments
824             mkdir -p /data/scripts
825             mkdir -p /data/logs/BE
826             mkdir -p /data/logs/FE
827             chmod 777 /data
828             chmod 777 /data/logs/BE
829             chmod 777 /data/logs/FE
830
831             git clone -b __gerrit_branch__ --single-branch https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/sdc.git
832
833             cat > /root/.bash_aliases << EOF
834             alias dcls='/data/scripts/docker_clean.sh \$1'
835             alias dlog='/data/scripts/docker_login.sh \$1'
836             alias rund='/data/scripts/docker_run.sh'
837             alias health='/data/scripts/docker_health.sh'
838             EOF
839
840             # Run docker-compose to spin up containers
841             ./asdc_vm_init.sh
842             
843
844   # PORTAL instantiation
845   portal_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": 10.0.9.1}]
850
851   portal_volume:
852     type: OS::Cinder::Volume
853     properties:
854       name: vol1-portal
855       size: 50
856       volume_type: SSD
857       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
858
859   portal_vm:
860     type: OS::Nova::Server
861     properties:
862       flavor: 15 GB Memory v1
863       name: vm1-portal
864       key_name: { get_resource: vm_key }
865       block_device_mapping:
866         - volume_id: { get_resource: portal_volume }
867           device_name: vda
868       networks:
869         - network: { get_param: public_net_id }
870         - port: { get_resource: portal_private_port }
871       user_data_format: RAW
872       user_data:
873         str_replace:
874           params:
875             __nexus_repo__: { get_param: nexus_repo }
876             __nexus_docker_repo__: { get_param: nexus_docker_repo }
877             __nexus_username__: { get_param: nexus_username }
878             __nexus_password__: { get_param: nexus_password }
879             __gitlab_username__: { get_param: gitlab_username }
880             __gitlab_password__: { get_param: gitlab_password }
881             __artifacts_version__: { get_param: artifacts_version }
882             __docker_version__: { get_param: docker_version }
883             __gerrit_branch__: { get_param: gerrit_branch }
884           template: |
885             #!/bin/bash
886             
887             # DNS/GW IP address configuration
888             mkdir /opt/config
889             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
890             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
891             resolvconf -u
892             
893             # Download dependencies
894             add-apt-repository -y ppa:openjdk-r/ppa
895             apt-get update
896             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk unzip mysql-client-core-5.6 ntp ntpdate
897             
898             # Download scripts from Nexus
899             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/portal_vm_init.sh -o /opt/portal_vm_init.sh
900             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/portal_serv.sh -o /opt/portal_serv.sh
901             chmod +x /opt/portal_vm_init.sh
902             chmod +x /opt/portal_serv.sh
903             mv /opt/portal_serv.sh /etc/init.d
904             update-rc.d portal_serv.sh defaults
905             
906             # Download and install docker-engine and docker-compose
907             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
908             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
909             apt-get update
910             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
911             apt-get install -y docker-engine
912             service docker start
913             mkdir /opt/docker
914             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
915             chmod +x /opt/docker/docker-compose
916
917             # Store credentials in files
918             mkdir -p /opt/config
919             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
920             echo "__nexus_username__" > /opt/config/nexus_username.txt
921             echo "__nexus_password__" > /opt/config/nexus_password.txt
922             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
923             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
924             echo "__docker_version__" > /opt/config/docker_version.txt
925
926             # Run Portal-specific instructions
927             mkdir -p /PROJECT/OpenSource/UbuntuEP/logs
928             cd /opt
929             git clone -b __gerrit_branch__ --single-branch https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/portal.git
930
931             # Run docker-compose to spin up containers
932             ./portal_vm_init.sh
933
934
935   # DCAE Controller instantiation
936   dcae_c_private_port:
937     type: OS::Neutron::Port
938     properties:
939       network: { get_resource: oam_ecomp }
940       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.4.1}]
941   dcae_c_vm:
942     type: OS::Nova::Server
943     properties:
944       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
945       flavor: 8 GB General Purpose v1
946       name: vm1-dcae-controller
947       key_name: { get_resource: vm_key }
948       networks:
949         - network: { get_param: public_net_id }
950         - port: { get_resource: dcae_c_private_port }
951       user_data_format: RAW
952       user_data: 
953         str_replace:
954           params:
955             __nexus_repo__: { get_param: nexus_repo }
956             __nexus_docker_repo__: { get_param: nexus_docker_repo }
957             __nexus_username__: { get_param: nexus_username }
958             __nexus_password__: { get_param: nexus_password }
959             __nexus_url_snapshots__: { get_param: nexus_url_snapshot }
960             __gitlab_username__: { get_param: gitlab_username }
961             __gitlab_password__: { get_param: gitlab_password }
962             __gitlab_branch__: { get_param: gitlab_branch }
963             __dcae_zone__: { get_param: dcae_zone }
964             __dcae_state__: { get_param: dcae_state }
965             __artifacts_version__: { get_param: artifacts_version }
966             __tenant_id__: { get_param: openstack_tenant_id }
967             __openstack_private_network_name__: { get_attr: [oam_ecomp, name] }
968             __openstack_user__: { get_param: openstack_username }
969             __openstack_password__: { get_param: openstack_api_key }
970             __key_name__: { get_param: key_name }
971             __rand_str__: { get_resource: random-str }
972             __pub_key__: { get_param: pub_key }
973             __nexus_repo_root__: { get_param: nexus_repo_root }
974             __openstack_region__: { get_param: openstack_region }
975             __docker_version__: { get_param: docker_version }
976             __gerrit_branch__: { get_param: gerrit_branch }
977           template: |
978             #!/bin/bash
979             
980             # DNS/GW IP address configuration
981             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
982             resolvconf -u
983
984             # Download dependencies
985             add-apt-repository -y ppa:openjdk-r/ppa
986             apt-get update
987             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk make git ntp ntpdate
988
989             # Download scripts from Nexus
990             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/dcae_vm_init.sh -o /opt/dcae_vm_init.sh
991             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/dcae_serv.sh -o /opt/dcae_serv.sh
992             chmod +x /opt/dcae_vm_init.sh
993             chmod +x /opt/dcae_serv.sh
994             mv /opt/dcae_serv.sh /etc/init.d
995             update-rc.d dcae_serv.sh defaults
996
997             # Download and install docker-engine and docker-compose
998             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
999             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
1000             apt-get update
1001             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
1002             apt-get install -y docker-engine
1003             service docker start
1004             mkdir /opt/docker
1005             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
1006             chmod +x /opt/docker/docker-compose
1007             
1008             # DCAE Controller specific deployment
1009             cd /opt
1010             git clone -b __gerrit_branch__ --single-branch https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/dcae/demo/startup/controller.git dcae-startup-vm-controller
1011
1012             cd dcae-startup-vm-controller
1013             mkdir -p /opt/app/dcae-controller
1014             cat > /opt/app/dcae-controller/config.yaml << EOF_CONFIG
1015             ZONE: __dcae_zone__
1016             STATE: __dcae_state__
1017             DCAE-VERSION: __artifacts_version__
1018             HORIZON-URL: https://mycloud.rackspace.com/cloud/__tenant_id__
1019             KEYSTONE-URL: https://identity.api.rackspacecloud.com/v2.0
1020             OPENSTACK-TENANT-ID: __tenant_id__
1021             OPENSTACK-TENANT-NAME: OPEN-ECOMP
1022             OPENSTACK-REGION: __openstack_region__
1023             OPENSTACK-PRIVATE-NETWORK: __openstack_private_network_name__
1024             OPENSTACK-USER: __openstack_user__
1025             OPENSTACK-PASSWORD: __openstack_password__
1026             OPENSTACK-KEYNAME: __key_name_____rand_str___dcae
1027             OPENSTACK-PUBKEY: __pub_key__
1028             
1029             NEXUS-URL-ROOT: __nexus_repo_root__
1030             NEXUS-USER: __nexus_username__
1031             NEXUS-PASSWORD: __nexus_password__
1032             NEXUS-URL-SNAPSHOTS: __nexus_url_snapshots__
1033             NEXUS-RAWURL: __nexus_repo__
1034             
1035             DOCKER-REGISTRY: __nexus_docker_repo__
1036
1037             GIT-MR-REPO: https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/dcae/demo/startup/message-router.git
1038             EOF_CONFIG
1039
1040             # Store credentials in files
1041             mkdir -p /opt/config
1042             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1043             echo "__nexus_username__" > /opt/config/nexus_username.txt
1044             echo "__nexus_password__" > /opt/config/nexus_password.txt
1045             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
1046             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
1047             echo "__gitlab_branch__" > /opt/config/gitlab_branch.txt
1048             echo "__docker_version__" > /opt/config/docker_version.txt
1049
1050             cd /opt
1051             ./dcae_vm_init.sh
1052
1053
1054   # Policy engine instantiation
1055   policy_private_port:
1056     type: OS::Neutron::Port
1057     properties:
1058       network: { get_resource: oam_ecomp }
1059       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.6.1}]
1060
1061   policy_volume:
1062     type: OS::Cinder::Volume
1063     properties:
1064       name: vol1-policy
1065       size: 50
1066       volume_type: SSD
1067       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
1068
1069   policy_vm:
1070     type: OS::Nova::Server
1071     properties:
1072       flavor: 15 GB Compute v1
1073       name: vm1-policy
1074       key_name: { get_resource: vm_key }
1075       block_device_mapping:
1076         - volume_id: { get_resource: policy_volume }
1077           device_name: vda
1078       networks:
1079         - network: { get_param: public_net_id }
1080         - port: { get_resource: policy_private_port }
1081       user_data_format: RAW
1082       user_data:
1083         str_replace:
1084           params:
1085             __nexus_repo__: { get_param: nexus_repo }
1086             __nexus_docker_repo__: { get_param: nexus_docker_repo }
1087             __nexus_username__: { get_param: nexus_username }
1088             __nexus_password__: { get_param: nexus_password }
1089             __gitlab_username__: { get_param: gitlab_username }
1090             __gitlab_password__: { get_param: gitlab_password }
1091             __artifacts_version__: { get_param: artifacts_version }
1092             __docker_version__: { get_param: docker_version }
1093             __gerrit_branch__: { get_param: gerrit_branch }
1094           template: |
1095             #!/bin/bash
1096             
1097             # DNS/GW IP address configuration
1098             mkdir /opt/config
1099             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
1100             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
1101             resolvconf -u
1102
1103             # Download dependencies
1104             add-apt-repository -y ppa:openjdk-r/ppa
1105             apt-get update
1106             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
1107
1108             # Download scripts from Nexus
1109             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/policy_vm_init.sh -o /opt/policy_vm_init.sh
1110             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/policy_serv.sh -o /opt/policy_serv.sh
1111             chmod +x /opt/policy_vm_init.sh
1112             chmod +x /opt/policy_serv.sh
1113             mv /opt/policy_serv.sh /etc/init.d
1114             update-rc.d policy_serv.sh defaults
1115
1116             # Download and install docker-engine and docker-compose
1117             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
1118             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
1119             apt-get update
1120             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
1121             apt-get install -y docker-engine
1122             service docker start
1123             mkdir /opt/docker
1124             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
1125             chmod +x /opt/docker/docker-compose
1126
1127             # Store credentials in files
1128             mkdir -p /opt/config
1129             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1130             echo "__nexus_username__" > /opt/config/nexus_username.txt
1131             echo "__nexus_password__" > /opt/config/nexus_password.txt
1132             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
1133             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
1134             echo "__docker_version__" > /opt/config/docker_version.txt
1135
1136             # Run docker-compose to spin up containers
1137             cd /opt
1138             git clone -b __gerrit_branch__ --single-branch https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/policy/docker.git policy
1139
1140             ./policy_vm_init.sh
1141
1142
1143   # APP-C instantiation
1144   appc_private_port:
1145     type: OS::Neutron::Port
1146     properties:
1147       network: { get_resource: oam_ecomp }
1148       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.2.1}]
1149
1150   appc_vm:
1151     type: OS::Nova::Server
1152     properties:
1153       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
1154       flavor: 4 GB General Purpose v1
1155       name: vm1-appc
1156       key_name: { get_resource: vm_key }
1157       networks:
1158         - network: { get_param: public_net_id }
1159         - port: { get_resource: appc_private_port }
1160       user_data_format: RAW
1161       user_data:
1162         str_replace:
1163           params:
1164             __nexus_repo__: { get_param: nexus_repo }
1165             __nexus_docker_repo__: { get_param: nexus_docker_repo }
1166             __nexus_username__: { get_param: nexus_username }
1167             __nexus_password__: { get_param: nexus_password }
1168             __gitlab_username__: { get_param: gitlab_username }
1169             __gitlab_password__: { get_param: gitlab_password }
1170             __dmaap_topic__: { get_param: dmaap_topic }
1171             __artifacts_version__: { get_param: artifacts_version }
1172             __docker_version__: { get_param: docker_version }
1173             __gerrit_branch__: { get_param: gerrit_branch }
1174           template: |
1175             #!/bin/bash
1176
1177             # DNS/GW IP address configuration
1178             mkdir /opt/config
1179             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
1180             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
1181             resolvconf -u
1182
1183             # Download dependencies
1184             add-apt-repository -y ppa:openjdk-r/ppa
1185             apt-get update
1186             apt-get install -y apt-transport-https ca-certificates wget openjdk-7-jdk ntp ntpdate
1187
1188             # Download scripts from Nexus
1189             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/appc_vm_init.sh -o /opt/appc_vm_init.sh
1190             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/appc_serv.sh -o /opt/appc_serv.sh
1191             chmod +x /opt/appc_vm_init.sh
1192             chmod +x /opt/appc_serv.sh
1193             mv /opt/appc_serv.sh /etc/init.d
1194             update-rc.d appc_serv.sh defaults
1195             
1196             # Download and install docker-engine and docker-compose
1197             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
1198             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
1199             apt-get update
1200             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
1201             apt-get install -y docker-engine
1202             service docker start
1203
1204             mkdir /opt/docker
1205             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
1206             chmod +x /opt/docker/docker-compose
1207             
1208             # Store credentials in files
1209             mkdir -p /opt/config
1210             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1211             echo "__nexus_username__" > /opt/config/nexus_username.txt
1212             echo "__nexus_password__" > /opt/config/nexus_password.txt
1213             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
1214             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
1215             echo "__dmaap_topic__" > /opt/config/dmaap_topic.txt
1216             echo "__docker_version__" > /opt/config/docker_version.txt
1217
1218             # Run docker-compose to spin up containers
1219             cd /opt
1220             git clone -b __gerrit_branch__ --single-branch https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/appc/deployment.git appc
1221             ./appc_vm_init.sh
1222