blob: a8c47693834c56d75e3c817fb75bf5e2e84f776a [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
13 private_subnet_id:
14 type: string
15 external_network_id:
16 type: string
17 port:
18 type: string
19 default: '80'
Rabi Mishra7205fee2015-04-06 07:57:34 +053020 timeout:
21 type: number
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +040022
23resources:
24 sec_group:
25 type: OS::Neutron::SecurityGroup
26 properties:
27 description: Add security group rules for servers
28 name: security-group
29 rules:
30 - remote_ip_prefix: 0.0.0.0/0
31 protocol: tcp
32 port_range_min: { get_param: port }
33 port_range_max: { get_param: port }
34 - remote_ip_prefix: 0.0.0.0/0
35 protocol: icmp
36
Rabi Mishra7205fee2015-04-06 07:57:34 +053037 wait_condition:
38 type: OS::Heat::WaitCondition
39 properties:
40 handle: { get_resource: wait_condition_handle }
41 count: 2
42 timeout: { get_param: timeout }
43
44 wait_condition_handle:
45 type: OS::Heat::WaitConditionHandle
46
47 config:
48 type: OS::Heat::SoftwareConfig
49 properties:
50 group: ungrouped
51 config:
52 str_replace:
53 template: |
54 #!/bin/bash -v
55 echo $(hostname) > index.html
56 python -m SimpleHTTPServer port &
57 wc_notify --data-binary '{"status": "SUCCESS"}'
58 params:
59 wc_notify: { get_attr: ['wait_condition_handle', 'curl_cli'] }
60 port: { get_param: port }
61
Sergey Krayneve0ad3632015-03-19 11:34:32 -040062 server1:
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +040063 type: OS::Nova::Server
64 properties:
65 name: Server1
66 image: { get_param: image }
67 flavor: { get_param: flavor }
68 key_name: { get_param: key_name }
69 security_groups: [{ get_resource: sec_group }]
Rabi Mishra7205fee2015-04-06 07:57:34 +053070 user_data_format: SOFTWARE_CONFIG
71 user_data: { get_resource: config }
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +040072
Sergey Krayneve0ad3632015-03-19 11:34:32 -040073 server2:
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +040074 type: OS::Nova::Server
75 properties:
76 name: Server2
77 image: { get_param: image }
78 flavor: { get_param: flavor }
79 key_name: { get_param: key_name }
80 security_groups: [{ get_resource: sec_group }]
Rabi Mishra7205fee2015-04-06 07:57:34 +053081 user_data_format: SOFTWARE_CONFIG
82 user_data: { get_resource: config }
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +040083
84 health_monitor:
85 type: OS::Neutron::HealthMonitor
86 properties:
87 delay: 3
88 type: HTTP
89 timeout: 3
90 max_retries: 3
91
92 test_pool:
93 type: OS::Neutron::Pool
94 properties:
95 lb_method: ROUND_ROBIN
96 protocol: HTTP
97 subnet: { get_param: private_subnet_id }
98 monitors:
99 - { get_resource: health_monitor }
100 vip:
101 protocol_port: { get_param: port }
102
103 floating_ip:
104 type: OS::Neutron::FloatingIP
105 properties:
106 floating_network: { get_param: external_network_id }
107 port_id:
108 { get_attr: [test_pool, vip, 'port_id'] }
109
110 LBaaS:
111 type: OS::Neutron::LoadBalancer
Rabi Mishra7205fee2015-04-06 07:57:34 +0530112 depends_on: wait_condition
Anastasia Kuznetsova3e0ab4d2015-03-06 18:10:13 +0400113 properties:
114 pool_id: { get_resource: test_pool }
115 protocol_port: { get_param: port }
116 members:
117 - { get_resource: server1 }
118
Sergey Krayneve0ad3632015-03-19 11:34:32 -0400119outputs:
120 serv1_ip:
121 value: {get_attr: [server1, networks, private, 0]}
122 serv2_ip:
123 value: {get_attr: [server2, networks, private, 0]}
124 vip:
125 value: {get_attr: [test_pool, vip, address]}
126 fip:
127 value: {get_attr: [floating_ip, floating_ip_address]}