Updatd after network review 2017-08-03
[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) 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   vaaa_name_0:
101     type: string
102     label: vAAA name
103     description: Name of the vAAA
104   vdns_name_0:
105     type: string
106     label: vDNS name
107     description: Name of the vDNS
108   vdhcp_name_0:
109     type: string
110     label: vDHCP name
111     description: Name of the vDHCP
112   vnf_id:
113     type: string
114     label: VNF ID
115     description: The VNF ID is provided by ONAP
116   vf_module_id:
117     type: string
118     label: vFirewall module ID
119     description: The vAAA Module ID is provided by ONAP
120   dcae_collector_ip:
121     type: string
122     label: DCAE collector IP address
123     description: IP address of the DCAE collector
124   dcae_collector_port:
125     type: string
126     label: DCAE collector port
127     description: Port of the DCAE collector
128   key_name:
129     type: string
130     label: Key pair name
131     description: Public/Private key pair name
132   pub_key:
133     type: string
134     label: Public key
135     description: Public key to be installed on the compute instance
136   repo_url_blob:
137     type: string
138     label: Repository URL
139     description: URL of the repository that hosts the demo packages
140   repo_url_artifacts:
141     type: string
142     label: Repository URL
143     description: URL of the repository that hosts the demo packages
144   install_script_version:
145     type: string
146     label: Installation script version number
147     description: Version number of the scripts that install the vFW demo app
148   demo_artifacts_version:
149     type: string
150     label: Artifacts version used in demo vnfs
151     description: Artifacts (jar, tar.gz) version used in demo vnfs
152   cloud_env:
153     type: string
154     label: Cloud environment
155     description: Cloud environment (e.g., openstack, rackspace)
156
157 #############
158 #           #
159 # RESOURCES #
160 #           #
161 #############
162
163 resources:
164
165   random-str:
166     type: OS::Heat::RandomString
167     properties:
168       length: 4
169
170   my_keypair:
171     type: OS::Nova::KeyPair
172     properties:
173       name:
174         str_replace:
175           template: base_rand
176           params:
177             base: { get_param: key_name }
178             rand: { get_resource: random-str }
179       public_key: { get_param: pub_key }
180       save_private_key: false
181
182   cpe_signal_network:
183     type: OS::Neutron::Net
184     properties:
185       name: { get_param: cpe_signal_net_id }
186   cpe_signal_subnet:
187     type: OS::Neutron::Subnet
188     properties:
189       name: { get_param: cpe_signal_net_id }
190       network_id: { get_resource: cpe_signal_network }
191       cidr: { get_param: cpe_signal_net_cidr }
192
193   cpe_public_network:
194     type: OS::Neutron::Net
195     properties:
196       name: { get_param: cpe_public_net_id }
197   cpe_public_subnet:
198     type: OS::Neutron::Subnet
199     properties:
200       name: { get_param: cpe_public_net_id }
201       network_id: { get_resource: cpe_public_network }
202       cidr: { get_param: cpe_public_net_cidr }
203
204
205   # Virtual Load Balancer Instantiation
206   vaaa_private_0_port:
207     type: OS::Neutron::Port
208     properties:
209       network: { get_resource: cpe_signal_network }
210       fixed_ips: [{"subnet": { get_resource: cpe_signal_subnet }, "ip_address": { get_param: vaaa_private_ip_0 }}]
211
212   vaaa_private_1_port:
213     type: OS::Neutron::Port
214     properties:
215       network: { get_param: onap_private_net_id }
216       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vaaa_private_ip_1 }}]
217
218   vaaa_0:
219     type: OS::Nova::Server
220     properties:
221       image: { get_param: vcpe_image_name }
222       flavor: { get_param: vcpe_flavor_name }
223       name: { get_param: vaaa_name_0 }
224       key_name: { get_resource: my_keypair }
225       networks:
226         - network: { get_param: public_net_id }
227         - port: { get_resource: vaaa_private_0_port }
228         - port: { get_resource: vaaa_private_1_port }
229       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
230       user_data_format: RAW
231       user_data:
232         str_replace:
233           params:
234             __dcae_collector_ip__: { get_param: dcae_collector_ip }
235             __dcae_collector_port__: { get_param: dcae_collector_port }
236             __local_private_ipaddr__: { get_param: vaaa_private_ip_0 }
237             __repo_url_blob__ : { get_param: repo_url_blob }
238             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
239             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
240             __install_script_version__ : { get_param: install_script_version }
241             __cloud_env__ : { get_param: cloud_env }
242           template: |
243             #!/bin/bash
244
245             # Create configuration files
246             mkdir /opt/config
247             echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt
248             echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt
249             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
250             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
251             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
252             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
253             echo "__install_script_version__" > /opt/config/install_script_version.txt
254             echo "__cloud_env__" > /opt/config/cloud_env.txt
255
256             # Download and run install script
257             curl -k __repo_url_blob__/org.onap.demo/vnfs/vaaa/__install_script_version__/v_aaa_install.sh -o /opt/v_aaa_install.sh
258             cd /opt
259             chmod +x v_aaa_install.sh
260             ./v_aaa_install.sh
261
262
263   # Virtual DNS Instantiation
264   vdns_private_0_port:
265     type: OS::Neutron::Port
266     properties:
267       network: { get_resource: cpe_public_network }
268       fixed_ips: [{"subnet": { get_resource: cpe_public_subnet }, "ip_address": { get_param: vdns_private_ip_0 }}]
269
270   vdns_private_1_port:
271     type: OS::Neutron::Port
272     properties:
273       network: { get_param: onap_private_net_id }
274       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]
275
276   vdns_0:
277     type: OS::Nova::Server
278     properties:
279       image: { get_param: vcpe_image_name }
280       flavor: { get_param: vcpe_flavor_name }
281       name: { get_param: vdns_name_0 }
282       key_name: { get_resource: my_keypair }
283       networks:
284         - network: { get_param: public_net_id }
285         - port: { get_resource: vdns_private_0_port }
286         - port: { get_resource: vdns_private_1_port }
287       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
288       user_data_format: RAW
289       user_data:
290         str_replace:
291           params:
292             __lb_oam_int__ : { get_param: vaaa_private_ip_1 }
293             __lb_private_ipaddr__: { get_param: vaaa_private_ip_0 }
294             __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
295             __repo_url_blob__ : { get_param: repo_url_blob }
296             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
297             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
298             __install_script_version__ : { get_param: install_script_version }
299             __cloud_env__ : { get_param: cloud_env }
300           template: |
301             #!/bin/bash
302
303             # Create configuration files
304             mkdir /opt/config
305             echo "__lb_oam_int__" > /opt/config/lb_oam_int.txt
306             echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
307             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
308             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
309             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
310             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
311             echo "__install_script_version__" > /opt/config/install_script_version.txt
312             echo "__cloud_env__" > /opt/config/cloud_env.txt
313
314             # Download and run install script
315             curl -k __repo_url_blob__/org.onap.demo/vnfs/vdns/__install_script_version__/v_dns_install.sh -o /opt/v_dns_install.sh
316             cd /opt
317             chmod +x v_dns_install.sh
318             ./v_dns_install.sh
319
320
321   # Virtual DHCP Instantiation
322   vdhcp_private_0_port:
323     type: OS::Neutron::Port
324     properties:
325       network: { get_resource: cpe_signal_network }
326       fixed_ips: [{"subnet": { get_resource: cpe_signal_subnet }, "ip_address": { get_param: vdhcp_private_ip_0 }}]
327
328   vdhcp_private_1_port:
329     type: OS::Neutron::Port
330     properties:
331       network: { get_param: onap_private_net_id }
332       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdhcp_private_ip_1 }}]
333
334   vdhcp_0:
335     type: OS::Nova::Server
336     properties:
337       image: { get_param: vcpe_image_name }
338       flavor: { get_param: vcpe_flavor_name }
339       name: { get_param: vdhcp_name_0 }
340       key_name: { get_resource: my_keypair }
341       networks:
342         - network: { get_param: public_net_id }
343         - port: { get_resource: vdhcp_private_0_port }
344         - port: { get_resource: vdhcp_private_1_port }
345       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
346       user_data_format: RAW
347       user_data:
348         str_replace:
349           params:
350             __lb_oam_int__ : { get_param: vaaa_private_ip_1 }
351             __lb_private_ipaddr__: { get_param: vaaa_private_ip_0 }
352             __local_private_ipaddr__: { get_param: vdhcp_private_ip_0 }
353             __repo_url_blob__ : { get_param: repo_url_blob }
354             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
355             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
356             __install_script_version__ : { get_param: install_script_version }
357             __cloud_env__ : { get_param: cloud_env }
358           template: |
359             #!/bin/bash
360
361             # Create configuration files
362             mkdir /opt/config
363             echo "__lb_oam_int__" > /opt/config/lb_oam_int.txt
364             echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
365             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
366             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
367             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
368             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
369             echo "__install_script_version__" > /opt/config/install_script_version.txt
370             echo "__cloud_env__" > /opt/config/cloud_env.txt
371
372             # Download and run install script
373             curl -k __repo_url_blob__/org.onap.demo/vnfs/vdhcp/__install_script_version__/v_dhcp_install.sh -o /opt/v_dhcp_install.sh
374             cd /opt
375             chmod +x v_dhcp_install.sh
376             ./v_dhcp_install.sh