Merge "Set CLI_PRODUCT_VERSION to onap-1.1 in CLI"
[demo.git] / heat / vCPE / vbrgemu / base_vcpe_vbrgemu.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 vBRG Emulator (vBRGEMU)
28
29 #######################################################################
30 #                                                                     #
31 # PARAMETERS                                                                                                #
32 #                                                                     #
33 #     0_port should get IP address from DHCP discover through vBNG    #
34 #     DCAE is not monitoring the BRGEMULATOR                          #
35 #######################################################################
36
37 parameters:
38   vcpe_image_name:
39     type: string
40     label: Image name or ID
41     description: Image to be used for compute instance
42   vcpe_flavor_name:
43     type: string
44     label: Flavor
45     description: Type of instance (flavor) to be used
46   public_net_id:
47     type: string
48     label: Public network name or ID
49     description: Public network that enables remote connection to VNF
50   vbrgemu_bng_private_net_id:
51     type: string
52     label: vBNG private network name or ID
53     description: Private network that connects vBRGEMU to vBNG
54   vbrgemu_bng_private_subnet_id:
55     type: string
56     label: vBNG private sub-network name or ID
57     description: vBNG private sub-network name or ID
58   vbrgemu_bng_private_net_cidr:
59     type: string
60     label: vBNG IN private network CIDR
61     description: The CIDR of the input side of vBNG private network
62   vbrgemu_private_net_id:
63     type: string
64     label: vBRGEMU Home private network name or ID
65     description: Private network that connects vBRGEMU to local devices
66   vbrgemu_private_net_cidr:
67     type: string
68     label: vBRGEMU Home private network CIDR
69     description: The CIDR of the input side of vBRGEMU Home private network
70   vbrgemu_private_ip_0:
71     type: string
72     label: vGW private IP address
73     description: Private IP address towards the BRGEMU-BNG network
74   vbrgemu_private_ip_1:
75     type: string
76     label: vGW private IP address
77     description: Private IP address towards the BRGEMU private network
78   vbrgemu_name_0:
79     type: string
80     label: vGW  name
81     description: Name of the vGW
82   vnf_id:
83     type: string
84     label: VNF ID
85     description: The VNF ID is provided by ONAP
86   vf_module_id:
87     type: string
88     label: vCPE module ID
89     description: The vCPE Module ID is provided by ONAP
90   key_name:
91     type: string
92     label: Key pair name
93     description: Public/Private key pair name
94   pub_key:
95     type: string
96     label: Public key
97     description: Public key to be installed on the compute instance
98   repo_url_blob:
99     type: string
100     label: Repository URL
101     description: URL of the repository that hosts the demo packages
102   repo_url_artifacts:
103     type: string
104     label: Repository URL
105     description: URL of the repository that hosts the demo packages
106   install_script_version:
107     type: string
108     label: Installation script version number
109     description: Version number of the scripts that install the vFW demo app
110   demo_artifacts_version:
111     type: string
112     label: Artifacts version used in demo vnfs
113     description: Artifacts (jar, tar.gz) version used in demo vnfs
114   cloud_env:
115     type: string
116     label: Cloud environment
117     description: Cloud environment (e.g., openstack, rackspace)
118   vpp_source_repo_url:
119     type: string
120     label: VPP Source Git Repo
121     description: URL for VPP source codes
122   vpp_source_repo_branch:
123     type: string
124     label: VPP Source Git Branch
125     description: Git Branch for the VPP source codes
126   hc2vpp_source_repo_url:
127     type: string
128     label: Honeycomb Source Git Repo
129     description: URL for Honeycomb source codes
130   hc2vpp_source_repo_branch:
131     type: string
132     label: Honeycomb Source Git Branch
133     description: Git Branch for the Honeycomb source codes
134   vpp_patch_url:
135     type: string
136     label: VPP Patch URL
137     description: URL for VPP patch for vBRG Emulator
138   sdnc_ip:
139     type: string
140     label: SDNC ip address
141     description: SDNC ip address uesd to set NAT
142
143 #############
144 #           #
145 # RESOURCES #
146 #           #
147 #############
148
149 resources:
150
151   random-str:
152     type: OS::Heat::RandomString
153     properties:
154       length: 4
155
156   my_keypair:
157     type: OS::Nova::KeyPair
158     properties:
159       name:
160         str_replace:
161           template: base_rand
162           params:
163             base: { get_param: key_name }
164             rand: { get_resource: random-str }
165       public_key: { get_param: pub_key }
166       save_private_key: false
167
168   vbrgemu_private_network:
169     type: OS::Neutron::Net
170     properties:
171       name: { get_param: vbrgemu_private_net_id }
172
173   vbrgemu_private_subnet:
174     type: OS::Neutron::Subnet
175     properties:
176       name: { get_param: vbrgemu_private_net_id }
177       network_id: { get_resource: vbrgemu_private_network }
178       cidr: { get_param: vbrgemu_private_net_cidr }
179
180   # Virtual BRG Emulator Instantiation
181   # 0_port should get IP address from DHCP discover through vBNG once the VNF is running
182   vbrgemu_private_0_port:
183     type: OS::Neutron::Port
184     properties:
185       network: { get_param: vbrgemu_bng_private_net_id }
186       fixed_ips: [{"subnet": { get_param: vbrgemu_bng_private_subnet_id }, "ip_address": { get_param: vbrgemu_private_ip_0 }}]
187
188   vbrgemu_private_1_port:
189     type: OS::Neutron::Port
190     properties:
191       network: { get_resource: vbrgemu_private_network }
192       fixed_ips: [{"subnet": { get_resource: vbrgemu_private_subnet }, "ip_address": { get_param: vbrgemu_private_ip_1 }}]
193
194   vbrgemu_0:
195     type: OS::Nova::Server
196     properties:
197       image: { get_param: vcpe_image_name }
198       flavor: { get_param: vcpe_flavor_name }
199       name: { get_param: vbrgemu_name_0 }
200       key_name: { get_resource: my_keypair }
201       networks:
202         - network: { get_param: public_net_id }
203         - port: { get_resource: vbrgemu_private_0_port }
204         - port: { get_resource: vbrgemu_private_1_port }
205       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
206       user_data_format: RAW
207       user_data:
208         str_replace:
209           params:
210             __brgemu_net_ipaddr__: { get_param: vbrgemu_private_ip_1 }
211             __brgemu_cidr__: { get_param: vbrgemu_private_net_cidr }
212             __brgemu_bng_private_net_cidr__: { get_param: vbrgemu_bng_private_net_cidr }
213             __repo_url_blob__ : { get_param: repo_url_blob }
214             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
215             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
216             __install_script_version__ : { get_param: install_script_version }
217             __cloud_env__ : { get_param: cloud_env }
218             __vpp_source_repo_url__ : { get_param: vpp_source_repo_url }
219             __vpp_source_repo_branch__ : { get_param: vpp_source_repo_branch }
220             __hc2vpp_source_repo_url__ : { get_param: hc2vpp_source_repo_url }
221             __hc2vpp_source_repo_branch__ : { get_param: hc2vpp_source_repo_branch }
222             __vpp_patch_url__ : { get_param: vpp_patch_url }
223             __sdnc_ip__ : { get_param: sdnc_ip }
224           template: |
225             #!/bin/bash
226
227             # Create configuration files
228             mkdir /opt/config
229             echo "__brgemu_net_ipaddr__" > /opt/config/brgemu_net_ipaddr.txt
230             echo "__brgemu_cidr__" > /opt/config/brgemu_net_cidr.txt
231             echo "__brgemu_bng_private_net_cidr__" > /opt/config/brgemu_bng_private_net_cidr.txt
232             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
233             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
234             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
235             echo "__install_script_version__" > /opt/config/install_script_version.txt
236             echo "__cloud_env__" > /opt/config/cloud_env.txt
237             echo "__vpp_source_repo_url__" > /opt/config/vpp_source_repo_url.txt
238             echo "__vpp_source_repo_branch__" > /opt/config/vpp_source_repo_branch.txt
239             echo "__hc2vpp_source_repo_url__" > /opt/config/hc2vpp_source_repo_url.txt
240             echo "__hc2vpp_source_repo_branch__" > /opt/config/hc2vpp_source_repo_branch.txt
241             echo "__vpp_patch_url__" > /opt/config/vpp_patch_url.txt
242             echo "__sdnc_ip__" > /opt/config/sdnc_ip.txt
243
244             # Download and run install script
245             curl -k __repo_url_blob__/org.onap.demo/vnfs/vcpe/__install_script_version__/v_brgemu_install.sh -o /opt/v_brgemu_install.sh
246             cd /opt
247             chmod +x v_brgemu_install.sh
248             ./v_brgemu_install.sh