| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
import hashlib |
| 18 |
|
| 19 |
|
| 20 |
UUID = "3fc2ba62-9a02-433e-b565-d493ffc69034" |
| 21 |
|
| 22 |
image_list_fixture = { |
| 23 |
"images": [ |
| 24 |
{ |
| 25 |
"checksum": "9cb02fe7fcac26f8a25d6db3109063ae", |
| 26 |
"container_format": "bare", |
| 27 |
"created_at": "2015-07-23T16:58:50.000000", |
| 28 |
"deleted": "false", |
| 29 |
"deleted_at": "null", |
| 30 |
"disk_format": "raw", |
| 31 |
"id": UUID, |
| 32 |
"is_public": "false", |
| 33 |
"min_disk": 0, |
| 34 |
"min_ram": 0, |
| 35 |
"name": "test", |
| 36 |
"owner": "3447cea05d6947658d73791ed9e0ed9f", |
| 37 |
"properties": { |
| 38 |
"kernel_id": 1234, |
| 39 |
"ramdisk_id": 5678 |
| 40 |
}, |
| 41 |
"protected": "false", |
| 42 |
"size": 145, |
| 43 |
"status": "active", |
| 44 |
"updated_at": "2015-07-23T16:58:51.000000", |
| 45 |
"virtual_size": "null" |
| 46 |
} |
| 47 |
] |
| 48 |
} |
| 49 |
|
| 50 |
image_show_fixture = { |
| 51 |
"checksum": "9cb02fe7fcac26f8a25d6db3109063ae", |
| 52 |
"container_format": "bare", |
| 53 |
"created_at": "2015-07-24T12:18:13Z", |
| 54 |
"disk_format": "raw", |
| 55 |
"file": "/v2/images/%s/file" % UUID, |
| 56 |
"id": UUID, |
| 57 |
"kernel_id": "1234", |
| 58 |
"min_disk": 0, |
| 59 |
"min_ram": 0, |
| 60 |
"name": "img1", |
| 61 |
"owner": "411423405e10431fb9c47ac5b2446557", |
| 62 |
"protected": "false", |
| 63 |
"ramdisk_id": "5678", |
| 64 |
"schema": "/v2/schemas/image", |
| 65 |
"self": "/v2/images/%s" % UUID, |
| 66 |
"size": 145, |
| 67 |
"status": "active", |
| 68 |
"tags": [], |
| 69 |
"updated_at": "2015-07-24T12:18:13Z", |
| 70 |
"virtual_size": "null", |
| 71 |
"visibility": "shared", |
| 72 |
"os_hash_algo": "sha384", |
| 73 |
"os_hash_value": hashlib.sha384(b'DATA').hexdigest() |
| 74 |
} |
| 75 |
|
| 76 |
image_create_fixture = { |
| 77 |
"checksum": "9cb02fe7fcac26f8a25d6db3109063ae", |
| 78 |
"container_format": "bare", |
| 79 |
"created_at": "2015-07-24T12:18:13Z", |
| 80 |
"disk_format": "raw", |
| 81 |
"file": "/v2/images/%s/file" % UUID, |
| 82 |
"id": UUID, |
| 83 |
"kernel_id": "af81fccd-b2e8-4232-886c-aa98dda22882", |
| 84 |
"min_disk": 0, |
| 85 |
"min_ram": 0, |
| 86 |
"name": "img1", |
| 87 |
"owner": "411423405e10431fb9c47ac5b2446557", |
| 88 |
"protected": False, |
| 89 |
"ramdisk_id": "fdb3f864-9458-4185-bd26-5d27fe6b6adf", |
| 90 |
"schema": "/v2/schemas/image", |
| 91 |
"self": "/v2/images/%s" % UUID, |
| 92 |
"size": 145, |
| 93 |
"status": "active", |
| 94 |
"tags": [], |
| 95 |
"updated_at": "2015-07-24T12:18:13Z", |
| 96 |
"virtual_size": 123, |
| 97 |
"visibility": "private" |
| 98 |
} |
| 99 |
|
| 100 |
schema_fixture = { |
| 101 |
"additionalProperties": { |
| 102 |
"type": "string" |
| 103 |
}, |
| 104 |
"links": [ |
| 105 |
{ |
| 106 |
"href": "{self}", |
| 107 |
"rel": "self" |
| 108 |
}, |
| 109 |
{ |
| 110 |
"href": "{file}", |
| 111 |
"rel": "enclosure" |
| 112 |
}, |
| 113 |
{ |
| 114 |
"href": "{schema}", |
| 115 |
"rel": "describedby" |
| 116 |
} |
| 117 |
], |
| 118 |
"name": "image", |
| 119 |
"properties": { |
| 120 |
"architecture": { |
| 121 |
"description": "Operating system architecture as specified in " |
| 122 |
"http://docs.openstack.org/user-guide/common" |
| 123 |
"/cli_manage_images.html", |
| 124 |
"is_base": "false", |
| 125 |
"type": "string" |
| 126 |
}, |
| 127 |
"checksum": { |
| 128 |
"readOnly": True, |
| 129 |
"description": "md5 hash of image contents.", |
| 130 |
"maxLength": 32, |
| 131 |
"type": [ |
| 132 |
"null", |
| 133 |
"string" |
| 134 |
] |
| 135 |
}, |
| 136 |
"container_format": { |
| 137 |
"description": "Format of the container", |
| 138 |
"enum": [ |
| 139 |
"null", |
| 140 |
"ami", |
| 141 |
"ari", |
| 142 |
"aki", |
| 143 |
"bare", |
| 144 |
"ovf", |
| 145 |
"ova", |
| 146 |
"docker" |
| 147 |
], |
| 148 |
"type": [ |
| 149 |
"null", |
| 150 |
"string" |
| 151 |
] |
| 152 |
}, |
| 153 |
"created_at": { |
| 154 |
"readOnly": True, |
| 155 |
"description": "Date and time of image registration", |
| 156 |
"type": "string" |
| 157 |
}, |
| 158 |
"direct_url": { |
| 159 |
"readOnly": True, |
| 160 |
"description": "URL to access the image file kept in external " |
| 161 |
"store", |
| 162 |
"type": "string" |
| 163 |
}, |
| 164 |
"disk_format": { |
| 165 |
"description": "Format of the disk", |
| 166 |
"enum": [ |
| 167 |
"null", |
| 168 |
"ami", |
| 169 |
"ari", |
| 170 |
"aki", |
| 171 |
"vhd", |
| 172 |
"vmdk", |
| 173 |
"raw", |
| 174 |
"qcow2", |
| 175 |
"vdi", |
| 176 |
"iso", |
| 177 |
"ploop" |
| 178 |
], |
| 179 |
"type": [ |
| 180 |
"null", |
| 181 |
"string" |
| 182 |
] |
| 183 |
}, |
| 184 |
"file": { |
| 185 |
"readOnly": True, |
| 186 |
"description": "An image file url", |
| 187 |
"type": "string" |
| 188 |
}, |
| 189 |
"id": { |
| 190 |
"description": "An identifier for the image", |
| 191 |
"pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F])" |
| 192 |
"{4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", |
| 193 |
"type": "string" |
| 194 |
}, |
| 195 |
"instance_uuid": { |
| 196 |
"description": ("Metadata which can be used to record which " |
| 197 |
"instance this image is associated with. " |
| 198 |
"(Informational only, does not create an instance " |
| 199 |
"snapshot.)"), |
| 200 |
"is_base": "false", |
| 201 |
"type": "string" |
| 202 |
}, |
| 203 |
"kernel_id": { |
| 204 |
"description": "ID of image stored in Glance that should be used " |
| 205 |
"as the kernel when booting an AMI-style image.", |
| 206 |
"is_base": "false", |
| 207 |
"pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F])" |
| 208 |
"{4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", |
| 209 |
"type": [ |
| 210 |
"null", |
| 211 |
"string" |
| 212 |
] |
| 213 |
}, |
| 214 |
"locations": { |
| 215 |
"description": "A set of URLs to access the image file kept " |
| 216 |
"in external store", |
| 217 |
"items": { |
| 218 |
"properties": { |
| 219 |
"metadata": { |
| 220 |
"type": "object" |
| 221 |
}, |
| 222 |
"url": { |
| 223 |
"maxLength": 255, |
| 224 |
"type": "string" |
| 225 |
} |
| 226 |
}, |
| 227 |
"required": [ |
| 228 |
"url", |
| 229 |
"metadata" |
| 230 |
], |
| 231 |
"type": "object" |
| 232 |
}, |
| 233 |
"type": "array" |
| 234 |
}, |
| 235 |
"min_disk": { |
| 236 |
"description": "Amount of disk space (in GB) required to " |
| 237 |
"boot image.", |
| 238 |
"type": "integer" |
| 239 |
}, |
| 240 |
"min_ram": { |
| 241 |
"description": "Amount of ram (in MB) required to boot image.", |
| 242 |
"type": "integer" |
| 243 |
}, |
| 244 |
"name": { |
| 245 |
"description": "Descriptive name for the image", |
| 246 |
"maxLength": 255, |
| 247 |
"type": [ |
| 248 |
"null", |
| 249 |
"string" |
| 250 |
] |
| 251 |
}, |
| 252 |
"os_distro": { |
| 253 |
"description": "Common name of operating system distribution as " |
| 254 |
"specified in http://docs.openstack.org/trunk/" |
| 255 |
"openstack-compute/admin/content/" |
| 256 |
"adding-images.html", |
| 257 |
"is_base": "false", |
| 258 |
"type": "string" |
| 259 |
}, |
| 260 |
"os_version": { |
| 261 |
"description": "Operating system version as specified " |
| 262 |
"by the distributor", |
| 263 |
"is_base": "false", |
| 264 |
"type": "string" |
| 265 |
}, |
| 266 |
"owner": { |
| 267 |
"description": "Owner of the image", |
| 268 |
"maxLength": 255, |
| 269 |
"type": [ |
| 270 |
"null", |
| 271 |
"string" |
| 272 |
] |
| 273 |
}, |
| 274 |
"protected": { |
| 275 |
"description": "If true, image will not be deletable.", |
| 276 |
"type": "boolean" |
| 277 |
}, |
| 278 |
"ramdisk_id": { |
| 279 |
"description": "ID of image stored in Glance that should be used " |
| 280 |
"as the ramdisk when booting an AMI-style image.", |
| 281 |
"is_base": "false", |
| 282 |
"pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F])" |
| 283 |
"{4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", |
| 284 |
"type": [ |
| 285 |
"null", |
| 286 |
"string" |
| 287 |
] |
| 288 |
}, |
| 289 |
"schema": { |
| 290 |
"readOnly": True, |
| 291 |
"description": "An image schema url", |
| 292 |
"type": "string" |
| 293 |
}, |
| 294 |
"self": { |
| 295 |
"readOnly": True, |
| 296 |
"description": "An image self url", |
| 297 |
"type": "string" |
| 298 |
}, |
| 299 |
"size": { |
| 300 |
"readOnly": True, |
| 301 |
"description": "Size of image file in bytes", |
| 302 |
"type": [ |
| 303 |
"null", |
| 304 |
"integer" |
| 305 |
] |
| 306 |
}, |
| 307 |
"status": { |
| 308 |
"readOnly": True, |
| 309 |
"description": "Status of the image", |
| 310 |
"enum": [ |
| 311 |
"deactivated", |
| 312 |
"queued", |
| 313 |
"saving", |
| 314 |
"active", |
| 315 |
"killed", |
| 316 |
"deleted", |
| 317 |
"pending_delete", |
| 318 |
"uploading", |
| 319 |
"importing" |
| 320 |
], |
| 321 |
"type": "string" |
| 322 |
}, |
| 323 |
"tags": { |
| 324 |
"description": "List of strings related to the image", |
| 325 |
"items": { |
| 326 |
"maxLength": 255, |
| 327 |
"type": "string" |
| 328 |
}, |
| 329 |
"type": "array" |
| 330 |
}, |
| 331 |
"updated_at": { |
| 332 |
"readOnly": True, |
| 333 |
"description": "Date and time of the last image " |
| 334 |
"modification", |
| 335 |
"type": "string" |
| 336 |
}, |
| 337 |
"virtual_size": { |
| 338 |
"readOnly": True, |
| 339 |
"description": "Virtual size of image in bytes", |
| 340 |
"type": [ |
| 341 |
"null", |
| 342 |
"integer" |
| 343 |
] |
| 344 |
}, |
| 345 |
"visibility": { |
| 346 |
"description": "Scope of image accessibility", |
| 347 |
"enum": [ |
| 348 |
"public", |
| 349 |
"private", |
| 350 |
"community", |
| 351 |
"shared" |
| 352 |
], |
| 353 |
"type": "string" |
| 354 |
} |
| 355 |
} |
| 356 |
} |
| 357 |
|
| 358 |
image_versions_fixture = { |
| 359 |
"versions": [ |
| 360 |
{ |
| 361 |
"id": "v2.3", |
| 362 |
"links": [ |
| 363 |
{ |
| 364 |
"href": "http://localhost:9292/v2/", |
| 365 |
"rel": "self" |
| 366 |
} |
| 367 |
], |
| 368 |
"status": "CURRENT" |
| 369 |
}, |
| 370 |
{ |
| 371 |
"id": "v2.2", |
| 372 |
"links": [ |
| 373 |
{ |
| 374 |
"href": "http://localhost:9292/v2/", |
| 375 |
"rel": "self" |
| 376 |
} |
| 377 |
], |
| 378 |
"status": "SUPPORTED" |
| 379 |
}, |
| 380 |
{ |
| 381 |
"id": "v2.1", |
| 382 |
"links": [ |
| 383 |
{ |
| 384 |
"href": "http://localhost:9292/v2/", |
| 385 |
"rel": "self" |
| 386 |
} |
| 387 |
], |
| 388 |
"status": "SUPPORTED" |
| 389 |
}, |
| 390 |
{ |
| 391 |
"id": "v2.0", |
| 392 |
"links": [ |
| 393 |
{ |
| 394 |
"href": "http://localhost:9292/v2/", |
| 395 |
"rel": "self" |
| 396 |
} |
| 397 |
], |
| 398 |
"status": "SUPPORTED" |
| 399 |
}, |
| 400 |
{ |
| 401 |
"id": "v1.1", |
| 402 |
"links": [ |
| 403 |
{ |
| 404 |
"href": "http://localhost:9292/v1/", |
| 405 |
"rel": "self" |
| 406 |
} |
| 407 |
], |
| 408 |
"status": "SUPPORTED" |
| 409 |
}, |
| 410 |
{ |
| 411 |
"id": "v1.0", |
| 412 |
"links": [ |
| 413 |
{ |
| 414 |
"href": "http://localhost:9292/v1/", |
| 415 |
"rel": "self" |
| 416 |
} |
| 417 |
], |
| 418 |
"status": "SUPPORTED" |
| 419 |
} |
| 420 |
] |
| 421 |
} |