Fix path to vWEB in vCPE infra Heat template
[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   onap_private_net_id:
49     type: string
50     label: ONAP management network name or ID
51     description: Private network that connects ONAP components and the VNF
52   onap_private_subnet_id:
53     type: string
54     label: ONAP management sub-network name or ID
55     description: Private sub-network that connects ONAP components and the VNF
56   onap_private_net_cidr:
57     type: string
58     label: ONAP private network CIDR
59     description: The CIDR of the protected private network
60   cpe_signal_net_id:
61     type: string
62     label: vAAA private network name or ID
63     description: Private network that connects vAAA with vDNSs
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_id:
69     type: string
70     label: vCPE Public network (emulates internet) name or ID
71     description: Private network that connects vGW to emulated internet
72   cpe_public_net_cidr:
73     type: string
74     label: vCPE public network CIDR
75     description: The CIDR of the vCPE public
76   vaaa_private_ip_0:
77     type: string
78     label: vAAA private IP address towards the CPE_SIGNAL private network
79     description: Private IP address that is assigned to the vAAA to communicate with the vCPE components 
80   vaaa_private_ip_1:
81     type: string
82     label: vAAA private IP address towards the ONAP management network
83     description: Private IP address that is assigned to the vAAA to communicate with ONAP components
84   vdns_private_ip_0:
85     type: string
86     label: vDNS private IP address towards the CPE_PUBLIC private network
87     description: Private IP address that is assigned to the vDNS to communicate with the vCPE components
88   vdns_private_ip_1:
89     type: string
90     label: vDNS private IP address towards the ONAP management network
91     description: Private IP address that is assigned to the vDNS to communicate with ONAP components
92   vdhcp_private_ip_0:
93     type: string
94     label: vDHCP  private IP address towards the CPE_SIGNAL private network
95     description: Private IP address that is assigned to the vDHCP to communicate with the vCPE components
96   vdhcp_private_ip_1:
97     type: string
98     label: vDNS private IP address towards the ONAP management network
99     description: Private IP address that is assigned to the vDHCP to communicate with ONAP components
100   vweb_private_ip_0:
101     type: string
102     label: vWEB private IP address towards the CPE_PUBLIC private network
103     description: Private IP address that is assigned to the vWEB to communicate with the vGWs 
104   vweb_private_ip_1:
105     type: string
106     label: vWEB private IP address towards the ONAP management network
107     description: Private IP address that is assigned to the vWEB to communicate with ONAP components
108   vaaa_name_0:
109     type: string
110     label: vAAA name
111     description: Name of the vAAA
112   vdns_name_0:
113     type: string
114     label: vDNS name
115     description: Name of the vDNS
116   vdhcp_name_0:
117     type: string
118     label: vDHCP name
119     description: Name of the vDHCP
120   vweb_name_0:
121     type: string
122     label: vWEB name
123     description: Name of the vWEB 
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 vAAA 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   install_script_version:
157     type: string
158     label: Installation script version number
159     description: Version number of the scripts that install the vFW demo app
160   demo_artifacts_version:
161     type: string
162     label: Artifacts version used in demo vnfs
163     description: Artifacts (jar, tar.gz) version used in demo vnfs
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   cpe_signal_network:
195     type: OS::Neutron::Net
196     properties:
197       name: { get_param: cpe_signal_net_id }
198
199   cpe_signal_subnet:
200     type: OS::Neutron::Subnet
201     properties:
202       name: { get_param: cpe_signal_net_id }
203       network_id: { get_resource: cpe_signal_network }
204       cidr: { get_param: cpe_signal_net_cidr }
205
206   cpe_public_network:
207     type: OS::Neutron::Net
208     properties:
209       name: { get_param: cpe_public_net_id }
210
211   cpe_public_subnet:
212     type: OS::Neutron::Subnet
213     properties:
214       name: { get_param: cpe_public_net_id }
215       network_id: { get_resource: cpe_public_network }
216       cidr: { get_param: cpe_public_net_cidr }
217
218
219   # Virtual AAA server Instantiation
220   vaaa_private_0_port:
221     type: OS::Neutron::Port
222     properties:
223       network: { get_resource: cpe_signal_network }
224       fixed_ips: [{"subnet": { get_resource: cpe_signal_subnet }, "ip_address": { get_param: vaaa_private_ip_0 }}]
225
226   vaaa_private_1_port:
227     type: OS::Neutron::Port
228     properties:
229       network: { get_param: onap_private_net_id }
230       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vaaa_private_ip_1 }}]
231
232   vaaa_0:
233     type: OS::Nova::Server
234     properties:
235       image: { get_param: vcpe_image_name }
236       flavor: { get_param: vcpe_flavor_name }
237       name: { get_param: vaaa_name_0 }
238       key_name: { get_resource: my_keypair }
239       networks:
240         - network: { get_param: public_net_id }
241         - port: { get_resource: vaaa_private_0_port }
242         - port: { get_resource: vaaa_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             __dcae_collector_ip__: { get_param: dcae_collector_ip }
249             __dcae_collector_port__: { get_param: dcae_collector_port }
250             __cpe_signal_net_ipaddr__: { get_param: vaaa_private_ip_0 }
251             __oam_ipaddr__: { get_param: vaaa_private_ip_1 }
252             __oam_cidr__: { get_param: onap_private_net_cidr }
253             __cpe_signal_net_cidr__: { get_param: cpe_signal_net_cidr }
254             __repo_url_blob__ : { get_param: repo_url_blob }
255             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
256             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
257             __install_script_version__ : { get_param: install_script_version }
258             __cloud_env__ : { get_param: cloud_env }
259           template: |
260             #!/bin/bash
261
262             # Create configuration files
263             mkdir /opt/config
264             echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt
265             echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt
266             echo "__cpe_signal_net_ipaddr__" > /opt/config/cpe_signal_net_ipaddr.txt
267             echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt
268             echo "__oam_cidr__" > /opt/config/oam_cidr.txt
269             echo "__cpe_signal_net_cidr__" > /opt/config/cpe_signal_net_cidr.txt
270             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
271             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
272             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
273             echo "__install_script_version__" > /opt/config/install_script_version.txt
274             echo "__cloud_env__" > /opt/config/cloud_env.txt
275
276             # Download and run install script
277             curl -k __repo_url_blob__/org.onap.demo/vnfs/vcpe/__install_script_version__/v_aaa_install.sh -o /opt/v_aaa_install.sh
278             cd /opt
279             chmod +x v_aaa_install.sh
280             ./v_aaa_install.sh
281
282
283   # Virtual DNS Instantiation
284   vdns_private_0_port:
285     type: OS::Neutron::Port
286     properties:
287       network: { get_resource: cpe_public_network }
288       fixed_ips: [{"subnet": { get_resource: cpe_public_subnet }, "ip_address": { get_param: vdns_private_ip_0 }}]
289
290   vdns_private_1_port:
291     type: OS::Neutron::Port
292     properties:
293       network: { get_param: onap_private_net_id }
294       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]
295
296   vdns_0:
297     type: OS::Nova::Server
298     properties:
299       image: { get_param: vcpe_image_name }
300       flavor: { get_param: vcpe_flavor_name }
301       name: { get_param: vdns_name_0 }
302       key_name: { get_resource: my_keypair }
303       networks:
304         - network: { get_param: public_net_id }
305         - port: { get_resource: vdns_private_0_port }
306         - port: { get_resource: vdns_private_1_port }
307       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
308       user_data_format: RAW
309       user_data:
310         str_replace:
311           params:
312             __oam_ipaddr__ : { get_param: vdns_private_ip_1 }
313             __cpe_public_net_ipaddr__: { get_param: vdns_private_ip_0 }
314             __oam_cidr__: { get_param: onap_private_net_cidr }
315             __cpe_public_net_cidr__: { get_param: cpe_public_net_cidr }
316             __repo_url_blob__ : { get_param: repo_url_blob }
317             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
318             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
319             __install_script_version__ : { get_param: install_script_version }
320             __cloud_env__ : { get_param: cloud_env }
321           template: |
322             #!/bin/bash
323
324             # Create configuration files
325             mkdir /opt/config
326             echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt
327             echo "__cpe_public_net_ipaddr__" > /opt/config/cpe_public_net_ipaddr.txt
328             echo "__oam_cidr__" > /opt/config/oam_cidr.txt
329             echo "__cpe_public_net_cidr__" > /opt/config/cpe_public_net_cidr.txt
330             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
331             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
332             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
333             echo "__install_script_version__" > /opt/config/install_script_version.txt
334             echo "__cloud_env__" > /opt/config/cloud_env.txt
335
336             # Download and run install script
337             curl -k __repo_url_blob__/org.onap.demo/vnfs/vcpe/__install_script_version__/v_dns_install.sh -o /opt/v_dns_install.sh
338             cd /opt
339             chmod +x v_dns_install.sh
340             ./v_dns_install.sh
341
342
343   # Virtual DHCP Instantiation
344   vdhcp_private_0_port:
345     type: OS::Neutron::Port
346     properties:
347       network: { get_resource: cpe_signal_network }
348       fixed_ips: [{"subnet": { get_resource: cpe_signal_subnet }, "ip_address": { get_param: vdhcp_private_ip_0 }}]
349
350   vdhcp_private_1_port:
351     type: OS::Neutron::Port
352     properties:
353       network: { get_param: onap_private_net_id }
354       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdhcp_private_ip_1 }}]
355
356   vdhcp_0:
357     type: OS::Nova::Server
358     properties:
359       image: { get_param: vcpe_image_name }
360       flavor: { get_param: vcpe_flavor_name }
361       name: { get_param: vdhcp_name_0 }
362       key_name: { get_resource: my_keypair }
363       networks:
364         - network: { get_param: public_net_id }
365         - port: { get_resource: vdhcp_private_0_port }
366         - port: { get_resource: vdhcp_private_1_port }
367       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
368       user_data_format: RAW
369       user_data:
370         str_replace:
371           params:
372             __oam_ipaddr__ : { get_param: vdhcp_private_ip_1 }
373             __cpe_signal_ipaddr__: { get_param: vdhcp_private_ip_0 }
374             __oam_cidr__: { get_param: onap_private_net_cidr }
375             __cpe_signal_net_cidr__: { get_param: cpe_signal_net_cidr }
376             __repo_url_blob__ : { get_param: repo_url_blob }
377             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
378             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
379             __install_script_version__ : { get_param: install_script_version }
380             __cloud_env__ : { get_param: cloud_env }
381           template: |
382             #!/bin/bash
383
384             # Create configuration files
385             mkdir /opt/config
386             echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt
387             echo "__cpe_signal_ipaddr__" > /opt/config/cpe_signal_ipaddr.txt
388             echo "__oam_cidr__" > /opt/config/oam_cidr.txt
389             echo "__cpe_signal_net_cidr__" > /opt/config/cpe_signal_net_cidr.txt
390             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
391             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
392             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
393             echo "__install_script_version__" > /opt/config/install_script_version.txt
394             echo "__cloud_env__" > /opt/config/cloud_env.txt
395
396             # Download and run install script
397             curl -k __repo_url_blob__/org.onap.demo/vnfs/vcpe/__install_script_version__/v_dhcp_install.sh -o /opt/v_dhcp_install.sh
398             cd /opt
399             chmod +x v_dhcp_install.sh
400             ./v_dhcp_install.sh
401
402   # vWEB instantiaion
403   vweb_private_0_port:
404     type: OS::Neutron::Port
405     properties:
406       network: { get_resource: cpe_public_network }
407       fixed_ips: [{"subnet": { get_resource: cpe_public_subnet }, "ip_address": { get_param: vweb_private_ip_0 }}]
408
409   vweb_private_1_port:
410     type: OS::Neutron::Port
411     properties:
412       network: { get_param: onap_private_net_id }
413       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vweb_private_ip_1 }}]
414
415
416   vweb_0:
417     type: OS::Nova::Server
418     properties:
419       image: { get_param: vcpe_image_name }
420       flavor: { get_param: vcpe_flavor_name }
421       name: { get_param: vweb_name_0 }
422       key_name: { get_resource: my_keypair }
423       networks:
424         - network: { get_param: public_net_id }
425         - port: { get_resource: vweb_private_0_port }
426         - port: { get_resource: vweb_private_1_port }
427       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
428       user_data_format: RAW
429       user_data:
430         str_replace:
431           params:
432             __oam_ipaddr__ : { get_param: vweb_private_ip_1 }
433             __cpe_public_ipaddr__: { get_param: vweb_private_ip_0 }
434             __oam_cidr__: { get_param: onap_private_net_cidr }
435             __cpe_public_net_cidr__: { get_param: cpe_public_net_cidr }
436             __repo_url_blob__ : { get_param: repo_url_blob }
437             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
438             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
439             __install_script_version__ : { get_param: install_script_version }
440             __cloud_env__ : { get_param: cloud_env }
441           template: |
442             #!/bin/bash
443
444             # Create configuration files
445             mkdir /opt/config
446             echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt
447             echo "__cpe_public_ipaddr__" > /opt/config/cpe_public_ipaddr.txt
448             echo "__oam_cidr__" > /opt/config/oam_cidr.txt
449             echo "__cpe_public_net_cidr__" > /opt/config/cpe_public_net_cidr.txt
450             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
451             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
452             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
453             echo "__install_script_version__" > /opt/config/install_script_version.txt
454             echo "__cloud_env__" > /opt/config/cloud_env.txt
455
456             # Download and run install script
457             curl -k __repo_url_blob__/org.onap.demo/vnfs/vcpe/__install_script_version__/v_web_install.sh -o /opt/v_web_install.sh
458             cd /opt
459             chmod +x v_web_install.sh
460             ./v_web_install.sh