blob: 8f17723142cddaa1381940cc888e3431ff15426b [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001heat_template_version: 2013-05-23
2
3description: Heat template to deploy a vDNS for OpenECOMP (scaling-up scenario)
4
5parameters:
6 vlb_image_name:
7 type: string
8 label: Image name or ID
9 description: Image to be used for compute instance
10 vlb_flavor_name:
11 type: string
12 label: Flavor
13 description: Type of instance (flavor) to be used
14 public_net_id:
15 type: string
16 label: Public network name or ID
17 description: Public network that enables remote connection to VNF
18 vlb_private_net_id:
19 type: string
20 label: vLoadBalancer private network name or ID
21 description: Private network that connects vLoadBalancer with vDNSs
22 ecomp_private_net_id:
23 type: string
24 label: ECOMP management network name or ID
25 description: Private network that connects ECOMP component and the VNF
26 ecomp_private_subnet_id:
27 type: string
28 label: ECOMP management sub-network name or ID
29 description: Private sub-network that connects ECOMP component and the VNF
30 vlb_private_ip_0:
31 type: string
32 label: vLoadBalancer private IP address towards the private network
33 description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs
34 vlb_private_ip_1:
35 type: string
36 label: vLoadBalancer private IP address towards the ECOMP management network
37 description: Private IP address that is assigned to the vLoadBalancer to communicate with ECOMP components
38 vdns_private_ip_0:
39 type: string
40 label: vDNS private IP address towards the private network
41 description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer
42 vdns_private_ip_1:
43 type: string
44 label: vDNS private IP address towards the ECOMP management network
45 description: Private IP address that is assigned to the vDNS to communicate with ECOMP components
46 vdns_name_0:
47 type: string
48 label: vDNS name
49 description: Name of the vDNS
50 vnf_id:
51 type: string
52 label: VNF ID
53 description: The VNF ID is provided by ECOMP
54 vf_module_id:
55 type: string
56 label: vFirewall module ID
57 description: The vLoadBalancer Module ID is provided by ECOMP
58 webserver_ip:
59 type: string
60 label: Webserver IP address
61 description: IP address of the webserver that hosts the source code and binaries
62 key_name:
63 type: string
64 label: Key pair name
65 description: Public/Private key pair name
66 pub_key:
67 type: string
68 label: Public key
69 description: Public key to be installed on the compute instance
70 repo_user:
71 type: string
72 label: Repository username
73 description: Username to access the repository that hosts the demo packages
74 repo_passwd:
75 type: string
76 label: Repository password
77 description: Password to access the repository that hosts the demo packages
78 repo_url:
79 type: string
80 label: Repository URL
81 description: URL of the repository that hosts the demo packages
82
83resources:
84 vdns_0:
85 type: OS::Nova::Server
86 properties:
87 image: { get_param: vlb_image_name }
88 flavor: { get_param: vlb_flavor_name }
89 name: { get_param: vdns_name_0 }
90 key_name: { get_param: key_name }
91 networks:
92 - network: { get_param: public_net_id }
93 - port: { get_resource: vdns_private_0_port }
94 - port: { get_resource: vdns_private_1_port }
95 metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
96 user_data_format: RAW
97 user_data:
98 str_replace:
99 params:
100 __webserver__: { get_param: webserver_ip }
101 __lb_oam_int__ : { get_param: vlb_private_ip_1 }
102 __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }
103 __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
104 __repo_url__ : { get_param: repo_url }
105 __repo_user__ : { get_param: repo_user }
106 __repo_passwd__ : { get_param: repo_passwd }
107 template: |
108 #!/bin/bash
109
110 WEBSERVER_IP=__webserver__
111 LB_OAM_INT=__lb_oam_int__
112 LB_PRIVATE_IPADDR=__lb_private_ipaddr__
113 LOCAL_PRIVATE_IPADDR=__local_private_ipaddr__
114 REPO_URL=__repo_url__
115 REPO_USER=__repo_user__
116 REPO_PASSWD=__repo_passwd__
117
118 # Download required dependencies
119 add-apt-repository -y ppa:openjdk-r/ppa
120 apt-get update
121 apt-get install -y wget openjdk-8-jdk bind9 bind9utils bind9-doc apt-transport-https ca-certificates
122 sleep 1
123
124 # Install Nexus certificate
125 echo "$WEBSERVER_IP ecomp-nexus" >> /etc/hosts
126 keytool -printcert -sslserver $WEBSERVER_IP:8443 -rfc > nexus.crt
127 cp nexus.crt /usr/local/share/ca-certificates/
128 update-ca-certificates
129
130 # Download vDNS demo code for DNS Server
131 mkdir /opt/config
132 cd /opt
133 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/v_dns_init.sh
134 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/vdns.sh
135 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/DNSClient.tar.gz
136 tar -zxvf DNSClient.tar.gz
137 rm *.tar.gz
138 chmod +x v_dns_init.sh
139 chmod +x vdns.sh
140 echo $LB_OAM_INT > config/lb_oam_int.txt
141 echo $LB_PRIVATE_IPADDR > config/lb_private_ipaddr.txt
142 echo $LOCAL_PRIVATE_IPADDR > config/local_private_ipaddr.txt
143
144 # Download Bind config files
145 cd /opt/config
146 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/db_dnsdemo_openecomp_org
147 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/named.conf.options
148 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/named.conf.local
149
150 # Configure Bind
151 modprobe ip_gre
152 mkdir /etc/bind/zones
153 sed -i "s/OPTIONS=.*/OPTIONS=\"-4 -u bind\"/g" /etc/default/bind9
154 cp /opt/config/db_dnsdemo_openecomp_org /etc/bind/zones/db.dnsdemo.openecomp.org
155 cp /opt/config/named.conf.local /etc/bind/
156 sleep 1
157
158 # Start Failure Detector
159 cd /opt/DNSClient/src
160 javac -d ../bin/ *.java
161 cd /opt/DNSClient/bin
162 chmod +x dnsclient.sh
163 chmod +x set_gre_tunnel.sh
164 sleep 1
165
166 # Run instantiation script
167 cd /opt
168 mv vdns.sh /etc/init.d
169 update-rc.d vdns.sh defaults
170 ./v_dns_init.sh
171
172 vdns_private_0_port:
173 type: OS::Neutron::Port
174 properties:
175 network: { get_param: vlb_private_net_id }
176 fixed_ips: [{"subnet": { get_param: vlb_private_net_id }, "ip_address": { get_param: vdns_private_ip_0 }}]
177
178 vdns_private_1_port:
179 type: OS::Neutron::Port
180 properties:
181 network: { get_param: ecomp_private_net_id }
182 fixed_ips: [{"subnet": { get_param: ecomp_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]