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