Anastasia Kuznetsova | 3e0ab4d | 2015-03-06 18:10:13 +0400 | [diff] [blame^] | 1 | heat_template_version: 2014-10-16 |
| 2 | |
| 3 | description: | |
| 4 | Template which tests neutron load balancing resources |
| 5 | |
| 6 | parameters: |
| 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' |
| 20 | |
| 21 | resources: |
| 22 | sec_group: |
| 23 | type: OS::Neutron::SecurityGroup |
| 24 | properties: |
| 25 | description: Add security group rules for servers |
| 26 | name: security-group |
| 27 | rules: |
| 28 | - remote_ip_prefix: 0.0.0.0/0 |
| 29 | protocol: tcp |
| 30 | port_range_min: { get_param: port } |
| 31 | port_range_max: { get_param: port } |
| 32 | - remote_ip_prefix: 0.0.0.0/0 |
| 33 | protocol: icmp |
| 34 | |
| 35 | server1 : |
| 36 | type: OS::Nova::Server |
| 37 | properties: |
| 38 | name: Server1 |
| 39 | image: { get_param: image } |
| 40 | flavor: { get_param: flavor } |
| 41 | key_name: { get_param: key_name } |
| 42 | security_groups: [{ get_resource: sec_group }] |
| 43 | user_data: |
| 44 | list_join: |
| 45 | - '' |
| 46 | - - '#!/bin/bash -v |
| 47 | |
| 48 | ' |
| 49 | - 'echo $(hostname) > index.html |
| 50 | |
| 51 | ' |
| 52 | - 'python -m SimpleHTTPServer ' |
| 53 | - { get_param: port } |
| 54 | |
| 55 | server2 : |
| 56 | type: OS::Nova::Server |
| 57 | properties: |
| 58 | name: Server2 |
| 59 | image: { get_param: image } |
| 60 | flavor: { get_param: flavor } |
| 61 | key_name: { get_param: key_name } |
| 62 | security_groups: [{ get_resource: sec_group }] |
| 63 | user_data: |
| 64 | list_join: |
| 65 | - '' |
| 66 | - - '#!/bin/bash -v |
| 67 | |
| 68 | ' |
| 69 | - 'echo $(hostname) > index.html |
| 70 | |
| 71 | ' |
| 72 | - 'python -m SimpleHTTPServer ' |
| 73 | - { get_param: port } |
| 74 | |
| 75 | health_monitor: |
| 76 | type: OS::Neutron::HealthMonitor |
| 77 | properties: |
| 78 | delay: 3 |
| 79 | type: HTTP |
| 80 | timeout: 3 |
| 81 | max_retries: 3 |
| 82 | |
| 83 | test_pool: |
| 84 | type: OS::Neutron::Pool |
| 85 | properties: |
| 86 | lb_method: ROUND_ROBIN |
| 87 | protocol: HTTP |
| 88 | subnet: { get_param: private_subnet_id } |
| 89 | monitors: |
| 90 | - { get_resource: health_monitor } |
| 91 | vip: |
| 92 | protocol_port: { get_param: port } |
| 93 | |
| 94 | floating_ip: |
| 95 | type: OS::Neutron::FloatingIP |
| 96 | properties: |
| 97 | floating_network: { get_param: external_network_id } |
| 98 | port_id: |
| 99 | { get_attr: [test_pool, vip, 'port_id'] } |
| 100 | |
| 101 | LBaaS: |
| 102 | type: OS::Neutron::LoadBalancer |
| 103 | properties: |
| 104 | pool_id: { get_resource: test_pool } |
| 105 | protocol_port: { get_param: port } |
| 106 | members: |
| 107 | - { get_resource: server1 } |
| 108 | |