f32bd29baaf37409ef2c5261341c357b89345a63
[demo.git] / heat / vLB / base_vlb_rackspace.yaml
1 heat_template_version: 2013-05-23
2
3 description: Heat template to deploy vLoadBalancer/vDNS demo app for ONAP
4
5 parameters:
6   vlb_image_name:
7     type: string
8     label: Image name or ID
9     description: Image to be used for compute instance
10   vlb_flavor_name:
11     type: string
12     label: Flavor
13     description: Type of instance (flavor) to be used
14   public_net_id:
15     type: string
16     label: Public network name or ID
17     description: Public network that enables remote connection to VNF
18   vlb_private_net_id:
19     type: string
20     label: vLoadBalancer private network name or ID
21     description: Private network that connects vLoadBalancer with vDNSs
22   onap_private_net_id:
23     type: string
24     label: ONAP management network name or ID
25     description: Private network that connects ONAP components and the VNF
26   onap_private_subnet_id:
27     type: string
28     label: ONAP management sub-network name or ID
29     description: Private sub-network that connects ONAP components and the VNF
30   vlb_private_net_cidr:
31     type: string
32     label: vLoadBalancer private network CIDR
33     description: The CIDR of the vLoadBalancer private network
34   onap_private_net_cidr:
35     type: string
36     label: ONAP private network CIDR
37     description: The CIDR of the protected private network
38   vlb_private_ip_0:
39     type: string
40     label: vLoadBalancer private IP address towards the private network
41     description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs
42   vlb_private_ip_1:
43     type: string
44     label: vLoadBalancer private IP address towards the ONAP management network
45     description: Private IP address that is assigned to the vLoadBalancer to communicate with ONAP components
46   vdns_private_ip_0:
47     type: string
48     label: vDNS private IP address towards the private network
49     description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer
50   vdns_private_ip_1:
51     type: string
52     label: vDNS private IP address towards the ONAP management network
53     description: Private IP address that is assigned to the vDNS to communicate with ONAP components
54   vlb_name_0:
55     type: string
56     label: vLoadBalancer name
57     description: Name of the vLoadBalancer
58   vdns_name_0:
59     type: string
60     label: vDNS name
61     description: Name of the vDNS
62   vnf_id:
63     type: string
64     label: VNF ID
65     description: The VNF ID is provided by ONAP
66   vf_module_id:
67     type: string
68     label: vFirewall module ID
69     description: The vLoadBalancer Module ID is provided by ONAP
70   dcae_collector_ip:
71     type: string
72     label: DCAE collector IP address
73     description: IP address of the DCAE collector
74   dcae_collector_port:
75     type: string
76     label: DCAE collector port
77     description: Port of the DCAE collector
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 resources:
108
109   random-str:
110     type: OS::Heat::RandomString
111     properties:
112       length: 4
113
114   my_keypair:
115     type: OS::Nova::KeyPair
116     properties:
117       name:
118         str_replace:
119           template: base_rand
120           params:
121             base: { get_param: key_name }
122             rand: { get_resource: random-str }
123       public_key: { get_param: pub_key }
124       save_private_key: false
125
126   vlb_private_network:
127     type: OS::Neutron::Net
128     properties:
129       name: { get_param: vlb_private_net_id }
130
131   vlb_private_subnet:
132     type: OS::Neutron::Subnet
133     properties:
134       name: { get_param: vlb_private_net_id }
135       network_id: { get_resource: vlb_private_network }
136       cidr: { get_param: vlb_private_net_cidr }
137
138   # Virtual Load Balancer Instantiation
139   vlb_private_0_port:
140     type: OS::Neutron::Port
141     properties:
142       network: { get_resource: vlb_private_network }
143       fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vlb_private_ip_0 }}]
144
145   vlb_private_1_port:
146     type: OS::Neutron::Port
147     properties:
148       network: { get_param: onap_private_net_id }
149       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vlb_private_ip_1 }}]
150
151   vlb_0:
152     type: OS::Nova::Server
153     properties:
154       image: { get_param: vlb_image_name }
155       flavor: { get_param: vlb_flavor_name }
156       name: { get_param: vlb_name_0 }
157       key_name: { get_resource: my_keypair }
158       networks:
159         - network: { get_param: public_net_id }
160         - port: { get_resource: vlb_private_0_port }
161         - port: { get_resource: vlb_private_1_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             __dcae_collector_ip__: { get_param: dcae_collector_ip }
168             __dcae_collector_port__: { get_param: dcae_collector_port }
169             __local_private_ipaddr__: { get_param: vlb_private_ip_0 }
170             __repo_url_blob__ : { get_param: repo_url_blob }
171             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
172             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
173             __install_script_version__ : { get_param: install_script_version }
174             __cloud_env__ : { get_param: cloud_env }
175           template: |
176             #!/bin/bash
177
178             # Create configuration files
179             mkdir /opt/config
180             echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt
181             echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt
182             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
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/vlb/__install_script_version__/v_lb_install.sh -o /opt/v_lb_install.sh
191             cd /opt
192             chmod +x v_lb_install.sh
193             ./v_lb_install.sh
194
195
196   # Virtual DNS Instantiation
197   vdns_private_0_port:
198     type: OS::Neutron::Port
199     properties:
200       network: { get_resource: vlb_private_network }
201       fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vdns_private_ip_0 }}]
202
203   vdns_private_1_port:
204     type: OS::Neutron::Port
205     properties:
206       network: { get_param: onap_private_net_id }
207       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]
208
209   vdns_0:
210     type: OS::Nova::Server
211     properties:
212       image: { get_param: vlb_image_name }
213       flavor: { get_param: vlb_flavor_name }
214       name: { get_param: vdns_name_0 }
215       key_name: { get_resource: my_keypair }
216       networks:
217         - network: { get_param: public_net_id }
218         - port: { get_resource: vdns_private_0_port }
219         - port: { get_resource: vdns_private_1_port }
220       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
221       user_data_format: RAW
222       user_data:
223         str_replace:
224           params:
225             __lb_oam_int__ : { get_param: vlb_private_ip_1 }
226             __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }
227             __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
228             __repo_url_blob__ : { get_param: repo_url_blob }
229             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
230             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
231             __install_script_version__ : { get_param: install_script_version }
232             __cloud_env__ : { get_param: cloud_env }
233           template: |
234             #!/bin/bash
235
236             # Create configuration files
237             mkdir /opt/config
238             echo "__lb_oam_int__" > /opt/config/lb_oam_int.txt
239             echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
240             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
241             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
242             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
243             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
244             echo "__install_script_version__" > /opt/config/install_script_version.txt
245             echo "__cloud_env__" > /opt/config/cloud_env.txt
246
247             # Download and run install script
248             curl -k __repo_url_blob__/org.openecomp.demo/vnfs/vlb/__install_script_version__/v_dns_install.sh -o /opt/v_dns_install.sh
249             cd /opt
250             chmod +x v_dns_install.sh
251             ./v_dns_install.sh