blob: 70659471a6dd949c69a3f0900bdc9293b9aa64fa [file] [log] [blame]
Ash Wilsone77ffb02014-10-20 13:10:26 -04001// +build fixtures
Ash Wilsone77ffb02014-10-20 13:10:26 -04002package servers
3
Ash Wilsone77ffb02014-10-20 13:10:26 -04004// ServerListBody contains the canned body of a servers.List response.
5const ServerListBody = `
6{
7 "servers": [
8 {
9 "status": "ACTIVE",
10 "updated": "2014-09-25T13:10:10Z",
11 "hostId": "29d3c8c896a45aa4c34e52247875d7fefc3d94bbcc9f622b5d204362",
12 "OS-EXT-SRV-ATTR:host": "devstack",
13 "addresses": {
14 "private": [
15 {
16 "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:7c:1b:2b",
17 "version": 4,
18 "addr": "10.0.0.32",
19 "OS-EXT-IPS:type": "fixed"
20 }
21 ]
22 },
23 "links": [
24 {
25 "href": "http://104.130.131.164:8774/v2/fcad67a6189847c4aecfa3c81a05783b/servers/ef079b0c-e610-4dfb-b1aa-b49f07ac48e5",
26 "rel": "self"
27 },
28 {
29 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/servers/ef079b0c-e610-4dfb-b1aa-b49f07ac48e5",
30 "rel": "bookmark"
31 }
32 ],
33 "key_name": null,
34 "image": {
35 "id": "f90f6034-2570-4974-8351-6b49732ef2eb",
36 "links": [
37 {
38 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/images/f90f6034-2570-4974-8351-6b49732ef2eb",
39 "rel": "bookmark"
40 }
41 ]
42 },
43 "OS-EXT-STS:task_state": null,
44 "OS-EXT-STS:vm_state": "active",
45 "OS-EXT-SRV-ATTR:instance_name": "instance-0000001e",
46 "OS-SRV-USG:launched_at": "2014-09-25T13:10:10.000000",
47 "OS-EXT-SRV-ATTR:hypervisor_hostname": "devstack",
48 "flavor": {
49 "id": "1",
50 "links": [
51 {
52 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/flavors/1",
53 "rel": "bookmark"
54 }
55 ]
56 },
57 "id": "ef079b0c-e610-4dfb-b1aa-b49f07ac48e5",
58 "security_groups": [
59 {
60 "name": "default"
61 }
62 ],
63 "OS-SRV-USG:terminated_at": null,
64 "OS-EXT-AZ:availability_zone": "nova",
65 "user_id": "9349aff8be7545ac9d2f1d00999a23cd",
66 "name": "herp",
67 "created": "2014-09-25T13:10:02Z",
68 "tenant_id": "fcad67a6189847c4aecfa3c81a05783b",
69 "OS-DCF:diskConfig": "MANUAL",
70 "os-extended-volumes:volumes_attached": [],
71 "accessIPv4": "",
72 "accessIPv6": "",
73 "progress": 0,
74 "OS-EXT-STS:power_state": 1,
75 "config_drive": "",
76 "metadata": {}
77 },
78 {
79 "status": "ACTIVE",
80 "updated": "2014-09-25T13:04:49Z",
81 "hostId": "29d3c8c896a45aa4c34e52247875d7fefc3d94bbcc9f622b5d204362",
82 "OS-EXT-SRV-ATTR:host": "devstack",
83 "addresses": {
84 "private": [
85 {
86 "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:9e:89:be",
87 "version": 4,
88 "addr": "10.0.0.31",
89 "OS-EXT-IPS:type": "fixed"
90 }
91 ]
92 },
93 "links": [
94 {
95 "href": "http://104.130.131.164:8774/v2/fcad67a6189847c4aecfa3c81a05783b/servers/9e5476bd-a4ec-4653-93d6-72c93aa682ba",
96 "rel": "self"
97 },
98 {
99 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/servers/9e5476bd-a4ec-4653-93d6-72c93aa682ba",
100 "rel": "bookmark"
101 }
102 ],
103 "key_name": null,
104 "image": {
105 "id": "f90f6034-2570-4974-8351-6b49732ef2eb",
106 "links": [
107 {
108 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/images/f90f6034-2570-4974-8351-6b49732ef2eb",
109 "rel": "bookmark"
110 }
111 ]
112 },
113 "OS-EXT-STS:task_state": null,
114 "OS-EXT-STS:vm_state": "active",
115 "OS-EXT-SRV-ATTR:instance_name": "instance-0000001d",
116 "OS-SRV-USG:launched_at": "2014-09-25T13:04:49.000000",
117 "OS-EXT-SRV-ATTR:hypervisor_hostname": "devstack",
118 "flavor": {
119 "id": "1",
120 "links": [
121 {
122 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/flavors/1",
123 "rel": "bookmark"
124 }
125 ]
126 },
127 "id": "9e5476bd-a4ec-4653-93d6-72c93aa682ba",
128 "security_groups": [
129 {
130 "name": "default"
131 }
132 ],
133 "OS-SRV-USG:terminated_at": null,
134 "OS-EXT-AZ:availability_zone": "nova",
135 "user_id": "9349aff8be7545ac9d2f1d00999a23cd",
136 "name": "derp",
137 "created": "2014-09-25T13:04:41Z",
138 "tenant_id": "fcad67a6189847c4aecfa3c81a05783b",
139 "OS-DCF:diskConfig": "MANUAL",
140 "os-extended-volumes:volumes_attached": [],
141 "accessIPv4": "",
142 "accessIPv6": "",
143 "progress": 0,
144 "OS-EXT-STS:power_state": 1,
145 "config_drive": "",
146 "metadata": {}
147 }
148 ]
149}
150`
151
152// SingleServerBody is the canned body of a Get request on an existing server.
153const SingleServerBody = `
154{
155 "server": {
156 "status": "ACTIVE",
157 "updated": "2014-09-25T13:04:49Z",
158 "hostId": "29d3c8c896a45aa4c34e52247875d7fefc3d94bbcc9f622b5d204362",
159 "OS-EXT-SRV-ATTR:host": "devstack",
160 "addresses": {
161 "private": [
162 {
163 "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:9e:89:be",
164 "version": 4,
165 "addr": "10.0.0.31",
166 "OS-EXT-IPS:type": "fixed"
167 }
168 ]
169 },
170 "links": [
171 {
172 "href": "http://104.130.131.164:8774/v2/fcad67a6189847c4aecfa3c81a05783b/servers/9e5476bd-a4ec-4653-93d6-72c93aa682ba",
173 "rel": "self"
174 },
175 {
176 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/servers/9e5476bd-a4ec-4653-93d6-72c93aa682ba",
177 "rel": "bookmark"
178 }
179 ],
180 "key_name": null,
181 "image": {
182 "id": "f90f6034-2570-4974-8351-6b49732ef2eb",
183 "links": [
184 {
185 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/images/f90f6034-2570-4974-8351-6b49732ef2eb",
186 "rel": "bookmark"
187 }
188 ]
189 },
190 "OS-EXT-STS:task_state": null,
191 "OS-EXT-STS:vm_state": "active",
192 "OS-EXT-SRV-ATTR:instance_name": "instance-0000001d",
193 "OS-SRV-USG:launched_at": "2014-09-25T13:04:49.000000",
194 "OS-EXT-SRV-ATTR:hypervisor_hostname": "devstack",
195 "flavor": {
196 "id": "1",
197 "links": [
198 {
199 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/flavors/1",
200 "rel": "bookmark"
201 }
202 ]
203 },
204 "id": "9e5476bd-a4ec-4653-93d6-72c93aa682ba",
205 "security_groups": [
206 {
207 "name": "default"
208 }
209 ],
210 "OS-SRV-USG:terminated_at": null,
211 "OS-EXT-AZ:availability_zone": "nova",
212 "user_id": "9349aff8be7545ac9d2f1d00999a23cd",
213 "name": "derp",
214 "created": "2014-09-25T13:04:41Z",
215 "tenant_id": "fcad67a6189847c4aecfa3c81a05783b",
216 "OS-DCF:diskConfig": "MANUAL",
217 "os-extended-volumes:volumes_attached": [],
218 "accessIPv4": "",
219 "accessIPv6": "",
220 "progress": 0,
221 "OS-EXT-STS:power_state": 1,
222 "config_drive": "",
223 "metadata": {}
224 }
225}
226`
227
228var (
229 // ServerHerp is a Server struct that should correspond to the first result in ServerListBody.
230 ServerHerp = Server{
231 Status: "ACTIVE",
232 Updated: "2014-09-25T13:10:10Z",
233 HostID: "29d3c8c896a45aa4c34e52247875d7fefc3d94bbcc9f622b5d204362",
234 Addresses: map[string]interface{}{
235 "private": []interface{}{
236 map[string]interface{}{
237 "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:7c:1b:2b",
238 "version": float64(4),
239 "addr": "10.0.0.32",
240 "OS-EXT-IPS:type": "fixed",
241 },
242 },
243 },
244 Links: []interface{}{
245 map[string]interface{}{
246 "href": "http://104.130.131.164:8774/v2/fcad67a6189847c4aecfa3c81a05783b/servers/ef079b0c-e610-4dfb-b1aa-b49f07ac48e5",
247 "rel": "self",
248 },
249 map[string]interface{}{
250 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/servers/ef079b0c-e610-4dfb-b1aa-b49f07ac48e5",
251 "rel": "bookmark",
252 },
253 },
254 Image: map[string]interface{}{
255 "id": "f90f6034-2570-4974-8351-6b49732ef2eb",
256 "links": []interface{}{
257 map[string]interface{}{
258 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/images/f90f6034-2570-4974-8351-6b49732ef2eb",
259 "rel": "bookmark",
260 },
261 },
262 },
263 Flavor: map[string]interface{}{
264 "id": "1",
265 "links": []interface{}{
266 map[string]interface{}{
267 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/flavors/1",
268 "rel": "bookmark",
269 },
270 },
271 },
272 ID: "ef079b0c-e610-4dfb-b1aa-b49f07ac48e5",
273 UserID: "9349aff8be7545ac9d2f1d00999a23cd",
274 Name: "herp",
275 Created: "2014-09-25T13:10:02Z",
276 TenantID: "fcad67a6189847c4aecfa3c81a05783b",
277 Metadata: map[string]interface{}{},
278 }
279
280 // ServerDerp is a Server struct that should correspond to the second server in ServerListBody.
281 ServerDerp = Server{
282 Status: "ACTIVE",
283 Updated: "2014-09-25T13:04:49Z",
284 HostID: "29d3c8c896a45aa4c34e52247875d7fefc3d94bbcc9f622b5d204362",
285 Addresses: map[string]interface{}{
286 "private": []interface{}{
287 map[string]interface{}{
288 "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:9e:89:be",
289 "version": float64(4),
290 "addr": "10.0.0.31",
291 "OS-EXT-IPS:type": "fixed",
292 },
293 },
294 },
295 Links: []interface{}{
296 map[string]interface{}{
297 "href": "http://104.130.131.164:8774/v2/fcad67a6189847c4aecfa3c81a05783b/servers/9e5476bd-a4ec-4653-93d6-72c93aa682ba",
298 "rel": "self",
299 },
300 map[string]interface{}{
301 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/servers/9e5476bd-a4ec-4653-93d6-72c93aa682ba",
302 "rel": "bookmark",
303 },
304 },
305 Image: map[string]interface{}{
306 "id": "f90f6034-2570-4974-8351-6b49732ef2eb",
307 "links": []interface{}{
308 map[string]interface{}{
309 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/images/f90f6034-2570-4974-8351-6b49732ef2eb",
310 "rel": "bookmark",
311 },
312 },
313 },
314 Flavor: map[string]interface{}{
315 "id": "1",
316 "links": []interface{}{
317 map[string]interface{}{
318 "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/flavors/1",
319 "rel": "bookmark",
320 },
321 },
322 },
323 ID: "9e5476bd-a4ec-4653-93d6-72c93aa682ba",
324 UserID: "9349aff8be7545ac9d2f1d00999a23cd",
325 Name: "derp",
326 Created: "2014-09-25T13:04:41Z",
327 TenantID: "fcad67a6189847c4aecfa3c81a05783b",
328 Metadata: map[string]interface{}{},
329 }
330)