Update vLB to Ubuntu 1604 and VPP 1707
[demo.git] / heat / vLB / base_vlb_openstack.yaml
1 ##########################################################################
2 #
3 #==================LICENSE_START==========================================
4
5 #
6 # Copyright © 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: 2013-05-23
26
27 description: Heat template to deploy vLoadBalancer/vDNS demo app for ONAP
28
29 ##############
30 #            #
31 # PARAMETERS #
32 #            #
33 ##############
34
35 parameters:
36   vlb_image_name:
37     type: string
38     label: Image name or ID
39     description: Image to be used for compute instance
40   vlb_flavor_name:
41     type: string
42     label: Flavor
43     description: Type of instance (flavor) to be used
44   public_net_id:
45     type: string
46     label: Public network name or ID
47     description: Public network that enables remote connection to VNF
48   vlb_private_net_id:
49     type: string
50     label: vLoadBalancer private network name or ID
51     description: Private network that connects vLoadBalancer with vDNSs
52   pktgen_private_net_id:
53     type: string
54     label: vPacketGen private network name or ID
55     description: Private network that connects vLoadBalancer with vPacketGen
56   onap_private_net_id:
57     type: string
58     label: ECOMP management network name or ID
59     description: Private network that connects ONAP component and the VNF
60   onap_private_subnet_id:
61     type: string
62     label: ECOMP management sub-network name or ID
63     description: Private sub-network that connects ONAP component and the VNF
64   vlb_private_net_cidr:
65     type: string
66     label: vLoadBalancer private network CIDR
67     description: The CIDR of the vLoadBalancer private network
68   pktgen_private_net_cidr:
69     type: string
70     label: vPacketGen private network CIDR
71     description: The CIDR of the vPacketGen private network
72   onap_private_net_cidr:
73     type: string
74     label: ONAP private network CIDR
75     description: The CIDR of the protected private network
76   vlb_private_ip_0:
77     type: string
78     label: vLoadBalancer private IP address towards the private network
79     description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs
80   vlb_private_ip_1:
81     type: string
82     label: vLoadBalancer private IP address towards the ONAP management network
83     description: Private IP address that is assigned to the vLoadBalancer to communicate with ONAP components
84   vlb_private_ip_2:
85     type: string
86     label: vLoadBalancer private IP address towards the vPacketGen network
87     description: Private IP address that is assigned to the vLoadBalancer to communicate with vPacketGen
88   vdns_private_ip_0:
89     type: string
90     label: vDNS private IP address towards the private network
91     description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer
92   vdns_private_ip_1:
93     type: string
94     label: vDNS private IP address towards the ONAP management network
95     description: Private IP address that is assigned to the vDNS to communicate with ONAP components
96   vpg_private_ip_0:
97     type: string
98     label: vPacketGen private IP address towards the vPacketGen private network
99     description: Private IP address that is assigned to the vPacketGen to communicate with the vLoadBalancer
100   vpg_private_ip_1:
101     type: string
102     label: vPacketGen private IP address towards the ONAP management network
103     description: Private IP address that is assigned to the vPacketGen to communicate with ONAP components
104   vip:
105     type: string
106     label: Virtual Private IP of the vLoadBalancer
107     description: Virtual Private IP that is assigned to the vLoadBalancer's VPP layer
108   gre_ipaddr:
109     type: string
110     label: IP Address of the GRE tunnel
111     description: IP address assigned to the GRE tunnel on the vLoadBalancer
112   pg_int:
113     type: string
114     label: IP Address of the output vPacketGen interface
115     description: IP address assigned to the output interface of the vPacketGen's VPP layer
116   vlb_name_0:
117     type: string
118     label: vLoadBalancer name
119     description: Name of the vLoadBalancer
120   vdns_name_0:
121     type: string
122     label: vDNS name
123     description: Name of the vDNS
124   vnf_id:
125     type: string
126     label: VNF ID
127     description: The VNF ID is provided by ONAP
128   vf_module_id:
129     type: string
130     label: vFirewall module ID
131     description: The vLoadBalancer Module ID is provided by ONAP
132   dcae_collector_ip:
133     type: string
134     label: DCAE collector IP address
135     description: IP address of the DCAE collector
136   dcae_collector_port:
137     type: string
138     label: DCAE collector port
139     description: Port of the DCAE collector
140   key_name:
141     type: string
142     label: Key pair name
143     description: Public/Private key pair name
144   pub_key:
145     type: string
146     label: Public key
147     description: Public key to be installed on the compute instance
148   repo_url_blob:
149     type: string
150     label: Repository URL
151     description: URL of the repository that hosts the demo packages
152   repo_url_artifacts:
153     type: string
154     label: Repository URL
155     description: URL of the repository that hosts the demo packages
156   demo_artifacts_version:
157     type: string
158     label: Artifacts version used in demo vnfs
159     description: Artifacts (jar, tar.gz) version used in demo vnfs
160   install_script_version:
161     type: string
162     label: Installation script version number
163     description: Version number of the scripts that install the vFW demo app
164   cloud_env:
165     type: string
166     label: Cloud environment
167     description: Cloud environment (e.g., openstack, rackspace)
168
169 #############
170 #           #
171 # RESOURCES #
172 #           #
173 #############
174
175 resources:
176
177   random-str:
178     type: OS::Heat::RandomString
179     properties:
180       length: 4
181
182   my_keypair:
183     type: OS::Nova::KeyPair
184     properties:
185       name: 
186         str_replace:
187           template: base_rand
188           params:
189             base: { get_param: key_name }
190             rand: { get_resource: random-str }  
191       public_key: { get_param: pub_key }
192       save_private_key: false
193
194   vlb_private_network:
195     type: OS::Neutron::Net
196     properties:
197       name: { get_param: vlb_private_net_id }
198
199   vlb_private_subnet:
200     type: OS::Neutron::Subnet
201     properties:
202       name: { get_param: vlb_private_net_id }
203       network_id: { get_resource: vlb_private_network }
204       cidr: { get_param: vlb_private_net_cidr }
205
206   pktgen_private_network:
207     type: OS::Neutron::Net
208     properties:
209       name: { get_param: pktgen_private_net_id }
210
211   pktgen_private_subnet:
212     type: OS::Neutron::Subnet
213     properties:
214       name: { get_param: pktgen_private_net_id }
215       network_id: { get_resource: pktgen_private_network }
216       cidr: { get_param: pktgen_private_net_cidr }
217
218   vlb_private_0_port:
219     type: OS::Neutron::Port
220     properties:
221       network: { get_resource: vlb_private_network }
222       fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vlb_private_ip_0 }}]
223
224   vlb_private_1_port:
225     type: OS::Neutron::Port
226     properties:
227       network: { get_param: onap_private_net_id }
228       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vlb_private_ip_1 }}]
229
230   vlb_private_2_port:
231     type: OS::Neutron::Port
232     properties:
233       network: { get_resource: pktgen_private_network }
234       fixed_ips: [{"subnet": { get_resource: pktgen_private_subnet }, "ip_address": { get_param: vlb_private_ip_2 }}]
235
236   vlb_0:
237     type: OS::Nova::Server
238     properties:
239       image: { get_param: vlb_image_name }
240       flavor: { get_param: vlb_flavor_name }
241       name: { get_param: vlb_name_0 }
242       key_name: { get_resource: my_keypair }
243       networks:
244         - network: { get_param: public_net_id }
245         - port: { get_resource: vlb_private_0_port }
246         - port: { get_resource: vlb_private_1_port }
247         - port: { get_resource: vlb_private_2_port }
248       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
249       user_data_format: RAW
250       user_data:
251         str_replace:
252           params:
253             __dcae_collector_ip__: { get_param: dcae_collector_ip }
254             __dcae_collector_port__: { get_param: dcae_collector_port }
255             __ip_to_dns_net__: { get_param: vlb_private_ip_0 }
256             __ip_to_pktgen_net__: { get_param: vlb_private_ip_2 }
257             __vip__: { get_param: vip }
258             __gre_ipaddr__: { get_param: gre_ipaddr }
259             __pktgen_ipaddr__: { get_param: vpg_private_ip_0 }
260             __oam_private_ipaddr__: { get_param: vlb_private_ip_1 }
261             __repo_url_blob__: { get_param: repo_url_blob }
262             __repo_url_artifacts__: { get_param: repo_url_artifacts }
263             __demo_artifacts_version__: { get_param: demo_artifacts_version }
264             __install_script_version__: { get_param: install_script_version }
265             __vlb_private_net_cidr__: { get_param: vlb_private_net_cidr }
266             __onap_private_net_cidr__: { get_param: onap_private_net_cidr }
267             __pktgen_private_net_cidr__: { get_param: pktgen_private_net_cidr }
268             __cloud_env__: { get_param: cloud_env }
269           template: |
270             #!/bin/bash
271
272             # Create configuration files
273             mkdir /opt/config
274             echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt
275             echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt
276             echo "__ip_to_dns_net__" > /opt/config/ip_to_dns_net.txt
277             echo "__ip_to_pktgen_net__" > /opt/config/ip_to_pktgen_net.txt
278             echo "__vip__" > /opt/config/vip.txt
279             echo "__gre_ipaddr__" > /opt/config/gre_ipaddr.txt
280             echo "__pktgen_ipaddr__" > /opt/config/pktgen_ipaddr.txt
281             echo "__oam_private_ipaddr__" > /opt/config/oam_private_ipaddr.txt
282             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
283             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
284             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
285             echo "__install_script_version__" > /opt/config/install_script_version.txt
286             echo "__vlb_private_net_cidr__" > /opt/config/vlb_private_net_cidr.txt
287             echo "__pktgen_private_net_cidr__" > /opt/config/pktgen_private_net_cidr.txt
288             echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
289             echo "__cloud_env__" > /opt/config/cloud_env.txt
290
291             # Download and run install script
292             curl -k __repo_url_blob__/org.onap.demo/vnfs/vlb/__install_script_version__/v_lb_install.sh -o /opt/v_lb_install.sh
293             cd /opt
294             chmod +x v_lb_install.sh
295             ./v_lb_install.sh
296
297
298   vdns_private_0_port:
299     type: OS::Neutron::Port
300     properties:
301       network: { get_resource: vlb_private_network }
302       fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vdns_private_ip_0 }}]
303
304   vdns_private_1_port:
305     type: OS::Neutron::Port
306     properties:
307       network: { get_param: onap_private_net_id }
308       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]
309
310   vdns_0:
311     type: OS::Nova::Server
312     properties:
313       image: { get_param: vlb_image_name }
314       flavor: { get_param: vlb_flavor_name }
315       name: { get_param: vdns_name_0 }
316       key_name: { get_resource: my_keypair }
317       networks:
318         - network: { get_param: public_net_id }
319         - port: { get_resource: vdns_private_0_port }
320         - port: { get_resource: vdns_private_1_port }
321       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
322       user_data_format: RAW
323       user_data:
324         str_replace:
325           params:
326             __lb_oam_int__: { get_param: vlb_private_ip_1 }
327             __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }
328             __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
329             __oam_private_ipaddr__: { get_param: vdns_private_ip_1 }
330             __repo_url_blob__: { get_param: repo_url_blob }
331             __repo_url_artifacts__: { get_param: repo_url_artifacts }
332             __demo_artifacts_version__: { get_param: demo_artifacts_version }
333             __install_script_version__: { get_param: install_script_version }
334             __vlb_private_net_cidr__: { get_param: vlb_private_net_cidr }
335             __onap_private_net_cidr__: { get_param: onap_private_net_cidr }
336             __cloud_env__: { get_param: cloud_env }
337           template: |
338             #!/bin/bash
339
340             # Create configuration files
341             mkdir /opt/config
342             echo "__lb_oam_int__" > /opt/config/lb_oam_int.txt
343             echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
344             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
345             echo "__oam_private_ipaddr__" > /opt/config/oam_private_ipaddr.txt
346             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
347             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
348             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
349             echo "__install_script_version__" > /opt/config/install_script_version.txt
350             echo "__vlb_private_net_cidr__" > /opt/config/vlb_private_net_cidr.txt
351             echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
352             echo "__cloud_env__" > /opt/config/cloud_env.txt
353
354             # Download and run install script
355             curl -k __repo_url_blob__/org.onap.demo/vnfs/vlb/__install_script_version__/v_dns_install.sh -o /opt/v_dns_install.sh
356             cd /opt
357             chmod +x v_dns_install.sh
358             ./v_dns_install.sh
359
360
361   vpg_private_0_port:
362     type: OS::Neutron::Port
363     properties:
364       network: { get_resource: pktgen_private_network }
365       fixed_ips: [{"subnet": { get_resource: pktgen_private_subnet }, "ip_address": { get_param: vpg_private_ip_0 }}]
366
367   vpg_private_1_port:
368     type: OS::Neutron::Port
369     properties:
370       network: { get_param: onap_private_net_id }
371       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vpg_private_ip_1 }}]
372
373   vpg_0:
374     type: OS::Nova::Server
375     properties:
376       image: { get_param: vlb_image_name }
377       flavor: { get_param: vlb_flavor_name }
378       name: { get_param: vpg_name_0 }
379       key_name: { get_resource: my_keypair }
380       networks:
381         - network: { get_param: public_net_id }
382         - port: { get_resource: vpg_private_0_port }
383         - port: { get_resource: vpg_private_1_port }
384       user_data_format: RAW
385       user_data:
386         str_replace:
387           params:
388             __repo_url_blob__: { get_param: repo_url_blob }
389             __repo_url_artifacts__: { get_param: repo_url_artifacts }
390             __local_private_ipaddr__: { get_param: vpg_private_ip_0 }
391             __oam_private_ipaddr__: { get_param: vpg_private_ip_1 }
392             __onap_private_net_cidr__: { get_param: onap_private_net_cidr }
393             __pktgen_private_net_cidr__: { get_param: pktgen_private_net_cidr }
394             __vlb_ipaddr__: { get_param: vlb_private_ip_2 }
395             __demo_artifacts_version__: { get_param: demo_artifacts_version }
396             __install_script_version__: { get_param: install_script_version }
397             __pg_int__: { get_param: pg_int }
398             __cloud_env__: { get_param: cloud_env }
399           template: |
400             #!/bin/bash
401
402             # Create configuration files
403             mkdir /opt/config
404             echo "__oam_private_ipaddr__" > /opt/config/oam_private_ipaddr.txt
405             echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
406             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
407             echo "__pktgen_private_net_cidr__" > /opt/config/pktgen_private_net_cidr.txt
408             echo "__vlb_ipaddr__" > /opt/config/vlb_ipaddr.txt
409             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
410             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
411             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
412             echo "__install_script_version__" > /opt/config/install_script_version.txt
413             echo "__pg_int__" > /opt/config/pg_int.txt
414             echo "__cloud_env__" > /opt/config/cloud_env.txt
415
416             # Download and run install script
417             curl -k __repo_url_blob__/org.onap.demo/vnfs/vlb/__install_script_version__/v_packetgen_install.sh -o /opt/v_packetgen_install.sh
418             cd /opt
419             chmod +x v_packetgen_install.sh
420             ./v_packetgen_install.sh