b2ae4e6f0c739866c9d72f330438337a526c2ad2
[demo.git] / heat / vCPE / vbng / base_vcpe_vbng.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 virtual Broadband Network Gateway (vBNG)
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   brgemu_bng_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   brgemu_bng_private_subnet_id:
53     type: string
54     label: vBNG IN private sub-network name or ID
55     description: vBNG IN private sub-network name or ID
56   brgemu_bng_private_net_cidr:
57     type: string
58     label: vBNG IN private network CIDR
59     description: The CIDR of the input side of vBNG private network
60   bng_gmux_private_net_id:
61     type: string
62     label: vBNG vGMUX private network name or ID
63     description: Private network that connects vBNG to vGMUX
64   bng_gmux_private_subnet_id:
65     type: string
66     label: vBNG vGMUX private sub-network name or ID
67     description: vBNG vGMUX private sub-network name or ID
68   bng_gmux_private_net_cidr:
69     type: string
70     label: vGMUX private network CIDR
71     description: The CIDR of the input side of vGMUX 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   cpe_signal_net_id:
85     type: string
86     label: vCPE private network name or ID
87     description: Private network that connects vCPE elements with vCPE infrastructure elements
88   cpe_signal_subnet_id:
89     type: string
90     label: vCPE private sub-network name or ID
91     description: vCPE private sub-network name or ID
92   cpe_signal_private_net_cidr:
93     type: string
94     label: vAAA private network CIDR
95     description: The CIDR of the vAAA private network
96   vbng_private_ip_0:
97     type: string
98     label: vBNG IN private IP address
99     description: Private IP address that is assigned to the vBNG IN
100   vbng_private_ip_1:
101     type: string
102     label: vBNG private IP address towards the ONAP management network
103     description: Private IP address that is assigned to the vBNG to communicate with ONAP components
104   vbng_private_ip_2:
105     type: string
106     label: vBNG to CPE_SIGNAL private IP address
107     description: Private IP address that is assigned to the vBNG in the CPE_SIGNAL network
108   vbng_private_ip_3:
109     type: string
110     label: vBNG to vGMUX private IP address
111     description: Private IP address that is assigned to the vBNG to vGMUX port
112   vbng_name_0:
113     type: string
114     label: vBNG name
115     description: Name of the vBNG
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   vpp_source_repo_url:
161     type: string
162     label: VPP Source Git Repo
163     description: URL for VPP source codes
164   vpp_source_repo_branch:
165     type: string
166     label: VPP Source Git Branch
167     description: Git Branch for the VPP source codes
168   vpp_patch_url:
169     type: string
170     label: VPP Patch URL
171     description: URL for VPP patch for vBNG
172   sdnc_ip_addr:
173     type: string
174     label: SDNC IP address
175     description: IP address of the SDNC
176
177 #############
178 #           #
179 # RESOURCES #
180 #           #
181 #############
182
183 resources:
184
185   random-str:
186     type: OS::Heat::RandomString
187     properties:
188       length: 4
189
190   my_keypair:
191     type: OS::Nova::KeyPair
192     properties:
193       name:
194         str_replace:
195           template: base_rand
196           params:
197             base: { get_param: key_name }
198             rand: { get_resource: random-str }
199       public_key: { get_param: pub_key }
200       save_private_key: false
201
202
203   # Virtual BNG Instantiation
204   vbng_private_0_port:
205     type: OS::Neutron::Port
206     properties:
207       network: { get_param: brgemu_bng_private_net_id }
208       fixed_ips: [{"subnet": { get_param: brgemu_bng_private_subnet_id }, "ip_address": { get_param: vbng_private_ip_0 }}]
209
210   vbng_private_1_port:
211     type: OS::Neutron::Port
212     properties:
213       network: { get_param: onap_private_net_id }
214       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vbng_private_ip_1 }}]
215
216   vbng_private_2_port:
217     type: OS::Neutron::Port
218     properties:
219       network: { get_param: cpe_signal_net_id }
220       fixed_ips: [{"subnet": { get_param: cpe_signal_subnet_id }, "ip_address": { get_param: vbng_private_ip_2 }}]
221
222   vbng_private_3_port:
223     type: OS::Neutron::Port
224     properties:
225       network: { get_param: bng_gmux_private_net_id }
226       fixed_ips: [{"subnet": { get_param: bng_gmux_private_subnet_id }, "ip_address": { get_param: vbng_private_ip_3 }}]
227
228   vbng_0:
229     type: OS::Nova::Server
230     properties:
231       image: { get_param: vcpe_image_name }
232       flavor: { get_param: vcpe_flavor_name }
233       name: { get_param: vbng_name_0 }
234       key_name: { get_resource: my_keypair }
235       networks:
236         - network: { get_param: public_net_id }
237         - port: { get_resource: vbng_private_0_port }
238         - port: { get_resource: vbng_private_1_port }
239         - port: { get_resource: vbng_private_2_port }
240         - port: { get_resource: vbng_private_3_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             __oam_ipaddr__: { get_param: vbng_private_ip_1 }
247             __brgemu_bng_net_ipaddr__: { get_param: vbng_private_ip_0 }
248             __cpe_signal_net_ipaddr__: { get_param: vbng_private_ip_2 }
249             __bng_gmux_net_ipaddr__: { get_param: vbng_private_ip_3 }
250             __oam_cidr__: { get_param: onap_private_net_cidr }
251             __brgemu_bng_cidr__: { get_param: brgemu_bng_private_net_cidr }
252             __cpe_signal_cidr__: { get_param: cpe_signal_private_net_cidr }
253             __bng_gmux_cidr__: { get_param: bng_gmux_private_net_cidr }
254             __dcae_collector_ip__: { get_param: dcae_collector_ip }
255             __dcae_collector_port__: { get_param: dcae_collector_port }
256             __repo_url_blob__ : { get_param: repo_url_blob }
257             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
258             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
259             __install_script_version__ : { get_param: install_script_version }
260             __cloud_env__ : { get_param: cloud_env }
261             __vpp_source_repo_url__ : { get_param: vpp_source_repo_url }
262             __vpp_source_repo_branch__ : { get_param: vpp_source_repo_branch }
263             __vpp_patch_url__ : { get_param: vpp_patch_url }
264             __sdnc_ip_addr__: { get_param: sdnc_ip_addr }
265           template: |
266             #!/bin/bash
267
268             # Create configuration files
269             mkdir /opt/config
270             echo "__brgemu_bng_net_ipaddr__" > /opt/config/brgemu_bng_net_ipaddr.txt
271             echo "__cpe_signal_net_ipaddr__" > /opt/config/cpe_signal_net_ipaddr.txt
272             echo "__bng_gmux_net_ipaddr__" > /opt/config/bng_gmux_net_ipaddr.txt
273             echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt
274             echo "__oam_cidr__" > /opt/config/oam_cidr.txt
275             echo "__bng_gmux_cidr__" > /opt/config/bng_gmux_net_cidr.txt
276             echo "__cpe_signal_cidr__" > /opt/config/cpe_signal_net_cidr.txt
277             echo "__brgemu_bng_cidr__" > /opt/config/brgemu_bng_net_cidr.txt
278             echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt
279             echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt
280             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
281             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
282             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
283             echo "__install_script_version__" > /opt/config/install_script_version.txt
284             echo "__cloud_env__" > /opt/config/cloud_env.txt
285             echo "__vpp_source_repo_url__" > /opt/config/vpp_source_repo_url.txt
286             echo "__vpp_source_repo_branch__" > /opt/config/vpp_source_repo_branch.txt
287             echo "__vpp_patch_url__" > /opt/config/vpp_patch_url.txt
288             echo "__sdnc_ip_addr__" > /opt/config/sdnc_ip_addr.txt
289
290             # Download and run install script
291             curl -k __repo_url_blob__/org.onap.demo/vnfs/vcpe/__install_script_version__/v_bng_install.sh -o /opt/v_bng_install.sh
292             cd /opt
293             chmod +x v_bng_install.sh
294             ./v_bng_install.sh