Fixed CDR_IMAGE_VERSION in portal script
[demo.git] / heat / vFWCL / vFWSNK / base_vfw.yaml
1 ##########################################################################
2 #
3 #==================LICENSE_START==========================================
4 #
5 #
6 # Copyright (c) 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 that deploys vFirewall Closed Loop demo app (vFW and vSink) for ONAP
28
29 ##############
30 #            #
31 # PARAMETERS #
32 #            #
33 ##############
34
35 parameters:
36   image_name:
37     type: string
38     label: Image name or ID
39     description: Image to be used for compute instance
40   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   unprotected_private_net_id:
49     type: string
50     label: Unprotected private network name or ID
51     description: Private network that connects vPacketGenerator with vFirewall
52   unprotected_private_subnet_id:
53     type: string
54     label: Unprotected private subnetwork name or ID
55     description: Private subnetwork of the protected network
56   unprotected_private_net_cidr:
57     type: string
58     label: Unprotected private network CIDR
59     description: The CIDR of the unprotected private network
60   protected_private_net_id:
61     type: string
62     label: Protected private network name or ID
63     description: Private network that connects vFirewall with vSink
64   protected_private_subnet_id:
65     type: string
66     label: Protected private subnetwork name or ID
67     description: Private subnetwork of the unprotected network
68   protected_private_net_cidr:
69     type: string
70     label: Protected private network CIDR
71     description: The CIDR of the protected private network
72   onap_private_net_id:
73     type: string
74     label: ONAP management network name or ID
75     description: Private network that connects ONAP components and the VNF
76   onap_private_subnet_id:
77     type: string
78     label: ONAP management sub-network name or ID
79     description: Private sub-network that connects ONAP components and the VNF
80   onap_private_net_cidr:
81     type: string
82     label: ONAP private network CIDR
83     description: The CIDR of the protected private network
84   vfw_private_ip_0:
85     type: string
86     label: vFirewall private IP address towards the unprotected network
87     description: Private IP address that is assigned to the vFirewall to communicate with the vPacketGenerator
88   vfw_private_ip_1:
89     type: string
90     label: vFirewall private IP address towards the protected network
91     description: Private IP address that is assigned to the vFirewall to communicate with the vSink
92   vfw_private_ip_2:
93     type: string
94     label: vFirewall private IP address towards the ONAP management network
95     description: Private IP address that is assigned to the vFirewall to communicate with ONAP components
96   vpg_private_ip_0:
97     type: string
98     label: vPacketGenerator private IP address towards the unprotected network
99     description: Private IP address that is assigned to the vPacketGenerator to communicate with the vFirewall
100   vsn_private_ip_0:
101     type: string
102     label: vSink private IP address towards the protected network
103     description: Private IP address that is assigned to the vSink to communicate with the vFirewall
104   vsn_private_ip_1:
105     type: string
106     label: vSink private IP address towards the ONAP management network
107     description: Private IP address that is assigned to the vSink to communicate with ONAP components
108   vfw_name_0:
109     type: string
110     label: vFirewall name
111     description: Name of the vFirewall
112   vsn_name_0:
113     type: string
114     label: vSink name
115     description: Name of the vSink
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: vFirewall module ID
123     description: The vFirewall 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   random-str:
169     type: OS::Heat::RandomString
170     properties:
171       length: 4
172
173   my_keypair:
174     type: OS::Nova::KeyPair
175     properties:
176       name:
177         str_replace:
178           template: base_rand
179           params:
180             base: { get_param: key_name }
181             rand: { get_resource: random-str }
182       public_key: { get_param: pub_key }
183       save_private_key: false
184
185   unprotected_private_network:
186     type: OS::Neutron::Net
187     properties:
188       name: { get_param: unprotected_private_net_id }
189
190   unprotected_private_subnet:
191     type: OS::Neutron::Subnet
192     properties:
193       name: { get_param: unprotected_private_subnet_id }
194       network_id: { get_resource: unprotected_private_network }
195       cidr: { get_param: unprotected_private_net_cidr }
196
197   protected_private_network:
198     type: OS::Neutron::Net
199     properties:
200       name: { get_param: protected_private_net_id }
201
202   protected_private_subnet:
203     type: OS::Neutron::Subnet
204     properties:
205       name: { get_param: protected_private_subnet_id }
206       network_id: { get_resource: protected_private_network }
207       cidr: { get_param: protected_private_net_cidr }
208
209   # Virtual Firewall instantiation
210   vfw_private_0_port:
211     type: OS::Neutron::Port
212     properties:
213       network: { get_resource: unprotected_private_network }
214       fixed_ips: [{"subnet": { get_resource: unprotected_private_subnet }, "ip_address": { get_param: vfw_private_ip_0 }}]
215
216   vfw_private_1_port:
217     type: OS::Neutron::Port
218     properties:
219       allowed_address_pairs: [{ "ip_address": { get_param: vpg_private_ip_0 }}]
220       network: { get_resource: protected_private_network }
221       fixed_ips: [{"subnet": { get_resource: protected_private_subnet }, "ip_address": { get_param: vfw_private_ip_1 }}]
222
223   vfw_private_2_port:
224     type: OS::Neutron::Port
225     properties:
226       network: { get_param: onap_private_net_id }
227       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vfw_private_ip_2 }}]
228
229   vfw_0:
230     type: OS::Nova::Server
231     properties:
232       image: { get_param: image_name }
233       flavor: { get_param: flavor_name }
234       name: { get_param: vfw_name_0 }
235       key_name: { get_resource: my_keypair }
236       networks:
237         - network: { get_param: public_net_id }
238         - port: { get_resource: vfw_private_0_port }
239         - port: { get_resource: vfw_private_1_port }
240         - port: { get_resource: vfw_private_2_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             __repo_url_blob__ : { get_param: repo_url_blob }
249             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
250             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
251             __install_script_version__ : { get_param: install_script_version }
252             __vfw_private_ip_0__ : { get_param: vfw_private_ip_0 }
253             __vfw_private_ip_1__ : { get_param: vfw_private_ip_1 }
254             __vfw_private_ip_2__ : { get_param: vfw_private_ip_2 }
255             __unprotected_private_net_cidr__ : { get_param: unprotected_private_net_cidr }
256             __protected_private_net_cidr__ : { get_param: protected_private_net_cidr }
257             __onap_private_net_cidr__ : { get_param: onap_private_net_cidr }
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 "__repo_url_blob__" > /opt/config/repo_url_blob.txt
267             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
268             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
269             echo "__install_script_version__" > /opt/config/install_script_version.txt
270             echo "__vfw_private_ip_0__" > /opt/config/vfw_private_ip_0.txt
271             echo "__vfw_private_ip_1__" > /opt/config/vfw_private_ip_1.txt
272             echo "__vfw_private_ip_2__" > /opt/config/vfw_private_ip_2.txt
273             echo "__unprotected_private_net_cidr__" > /opt/config/unprotected_private_net_cidr.txt
274             echo "__protected_private_net_cidr__" > /opt/config/protected_private_net_cidr.txt
275             echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
276             echo "__cloud_env__" > /opt/config/cloud_env.txt
277
278             # Download and run install script
279             curl -k __repo_url_blob__/org.onap.demo/vnfs/vfw/__install_script_version__/v_firewall_install.sh -o /opt/v_firewall_install.sh
280             cd /opt
281             chmod +x v_firewall_install.sh
282             ./v_firewall_install.sh
283
284
285   # Virtual Sink instantiation
286   vsn_private_0_port:
287     type: OS::Neutron::Port
288     properties:
289       network: { get_resource: protected_private_network }
290       fixed_ips: [{"subnet": { get_resource: protected_private_subnet }, "ip_address": { get_param: vsn_private_ip_0 }}]
291
292   vsn_private_1_port:
293     type: OS::Neutron::Port
294     properties:
295       network: { get_param: onap_private_net_id }
296       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vsn_private_ip_1 }}]
297
298   vsn_0:
299     type: OS::Nova::Server
300     properties:
301       image: { get_param: image_name }
302       flavor: { get_param: flavor_name }
303       name: { get_param: vsn_name_0 }
304       key_name: { get_resource: my_keypair }
305       networks:
306         - network: { get_param: public_net_id }
307         - port: { get_resource: vsn_private_0_port }
308         - port: { get_resource: vsn_private_1_port }
309       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
310       user_data_format: RAW
311       user_data:
312         str_replace:
313           params:
314             __protected_net_gw__: { get_param: vfw_private_ip_1 }
315             __unprotected_net__: { get_param: unprotected_private_net_cidr }
316             __repo_url_blob__ : { get_param: repo_url_blob }
317             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
318             __install_script_version__ : { get_param: install_script_version }
319             __vsn_private_ip_0__ : { get_param: vsn_private_ip_0 }
320             __vsn_private_ip_1__ : { get_param: vsn_private_ip_1 }
321             __protected_private_net_cidr__ : { get_param: protected_private_net_cidr }
322             __onap_private_net_cidr__ : { get_param: onap_private_net_cidr }
323             __cloud_env__ : { get_param: cloud_env }
324           template: |
325             #!/bin/bash
326
327             # Create configuration files
328             mkdir /opt/config
329             echo "__protected_net_gw__" > /opt/config/protected_net_gw.txt
330             echo "__unprotected_net__" > /opt/config/unprotected_net.txt
331             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
332             echo "__install_script_version__" > /opt/config/install_script_version.txt
333             echo "__vsn_private_ip_0__" > /opt/config/vsn_private_ip_0.txt
334             echo "__vsn_private_ip_1__" > /opt/config/vsn_private_ip_1.txt
335             echo "__protected_private_net_cidr__" > /opt/config/protected_private_net_cidr.txt
336             echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
337             echo "__cloud_env__" > /opt/config/cloud_env.txt
338
339             # Download and run install script
340             curl -k __repo_url_blob__/org.onap.demo/vnfs/vfw/__install_script_version__/v_sink_install.sh -o /opt/v_sink_install.sh
341             cd /opt
342             chmod +x v_sink_install.sh
343             ./v_sink_install.sh