Add vIMS heat template in demo repository
[demo.git] / heat / vIMS / base_clearwater.yaml
1 # Project Clearwater - IMS in the Cloud
2 # Copyright (C) 2015  Metaswitch Networks Ltd
3 #
4 # This program is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by the
6 # Free Software Foundation, either version 3 of the License, or (at your
7 # option) any later version, along with the "Special Exception" for use of
8 # the program along with SSL, set forth below. This program is distributed
9 # in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 # A PARTICULAR PURPOSE.  See the GNU General Public License for more
12 # details. You should have received a copy of the GNU General Public
13 # License along with this program.  If not, see
14 # <http://www.gnu.org/licenses/>.
15 #
16 # The author can be reached by email at clearwater@metaswitch.com or by
17 # post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK
18 #
19 # Special Exception
20 # Metaswitch Networks Ltd  grants you permission to copy, modify,
21 # propagate, and distribute a work formed by combining OpenSSL with The
22 # Software, or a work derivative of such a combination, even if such
23 # copying, modification, propagation, or distribution would otherwise
24 # violate the terms of the GPL. You must comply with the GPL in all
25 # respects for all of the code used other than OpenSSL.
26 # "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL
27 # Project and licensed under the OpenSSL Licenses, or a work based on such
28 # software and licensed under the OpenSSL Licenses.
29 # "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License
30 # under which the OpenSSL Project distributes the OpenSSL toolkit software,
31 # as those licenses appear in the file LICENSE-OPENSSL.
32
33 heat_template_version: 2015-04-30
34
35 description: >
36   Base Project Clearwater Nazgul deployment on ONAP (Open Network Automation Platform)
37
38 parameters:
39 # Metadata required by ONAP
40   vnf_name:
41     type: string
42     label: VNF name
43     description: Unique name for this VNF instance
44   vnf_id:
45     type: string
46     label: VNF ID
47     description: The VNF ID provided by ONAP
48   vf_module_id:
49     type: string
50     label: VNF module ID
51     description: The VNF module ID provided by ONAP
52
53 # flavor parameters, naming required by ONAP
54   bono_flavor_name:
55     type: string
56     description: VM flavor for bono VMs
57     constraints:
58       - custom_constraint: nova.flavor
59         description: Must be a valid flavor name
60   sprout_flavor_name:
61     type: string
62     description: VM flavor for sprout VMs
63     constraints:
64       - custom_constraint: nova.flavor
65         description: Must be a valid flavor name
66   vellum_flavor_name:
67     type: string
68     description: VM flavor for homestead VMs
69     constraints:
70       - custom_constraint: nova.flavor
71         description: Must be a valid flavor name
72   homer_flavor_name:
73     type: string
74     description: VM flavor for homer VMs
75     constraints:
76       - custom_constraint: nova.flavor
77         description: Must be a valid flavor name
78   dime_flavor_name:
79     type: string
80     description: VM flavor for dime VMs
81     constraints:
82       - custom_constraint: nova.flavor
83         description: Must be a valid flavor name
84   ellis_flavor_name:
85     type: string
86     description: VM flavor for ellis VM
87     constraints:
88       - custom_constraint: nova.flavor
89         description: Must be a valid flavor name
90   dns_flavor_name:
91     type: string
92     description: VM flavor for dns VM
93     constraints:
94       - custom_constraint: nova.flavor
95         description: Must be a valid flavor name
96   robot_flavor_name:
97     type: string
98     description: VM flavor for robot_test VM
99     constraints:
100       - custom_constraint: nova.flavor
101         description: Must be a valid flavor name
102
103 # image parameters, naming required by ONAP
104   bono_image_name:
105     type: string
106     description: Name of image for bono VMs
107   sprout_image_name:
108     type: string
109     description: Name of image for sprout VMs
110   vellum_image_name:
111     type: string
112     description: Name of image for homestead VMs
113   homer_image_name:
114     type: string
115     description: Name of image for homer VMs
116   dime_image_name:
117     type: string
118     description: Name of image for dime VMs
119   ellis_image_name:
120     type: string
121     description: Name of image for ellis VM
122   dns_image_name:
123     type: string
124     description: Name of image for dns VMs
125   robot_image_name:
126     type: string
127     description: Name of image for robot_test VMs
128
129 # overall clearwater parameters, naming required by ONAP
130   clearwater_key_name:
131     type: string
132     label: openSSH Key name
133     description: openSSH key name
134   clearwater_pub_key:
135     type: string
136     label: Public key
137     description: Public key to be installed on the compute instance
138   repo_url:
139     type: string
140     description: URL for Clearwater repository
141   zone:
142     type: string
143     description: DNS zone
144   dn_range_start:
145     type: string
146     description: First directory number in pool
147     constraints:
148       - allowed_pattern: "[0-9]+"
149         description: Must be numeric
150   dn_range_length:
151     type: string
152     description: Number of directory numbers to add to pool
153     constraints:
154       - allowed_pattern: "[0-9]+"
155         description: Must be numeric
156   dnssec_key:
157     type: string
158     description: DNSSEC private key (Base64-encoded)
159     constraints:
160       - allowed_pattern: "[0-9A-Za-z+/=]+"
161         description: Must be Base64-encoded
162 # names parameters
163   bono_name_0:
164     type: string
165     description: The VM name
166   sprout_name_0:
167     type: string
168     description: The VM name
169   vellum_name_0:
170     type: string
171     description: The VM name
172   homer_name_0:
173     type: string
174     description: The VM name
175   dime_name_0:
176     type: string
177     description: The VM name
178   ellis_name_0:
179     type: string
180     description: The VM name
181   dns_name_0:
182     type: string
183     description: The VM name
184
185
186 # Network parameters, naming required by ONAP
187   admin_plane_net_name:
188     type: string
189     label: external management network
190     description: The external management network
191
192
193 resources:
194
195   clearwater_random_str:
196     type: OS::Heat::RandomString
197     properties:
198       length: 4
199
200   clearwater_instantiated_key_name:
201     type: OS::Nova::KeyPair
202     properties:
203       name:
204         str_replace:
205           template: pre_base_rand
206           params:
207             pre: key_
208             base: { get_param: vnf_name }
209             rand: { get_resource: clearwater_random_str }
210       public_key: { get_param: clearwater_pub_key }
211       save_private_key: false
212
213   dns:
214     type: dns.yaml
215     properties:
216       vnf_id: { get_param: vnf_id }
217       vf_module_id: { get_param: vf_module_id }
218       vnf_name: { get_param: vnf_name }
219       public_net_id: { get_param: admin_plane_net_name }
220       dns_flavor_name: { get_param: dns_flavor_name }
221       dns_image_name: { get_param: dns_image_name }
222       key_name: { get_resource: clearwater_instantiated_key_name }
223       zone: { get_param: zone }
224       dnssec_key: { get_param: dnssec_key }
225       dns_name_0: { get_param: dns_name_0 }
226
227
228   ellis:
229     type: ellis.yaml
230     properties:
231       vnf_id: { get_param: vnf_id }
232       vf_module_id: { get_param: vf_module_id }
233       vnf_name: { get_param: vnf_name }
234       public_net_id: { get_param: admin_plane_net_name }
235       ellis_flavor_name: { get_param: ellis_flavor_name }
236       ellis_image_name: { get_param: ellis_image_name }
237       key_name: { get_resource: clearwater_instantiated_key_name }
238       repo_url: { get_param: repo_url }
239       zone: { get_param: zone }
240       dn_range_start: { get_param: dn_range_start }
241       dn_range_length: { get_param: dn_range_length }
242       dns_ip: { get_attr: [ dns, dns_ip ] }
243       dnssec_key: { get_param: dnssec_key }
244       etcd_ip: "" #for ellis etcd_ip is empty
245       ellis_name_0: { get_param: ellis_name_0 }
246
247   bono:
248     type: bono.yaml
249     properties:
250       vnf_id: { get_param: vnf_id }
251       vf_module_id: { get_param: vf_module_id }
252       vnf_name: { get_param: vnf_name }
253       public_net_id: { get_param: admin_plane_net_name }
254       bono_flavor_name: { get_param: bono_flavor_name }
255       bono_image_name: { get_param: bono_image_name }
256       key_name: { get_resource: clearwater_instantiated_key_name }
257       repo_url: { get_param: repo_url }
258       zone: { get_param: zone }
259       dns_ip: { get_attr: [ dns, dns_ip ] }
260       dnssec_key: { get_param: dnssec_key }
261       etcd_ip: { get_attr: [ ellis, ellis_ip ] }
262       bono_name_0: { get_param: bono_name_0 }
263
264   sprout:
265     type: sprout.yaml
266     properties:
267       vnf_id: { get_param: vnf_id }
268       vf_module_id: { get_param: vf_module_id }
269       vnf_name: { get_param: vnf_name }
270       public_net_id: { get_param: admin_plane_net_name }
271       sprout_flavor_name: { get_param: sprout_flavor_name }
272       sprout_image_name: { get_param: sprout_image_name }
273       key_name: { get_resource: clearwater_instantiated_key_name }
274       repo_url: { get_param: repo_url }
275       zone: { get_param: zone }
276       dns_ip: { get_attr: [ dns, dns_ip ] }
277       dnssec_key: { get_param: dnssec_key }
278       etcd_ip: { get_attr: [ ellis, ellis_ip ] }
279       sprout_name_0: { get_param: sprout_name_0 }
280
281
282   homer:
283     type: homer.yaml
284     properties:
285       vnf_id: { get_param: vnf_id }
286       vf_module_id: { get_param: vf_module_id }
287       vnf_name: { get_param: vnf_name }
288       public_net_id: { get_param: admin_plane_net_name }
289       homer_flavor_name: { get_param: homer_flavor_name }
290       homer_image_name: { get_param: homer_image_name }
291       key_name: { get_resource: clearwater_instantiated_key_name }
292       repo_url: { get_param: repo_url }
293       zone: { get_param: zone }
294       dns_ip: { get_attr: [ dns, dns_ip ] }
295       dnssec_key: { get_param: dnssec_key }
296       etcd_ip: { get_attr: [ ellis, ellis_ip ] }
297       homer_name_0: { get_param: homer_name_0 }
298
299   vellum:
300     type: vellum.yaml
301     properties:
302       vnf_id: { get_param: vnf_id }
303       vf_module_id: { get_param: vf_module_id }
304       vnf_name: { get_param: vnf_name }
305       public_net_id: { get_param: admin_plane_net_name }
306       vellum_flavor_name: { get_param: vellum_flavor_name }
307       vellum_image_name: { get_param: vellum_image_name }
308       key_name: { get_resource: clearwater_instantiated_key_name }
309       repo_url: { get_param: repo_url }
310       zone: { get_param: zone }
311       dns_ip: { get_attr: [ dns, dns_ip ] }
312       dnssec_key: { get_param: dnssec_key }
313       etcd_ip: { get_attr: [ ellis, ellis_ip ] }
314       vellum_name_0:  { get_param: vellum_name_0 }
315
316   dime:
317     type: dime.yaml
318     properties:
319       vnf_id: { get_param: vnf_id }
320       vf_module_id: { get_param: vf_module_id }
321       vnf_name: { get_param: vnf_name }
322       public_net_id: { get_param: admin_plane_net_name }
323       dime_flavor_name: { get_param: dime_flavor_name }
324       dime_image_name: { get_param: dime_image_name }
325       key_name: { get_resource: clearwater_instantiated_key_name }
326       repo_url: { get_param: repo_url }
327       zone: { get_param: zone }
328       dns_ip: { get_attr: [ dns, dns_ip ] }
329       dnssec_key: { get_param: dnssec_key }
330       etcd_ip: { get_attr: [ ellis, ellis_ip ] }
331       dime_name_0: { get_param: dime_name_0 }
332
333   robot_0_security_group:
334     type: OS::Neutron::SecurityGroup
335     properties:
336       description: security group
337       name:
338         str_replace:
339           template: pre_base_rand
340           params:
341             pre: robot_sg_
342             base: { get_param: vnf_name }
343             rand: { get_resource: clearwater_random_str }
344       rules: [
345         {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 22, port_range_max: 22},
346         {remote_ip_prefix: 0.0.0.0/0, protocol: udp, port_range_min: 161, port_range_max: 162},
347         {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 2380, port_range_max: 2380},
348         {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 4000, port_range_max: 4000},
349         {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 443, port_range_max: 443},
350         {remote_ip_prefix: 0.0.0.0/0, protocol: icmp}]
351
352   robot_0_admin_plane_port_0:
353     type: OS::Neutron::Port
354     properties:
355       name:
356         str_replace:
357           template: pre_base_rand
358           params:
359             pre: admin_port_0_
360             base: { get_param: vnf_name }
361             rand: { get_resource: clearwater_random_str }
362       network: { get_param: admin_plane_net_name }
363       security_groups: [{ get_resource: robot_0_security_group }]
364
365   robot_server_0:
366     type: OS::Nova::Server
367     properties:
368       name:
369         str_replace:
370           template: pre_base_rand
371           params:
372             pre: robot_server_0_
373             base: { get_param: vnf_name }
374             rand: { get_resource: clearwater_random_str }
375       flavor: { get_param: robot_flavor_name }
376       image: { get_param: robot_image_name }
377       key_name: { get_resource: clearwater_instantiated_key_name }
378       networks:
379         - port: { get_resource: robot_0_admin_plane_port_0 }
380       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }, vnf_name: { get_param: vnf_name }}
381       user_data_format: RAW
382       user_data:
383         str_replace:
384           params:
385             __zone__: { get_param: zone }
386             __DNS_IP_ADDR__: { get_attr: [ dns, dns_ip ] }
387
388           template: |
389             #!/bin/bash
390
391             ## activate debug
392             set -x
393
394             ## install 'clearwater-live-test' in ubuntu home directory
395             ## without this all is installed in root dir
396             mkdir /home/ubuntu -p
397             cd /home/ubuntu
398
399             sudo apt-get update
400             sudo apt-get install build-essential git --yes
401             curl -sSL https://rvm.io/mpapis.asc | gpg --import -
402             curl -L https://get.rvm.io | bash -s stable
403             source /etc/profile.d/rvm.sh
404             rvm autolibs enable
405             rvm install 1.9.3
406             rvm use 1.9.3
407
408             git config --global url."https://".insteadOf git://
409             git config --global url."https://github.com/Metaswitch".insteadOf "git@github.com:Metaswitch"
410             git clone -b stable https://github.com/Metaswitch/clearwater-live-test.git --recursive
411             cd clearwater-live-test
412             sudo apt-get install bundler --yes
413             sudo bundle install
414
415             ##update dns
416             echo "nameserver __DNS_IP_ADDR__" >> /etc/resolvconf/resolv.conf.d/head
417             resolvconf -u
418
419             echo "To start live-test run: rake test[__zone__] SIGNUP_CODE=secret"
420
421             #rake test[vimstest.onap.org] SIGNUP_CODE=secret PROXY=84.39.37.62 ELLIS=84.39.34.60