blob: c292f2957d97bd7839d7fa7fcf55e04c1e9718ba [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001heat_template_version: 2013-05-23
2
Jerry Flood3fc36a32017-10-11 11:09:19 -04003description: Heat template to deploy vLoadBalancer/vDNS demo app for OpenECOMP
DR695Hccff30b2017-02-17 18:44:24 -05004
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
Jerry Flood3fc36a32017-10-11 11:09:19 -040022 ecomp_private_net_id:
DR695Hccff30b2017-02-17 18:44:24 -050023 type: string
24 label: ECOMP management network name or ID
Jerry Flood3fc36a32017-10-11 11:09:19 -040025 description: Private network that connects ECOMP component and the VNF
26 ecomp_private_subnet_id:
DR695Hccff30b2017-02-17 18:44:24 -050027 type: string
28 label: ECOMP management sub-network name or ID
Jerry Flood3fc36a32017-10-11 11:09:19 -040029 description: Private sub-network that connects ECOMP component and the VNF
DR695Hccff30b2017-02-17 18:44:24 -050030 vlb_private_net_cidr:
31 type: string
32 label: vLoadBalancer private network CIDR
33 description: The CIDR of the vLoadBalancer private network
Jerry Flood3fc36a32017-10-11 11:09:19 -040034 ecomp_private_net_cidr:
DR695Hccff30b2017-02-17 18:44:24 -050035 type: string
Jerry Flood3fc36a32017-10-11 11:09:19 -040036 label: ECOMP private network CIDR
DR695Hccff30b2017-02-17 18:44:24 -050037 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
Jerry Flood3fc36a32017-10-11 11:09:19 -040044 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
DR695Hccff30b2017-02-17 18:44:24 -050046 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
Jerry Flood3fc36a32017-10-11 11:09:19 -040052 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
DR695Hccff30b2017-02-17 18:44:24 -050054 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
Jerry Flood3fc36a32017-10-11 11:09:19 -040065 description: The VNF ID is provided by ECOMP
DR695Hccff30b2017-02-17 18:44:24 -050066 vf_module_id:
67 type: string
68 label: vFirewall module ID
Jerry Flood3fc36a32017-10-11 11:09:19 -040069 description: The vLoadBalancer Module ID is provided by ECOMP
DR695Hccff30b2017-02-17 18:44:24 -050070 dcae_collector_ip:
71 type: string
72 label: DCAE collector IP address
73 description: IP address of the DCAE collector
74 dcae_collector_port:
75 type: string
76 label: DCAE collector port
77 description: Port of the DCAE collector
78 key_name:
79 type: string
80 label: Key pair name
81 description: Public/Private key pair name
82 pub_key:
83 type: string
84 label: Public key
85 description: Public key to be installed on the compute instance
jf98609ab26342017-02-28 15:07:36 -050086 repo_url_blob:
DR695Hccff30b2017-02-17 18:44:24 -050087 type: string
88 label: Repository URL
89 description: URL of the repository that hosts the demo packages
jf98609ab26342017-02-28 15:07:36 -050090 repo_url_artifacts:
91 type: string
92 label: Repository URL
93 description: URL of the repository that hosts the demo packages
94 demo_artifacts_version:
95 type: string
96 label: Artifacts version used in demo vnfs
97 description: Artifacts (jar, tar.gz) version used in demo vnfs
DR695Hccff30b2017-02-17 18:44:24 -050098
99resources:
jf98609ab26342017-02-28 15:07:36 -0500100
101 random-str:
102 type: OS::Heat::RandomString
103 properties:
104 length: 4
Jerry Flood3fc36a32017-10-11 11:09:19 -0400105
DR695Hccff30b2017-02-17 18:44:24 -0500106 my_keypair:
107 type: OS::Nova::KeyPair
108 properties:
jf98609ab26342017-02-28 15:07:36 -0500109 name:
110 str_replace:
111 template: base_rand
112 params:
113 base: { get_param: key_name }
114 rand: { get_resource: random-str }
DR695Hccff30b2017-02-17 18:44:24 -0500115 public_key: { get_param: pub_key }
116 save_private_key: false
117
118 vlb_private_network:
119 type: OS::Neutron::Net
120 properties:
121 name: { get_param: vlb_private_net_id }
122
123 vlb_private_subnet:
124 type: OS::Neutron::Subnet
125 properties:
126 name: { get_param: vlb_private_net_id }
127 network_id: { get_resource: vlb_private_network }
128 cidr: { get_param: vlb_private_net_cidr }
129
130 vlb_0:
131 type: OS::Nova::Server
132 properties:
133 image: { get_param: vlb_image_name }
134 flavor: { get_param: vlb_flavor_name }
135 name: { get_param: vlb_name_0 }
136 key_name: { get_resource: my_keypair }
137 networks:
138 - network: { get_param: public_net_id }
139 - port: { get_resource: vlb_private_0_port }
140 - port: { get_resource: vlb_private_1_port }
141 metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
142 user_data_format: RAW
143 user_data:
144 str_replace:
145 params:
DR695Hccff30b2017-02-17 18:44:24 -0500146 __dcae_collector_ip__: { get_param: dcae_collector_ip }
147 __dcae_collector_port__: { get_param: dcae_collector_port }
Jerry Flood3fc36a32017-10-11 11:09:19 -0400148 __local_private_ipaddr__: { get_param: vlb_private_ip_0 }
149 __repo_url_blob__ : { get_param: repo_url_blob }
150 __repo_url_artifacts__ : { get_param: repo_url_artifacts }
151 __demo_artifacts_version__ : { get_param: demo_artifacts_version }
DR695Hccff30b2017-02-17 18:44:24 -0500152 template: |
153 #!/bin/bash
154
Jerry Flood3fc36a32017-10-11 11:09:19 -0400155 DCAE_COLLECTOR_IP=__dcae_collector_ip__
156 DCAE_COLLECTOR_PORT=__dcae_collector_port__
157 LOCAL_PRIVATE_IPADDR=__local_private_ipaddr__
158 REPO_URL_BLOB=__repo_url_blob__
159 REPO_URL_ARTIFACTS=__repo_url_artifacts__
160 DEMO_ARTIFACTS_VERSION=__demo_artifacts_version__
161
162 # Download required dependencies
163 add-apt-repository -y ppa:openjdk-r/ppa
164 apt-get update
165 apt-get install -y make gcc wget openjdk-8-jdk bridge-utils libcurl4-openssl-dev apt-transport-https ca-certificates
166 apt-get install -y maven
167 sleep 1
168
169 # Download vLB demo code for load balancer
DR695Hccff30b2017-02-17 18:44:24 -0500170 mkdir /opt/config
Jerry Flood3fc36a32017-10-11 11:09:19 -0400171 mkdir /opt/FDserver
DR695Hccff30b2017-02-17 18:44:24 -0500172 cd /opt
jf98609ab26342017-02-28 15:07:36 -0500173
Jerry Flood3fc36a32017-10-11 11:09:19 -0400174 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/v_lb_init.sh
175 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/vlb.sh
176 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/dnsmembership.sh
177 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/add_dns.sh
178 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/remove_dns.sh
jf98609ab26342017-02-28 15:07:36 -0500179
Jerry Flood3fc36a32017-10-11 11:09:19 -0400180 mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DremoteRepositories=$REPO_URL_ARTIFACTS -Dartifact=org.openecomp.demo.vnf.vlb:dns-manager:$DEMO_ARTIFACTS_VERSION:jar -Dtransitive=false -Ddest=.
181 mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DremoteRepositories=$REPO_URL_ARTIFACTS -Dartifact=org.openecomp.demo.vnf.ves:ves:$DEMO_ARTIFACTS_VERSION:tar.gz:demo -Dtransitive=false -Ddest=.
182 mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DremoteRepositories=$REPO_URL_ARTIFACTS -Dartifact=org.openecomp.demo.vnf.ves:ves_vlb_reporting:$DEMO_ARTIFACTS_VERSION:tar.gz:demo -Dtransitive=false -Ddest=.
183
184 tar -zxvf ves-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
185 mv ves-$DEMO_ARTIFACTS_VERSION VES
186 tar -zxvf ves_vlb_reporting-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
187 mv ves_vlb_reporting-$DEMO_ARTIFACTS_VERSION VESreporting_vLB
188
189 mv VESreporting_vLB /opt/VES/code/evel_training/VESreporting
190 mv dns-manager-$DEMO_ARTIFACTS_VERSION.jar /opt/FDserver/dns-manager-$DEMO_ARTIFACTS_VERSION.jar
191 mv dnsmembership.sh /opt/FDserver/dnsmembership.sh
192 mv add_dns.sh /opt/FDserver/add_dns.sh
193 mv remove_dns.sh /opt/FDserver/remove_dns.sh
194 rm *.tar.gz
195
196 chmod +x v_lb_init.sh
197 chmod +x vlb.sh
198 chmod +x /opt/VES/code/evel_training/VESreporting/go-client.sh
199 chmod +x /opt/FDserver/dnsmembership.sh
200 chmod +x /opt/FDserver/add_dns.sh
201 chmod +x /opt/FDserver/remove_dns.sh
202
203 echo $DCAE_COLLECTOR_IP > config/dcae_collector_ip.txt
204 echo $DCAE_COLLECTOR_PORT > config/dcae_collector_port.txt
205 echo $LOCAL_PRIVATE_IPADDR > config/local_private_ipaddr.txt
206 LOCAL_PUBLIC_IPADDR=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
207 echo $LOCAL_PUBLIC_IPADDR > config/local_public_ipaddr.txt
208 echo $DEMO_ARTIFACTS_VERSION > config/artifacts_version.txt
209
210 # Install VPP
211 export UBUNTU="trusty"
212 export RELEASE=".stable.1609"
213 rm /etc/apt/sources.list.d/99fd.io.list
214 echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io$RELEASE.ubuntu.$UBUNTU.main/ ./" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list
215 apt-get update
216 apt-get install -y vpp vpp-dpdk-dkms vpp-lib vpp-dbg vpp-plugins vpp-dev
217 sleep 1
218
219 # Install VES
220 cd /opt/VES/bldjobs/
221 make clean
222 make
223 sleep 1
224
225 # Run instantiation script
226 cd /opt
227 mv vlb.sh /etc/init.d
228 update-rc.d vlb.sh defaults
229 ./v_lb_init.sh
230
231 vlb_private_0_port:
DR695Hccff30b2017-02-17 18:44:24 -0500232 type: OS::Neutron::Port
233 properties:
234 network: { get_resource: vlb_private_network }
Jerry Flood3fc36a32017-10-11 11:09:19 -0400235 fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vlb_private_ip_0 }}]
DR695Hccff30b2017-02-17 18:44:24 -0500236
Jerry Flood3fc36a32017-10-11 11:09:19 -0400237 vlb_private_1_port:
DR695Hccff30b2017-02-17 18:44:24 -0500238 type: OS::Neutron::Port
239 properties:
Jerry Flood3fc36a32017-10-11 11:09:19 -0400240 network: { get_param: ecomp_private_net_id }
241 fixed_ips: [{"subnet": { get_param: ecomp_private_subnet_id }, "ip_address": { get_param: vlb_private_ip_1 }}]
DR695Hccff30b2017-02-17 18:44:24 -0500242
243 vdns_0:
244 type: OS::Nova::Server
245 properties:
246 image: { get_param: vlb_image_name }
247 flavor: { get_param: vlb_flavor_name }
248 name: { get_param: vdns_name_0 }
249 key_name: { get_resource: my_keypair }
250 networks:
251 - network: { get_param: public_net_id }
252 - port: { get_resource: vdns_private_0_port }
253 - port: { get_resource: vdns_private_1_port }
254 metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
255 user_data_format: RAW
256 user_data:
257 str_replace:
258 params:
Jerry Flood3fc36a32017-10-11 11:09:19 -0400259 __lb_oam_int__ : { get_param: vlb_private_ip_1 }
DR695Hccff30b2017-02-17 18:44:24 -0500260 __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }
261 __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
Jerry Flood3fc36a32017-10-11 11:09:19 -0400262 __repo_url_blob__ : { get_param: repo_url_blob }
263 __repo_url_artifacts__ : { get_param: repo_url_artifacts }
264 __demo_artifacts_version__ : { get_param: demo_artifacts_version }
DR695Hccff30b2017-02-17 18:44:24 -0500265 template: |
266 #!/bin/bash
267
Jerry Flood3fc36a32017-10-11 11:09:19 -0400268 LB_OAM_INT=__lb_oam_int__
269 LB_PRIVATE_IPADDR=__lb_private_ipaddr__
270 LOCAL_PRIVATE_IPADDR=__local_private_ipaddr__
271 REPO_URL_BLOB=__repo_url_blob__
272 REPO_URL_ARTIFACTS=__repo_url_artifacts__
273 DEMO_ARTIFACTS_VERSION=__demo_artifacts_version__
274
275 # Download required dependencies
276 add-apt-repository -y ppa:openjdk-r/ppa
277 apt-get update
278 apt-get install -y wget openjdk-8-jdk bind9 bind9utils bind9-doc apt-transport-https ca-certificates
279 apt-get install -y maven
280 sleep 1
281
282 # Download vDNS demo code for DNS Server
DR695Hccff30b2017-02-17 18:44:24 -0500283 mkdir /opt/config
Jerry Flood3fc36a32017-10-11 11:09:19 -0400284 mkdir /opt/FDclient
DR695Hccff30b2017-02-17 18:44:24 -0500285 cd /opt
Jerry Flood3fc36a32017-10-11 11:09:19 -0400286
287 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/v_dns_init.sh
288 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/vdns.sh
289 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/dnsclient.sh
290 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/set_gre_tunnel.sh
291
292 mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DremoteRepositories=$REPO_URL_ARTIFACTS -Dartifact=org.openecomp.demo.vnf.vlb:dns-client:$DEMO_ARTIFACTS_VERSION:jar -Dtransitive=false -Ddest=.
jf98609ab26342017-02-28 15:07:36 -0500293
Jerry Flood3fc36a32017-10-11 11:09:19 -0400294 mv dns-client-$DEMO_ARTIFACTS_VERSION.jar /opt/FDclient/
295 mv dnsclient.sh /opt/FDclient/
296 mv set_gre_tunnel.sh /opt/FDclient/
jf98609ab26342017-02-28 15:07:36 -0500297
Jerry Flood3fc36a32017-10-11 11:09:19 -0400298 chmod +x v_dns_init.sh
299 chmod +x vdns.sh
300 chmod +x /opt/FDclient/dnsclient.sh
301 chmod +x /opt/FDclient/set_gre_tunnel.sh
302
303 echo $LB_OAM_INT > config/lb_oam_int.txt
304 echo $LB_PRIVATE_IPADDR > config/lb_private_ipaddr.txt
305 echo $LOCAL_PRIVATE_IPADDR > config/local_private_ipaddr.txt
306 echo $DEMO_ARTIFACTS_VERSION > config/artifacts_version.txt
307
308 # Download Bind config files
309 cd /opt/config
310 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/db_dnsdemo_openecomp_org
311 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/named.conf.options
312 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/named.conf.local
313
314 # Configure Bind
315 modprobe ip_gre
316 mkdir /etc/bind/zones
317 sed -i "s/OPTIONS=.*/OPTIONS=\"-4 -u bind\"/g" /etc/default/bind9
318 mv db_dnsdemo_openecomp_org /etc/bind/zones/db.dnsdemo.openecomp.org
319 mv named.conf.options /etc/bind/
320 mv named.conf.local /etc/bind/
321 sleep 1
322
323 # Run instantiation script
324 cd /opt
325 mv vdns.sh /etc/init.d
326 update-rc.d vdns.sh defaults
327 ./v_dns_init.sh
328
329 vdns_private_0_port:
DR695Hccff30b2017-02-17 18:44:24 -0500330 type: OS::Neutron::Port
331 properties:
Jerry Flood3fc36a32017-10-11 11:09:19 -0400332 network: { get_resource: vlb_private_network }
333 fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vdns_private_ip_0 }}]
DR695Hccff30b2017-02-17 18:44:24 -0500334
Jerry Flood3fc36a32017-10-11 11:09:19 -0400335 vdns_private_1_port:
DR695Hccff30b2017-02-17 18:44:24 -0500336 type: OS::Neutron::Port
337 properties:
Jerry Flood3fc36a32017-10-11 11:09:19 -0400338 network: { get_param: ecomp_private_net_id }
339 fixed_ips: [{"subnet": { get_param: ecomp_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]