Move heat templates from openecom to onap
[demo.git] / heat / vCPE / metro / base_vcpe_metro_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 Metro elements (vBNG, vGMUX ) 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   vbng_in_private_net_id:
49     type: string
50     label: vBNG IN private network name or ID
51     description: Private network that connects vBRG to vBNG
52   vbng_in_private_net_cidr:
53     type: string
54     label: vBNG IN private network CIDR
55     description: The CIDR of the input side of vBNG private network
56   vbng_vgmux_private_net_id:
57     type: string
58     label: vBNG vGMUX private network name or ID
59     description: Private network that connects vBNG to vGMUX
60   vbng_vgmux_private_net_cidr:
61     type: string
62     label: vGMUX private network CIDR
63     description: The CIDR of the input side of vGMUX private network
64   vgmux_private_net_id:
65     type: string
66     label: vGMUX private network name or ID
67     description: Private network that connects vGMUX to vGWs
68   onap_private_net_id:
69     type: string
70     label: ONAP management network name or ID
71     description: Private network that connects ONAP components and the VNF
72   onap_private_subnet_id:
73     type: string
74     label: ONAP management sub-network name or ID
75     description: Private sub-network that connects ONAP components and the VNF
76   vgmux_private_net_cidr:
77     type: string
78     label: vGMUX private network CIDR
79     description: The CIDR of the vGMUX private network
80   onap_private_net_cidr:
81     type: string
82     label: ONAP private network CIDR
83     description: The CIDR of the protected private network
84   vbng_private_ip_0:
85     type: string
86     label: vBNG IN private IP address
87     description: Private IP address that is assigned to the vBNG IN
88   vbng_private_ip_1:
89     type: string
90     label: vBNG private IP address towards the ONAP management network
91     description: Private IP address that is assigned to the vBNG to communicate with ONAP components
92   vbng_private_ip_2:
93     type: string
94     label: vBNG to vGMUX  private IP address
95     description: Private IP address that is assigned to the vBNG to vGMUX port
96   vgmux_private_ip_0:
97     type: string
98     label: vGMUX private IP address towards the private network
99     description: Private IP address that is assigned to the vGMUX to communicate with the vCPE components
100   vgmux_private_ip_1:
101     type: string
102     label: vGMUX private IP address towards the ONAP management network
103     description: Private IP address that is assigned to the vGMUX to communicate with ONAP components
104   vgmux_private_ip_2:
105     type: string
106     label: vGMUX private IP address towards the ONAP management network
107     description: Private IP address that is assigned to the vGMUX to communicate with ONAP components
108   vbng_name_0:
109     type: string
110     label: vBNG name
111     description: Name of the vBNG
112   vgmux_name_0:
113     type: string
114     label: vGMUX name
115     description: Name of the vGMUX
116   vnf_id:
117     type: string
118     label: VNF ID
119     description: The VNF ID is provided by ONAP
120   vf_module_id:
121     type: string
122     label: vCPE module ID
123     description: The vCPE Module ID is provided by ONAP
124   dcae_collector_ip:
125     type: string
126     label: DCAE collector IP address
127     description: IP address of the DCAE collector
128   dcae_collector_port:
129     type: string
130     label: DCAE collector port
131     description: Port of the DCAE collector
132   key_name:
133     type: string
134     label: Key pair name
135     description: Public/Private key pair name
136   pub_key:
137     type: string
138     label: Public key
139     description: Public key to be installed on the compute instance
140   repo_url_blob:
141     type: string
142     label: Repository URL
143     description: URL of the repository that hosts the demo packages
144   repo_url_artifacts:
145     type: string
146     label: Repository URL
147     description: URL of the repository that hosts the demo packages
148   install_script_version:
149     type: string
150     label: Installation script version number
151     description: Version number of the scripts that install the vFW demo app
152   demo_artifacts_version:
153     type: string
154     label: Artifacts version used in demo vnfs
155     description: Artifacts (jar, tar.gz) version used in demo vnfs
156   cloud_env:
157     type: string
158     label: Cloud environment
159     description: Cloud environment (e.g., openstack, rackspace)
160
161 #############
162 #           #
163 # RESOURCES #
164 #           #
165 #############
166
167 resources:
168
169   random-str:
170     type: OS::Heat::RandomString
171     properties:
172       length: 4
173
174   my_keypair:
175     type: OS::Nova::KeyPair
176     properties:
177       name:
178         str_replace:
179           template: base_rand
180           params:
181             base: { get_param: key_name }
182             rand: { get_resource: random-str }
183       public_key: { get_param: pub_key }
184       save_private_key: false
185
186   vbng_in_private_network:
187     type: OS::Neutron::Net
188     properties:
189       name: { get_param: vbng_in_private_net_id }
190   vbng_in_private_subnet:
191     type: OS::Neutron::Subnet
192     properties:
193       name: { get_param: vbng_in_private_net_id }
194       network_id: { get_resource: vbng_in_private_network }
195       cidr: { get_param: vbng_in_private_net_cidr }
196   vbng_vgmux_private_network:
197     type: OS::Neutron::Net
198     properties:
199       name: { get_param: vbng_vgmux_private_net_id }
200   vbng_vgmux_private_subnet:
201     type: OS::Neutron::Subnet
202     properties:
203       name: { get_param: vbng_vgmux_private_net_id }
204       network_id: { get_resource: vbng_vgmux_private_network }
205       cidr: { get_param: vbng_vgmux_private_net_cidr }
206   vgmux_private_network:
207     type: OS::Neutron::Net
208     properties:
209       name: { get_param: vgmux_private_net_id }
210   vgmux_private_subnet:
211     type: OS::Neutron::Subnet
212     properties:
213       name: { get_param: vgmux_private_net_id }
214       network_id: { get_resource: vgmux_private_network }
215       cidr: { get_param: vgmux_private_net_cidr }
216
217
218   # Virtual BNG Instantiation
219   vbng_private_0_port:
220     type: OS::Neutron::Port
221     properties:
222       network: { get_resource: vbng_in_private_network }
223       fixed_ips: [{"subnet": { get_resource: vbng_in_private_subnet}, "ip_address": { get_param: vbng_private_ip_0 }}]
224
225   vbng_private_1_port:
226     type: OS::Neutron::Port
227     properties:
228       network: { get_param: onap_private_net_id }
229       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vbng_private_ip_1 }}]
230
231   vbng_private_2_port:
232     type: OS::Neutron::Port
233     properties:
234       network: { get_resource: vbng_vgmux_private_network }
235       fixed_ips: [{"subnet": { get_resource: vbng_vgmux_private_subnet}, "ip_address": { get_param: vbng_private_ip_2 }}]
236
237   vbng_0:
238     type: OS::Nova::Server
239     properties:
240       image: { get_param: vcpe_image_name }
241       flavor: { get_param: vcpe_flavor_name }
242       name: { get_param: vbng_name_0 }
243       key_name: { get_resource: my_keypair }
244       networks:
245         - network: { get_param: public_net_id }
246         - port: { get_resource: vbng_private_0_port }
247         - port: { get_resource: vbng_private_1_port }
248         - port: { get_resource: vbng_private_2_port }
249       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
250       user_data_format: RAW
251       user_data:
252         str_replace:
253           params:
254             __dcae_collector_ip__: { get_param: dcae_collector_ip }
255             __dcae_collector_port__: { get_param: dcae_collector_port }
256             __local_private_ipaddr__: { get_param: vbng_private_ip_1 }
257             __repo_url_blob__ : { get_param: repo_url_blob }
258             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
259             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
260             __install_script_version__ : { get_param: install_script_version }
261             __cloud_env__ : { get_param: cloud_env }
262           template: |
263             #!/bin/bash
264
265             # Create configuration files
266             mkdir /opt/config
267             echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt
268             echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt
269             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.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/vbng/__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 GMUX Instantiation
284   vgmux_private_0_port:
285     type: OS::Neutron::Port
286     properties:
287       network: { get_resource: vbng_vgmux_private_network }
288       fixed_ips: [{"subnet": { get_resource: vbng_vgmux_private_subnet}, "ip_address": { get_param: vgmux_private_ip_0 }}]
289
290   vgmux_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: vgmux_private_ip_1 }}]
295
296   vgmux_private_2_port:
297     type: OS::Neutron::Port
298     properties:
299       network: { get_resource: vgmux_private_network }
300       fixed_ips: [{"subnet": {  get_resource: vgmux_private_subnet}, "ip_address": { get_param: vgmux_private_ip_2 }}]
301
302   vgmux_0:
303     type: OS::Nova::Server
304     properties:
305       image: { get_param: vcpe_image_name }
306       flavor: { get_param: vcpe_flavor_name }
307       name: { get_param: vgmux_name_0 }
308       key_name: { get_resource: my_keypair }
309       networks:
310         - network: { get_param: public_net_id }
311         - port: { get_resource: vgmux_private_0_port }
312         - port: { get_resource: vgmux_private_1_port }
313         - port: { get_resource: vgmux_private_2_port }
314       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
315       user_data_format: RAW
316       user_data:
317         str_replace:
318           params:
319             __gmux_oam_int__ : { get_param: vgmux_private_ip_1 }
320             __gmux_private_ipaddr__: { get_param: vgmux_private_ip_2 }
321             __local_private_ipaddr__: { get_param: vgmux_private_ip_1 }
322             __repo_url_blob__ : { get_param: repo_url_blob }
323             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
324             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
325             __install_script_version__ : { get_param: install_script_version }
326             __cloud_env__ : { get_param: cloud_env }
327           template: |
328             #!/bin/bash
329
330             # Create configuration files
331             mkdir /opt/config
332             echo "__gmux_oam_int__" > /opt/config/gmux_oam_int.txt
333             echo "__gmux_private_ipaddr__" > /opt/config/gmux_private_ipaddr.txt
334             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
335             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
336             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
337             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
338             echo "__install_script_version__" > /opt/config/install_script_version.txt
339             echo "__cloud_env__" > /opt/config/cloud_env.txt
340
341             # Download and run install script
342             curl -k __repo_url_blob__/org.onap.demo/vnfs/vgmux/__install_script_version__/v_dns_install.sh -o /opt/v_dns_install.sh
343             cd /opt
344             chmod +x v_dns_install.sh
345             ./v_dns_install.sh
346