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