Add setup and cleanup for maintenance test
[doctor.git] / doctor_tests / maintenance_hot_tpl.yaml
1 ---
2 heat_template_version: 2017-02-24
3 description: Doctor Maintenance test case
4
5 parameters:
6   ext_net:
7     type: string
8     default: external
9   flavor_vcpus:
10     type: number
11     default: 24
12   maint_image:
13     type: string
14     default: cirros
15   ha_intances:
16     type: number
17     default: 2
18   nonha_intances:
19     type: number
20     default: 4
21   app_manager_alarm_url:
22     type: string
23     default: http://0.0.0.0:12348/maintenance
24   inpector_alarm_url:
25     type: string
26     default: http://0.0.0.0:12345/maintenance
27
28
29 resources:
30   int_net:
31     type: OS::Neutron::Net
32
33   int_subnet:
34     type: OS::Neutron::Subnet
35     properties:
36       network_id: {get_resource: int_net}
37       cidr: "9.9.9.0/24"
38       dns_nameservers: ["8.8.8.8"]
39       ip_version: 4
40
41   int_router:
42     type: OS::Neutron::Router
43     properties:
44       external_gateway_info: {network: {get_param: ext_net}}
45
46   int_interface:
47     type: OS::Neutron::RouterInterface
48     properties:
49       router_id: {get_resource: int_router}
50       subnet: {get_resource: int_subnet}
51
52   maint_instance_flavor:
53     type: OS::Nova::Flavor
54     properties:
55       name: doctor_maint_flavor
56       ram: 512
57       vcpus: {get_param: flavor_vcpus}
58       disk: 1
59
60   ha_app_svrgrp:
61     type: OS::Nova::ServerGroup
62     properties:
63       name: doctor_ha_app_group
64       policies: ['anti-affinity']
65
66   floating_ip:
67     type: OS::Nova::FloatingIP
68     properties:
69       pool: {get_param: ext_net}
70
71   multi_ha_instances:
72     type: OS::Heat::ResourceGroup
73     properties:
74       count: {get_param: ha_intances}
75       resource_def:
76         type: OS::Nova::Server
77         properties:
78           name: doctor_ha_app_%index%
79           flavor: {get_resource: maint_instance_flavor}
80           image: {get_param: maint_image}
81           networks:
82             - network: {get_resource: int_net}
83           scheduler_hints:
84             group: {get_resource: ha_app_svrgrp}
85
86   multi_nonha_instances:
87     type: OS::Heat::ResourceGroup
88     properties:
89       count: {get_param: nonha_intances}
90       resource_def:
91         type: OS::Nova::Server
92         properties:
93           name: doctor_nonha_app_%index%
94           flavor: {get_resource: maint_instance_flavor}
95           image: {get_param: maint_image}
96           networks:
97             - network: {get_resource: int_net}
98
99   association:
100     type: OS::Nova::FloatingIPAssociation
101     properties:
102       floating_ip: {get_resource: floating_ip}
103       server_id: {get_attr: [multi_ha_instances, resource.0]}
104
105   app_manager_alarm:
106     type: OS::Aodh::EventAlarm
107     properties:
108       alarm_actions:
109         - {get_param: app_manager_alarm_url}
110       event_type: "maintenance.scheduled"
111       repeat_actions: true
112
113   inpector_alarm:
114     type: OS::Aodh::EventAlarm
115     properties:
116       alarm_actions:
117         - {get_param: inpector_alarm_url}
118       event_type: "maintenance.host"
119       repeat_actions: true