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