Ash Wilson | 69c0874 | 2014-10-21 14:04:40 -0400 | [diff] [blame] | 1 | // +build fixtures |
Ash Wilson | 15e0f27 | 2014-10-21 15:33:02 -0400 | [diff] [blame^] | 2 | |
Ash Wilson | 69c0874 | 2014-10-21 14:04:40 -0400 | [diff] [blame] | 3 | package servers |
| 4 | |
| 5 | import ( |
| 6 | os "github.com/rackspace/gophercloud/openstack/compute/v2/servers" |
| 7 | ) |
| 8 | |
| 9 | // ListOutput is the recorded output of a Rackspace servers.List request. |
| 10 | const ListOutput = ` |
| 11 | { |
| 12 | "servers": [ |
| 13 | { |
| 14 | "OS-DCF:diskConfig": "MANUAL", |
| 15 | "OS-EXT-STS:power_state": 1, |
| 16 | "OS-EXT-STS:task_state": null, |
| 17 | "OS-EXT-STS:vm_state": "active", |
| 18 | "accessIPv4": "1.2.3.4", |
| 19 | "accessIPv6": "1111:4822:7818:121:2000:9b5e:7438:a2d0", |
| 20 | "addresses": { |
| 21 | "private": [ |
| 22 | { |
| 23 | "addr": "10.208.230.113", |
| 24 | "version": 4 |
| 25 | } |
| 26 | ], |
| 27 | "public": [ |
| 28 | { |
| 29 | "addr": "2001:4800:7818:101:2000:9b5e:7428:a2d0", |
| 30 | "version": 6 |
| 31 | }, |
| 32 | { |
| 33 | "addr": "104.130.131.164", |
| 34 | "version": 4 |
| 35 | } |
| 36 | ] |
| 37 | }, |
| 38 | "created": "2014-09-23T12:34:58Z", |
| 39 | "flavor": { |
| 40 | "id": "performance1-8", |
| 41 | "links": [ |
| 42 | { |
| 43 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-8", |
| 44 | "rel": "bookmark" |
| 45 | } |
| 46 | ] |
| 47 | }, |
| 48 | "hostId": "e8951a524bc465b0898aeac7674da6fe1495e253ae1ea17ddb2c2475", |
| 49 | "id": "59818cee-bc8c-44eb-8073-673ee65105f7", |
| 50 | "image": { |
| 51 | "id": "255df5fb-e3d4-45a3-9a07-c976debf7c14", |
| 52 | "links": [ |
| 53 | { |
| 54 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/255df5fb-e3d4-45a3-9a07-c976debf7c14", |
| 55 | "rel": "bookmark" |
| 56 | } |
| 57 | ] |
| 58 | }, |
| 59 | "key_name": "mykey", |
| 60 | "links": [ |
| 61 | { |
| 62 | "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/59818cee-bc8c-44eb-8073-673ee65105f7", |
| 63 | "rel": "self" |
| 64 | }, |
| 65 | { |
| 66 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/59818cee-bc8c-44eb-8073-673ee65105f7", |
| 67 | "rel": "bookmark" |
| 68 | } |
| 69 | ], |
| 70 | "metadata": {}, |
| 71 | "name": "devstack", |
| 72 | "progress": 100, |
| 73 | "status": "ACTIVE", |
| 74 | "tenant_id": "111111", |
| 75 | "updated": "2014-09-23T12:38:19Z", |
| 76 | "user_id": "14ae7bb21d81422694655f3cc30f2930" |
| 77 | }, |
| 78 | { |
| 79 | "OS-DCF:diskConfig": "MANUAL", |
| 80 | "OS-EXT-STS:power_state": 1, |
| 81 | "OS-EXT-STS:task_state": null, |
| 82 | "OS-EXT-STS:vm_state": "active", |
| 83 | "accessIPv4": "1.1.2.3", |
| 84 | "accessIPv6": "2222:4444:7817:101:be76:4eff:f0e5:9e02", |
| 85 | "addresses": { |
| 86 | "private": [ |
| 87 | { |
| 88 | "addr": "10.10.20.30", |
| 89 | "version": 4 |
| 90 | } |
| 91 | ], |
| 92 | "public": [ |
| 93 | { |
| 94 | "addr": "1.1.2.3", |
| 95 | "version": 4 |
| 96 | }, |
| 97 | { |
| 98 | "addr": "2222:4444:7817:101:be76:4eff:f0e5:9e02", |
| 99 | "version": 6 |
| 100 | } |
| 101 | ] |
| 102 | }, |
| 103 | "created": "2014-07-21T19:32:55Z", |
| 104 | "flavor": { |
| 105 | "id": "performance1-2", |
| 106 | "links": [ |
| 107 | { |
| 108 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-2", |
| 109 | "rel": "bookmark" |
| 110 | } |
| 111 | ] |
| 112 | }, |
| 113 | "hostId": "f859679906d6b1a38c1bd516b78f4dcc7d5fcf012578fa3ce460716c", |
| 114 | "id": "25f1c7f5-e00a-4715-b354-16e24b2f4630", |
| 115 | "image": { |
| 116 | "id": "bb02b1a3-bc77-4d17-ab5b-421d89850fca", |
| 117 | "links": [ |
| 118 | { |
| 119 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/bb02b1a3-bc77-4d17-ab5b-421d89850fca", |
| 120 | "rel": "bookmark" |
| 121 | } |
| 122 | ] |
| 123 | }, |
| 124 | "key_name": "otherkey", |
| 125 | "links": [ |
| 126 | { |
| 127 | "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630", |
| 128 | "rel": "self" |
| 129 | }, |
| 130 | { |
| 131 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630", |
| 132 | "rel": "bookmark" |
| 133 | } |
| 134 | ], |
| 135 | "metadata": {}, |
| 136 | "name": "peril-dfw", |
| 137 | "progress": 100, |
| 138 | "status": "ACTIVE", |
| 139 | "tenant_id": "111111", |
| 140 | "updated": "2014-07-21T19:34:24Z", |
| 141 | "user_id": "14ae7bb21d81422694655f3cc30f2930" |
| 142 | } |
| 143 | ] |
| 144 | } |
| 145 | ` |
| 146 | |
| 147 | // GetOutput is the recorded output of a Rackspace servers.Get request. |
| 148 | const GetOutput = ` |
| 149 | { |
| 150 | "server": { |
| 151 | "OS-DCF:diskConfig": "AUTO", |
| 152 | "OS-EXT-STS:power_state": 1, |
| 153 | "OS-EXT-STS:task_state": null, |
| 154 | "OS-EXT-STS:vm_state": "active", |
| 155 | "accessIPv4": "1.2.4.8", |
| 156 | "accessIPv6": "2001:4800:6666:105:2a0f:c056:f594:7777", |
| 157 | "addresses": { |
| 158 | "private": [ |
| 159 | { |
| 160 | "addr": "10.20.40.80", |
| 161 | "version": 4 |
| 162 | } |
| 163 | ], |
| 164 | "public": [ |
| 165 | { |
| 166 | "addr": "1.2.4.8", |
| 167 | "version": 4 |
| 168 | }, |
| 169 | { |
| 170 | "addr": "2001:4800:6666:105:2a0f:c056:f594:7777", |
| 171 | "version": 6 |
| 172 | } |
| 173 | ] |
| 174 | }, |
| 175 | "created": "2014-10-21T14:42:16Z", |
| 176 | "flavor": { |
| 177 | "id": "performance1-1", |
| 178 | "links": [ |
| 179 | { |
| 180 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-1", |
| 181 | "rel": "bookmark" |
| 182 | } |
| 183 | ] |
| 184 | }, |
| 185 | "hostId": "430d2ae02de0a7af77012c94778145eccf67e75b1fac0528aa10d4a7", |
| 186 | "id": "8c65cb68-0681-4c30-bc88-6b83a8a26aee", |
| 187 | "image": { |
| 188 | "id": "e19a734c-c7e6-443a-830c-242209c4d65d", |
| 189 | "links": [ |
| 190 | { |
| 191 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/e19a734c-c7e6-443a-830c-242209c4d65d", |
| 192 | "rel": "bookmark" |
| 193 | } |
| 194 | ] |
| 195 | }, |
| 196 | "key_name": null, |
| 197 | "links": [ |
| 198 | { |
| 199 | "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee", |
| 200 | "rel": "self" |
| 201 | }, |
| 202 | { |
| 203 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee", |
| 204 | "rel": "bookmark" |
| 205 | } |
| 206 | ], |
| 207 | "metadata": {}, |
| 208 | "name": "Gophercloud-pxpGGuey", |
| 209 | "progress": 100, |
| 210 | "status": "ACTIVE", |
| 211 | "tenant_id": "111111", |
| 212 | "updated": "2014-10-21T14:42:57Z", |
| 213 | "user_id": "14ae7bb21d81423694655f4dd30f2930" |
| 214 | } |
| 215 | } |
| 216 | ` |
| 217 | |
| 218 | // DevstackServer is the expected first result from parsing ListOutput. |
| 219 | var DevstackServer = os.Server{ |
| 220 | ID: "59818cee-bc8c-44eb-8073-673ee65105f7", |
| 221 | Name: "devstack", |
| 222 | TenantID: "111111", |
| 223 | UserID: "14ae7bb21d81422694655f3cc30f2930", |
| 224 | HostID: "e8951a524bc465b0898aeac7674da6fe1495e253ae1ea17ddb2c2475", |
| 225 | Updated: "2014-09-23T12:38:19Z", |
| 226 | Created: "2014-09-23T12:34:58Z", |
| 227 | AccessIPv4: "1.2.3.4", |
| 228 | AccessIPv6: "1111:4822:7818:121:2000:9b5e:7438:a2d0", |
| 229 | Progress: 100, |
| 230 | Status: "ACTIVE", |
| 231 | Image: map[string]interface{}{ |
| 232 | "id": "255df5fb-e3d4-45a3-9a07-c976debf7c14", |
| 233 | "links": []interface{}{ |
| 234 | map[string]interface{}{ |
| 235 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/255df5fb-e3d4-45a3-9a07-c976debf7c14", |
| 236 | "rel": "bookmark", |
| 237 | }, |
| 238 | }, |
| 239 | }, |
| 240 | Flavor: map[string]interface{}{ |
| 241 | "id": "performance1-8", |
| 242 | "links": []interface{}{ |
| 243 | map[string]interface{}{ |
| 244 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-8", |
| 245 | "rel": "bookmark", |
| 246 | }, |
| 247 | }, |
| 248 | }, |
| 249 | Addresses: map[string]interface{}{ |
| 250 | "private": []interface{}{ |
| 251 | map[string]interface{}{ |
| 252 | "addr": "10.20.30.40", |
| 253 | "version": float64(4.0), |
| 254 | }, |
| 255 | }, |
| 256 | "public": []interface{}{ |
| 257 | map[string]interface{}{ |
| 258 | "addr": "1111:4822:7818:121:2000:9b5e:7438:a2d0", |
| 259 | "version": float64(6.0), |
| 260 | }, |
| 261 | map[string]interface{}{ |
| 262 | "addr": "1.2.3.4", |
| 263 | "version": float64(4.0), |
| 264 | }, |
| 265 | }, |
| 266 | }, |
| 267 | Metadata: map[string]interface{}{}, |
| 268 | Links: []interface{}{ |
| 269 | map[string]interface{}{ |
| 270 | "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/59918cee-bd9d-44eb-8173-673ee75105f7", |
| 271 | "rel": "self", |
| 272 | }, |
| 273 | map[string]interface{}{ |
| 274 | "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/59818cee-bc8c-44eb-8073-673ee65105f7", |
| 275 | "rel": "bookmark", |
| 276 | }, |
| 277 | }, |
| 278 | KeyName: "mykey", |
| 279 | AdminPass: "", |
| 280 | } |
| 281 | |
| 282 | // PerilServer is the expected second result from parsing ListOutput. |
| 283 | var PerilServer = os.Server{ |
| 284 | ID: "25f1c7f5-e00a-4715-b354-16e24b2f4630", |
| 285 | Name: "peril-dfw", |
| 286 | TenantID: "111111", |
| 287 | UserID: "14ae7bb21d81422694655f3cc30f2930", |
| 288 | HostID: "f859679906d6b1a38c1bd516b78f4dcc7d5fcf012578fa3ce460716c", |
| 289 | Updated: "2014-07-21T19:34:24Z", |
| 290 | Created: "2014-07-21T19:32:55Z", |
| 291 | AccessIPv4: "1.1.2.3", |
| 292 | AccessIPv6: "2222:4444:7817:101:be76:4eff:f0e5:9e02", |
| 293 | Progress: 100, |
| 294 | Status: "ACTIVE", |
| 295 | Image: map[string]interface{}{ |
| 296 | "id": "bb02b1a3-bc77-4d17-ab5b-421d89850fca", |
| 297 | "links": []interface{}{ |
| 298 | map[string]interface{}{ |
| 299 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/bb02b1a3-bc77-4d17-ab5b-421d89850fca", |
| 300 | "rel": "bookmark", |
| 301 | }, |
| 302 | }, |
| 303 | }, |
| 304 | Flavor: map[string]interface{}{ |
| 305 | "id": "performance1-2", |
| 306 | "links": []interface{}{ |
| 307 | map[string]interface{}{ |
| 308 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-2", |
| 309 | "rel": "bookmark", |
| 310 | }, |
| 311 | }, |
| 312 | }, |
| 313 | Addresses: map[string]interface{}{ |
| 314 | "private": []interface{}{ |
| 315 | map[string]interface{}{ |
| 316 | "addr": "10.10.20.30", |
| 317 | "version": float64(4.0), |
| 318 | }, |
| 319 | }, |
| 320 | "public": []interface{}{ |
| 321 | map[string]interface{}{ |
| 322 | "addr": "2222:4444:7817:101:be76:4eff:f0e5:9e02", |
| 323 | "version": float64(6.0), |
| 324 | }, |
| 325 | map[string]interface{}{ |
| 326 | "addr": "1.1.2.3", |
| 327 | "version": float64(4.0), |
| 328 | }, |
| 329 | }, |
| 330 | }, |
| 331 | Metadata: map[string]interface{}{}, |
| 332 | Links: []interface{}{ |
| 333 | map[string]interface{}{ |
| 334 | "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630", |
| 335 | "rel": "self", |
| 336 | }, |
| 337 | map[string]interface{}{ |
| 338 | "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630", |
| 339 | "rel": "bookmark", |
| 340 | }, |
| 341 | }, |
| 342 | KeyName: "otherkey", |
| 343 | AdminPass: "", |
| 344 | } |
| 345 | |
| 346 | // GophercloudServer is the expected result from parsing GetOutput. |
| 347 | var GophercloudServer = os.Server{ |
| 348 | ID: "8c65cb68-0681-4c30-bc88-6b83a8a26aee", |
| 349 | Name: "Gophercloud-pxpGGuey", |
| 350 | TenantID: "111111", |
| 351 | UserID: "14ae7bb21d81423694655f4dd30f2930", |
| 352 | HostID: "430d2ae02de0a7af77012c94778145eccf67e75b1fac0528aa10d4a7", |
| 353 | Updated: "2014-10-21T14:42:57Z", |
| 354 | Created: "2014-10-21T14:42:16Z", |
| 355 | AccessIPv4: "1.2.4.8", |
| 356 | AccessIPv6: "2001:4800:6666:105:2a0f:c056:f594:7777", |
| 357 | Progress: 100, |
| 358 | Status: "ACTIVE", |
| 359 | Image: map[string]interface{}{ |
| 360 | "id": "e19a734c-c7e6-443a-830c-242209c4d65d", |
| 361 | "links": []interface{}{ |
| 362 | map[string]interface{}{ |
| 363 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/e19a734c-c7e6-443a-830c-242209c4d65d", |
| 364 | "rel": "bookmark", |
| 365 | }, |
| 366 | }, |
| 367 | }, |
| 368 | Flavor: map[string]interface{}{ |
| 369 | "id": "performance1-1", |
| 370 | "links": []interface{}{ |
| 371 | map[string]interface{}{ |
| 372 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-1", |
| 373 | "rel": "bookmark", |
| 374 | }, |
| 375 | }, |
| 376 | }, |
| 377 | Addresses: map[string]interface{}{ |
| 378 | "private": []interface{}{ |
| 379 | map[string]interface{}{ |
| 380 | "addr": "10.20.40.80", |
| 381 | "version": float64(4.0), |
| 382 | }, |
| 383 | }, |
| 384 | "public": []interface{}{ |
| 385 | map[string]interface{}{ |
| 386 | "addr": "2001:4800:6666:105:2a0f:c056:f594:7777", |
| 387 | "version": float64(6.0), |
| 388 | }, |
| 389 | map[string]interface{}{ |
| 390 | "addr": "1.2.4.8", |
| 391 | "version": float64(4.0), |
| 392 | }, |
| 393 | }, |
| 394 | }, |
| 395 | Metadata: map[string]interface{}{}, |
| 396 | Links: []interface{}{ |
| 397 | map[string]interface{}{ |
| 398 | "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee", |
| 399 | "rel": "self", |
| 400 | }, |
| 401 | map[string]interface{}{ |
| 402 | "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee", |
| 403 | "rel": "bookmark", |
| 404 | }, |
| 405 | }, |
| 406 | KeyName: "", |
| 407 | AdminPass: "", |
| 408 | } |
| 409 | |
| 410 | // ExpectedServerSlice is the collection of servers, in order, that should be parsed from ListOutput. |
| 411 | var ExpectedServerSlice = []os.Server{DevstackServer, PerilServer} |