blob: 5dfc432289b3960ff38fe99d4fb4d5378071776b [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001heat_template_version: 2013-05-23
2
3description: Heat template to deploy vLoadBalancer/vDNS demo app for OpenECOMP
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_net_cidr:
31 type: string
32 label: vLoadBalancer private network CIDR
33 description: The CIDR of the vLoadBalancer private network
34 ecomp_private_net_cidr:
35 type: string
36 label: ECOMP private network CIDR
37 description: The CIDR of the protected private network
38 vlb_private_ip_0:
39 type: string
40 label: vLoadBalancer private IP address towards the private network
41 description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs
42 vlb_private_ip_1:
43 type: string
44 label: vLoadBalancer private IP address towards the ECOMP management network
45 description: Private IP address that is assigned to the vLoadBalancer to communicate with ECOMP components
46 vdns_private_ip_0:
47 type: string
48 label: vDNS private IP address towards the private network
49 description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer
50 vdns_private_ip_1:
51 type: string
52 label: vDNS private IP address towards the ECOMP management network
53 description: Private IP address that is assigned to the vDNS to communicate with ECOMP components
54 vlb_name_0:
55 type: string
56 label: vLoadBalancer name
57 description: Name of the vLoadBalancer
58 vdns_name_0:
59 type: string
60 label: vDNS name
61 description: Name of the vDNS
62 vnf_id:
63 type: string
64 label: VNF ID
65 description: The VNF ID is provided by ECOMP
66 vf_module_id:
67 type: string
68 label: vFirewall module ID
69 description: The vLoadBalancer Module ID is provided by ECOMP
70 webserver_ip:
71 type: string
72 label: Webserver IP address
73 description: IP address of the webserver that hosts the source code and binaries
74 dcae_collector_ip:
75 type: string
76 label: DCAE collector IP address
77 description: IP address of the DCAE collector
78 dcae_collector_port:
79 type: string
80 label: DCAE collector port
81 description: Port of the DCAE collector
82 key_name:
83 type: string
84 label: Key pair name
85 description: Public/Private key pair name
86 pub_key:
87 type: string
88 label: Public key
89 description: Public key to be installed on the compute instance
90 repo_user:
91 type: string
92 label: Repository username
93 description: Username to access the repository that hosts the demo packages
94 repo_passwd:
95 type: string
96 label: Repository password
97 description: Password to access the repository that hosts the demo packages
98 repo_url:
99 type: string
100 label: Repository URL
101 description: URL of the repository that hosts the demo packages
102
103resources:
104 my_keypair:
105 type: OS::Nova::KeyPair
106 properties:
107 name: { get_param: key_name }
108 public_key: { get_param: pub_key }
109 save_private_key: false
110
111 vlb_private_network:
112 type: OS::Neutron::Net
113 properties:
114 name: { get_param: vlb_private_net_id }
115
116 vlb_private_subnet:
117 type: OS::Neutron::Subnet
118 properties:
119 name: { get_param: vlb_private_net_id }
120 network_id: { get_resource: vlb_private_network }
121 cidr: { get_param: vlb_private_net_cidr }
122
123 vlb_0:
124 type: OS::Nova::Server
125 properties:
126 image: { get_param: vlb_image_name }
127 flavor: { get_param: vlb_flavor_name }
128 name: { get_param: vlb_name_0 }
129 key_name: { get_resource: my_keypair }
130 networks:
131 - network: { get_param: public_net_id }
132 - port: { get_resource: vlb_private_0_port }
133 - port: { get_resource: vlb_private_1_port }
134 metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
135 user_data_format: RAW
136 user_data:
137 str_replace:
138 params:
139 __webserver__: { get_param: webserver_ip }
140 __dcae_collector_ip__: { get_param: dcae_collector_ip }
141 __dcae_collector_port__: { get_param: dcae_collector_port }
142 __local_private_ipaddr__: { get_param: vlb_private_ip_0 }
143 __repo_url__ : { get_param: repo_url }
144 __repo_user__ : { get_param: repo_user }
145 __repo_passwd__ : { get_param: repo_passwd }
146 template: |
147 #!/bin/bash
148
149 WEBSERVER_IP=__webserver__
150 DCAE_COLLECTOR_IP=__dcae_collector_ip__
151 DCAE_COLLECTOR_PORT=__dcae_collector_port__
152 LOCAL_PRIVATE_IPADDR=__local_private_ipaddr__
153 REPO_URL=__repo_url__
154 REPO_USER=__repo_user__
155 REPO_PASSWD=__repo_passwd__
156
157 # Download required dependencies
158 add-apt-repository -y ppa:openjdk-r/ppa
159 apt-get update
160 apt-get install -y make gcc wget openjdk-8-jdk bridge-utils libcurl4-openssl-dev apt-transport-https ca-certificates
161 sleep 1
162
163 # Install Nexus certificate
164 echo "$WEBSERVER_IP ecomp-nexus" >> /etc/hosts
165 keytool -printcert -sslserver $WEBSERVER_IP:8443 -rfc > nexus.crt
166 cp nexus.crt /usr/local/share/ca-certificates/
167 update-ca-certificates
168
169 # Download vLB demo code for load balancer
170 mkdir /opt/config
171 cd /opt
172 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/v_lb_init.sh
173 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/vlb.sh
174 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/vpp.tar.gz
175 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/DNSManager.tar.gz
176 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/VESvLB.tar.gz
177 tar -zxvf vpp.tar.gz
178 tar -zxvf DNSManager.tar.gz
179 tar -zxvf VESvLB.tar.gz
180 rm *.tar.gz
181 chmod +x v_lb_init.sh
182 chmod +x vlb.sh
183 echo $DCAE_COLLECTOR_IP > config/dcae_collector_ip.txt
184 echo $DCAE_COLLECTOR_PORT > config/dcae_collector_port.txt
185 echo $LOCAL_PRIVATE_IPADDR > config/local_private_ipaddr.txt
186 LOCAL_PUBLIC_IPADDR=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
187 echo $LOCAL_PUBLIC_IPADDR > config/local_public_ipaddr.txt
188
189 # Install VPP
190 cd /opt/vpp/build-root/
191 dpkg -i vpp-lib_16.09-3~gc021053_amd64.deb
192 dpkg -i vpp_16.09-3~gc021053_amd64.deb
193 dpkg -i vpp-dbg_16.09-3~gc021053_amd64.deb
194 dpkg -i vpp-dev_16.09-3~gc021053_amd64.deb
195 dpkg -i vpp-dpdk-dev_16.09-3~gc021053_amd64.deb
196 dpkg -i vpp-plugins_16.09-3~gc021053_amd64.deb
197 sleep 1
198
199 # Install Failure Detector
200 cd /opt/DNSManager/src
201 javac -d ../bin/ *.java
202 cd /opt/DNSManager/bin
203 chmod +x dnsmembership.sh
204 chmod +x add_dns.sh
205 chmod +x remove_dns.sh
206 sleep 1
207
208 # Install VES
209 cd /opt/VES1.1/bldjobs/
210 make clean
211 make
212 sleep 1
213
214 # Run instantiation script
215 cd /opt
216 mv vlb.sh /etc/init.d
217 update-rc.d vlb.sh defaults
218 ./v_lb_init.sh
219
220 vlb_private_0_port:
221 type: OS::Neutron::Port
222 properties:
223 network: { get_resource: vlb_private_network }
224 fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vlb_private_ip_0 }}]
225
226 vlb_private_1_port:
227 type: OS::Neutron::Port
228 properties:
229 network: { get_param: ecomp_private_net_id }
230 fixed_ips: [{"subnet": { get_param: ecomp_private_subnet_id }, "ip_address": { get_param: vlb_private_ip_1 }}]
231
232 vdns_0:
233 type: OS::Nova::Server
234 properties:
235 image: { get_param: vlb_image_name }
236 flavor: { get_param: vlb_flavor_name }
237 name: { get_param: vdns_name_0 }
238 key_name: { get_resource: my_keypair }
239 networks:
240 - network: { get_param: public_net_id }
241 - port: { get_resource: vdns_private_0_port }
242 - port: { get_resource: vdns_private_1_port }
243 metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
244 user_data_format: RAW
245 user_data:
246 str_replace:
247 params:
248 __webserver__: { get_param: webserver_ip }
249 __lb_oam_int__ : { get_param: vlb_private_ip_1 }
250 __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }
251 __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
252 __repo_url__ : { get_param: repo_url }
253 __repo_user__ : { get_param: repo_user }
254 __repo_passwd__ : { get_param: repo_passwd }
255 template: |
256 #!/bin/bash
257
258 WEBSERVER_IP=__webserver__
259 LB_OAM_INT=__lb_oam_int__
260 LB_PRIVATE_IPADDR=__lb_private_ipaddr__
261 LOCAL_PRIVATE_IPADDR=__local_private_ipaddr__
262 REPO_URL=__repo_url__
263 REPO_USER=__repo_user__
264 REPO_PASSWD=__repo_passwd__
265
266 # Download required dependencies
267 add-apt-repository -y ppa:openjdk-r/ppa
268 apt-get update
269 apt-get install -y wget openjdk-8-jdk bind9 bind9utils bind9-doc apt-transport-https ca-certificates
270 sleep 1
271
272 # Install Nexus certificate
273 echo "$WEBSERVER_IP ecomp-nexus" >> /etc/hosts
274 keytool -printcert -sslserver $WEBSERVER_IP:8443 -rfc > nexus.crt
275 cp nexus.crt /usr/local/share/ca-certificates/
276 update-ca-certificates
277
278 # Download vDNS demo code for DNS Server
279 mkdir /opt/config
280 cd /opt
281 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/v_dns_init.sh
282 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/vdns.sh
283 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/DNSClient.tar.gz
284 tar -zxvf DNSClient.tar.gz
285 rm *.tar.gz
286 chmod +x v_dns_init.sh
287 chmod +x vdns.sh
288 echo $LB_OAM_INT > config/lb_oam_int.txt
289 echo $LB_PRIVATE_IPADDR > config/lb_private_ipaddr.txt
290 echo $LOCAL_PRIVATE_IPADDR > config/local_private_ipaddr.txt
291
292 # Download Bind config files
293 cd /opt/config
294 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/db_dnsdemo_openecomp_org
295 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/named.conf.options
296 wget --user=$REPO_USER --password=$REPO_PASSWD $REPO_URL/named.conf.local
297
298 # Configure Bind
299 modprobe ip_gre
300 mkdir /etc/bind/zones
301 sed -i "s/OPTIONS=.*/OPTIONS=\"-4 -u bind\"/g" /etc/default/bind9
302 cp /opt/config/db_dnsdemo_openecomp_org /etc/bind/zones/db.dnsdemo.openecomp.org
303 cp /opt/config/named.conf.local /etc/bind/
304 sleep 1
305
306 # Start Failure Detector
307 cd /opt/DNSClient/src
308 javac -d ../bin/ *.java
309 cd /opt/DNSClient/bin
310 chmod +x dnsclient.sh
311 chmod +x set_gre_tunnel.sh
312 sleep 1
313
314 # Run instantiation script
315 cd /opt
316 mv vdns.sh /etc/init.d
317 update-rc.d vdns.sh defaults
318 ./v_dns_init.sh
319
320 vdns_private_0_port:
321 type: OS::Neutron::Port
322 properties:
323 network: { get_resource: vlb_private_network }
324 fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vdns_private_ip_0 }}]
325
326 vdns_private_1_port:
327 type: OS::Neutron::Port
328 properties:
329 network: { get_param: ecomp_private_net_id }
330 fixed_ips: [{"subnet": { get_param: ecomp_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]