blob: dd659d07f3a2f7779635de4c7370d970165d6ea2 [file] [log] [blame]
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +04001heat_template_version: 2014-10-16
2
3description: |
4 Template which tests neutron load balancing resources
5
6parameters:
7 key_name:
8 type: string
9 flavor:
10 type: string
11 image:
12 type: string
Rabi Mishraec4b03b2015-05-23 02:20:47 +053013 network:
14 type: string
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +040015 private_subnet_id:
16 type: string
17 external_network_id:
18 type: string
19 port:
20 type: string
21 default: '80'
Rabi Mishra7205fee2015-04-06 07:57:34 +053022 timeout:
23 type: number
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +040024
25resources:
26 sec_group:
27 type: OS::Neutron::SecurityGroup
28 properties:
29 description: Add security group rules for servers
30 name: security-group
31 rules:
32 - remote_ip_prefix: 0.0.0.0/0
33 protocol: tcp
34 port_range_min: { get_param: port }
35 port_range_max: { get_param: port }
36 - remote_ip_prefix: 0.0.0.0/0
37 protocol: icmp
38
Rabi Mishra7205fee2015-04-06 07:57:34 +053039 wait_condition:
40 type: OS::Heat::WaitCondition
41 properties:
42 handle: { get_resource: wait_condition_handle }
43 count: 2
44 timeout: { get_param: timeout }
45
46 wait_condition_handle:
47 type: OS::Heat::WaitConditionHandle
48
49 config:
50 type: OS::Heat::SoftwareConfig
51 properties:
52 group: ungrouped
53 config:
54 str_replace:
55 template: |
56 #!/bin/bash -v
57 echo $(hostname) > index.html
58 python -m SimpleHTTPServer port &
59 wc_notify --data-binary '{"status": "SUCCESS"}'
60 params:
61 wc_notify: { get_attr: ['wait_condition_handle', 'curl_cli'] }
62 port: { get_param: port }
63
Sergey Krayneve0ad3632015-03-19 11:34:32 -040064 server1:
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +040065 type: OS::Nova::Server
66 properties:
67 name: Server1
68 image: { get_param: image }
69 flavor: { get_param: flavor }
70 key_name: { get_param: key_name }
Rabi Mishraec4b03b2015-05-23 02:20:47 +053071 networks: [{network: {get_param: network} }]
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +040072 security_groups: [{ get_resource: sec_group }]
Rabi Mishra7205fee2015-04-06 07:57:34 +053073 user_data_format: SOFTWARE_CONFIG
74 user_data: { get_resource: config }
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +040075
Sergey Krayneve0ad3632015-03-19 11:34:32 -040076 server2:
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +040077 type: OS::Nova::Server
78 properties:
79 name: Server2
80 image: { get_param: image }
81 flavor: { get_param: flavor }
82 key_name: { get_param: key_name }
Rabi Mishraec4b03b2015-05-23 02:20:47 +053083 networks: [{network: {get_param: network} }]
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +040084 security_groups: [{ get_resource: sec_group }]
Rabi Mishra7205fee2015-04-06 07:57:34 +053085 user_data_format: SOFTWARE_CONFIG
86 user_data: { get_resource: config }
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +040087
88 health_monitor:
89 type: OS::Neutron::HealthMonitor
90 properties:
91 delay: 3
92 type: HTTP
93 timeout: 3
94 max_retries: 3
95
96 test_pool:
97 type: OS::Neutron::Pool
98 properties:
99 lb_method: ROUND_ROBIN
100 protocol: HTTP
101 subnet: { get_param: private_subnet_id }
102 monitors:
103 - { get_resource: health_monitor }
104 vip:
105 protocol_port: { get_param: port }
106
107 floating_ip:
108 type: OS::Neutron::FloatingIP
109 properties:
110 floating_network: { get_param: external_network_id }
111 port_id:
112 { get_attr: [test_pool, vip, 'port_id'] }
Sergey Kraynev83ef84d2015-04-29 05:31:54 -0400113 fixed_ip_address:
114 { get_attr: [test_pool, vip, 'address'] }
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +0400115
116 LBaaS:
117 type: OS::Neutron::LoadBalancer
Rabi Mishra7205fee2015-04-06 07:57:34 +0530118 depends_on: wait_condition
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +0400119 properties:
120 pool_id: { get_resource: test_pool }
121 protocol_port: { get_param: port }
122 members:
123 - { get_resource: server1 }
124
Sergey Krayneve0ad3632015-03-19 11:34:32 -0400125outputs:
Rabi Mishraec4b03b2015-05-23 02:20:47 +0530126 serv1_ip:
127 value: {get_attr: [server1, networks, { get_param: network }, 0]}
128 serv2_ip:
129 value: {get_attr: [server2, networks, { get_param: network }, 0]}
Sergey Krayneve0ad3632015-03-19 11:34:32 -0400130 vip:
131 value: {get_attr: [test_pool, vip, address]}
132 fip:
133 value: {get_attr: [floating_ip, floating_ip_address]}