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