Customize simpldemo.onap.org DNS zone with rdm_str
[oom.git] / kubernetes / config / docker / init / src / config / dcaegen2 / heat / onap_dcae.yaml
1 ##########################################################################
2 #
3 #==================LICENSE_START==========================================
4 #
5 #
6 # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
7 #
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #        http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 #==================LICENSE_END============================================
20 #
21 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 #
23 ##########################################################################
24
25 heat_template_version: 2015-10-15
26
27 description: Heat template to install ONAP components
28
29 ##############
30 #            #
31 # PARAMETERS #
32 #            #
33 ##############
34
35 parameters:
36
37   ##############################################
38   #                                            #
39   # Parameters used across all ONAP components #
40   #                                            #
41   ##############################################
42
43   public_net_id:
44     type: string
45     description: The ID of the Public network for floating IP address allocation
46
47   public_net_name:
48     type: string
49     description: The name of the Public network referred by public_net_id
50
51   ubuntu_1404_image:
52     type: string
53     description: Name of the Ubuntu 14.04 image
54
55   ubuntu_1604_image:
56     type: string
57     description: Name of the Ubuntu 16.04 image
58
59   flavor_small:
60     type: string
61     description: Name of the Small Flavor supported by the cloud provider
62
63   flavor_medium:
64     type: string
65     description: Name of the Medium Flavor supported by the cloud provider
66
67   flavor_large:
68     type: string
69     description: Name of the Large Flavor supported by the cloud provider
70
71   vm_base_name:
72     type: string
73     description: Base name of ONAP VMs
74
75   key_name:
76     type: string
77     description: Public/Private key pair name
78
79   pub_key:
80     type: string
81     description: Public key to be installed on the compute instance
82
83   nexus_repo:
84     type: string
85     description: Complete URL for the Nexus repository.
86
87   nexus_docker_repo:
88     type: string
89     description: Complete URL for the Nexus repository for docker images.
90
91   nexus_username:
92     type: string
93     description: Nexus Repository username
94
95   nexus_password:
96     type: string
97     description: Nexus Repository Password
98
99   artifacts_version:
100     type: string
101     description: Artifacts version of ONAP components
102
103   openstack_tenant_id:
104     type: string
105     description: OpenStack tenant ID
106
107   openstack_tenant_name:
108     type: string
109     description: OpenStack tenant name (matching with the openstack_tenant_id)
110
111   openstack_username:
112     type: string
113     description: OpenStack username
114
115   openstack_api_key:
116     type: string
117     description: OpenStack password or API Key
118
119   keystone_url:
120     type: string
121     description: URL of OpenStack Keystone
122
123   cloud_env:
124     type: string
125     description: Cloud Provider Name in lower case
126
127   openstack_region:
128     type: string
129     description: Region where the DCAE controller will spin the VMs
130
131   ######################
132   #                    #
133   # Network parameters #
134   #                    #
135   ######################
136
137   dns_list:
138     type: comma_delimited_list
139     description: List of External DNS for OAM ONAP network
140
141   external_dns:
142     type: string
143     description: Public IP of the external DNS for ONAP network
144
145   dns_forwarder:
146     type: string
147     description: the forwarder address for setting up ONAP's private DNS server
148
149   oam_network_cidr:
150     type: string
151     description: CIDR of the OAM ONAP network
152
153   ### Private IP addresses ###
154   dns_ip_addr:
155     type: string
156   dcae_ip_addr:
157     type: string
158   aai1_k8s_ip_addr:
159     type: string
160   aai2_k8s_ip_addr:
161     type: string
162   mr_k8s_ip_addr:
163     type: string
164   policy_k8s_ip_addr:
165     type: string
166   sdc_k8s_ip_addr:
167     type: string
168   openo_k8s_ip_addr:
169     type: string
170
171   ###########################
172   #                         #
173   # Parameters used by DCAE #
174   #                         #
175   ###########################
176
177   dnsaas_config_enabled:
178     type: string
179     description: whether the DNSaaS configuration section is enabled
180
181   dnsaas_region:
182     type: string
183     description: the region of the cloud instance providing the Designate DNS as a Service
184
185   dnsaas_keystone_url:
186     type: string
187     description: the keystone URL of the cloud instance providing the Designate DNS as a Service
188
189   dnsaas_username:
190     type: string
191     description: the username of the cloud instance providing the Designate DNS as a Service
192
193   dnsaas_password:
194     type: string
195     description: the password of the cloud instance providing the Designate DNS as a Service
196
197   dnsaas_tenant_name:
198     type: string
199     description: the name of the tenant in the cloud instance providing the Designate DNS as a Service
200
201   dcae_keystone_url:
202     type: string
203     description: the keystone URL for DCAE to use (via MultiCloud)
204
205   dcae_private_key:
206     type: string
207     description: the private key of the key-apir used between the DCAE bootstrap container and DCAE VMs
208
209   dcae_public_key:
210     type: string
211     description: the prublic key of the key-apir used between the DCAE bootstrap container and DCAE VMs
212
213   dcae_centos_7_image:
214     type: string
215     description: the id/name of the CentOS 7 VM imange
216
217   dcae_domain:
218     type: string
219     description: the top level domain to register DCAE VMs (the zone will be random-str.dcae_domain)
220
221   dcae_docker:
222     type: string
223
224
225 #############
226 #           #
227 # RESOURCES #
228 #           #
229 #############
230
231 resources:
232   random-str:
233     type: OS::Heat::RandomString
234     properties:
235       length: 4
236
237   # Public key used to access ONAP components
238   vm_key:
239     type: OS::Nova::KeyPair
240     properties:
241       name:
242         str_replace:
243           template: base_rand
244           params:
245             base: { get_param: key_name }
246             rand: { get_resource: random-str }
247       public_key: { get_param: pub_key }
248       save_private_key: false
249
250
251   # ONAP security group
252   onap_sg:
253     type: OS::Neutron::SecurityGroup
254     properties:
255       name:
256         str_replace:
257           template: base_rand
258           params:
259             base: onap_sg
260             rand: { get_resource: random-str }
261       description: security group used by ONAP
262       rules:
263         # All egress traffic
264         - direction: egress
265           ethertype: IPv4
266         - direction: egress
267           ethertype: IPv6
268         # ingress traffic
269         # ICMP
270         - protocol: icmp
271         - protocol: udp
272           port_range_min: 1
273           port_range_max: 65535
274         - protocol: tcp
275           port_range_min: 1
276           port_range_max: 65535
277
278   # ONAP management private network
279   oam_onap:
280     type: OS::Neutron::Net
281     properties:
282       name:
283         str_replace:
284           template: oam_onap_rand
285           params:
286             rand: { get_resource: random-str }
287
288   oam_onap_subnet:
289     type: OS::Neutron::Subnet
290     properties:
291       name:
292         str_replace:
293           template: oam_onap_rand
294           params:
295             rand: { get_resource: random-str }
296       network_id: { get_resource: oam_onap }
297       cidr: { get_param: oam_network_cidr }
298       dns_nameservers: { get_param: dns_list }
299
300   router:
301     type: OS::Neutron::Router
302     properties:
303       external_gateway_info:
304         network: { get_param: public_net_id }
305
306   router_interface:
307     type: OS::Neutron::RouterInterface
308     properties:
309       router_id: { get_resource: router }
310       subnet_id: { get_resource: oam_onap_subnet }
311
312   # DCAE GEN 2 Controller instantiation
313   dcae_c_private_port:
314     type: OS::Neutron::Port
315     properties:
316       network: { get_resource: oam_onap }
317       fixed_ips: [{"subnet": { get_resource: oam_onap_subnet }, "ip_address": { get_param: dcae_ip_addr }}]
318
319   dcae_c_floating_ip:
320     type: OS::Neutron::FloatingIP
321     properties:
322       floating_network_id: { get_param: public_net_id }
323       port_id: { get_resource: dcae_c_private_port }
324
325   dcae_c_vm:
326     type: OS::Nova::Server
327     properties:
328       image: { get_param: ubuntu_1604_image }
329       flavor: { get_param: flavor_small }
330       name:
331         str_replace:
332           template: base-dcae-bootstrap
333           params:
334             base: { get_param: vm_base_name }
335       key_name: { get_resource: vm_key }
336       networks:
337         - port: { get_resource: dcae_c_private_port }
338       #security_groups:
339       #  - { get_resource: onap_sg }
340       user_data_format: RAW
341       user_data:
342         str_replace:
343           params:
344             __rand_str__: { get_resource: random-str }
345             # repo related
346             __artifacts_version__: { get_param: artifacts_version }
347             __docker_version__: { get_param: dcae_docker }
348             __nexus_repo__: { get_param: nexus_repo }
349             __nexus_docker_repo__: { get_param: nexus_docker_repo }
350             __nexus_username__: { get_param: nexus_username }
351             __nexus_password__: { get_param: nexus_password }
352             # conf for the ONAP environment where the DCAE bootstrap vm/conatiner runs
353             __mac_addr__: { get_attr: [dcae_c_private_port, mac_address] }
354             __dcae_ip_addr__: { get_param: dcae_ip_addr }
355             __dcae_float_ip__: { get_attr: [dcae_c_floating_ip, floating_ip_address] }
356             __dns_ip_addr__: { get_param: dns_ip_addr }
357             __external_dns__: { get_param: external_dns }
358             __dns_forwarder__: { get_param: dns_forwarder }
359             __dcae_domain__: { get_param: dcae_domain }
360             # conf for VMs DCAE is to bringup
361             __openstack_keystone_url__: { get_param: keystone_url }
362             __dcae_keystone_url__: { get_param: dcae_keystone_url }
363             __dcaeos_cloud_env__: { get_param: cloud_env }
364             __dcaeos_keystone_url__: { get_param: dcae_keystone_url }
365             __dcaeos_region__: { get_param: openstack_region }
366             __dcaeos_tenant_id__: { get_param: openstack_tenant_id }
367             __dcaeos_tenant_name__: { get_param: openstack_tenant_name }
368             __dcaeos_security_group__:
369               str_replace:
370                 template: 'onap_sg_rand'
371                 params:
372                   rand: { get_resource: random-str }
373             #__dcaeos_security_group__: { get_attr: [onap_sg, name] }
374             __dcaeos_username__: { get_param: openstack_username }
375             __dcaeos_password__: { get_param: openstack_api_key }
376             __dcaeos_key_name__: { get_resource: vm_key }
377             __dcaeos_public_key__: { get_param: dcae_public_key }
378             __dcaeos_private_key__: { get_param: dcae_private_key }
379             __dcaeos_private_network_name__: { get_attr: [oam_onap, name] }
380             __dcaeos_public_network_name__: { get_param: public_net_name }
381             __dcaeos_ubuntu_1604_image__: { get_param: ubuntu_1604_image }
382             __dcaeos_centos_7_image__: { get_param: dcae_centos_7_image }
383             __dcaeos_flavor_id__: { get_param: flavor_medium }
384             __dcaeos_flavor_id_cdap__: { get_param: flavor_large }
385             __dcaeos_dnsaas_config_enabled__: { get_param: dnsaas_config_enabled }
386             __dcaeos_dnsaas_region__: { get_param: dnsaas_region }
387             __dcaeos_dnsaas_keystone_url__: { get_param: dnsaas_keystone_url }
388             __dnsaas_tenant_name__: { get_param: dnsaas_tenant_name }
389             __dcaeos_dnsaas_username__: { get_param: dnsaas_username }
390             __dcaeos_dnsaas_password__: { get_param: dnsaas_password }
391             # fixed private IPs
392             __mr_ip_addr__:
393               str_replace:
394                 template: { get_param: mr_k8s_ip_addr }
395                 params:
396                   __rand_str__: { get_resource: random-str }
397             __policy_ip_addr__:
398               str_replace:
399                 template: { get_param: policy_k8s_ip_addr }
400                 params:
401                   __rand_str__: { get_resource: random-str }
402             __sdc_ip_addr__:
403               str_replace:
404                 template: { get_param: sdc_k8s_ip_addr }
405                 params:
406                   __rand_str__: { get_resource: random-str }
407             __openo_ip_addr__:
408               str_replace:
409                 template: { get_param: openo_k8s_ip_addr }
410                 params:
411                   __rand_str__: { get_resource: random-str }
412             __aai1_ip_addr__:
413               str_replace:
414                 template: { get_param: aai1_k8s_ip_addr }
415                 params:
416                   __rand_str__: { get_resource: random-str }
417             __aai2_ip_addr__:
418               str_replace:
419                 template: { get_param: aai2_k8s_ip_addr }
420                 params:
421                   __rand_str__: { get_resource: random-str }
422             # floating IPs
423             __dns_floating_ip_addr__: { get_param: dns_ip_addr }
424             __aai1_floating_ip_addr__:
425               str_replace:
426                 template: { get_param: aai1_k8s_ip_addr }
427                 params:
428                   __rand_str__: { get_resource: random-str }
429             __aai2_floating_ip_addr__:
430               str_replace:
431                 template: { get_param: aai1_k8s_ip_addr }
432                 params:
433                   __rand_str__: { get_resource: random-str }
434             __mrouter_floating_ip_addr__:
435               str_replace:
436                 template: { get_param: mr_k8s_ip_addr }
437                 params:
438                   __rand_str__: { get_resource: random-str }
439             __sdc_floating_ip_addr__:
440               str_replace:
441                 template: { get_param: sdc_k8s_ip_addr }
442                 params:
443                   __rand_str__: { get_resource: random-str }
444             __policy_floating_ip_addr__:
445               str_replace:
446                 template: { get_param: policy_k8s_ip_addr }
447                 params:
448                   __rand_str__: { get_resource: random-str }
449             __openo_floating_ip_addr__:
450               str_replace:
451                 template: { get_param: openo_k8s_ip_addr }
452                 params:
453                   __rand_str__: { get_resource: random-str }
454             __dcae_c_floating_ip_addr__: { get_attr: [dcae_c_floating_ip, floating_ip_address] }
455
456           template: |
457             #!/bin/bash
458
459             # Create configuration files
460             mkdir -p /opt/config
461             echo "__rand_str__" > /opt/config/dcae_zone.txt
462             echo "__rand_str__" > /opt/config/rand_str.txt
463             # repo related
464             echo "__docker_version__" > /opt/config/docker_version.txt
465             echo "__artifacts_version__" > /opt/config/artifacts_version.txt
466             echo "__nexus_repo__" > /opt/config/nexus_repo.txt
467             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
468             echo "__nexus_username__" > /opt/config/nexus_username.txt
469             echo "__nexus_password__" > /opt/config/nexus_password.txt
470             echo "__gerrit_branch__" > /opt/config/gerrit_branch.txt
471             # conf for the ONAP environment where the DCAE bootstrap vm/conatiner runs
472             echo "__mac_addr__" > /opt/config/mac_addr.txt
473             echo "__dcae_ip_addr__" > /opt/config/dcae_ip_addr.txt
474             echo "__dcae_float_ip__" > /opt/config/dcae_float_ip.txt
475             echo "__dns_ip_addr__" > /opt/config/dns_ip_addr.txt
476             echo "__external_dns__" > /opt/config/external_dns.txt
477             echo "__dns_forwarder__" > /opt/config/dns_forwarder.txt  
478             echo "__dcae_domain__" > /opt/config/dcae_domain.txt
479             # conf for the OpenStack env where DCAE is deployed
480             echo "__openstack_keystone_url__" > /opt/config/openstack_keystone_url.txt
481             echo "__dcaeos_cloud_env__" > /opt/config/cloud_env.txt
482             echo "__dcaeos_keystone_url__" > /opt/config/keystone_url.txt
483             echo "__dcaeos_region__" > /opt/config/openstack_region.txt
484             echo "__dcaeos_tenant_id__" > /opt/config/tenant_id.txt
485             echo "__dcaeos_tenant_name__" > /opt/config/tenant_name.txt
486             echo "__dcaeos_username__" > /opt/config/openstack_user.txt
487             echo "__dcaeos_password__" > /opt/config/openstack_password.txt
488             echo "__dcaeos_key_name__" > /opt/config/key_name.txt
489             echo "__dcaeos_public_key__" > /opt/config/pub_key.txt
490             echo "__dcaeos_private_key__" > /opt/config/priv_key
491             echo "__dcaeos_private_network_name__" > /opt/config/openstack_private_network_name.txt
492             echo "__dcaeos_public_network_name__" > /opt/config/public_net_name.txt
493             echo "__dcaeos_public_network_name__" > /opt/config/public_net_id.txt
494             echo "__dcaeos_ubuntu_1604_image__" > /opt/config/ubuntu_1604_image.txt
495             echo "__dcaeos_centos_7_image__" > /opt/config/centos_7_image.txt
496             echo "__dcaeos_security_group__" > /opt/config/security_group.txt
497             echo "__dcaeos_flavor_id__" > /opt/config/flavor_id.txt
498             echo "__dcaeos_flavor_id_cdap__" > /opt/config/flavor_id_cdap.txt
499             echo "__dcaeos_dnsaas_config_enabled__" > /opt/config/dnsaas_config_enabled.txt
500             echo "__dcaeos_dnsaas_region__" > /opt/config/dnsaas_region.txt
501             echo "__dcaeos_dnsaas_keystone_url__" > /opt/config/dnsaas_keystone_url.txt
502             echo "__dnsaas_tenant_name__" > /opt/config/dnsaas_tenant_name.txt
503             echo "__dcaeos_dnsaas_username__" > /opt/config/dnsaas_username.txt
504             echo "__dcaeos_dnsaas_password__" > /opt/config/dnsaas_password.txt
505             # fixed private IP addresses of other ONAP components
506             echo "__mr_ip_addr__" > /opt/config/mr_ip_addr.txt
507             echo "__policy_ip_addr__" > /opt/config/policy_ip_addr.txt
508             echo "__sdc_ip_addr__" > /opt/config/sdc_ip_addr.txt
509             echo "__openo_ip_addr__" > /opt/config/openo_ip_addr.txt
510             echo "__aai1_ip_addr__" > /opt/config/aai1_ip_addr.txt
511             echo "__aai2_ip_addr__" > /opt/config/aai2_ip_addr.txt
512             # floating IPs
513             echo "__dns_floating_ip_addr__" > /opt/config/dns_floating_ip_addr.txt
514             echo "__aai1_floating_ip_addr__" > /opt/config/aai1_floating_ip_addr.txt
515             echo "__aai2_floating_ip_addr__" > /opt/config/aai2_floating_ip_addr.txt
516             echo "__mrouter_floating_ip_addr__" > /opt/config/mrouter_floating_ip_addr.txt
517             echo "__sdc_floating_ip_addr__" > /opt/config/sdc_floating_ip_addr.txt
518             echo "__policy_floating_ip_addr__" > /opt/config/policy_floating_ip_addr.txt
519             echo "__openo_floating_ip_addr__" > /opt/config/openo_floating_ip_addr.txt
520             echo "__dcae_c_floating_ip_addr__" > /opt/config/dcae_c_floating_ip_addr.txt
521
522             # Download and run install script
523             curl -k __nexus_repo__/org.onap.demo/boot/__artifacts_version__/dcae2_install.sh -o /opt/dcae2_install.sh
524             cd /opt
525             chmod +x dcae2_install.sh
526             ./dcae2_install.sh > /tmp/dcae2_install.log 2>&1
527
528 outputs:
529   dcae_floating_ip:
530     description: DCAE Boostrap container external IP Address
531     value: { get_attr: [ dcae_c_floating_ip, floating_ip_address ] }
532   random_string:
533     description: Random generated string identifing this deployment
534     value: {get_attr: [random-str, value]}