Clean up vCPE Heat templates
[demo.git] / heat / vCPE / infra / base_vcpe_infra_rackspace.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 vCPE Infrastructue emlements (vAAA, vDHCP, vDNS_DHCP, webServer_sink) for ONAP
28
29 ##############
30 #            #
31 # PARAMETERS #
32 #            #
33 ##############
34
35 parameters:
36   vcpe_image_name:
37     type: string
38     label: Image name or ID
39     description: Image to be used for compute instance
40   vcpe_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   cpe_signal_net_id:
49     type: string
50     label: vAAA private network name or ID
51     description: Private network that connects vAAA with vDNSs
52   onap_private_net_id:
53     type: string
54     label: ONAP management network name or ID
55     description: Private network that connects ONAP components and the VNF
56   cpe_public_net_id:
57     type: string
58     label: vCPE Public network (emulates internet) name or ID
59     description: Private network that connects vGW to emulated internet
60   onap_private_subnet_id:
61     type: string
62     label: ONAP management sub-network name or ID
63     description: Private sub-network that connects ONAP components and the VNF
64   cpe_signal_net_cidr:
65     type: string
66     label: vAAA private network CIDR
67     description: The CIDR of the vAAA private network
68   cpe_public_net_cidr:
69     type: string
70     label: vCPE public network CIDR
71     description: The CIDR of the vCPE public 
72   vaaa_private_ip_0:
73     type: string
74     label: vAAA private IP address towards the CPE_SIGNAL private network
75     description: Private IP address that is assigned to the vAAA to communicate with the vCPE components 
76   vaaa_private_ip_1:
77     type: string
78     label: vAAA private IP address towards the ONAP management network
79     description: Private IP address that is assigned to the vAAA to communicate with ONAP components
80   vdns_private_ip_0:
81     type: string
82     label: vDNS private IP address towards the CPE_PUBLIC private network
83     description: Private IP address that is assigned to the vDNS to communicate with the vCPE components
84   vdns_private_ip_1:
85     type: string
86     label: vDNS private IP address towards the ONAP management network
87     description: Private IP address that is assigned to the vDNS to communicate with ONAP components
88   vdhcp_private_ip_0:
89     type: string
90     label: vDHCP  private IP address towards the CPE_SIGNAL private network
91     description: Private IP address that is assigned to the vDHCP to communicate with the vCPE components
92   vdhcp_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 vDHCP to communicate with ONAP components
96   vweb_private_ip_0:
97     type: string
98     label: vWEB private IP address towards the CPE_PUBLIC private network
99     description: Private IP address that is assigned to the vWEB to communicate with the vGWs 
100   vweb_private_ip_1:
101     type: string
102     label: vWEB private IP address towards the ONAP management network
103     description: Private IP address that is assigned to the vWEB to communicate with ONAP components
104   vaaa_name_0:
105     type: string
106     label: vAAA name
107     description: Name of the vAAA
108   vdns_name_0:
109     type: string
110     label: vDNS name
111     description: Name of the vDNS
112   vdhcp_name_0:
113     type: string
114     label: vDHCP name
115     description: Name of the vDHCP
116   vweb_name_0:
117     type: string
118     label: vWEB name
119     description: Name of the vWEB 
120   vnf_id:
121     type: string
122     label: VNF ID
123     description: The VNF ID is provided by ONAP
124   vf_module_id:
125     type: string
126     label: vFirewall module ID
127     description: The vAAA Module ID is provided by ONAP
128   dcae_collector_ip:
129     type: string
130     label: DCAE collector IP address
131     description: IP address of the DCAE collector
132   dcae_collector_port:
133     type: string
134     label: DCAE collector port
135     description: Port of the DCAE collector
136   key_name:
137     type: string
138     label: Key pair name
139     description: Public/Private key pair name
140   pub_key:
141     type: string
142     label: Public key
143     description: Public key to be installed on the compute instance
144   repo_url_blob:
145     type: string
146     label: Repository URL
147     description: URL of the repository that hosts the demo packages
148   repo_url_artifacts:
149     type: string
150     label: Repository URL
151     description: URL of the repository that hosts the demo packages
152   install_script_version:
153     type: string
154     label: Installation script version number
155     description: Version number of the scripts that install the vFW demo app
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   cloud_env:
161     type: string
162     label: Cloud environment
163     description: Cloud environment (e.g., openstack, rackspace)
164
165 #############
166 #           #
167 # RESOURCES #
168 #           #
169 #############
170
171 resources:
172
173   random-str:
174     type: OS::Heat::RandomString
175     properties:
176       length: 4
177
178   my_keypair:
179     type: OS::Nova::KeyPair
180     properties:
181       name:
182         str_replace:
183           template: base_rand
184           params:
185             base: { get_param: key_name }
186             rand: { get_resource: random-str }
187       public_key: { get_param: pub_key }
188       save_private_key: false
189
190   cpe_signal_network:
191     type: OS::Neutron::Net
192     properties:
193       name: { get_param: cpe_signal_net_id }
194
195   cpe_signal_subnet:
196     type: OS::Neutron::Subnet
197     properties:
198       name: { get_param: cpe_signal_net_id }
199       network_id: { get_resource: cpe_signal_network }
200       cidr: { get_param: cpe_signal_net_cidr }
201
202   cpe_public_network:
203     type: OS::Neutron::Net
204     properties:
205       name: { get_param: cpe_public_net_id }
206
207   cpe_public_subnet:
208     type: OS::Neutron::Subnet
209     properties:
210       name: { get_param: cpe_public_net_id }
211       network_id: { get_resource: cpe_public_network }
212       cidr: { get_param: cpe_public_net_cidr }
213
214
215   # Virtual AAA server Instantiation
216   vaaa_private_0_port:
217     type: OS::Neutron::Port
218     properties:
219       network: { get_resource: cpe_signal_network }
220       fixed_ips: [{"subnet": { get_resource: cpe_signal_subnet }, "ip_address": { get_param: vaaa_private_ip_0 }}]
221
222   vaaa_private_1_port:
223     type: OS::Neutron::Port
224     properties:
225       network: { get_param: onap_private_net_id }
226       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vaaa_private_ip_1 }}]
227
228   vaaa_0:
229     type: OS::Nova::Server
230     properties:
231       image: { get_param: vcpe_image_name }
232       flavor: { get_param: vcpe_flavor_name }
233       name: { get_param: vaaa_name_0 }
234       key_name: { get_resource: my_keypair }
235       networks:
236         - network: { get_param: public_net_id }
237         - port: { get_resource: vaaa_private_0_port }
238         - port: { get_resource: vaaa_private_1_port }
239       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
240       user_data_format: RAW
241       user_data:
242         str_replace:
243           params:
244             __dcae_collector_ip__: { get_param: dcae_collector_ip }
245             __dcae_collector_port__: { get_param: dcae_collector_port }
246             __local_private_ipaddr__: { get_param: vaaa_private_ip_0 }
247             __repo_url_blob__ : { get_param: repo_url_blob }
248             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
249             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
250             __install_script_version__ : { get_param: install_script_version }
251             __cloud_env__ : { get_param: cloud_env }
252           template: |
253             #!/bin/bash
254
255             # Create configuration files
256             mkdir /opt/config
257             echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt
258             echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt
259             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
260             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
261             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
262             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
263             echo "__install_script_version__" > /opt/config/install_script_version.txt
264             echo "__cloud_env__" > /opt/config/cloud_env.txt
265
266             # Download and run install script
267             curl -k __repo_url_blob__/org.onap.demo/vnfs/vaaa/__install_script_version__/v_aaa_install.sh -o /opt/v_aaa_install.sh
268             cd /opt
269             chmod +x v_aaa_install.sh
270             ./v_aaa_install.sh
271
272
273   # Virtual DNS Instantiation
274   vdns_private_0_port:
275     type: OS::Neutron::Port
276     properties:
277       network: { get_resource: cpe_public_network }
278       fixed_ips: [{"subnet": { get_resource: cpe_public_subnet }, "ip_address": { get_param: vdns_private_ip_0 }}]
279
280   vdns_private_1_port:
281     type: OS::Neutron::Port
282     properties:
283       network: { get_param: onap_private_net_id }
284       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]
285
286   vdns_0:
287     type: OS::Nova::Server
288     properties:
289       image: { get_param: vcpe_image_name }
290       flavor: { get_param: vcpe_flavor_name }
291       name: { get_param: vdns_name_0 }
292       key_name: { get_resource: my_keypair }
293       networks:
294         - network: { get_param: public_net_id }
295         - port: { get_resource: vdns_private_0_port }
296         - port: { get_resource: vdns_private_1_port }
297       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
298       user_data_format: RAW
299       user_data:
300         str_replace:
301           params:
302             __lb_oam_int__ : { get_param: vaaa_private_ip_1 }
303             __lb_private_ipaddr__: { get_param: vaaa_private_ip_0 }
304             __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
305             __repo_url_blob__ : { get_param: repo_url_blob }
306             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
307             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
308             __install_script_version__ : { get_param: install_script_version }
309             __cloud_env__ : { get_param: cloud_env }
310           template: |
311             #!/bin/bash
312
313             # Create configuration files
314             mkdir /opt/config
315             echo "__lb_oam_int__" > /opt/config/lb_oam_int.txt
316             echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
317             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
318             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
319             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
320             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
321             echo "__install_script_version__" > /opt/config/install_script_version.txt
322             echo "__cloud_env__" > /opt/config/cloud_env.txt
323
324             # Download and run install script
325             curl -k __repo_url_blob__/org.onap.demo/vnfs/vdns/__install_script_version__/v_dns_install.sh -o /opt/v_dns_install.sh
326             cd /opt
327             chmod +x v_dns_install.sh
328             ./v_dns_install.sh
329
330
331   # Virtual DHCP Instantiation
332   vdhcp_private_0_port:
333     type: OS::Neutron::Port
334     properties:
335       network: { get_resource: cpe_signal_network }
336       fixed_ips: [{"subnet": { get_resource: cpe_signal_subnet }, "ip_address": { get_param: vdhcp_private_ip_0 }}]
337
338   vdhcp_private_1_port:
339     type: OS::Neutron::Port
340     properties:
341       network: { get_param: onap_private_net_id }
342       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdhcp_private_ip_1 }}]
343
344   vdhcp_0:
345     type: OS::Nova::Server
346     properties:
347       image: { get_param: vcpe_image_name }
348       flavor: { get_param: vcpe_flavor_name }
349       name: { get_param: vdhcp_name_0 }
350       key_name: { get_resource: my_keypair }
351       networks:
352         - network: { get_param: public_net_id }
353         - port: { get_resource: vdhcp_private_0_port }
354         - port: { get_resource: vdhcp_private_1_port }
355       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
356       user_data_format: RAW
357       user_data:
358         str_replace:
359           params:
360             __lb_oam_int__ : { get_param: vaaa_private_ip_1 }
361             __lb_private_ipaddr__: { get_param: vaaa_private_ip_0 }
362             __local_private_ipaddr__: { get_param: vdhcp_private_ip_0 }
363             __repo_url_blob__ : { get_param: repo_url_blob }
364             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
365             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
366             __install_script_version__ : { get_param: install_script_version }
367             __cloud_env__ : { get_param: cloud_env }
368           template: |
369             #!/bin/bash
370
371             # Create configuration files
372             mkdir /opt/config
373             echo "__lb_oam_int__" > /opt/config/lb_oam_int.txt
374             echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
375             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
376             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
377             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
378             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
379             echo "__install_script_version__" > /opt/config/install_script_version.txt
380             echo "__cloud_env__" > /opt/config/cloud_env.txt
381
382             # Download and run install script
383             curl -k __repo_url_blob__/org.onap.demo/vnfs/vdhcp/__install_script_version__/v_dhcp_install.sh -o /opt/v_dhcp_install.sh
384             cd /opt
385             chmod +x v_dhcp_install.sh
386             ./v_dhcp_install.sh
387
388   # vWEB instantiaion
389   vweb_private_0_port:
390     type: OS::Neutron::Port
391     properties:
392       network: { get_resource: cpe_public_network }
393       fixed_ips: [{"subnet": { get_resource: cpe_public_subnet }, "ip_address": { get_param: vweb_private_ip_0 }}]
394
395   vweb_private_1_port:
396     type: OS::Neutron::Port
397     properties:
398       network: { get_param: onap_private_net_id }
399       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vweb_private_ip_1 }}]
400
401
402   vweb_0:
403     type: OS::Nova::Server
404     properties:
405       image: { get_param: vcpe_image_name }
406       flavor: { get_param: vcpe_flavor_name }
407       name: { get_param: vweb_name_0 }
408       key_name: { get_resource: my_keypair }
409       networks:
410         - network: { get_param: public_net_id }
411         - port: { get_resource: vweb_private_0_port }
412         - port: { get_resource: vweb_private_1_port }
413       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
414       user_data_format: RAW
415       user_data:
416         str_replace:
417           params:
418             __web_oam_int__ : { get_param: vweb_private_ip_1 }
419             __web_private_ipaddr__: { get_param: vweb_private_ip_0 }
420             __local_private_ipaddr__: { get_param: vweb_private_ip_0 }
421             __repo_url_blob__ : { get_param: repo_url_blob }
422             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
423             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
424             __install_script_version__ : { get_param: install_script_version }
425             __cloud_env__ : { get_param: cloud_env }
426           template: |
427             #!/bin/bash
428
429             # Create configuration files
430             mkdir /opt/config
431             echo "__web_oam_int__" > /opt/config/lb_oam_int.txt
432             echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
433             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
434             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
435             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
436             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
437             echo "__install_script_version__" > /opt/config/install_script_version.txt
438             echo "__cloud_env__" > /opt/config/cloud_env.txt
439
440             # Download and run install script
441             curl -k __repo_url_blob__/org.onap.demo/vnfs/vdhcp/__install_script_version__/v_dhcp_install.sh -o /opt/v_dhcp_install.sh
442             cd /opt
443             chmod +x v_dhcp_install.sh