Merge "Initial KEA DHCP Hook"
[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   onap_private_net_cidr:
69     type: string
70     label: ONAP private network CIDR
71     description: The CIDR of the protected private network
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 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 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 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 vGW 
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   cpe_signal_subnet:
199     type: OS::Neutron::Subnet
200     properties:
201       name: { get_param: cpe_signal_net_id }
202       network_id: { get_resource: cpe_signal_network }
203       cidr: { get_param: cpe_signal_net_cidr }
204
205   cpe_public_network:
206     type: OS::Neutron::Net
207     properties:
208       name: { get_param: cpe_public_net_id }
209   cpe_public_subnet:
210     type: OS::Neutron::Subnet
211     properties:
212       name: { get_param: cpe_public_net_id }
213       network_id: { get_resource: cpe_public_network }
214       cidr: { get_param: cpe_public_net_cidr }
215
216
217   # Virtual AAA server Instantiation
218   vaaa_private_0_port:
219     type: OS::Neutron::Port
220     properties:
221       network: { get_resource: cpe_signal_network }
222       fixed_ips: [{"subnet": { get_resource: cpe_signal_subnet }, "ip_address": { get_param: vaaa_private_ip_0 }}]
223
224   vaaa_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: vaaa_private_ip_1 }}]
229
230   vaaa_0:
231     type: OS::Nova::Server
232     properties:
233       image: { get_param: vcpe_image_name }
234       flavor: { get_param: vcpe_flavor_name }
235       name: { get_param: vaaa_name_0 }
236       key_name: { get_resource: my_keypair }
237       networks:
238         - network: { get_param: public_net_id }
239         - port: { get_resource: vaaa_private_0_port }
240         - port: { get_resource: vaaa_private_1_port }
241       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
242       user_data_format: RAW
243       user_data:
244         str_replace:
245           params:
246             __dcae_collector_ip__: { get_param: dcae_collector_ip }
247             __dcae_collector_port__: { get_param: dcae_collector_port }
248             __local_private_ipaddr__: { get_param: vaaa_private_ip_0 }
249             __repo_url_blob__ : { get_param: repo_url_blob }
250             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
251             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
252             __install_script_version__ : { get_param: install_script_version }
253             __cloud_env__ : { get_param: cloud_env }
254           template: |
255             #!/bin/bash
256
257             # Create configuration files
258             mkdir /opt/config
259             echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt
260             echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt
261             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
262             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
263             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
264             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
265             echo "__install_script_version__" > /opt/config/install_script_version.txt
266             echo "__cloud_env__" > /opt/config/cloud_env.txt
267
268             # Download and run install script
269             curl -k __repo_url_blob__/org.onap.demo/vnfs/vaaa/__install_script_version__/v_aaa_install.sh -o /opt/v_aaa_install.sh
270             cd /opt
271             chmod +x v_aaa_install.sh
272             ./v_aaa_install.sh
273
274
275   # Virtual DNS Instantiation
276   vdns_private_0_port:
277     type: OS::Neutron::Port
278     properties:
279       network: { get_resource: cpe_public_network }
280       fixed_ips: [{"subnet": { get_resource: cpe_public_subnet }, "ip_address": { get_param: vdns_private_ip_0 }}]
281
282   vdns_private_1_port:
283     type: OS::Neutron::Port
284     properties:
285       network: { get_param: onap_private_net_id }
286       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]
287
288   vdns_0:
289     type: OS::Nova::Server
290     properties:
291       image: { get_param: vcpe_image_name }
292       flavor: { get_param: vcpe_flavor_name }
293       name: { get_param: vdns_name_0 }
294       key_name: { get_resource: my_keypair }
295       networks:
296         - network: { get_param: public_net_id }
297         - port: { get_resource: vdns_private_0_port }
298         - port: { get_resource: vdns_private_1_port }
299       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
300       user_data_format: RAW
301       user_data:
302         str_replace:
303           params:
304             __lb_oam_int__ : { get_param: vaaa_private_ip_1 }
305             __lb_private_ipaddr__: { get_param: vaaa_private_ip_0 }
306             __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
307             __repo_url_blob__ : { get_param: repo_url_blob }
308             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
309             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
310             __install_script_version__ : { get_param: install_script_version }
311             __cloud_env__ : { get_param: cloud_env }
312           template: |
313             #!/bin/bash
314
315             # Create configuration files
316             mkdir /opt/config
317             echo "__lb_oam_int__" > /opt/config/lb_oam_int.txt
318             echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
319             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
320             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
321             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
322             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
323             echo "__install_script_version__" > /opt/config/install_script_version.txt
324             echo "__cloud_env__" > /opt/config/cloud_env.txt
325
326             # Download and run install script
327             curl -k __repo_url_blob__/org.onap.demo/vnfs/vdns/__install_script_version__/v_dns_install.sh -o /opt/v_dns_install.sh
328             cd /opt
329             chmod +x v_dns_install.sh
330             ./v_dns_install.sh
331
332
333   # Virtual DHCP Instantiation
334   vdhcp_private_0_port:
335     type: OS::Neutron::Port
336     properties:
337       network: { get_resource: cpe_signal_network }
338       fixed_ips: [{"subnet": { get_resource: cpe_signal_subnet }, "ip_address": { get_param: vdhcp_private_ip_0 }}]
339
340   vdhcp_private_1_port:
341     type: OS::Neutron::Port
342     properties:
343       network: { get_param: onap_private_net_id }
344       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdhcp_private_ip_1 }}]
345
346   vdhcp_0:
347     type: OS::Nova::Server
348     properties:
349       image: { get_param: vcpe_image_name }
350       flavor: { get_param: vcpe_flavor_name }
351       name: { get_param: vdhcp_name_0 }
352       key_name: { get_resource: my_keypair }
353       networks:
354         - network: { get_param: public_net_id }
355         - port: { get_resource: vdhcp_private_0_port }
356         - port: { get_resource: vdhcp_private_1_port }
357       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
358       user_data_format: RAW
359       user_data:
360         str_replace:
361           params:
362             __lb_oam_int__ : { get_param: vaaa_private_ip_1 }
363             __lb_private_ipaddr__: { get_param: vaaa_private_ip_0 }
364             __local_private_ipaddr__: { get_param: vdhcp_private_ip_0 }
365             __repo_url_blob__ : { get_param: repo_url_blob }
366             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
367             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
368             __install_script_version__ : { get_param: install_script_version }
369             __cloud_env__ : { get_param: cloud_env }
370           template: |
371             #!/bin/bash
372
373             # Create configuration files
374             mkdir /opt/config
375             echo "__lb_oam_int__" > /opt/config/lb_oam_int.txt
376             echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
377             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
378             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
379             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
380             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
381             echo "__install_script_version__" > /opt/config/install_script_version.txt
382             echo "__cloud_env__" > /opt/config/cloud_env.txt
383
384             # Download and run install script
385             curl -k __repo_url_blob__/org.onap.demo/vnfs/vdhcp/__install_script_version__/v_dhcp_install.sh -o /opt/v_dhcp_install.sh
386             cd /opt
387             chmod +x v_dhcp_install.sh
388             ./v_dhcp_install.sh
389
390   # vWEB instantiaion
391   vweb_private_0_port:
392     type: OS::Neutron::Port
393     properties:
394       network: { get_resource: cpe_public_network }
395       fixed_ips: [{"subnet": { get_resource: cpe_public_subnet }, "ip_address": { get_param: vweb_private_ip_0 }}]
396
397   vweb_private_1_port:
398     type: OS::Neutron::Port
399     properties:
400       network: { get_param: onap_private_net_id }
401       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vweb_private_ip_1 }}]
402
403
404   vweb_0:
405     type: OS::Nova::Server
406     properties:
407       image: { get_param: vcpe_image_name }
408       flavor: { get_param: vcpe_flavor_name }
409       name: { get_param: vweb_name_0 }
410       key_name: { get_resource: my_keypair }
411       networks:
412         - network: { get_param: public_net_id }
413         - port: { get_resource: vweb_private_0_port }
414         - port: { get_resource: vweb_private_1_port }
415       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
416       user_data_format: RAW
417       user_data:
418         str_replace:
419           params:
420             __web_oam_int__ : { get_param: vweb_private_ip_1 }
421             __web_private_ipaddr__: { get_param: vweb_private_ip_0 }
422             __local_private_ipaddr__: { get_param: vweb_private_ip_0 }
423             __repo_url_blob__ : { get_param: repo_url_blob }
424             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
425             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
426             __install_script_version__ : { get_param: install_script_version }
427             __cloud_env__ : { get_param: cloud_env }
428           template: |
429             #!/bin/bash
430
431             # Create configuration files
432             mkdir /opt/config
433             echo "__web_oam_int__" > /opt/config/lb_oam_int.txt
434             echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
435             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
436             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
437             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
438             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
439             echo "__install_script_version__" > /opt/config/install_script_version.txt
440             echo "__cloud_env__" > /opt/config/cloud_env.txt
441
442             # Download and run install script
443             curl -k __repo_url_blob__/org.onap.demo/vnfs/vdhcp/__install_script_version__/v_dhcp_install.sh -o /opt/v_dhcp_install.sh
444             cd /opt
445             chmod +x v_dhcp_install.sh