Clean up vCPE Heat templates
[demo.git] / heat / vCPE / vbrgemu / base_vcpe_vbrgemu_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 vBRG Emulator (vBRGEMU ) for ONAP
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_private_net_id:
55     type: string
56     label: vBRGEMU Home private network name or ID
57     description: Private network that connects vBRGEMU to local devices
58   vbrgemu_private_net_cidr:
59     type: string
60     label: vBRGEMU Home private network CIDR
61     description: The CIDR of the input side of vBRGEMU Home private network
62   vbrgemu_private_ip_1:
63     type: string
64     label: vGW IN private IP address
65     description: Private IP address that is assigned to the vBRGEMU (SHOULD NOT BE NEEDED) 
66   vbrgemu_name_0:
67     type: string
68     label: vGW  name
69     description: Name of the vGW
70   vnf_id:
71     type: string
72     label: VNF ID
73     description: The VNF ID is provided by ONAP
74   vf_module_id:
75     type: string
76     label: vCPE module ID
77     description: The vCPE Module ID is provided by ONAP
78   key_name:
79     type: string
80     label: Key pair name
81     description: Public/Private key pair name
82   pub_key:
83     type: string
84     label: Public key
85     description: Public key to be installed on the compute instance
86   repo_url_blob:
87     type: string
88     label: Repository URL
89     description: URL of the repository that hosts the demo packages
90   repo_url_artifacts:
91     type: string
92     label: Repository URL
93     description: URL of the repository that hosts the demo packages
94   install_script_version:
95     type: string
96     label: Installation script version number
97     description: Version number of the scripts that install the vFW demo app
98   demo_artifacts_version:
99     type: string
100     label: Artifacts version used in demo vnfs
101     description: Artifacts (jar, tar.gz) version used in demo vnfs
102   cloud_env:
103     type: string
104     label: Cloud environment
105     description: Cloud environment (e.g., openstack, rackspace)
106
107 #############
108 #           #
109 # RESOURCES #
110 #           #
111 #############
112
113 resources:
114
115   random-str:
116     type: OS::Heat::RandomString
117     properties:
118       length: 4
119
120   my_keypair:
121     type: OS::Nova::KeyPair
122     properties:
123       name:
124         str_replace:
125           template: base_rand
126           params:
127             base: { get_param: key_name }
128             rand: { get_resource: random-str }
129       public_key: { get_param: pub_key }
130       save_private_key: false
131
132   vbrgemu_private_network:
133     type: OS::Neutron::Net
134     properties:
135       name: { get_param: vbrgemu_private_net_id }
136
137   vbrgemu_private_subnet:
138     type: OS::Neutron::Subnet
139     properties:
140       name: { get_param: vbrgemu_private_net_id }
141       network_id: { get_resource: vbrgemu_private_network }
142       cidr: { get_param: vbrgemu_private_net_cidr }
143
144   # Virtual BRG Emulator Instantiation
145   # 0_port should get IP address from DHCP discover through vBNG
146   vbrgemu_private_0_port:
147     type: OS::Neutron::Port
148     properties:
149       network: { get_param: vbrgemu_bng_private_net_id}
150
151   vbrgemu_private_0_port:
152     type: OS::Neutron::Port
153     properties:
154       network: { get_param: vbrgemu_private_net_id}
155       fixed_ips: [{"subnet": { get_resource: vbrgemu_private_subnet}, "ip_address": { get_param: vbrgemu_private_ip_1 }}]
156
157   vbrgemu_0:
158     type: OS::Nova::Server
159     properties:
160       image: { get_param: vcpe_image_name }
161       flavor: { get_param: vcpe_flavor_name }
162       name: { get_param: vbrgemu_name_0 }
163       key_name: { get_resource: my_keypair }
164       networks:
165         - network: { get_param: public_net_id }
166         - port: { get_resource: vbrgemu_private_0_port }
167         - port: { get_resource: vbrgemu_private_1_port }
168       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
169       user_data_format: RAW
170       user_data:
171         str_replace:
172           params:
173             __repo_url_blob__ : { get_param: repo_url_blob }
174             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
175             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
176             __install_script_version__ : { get_param: install_script_version }
177             __cloud_env__ : { get_param: cloud_env }
178           template: |
179             #!/bin/bash
180
181             # Create configuration files
182             mkdir /opt/config
183             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
184             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
185             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
186             echo "__install_script_version__" > /opt/config/install_script_version.txt
187             echo "__cloud_env__" > /opt/config/cloud_env.txt
188
189             # Download and run install script
190             curl -k __repo_url_blob__/org.openecomp.demo/vnfs/vbrgemu/__install_script_version__/v_brgemu_install.sh -o /opt/v_brgemu_install.sh
191             cd /opt
192             chmod +x v_brgemu_install.sh
193             ./v_brgemu_install.sh