summaryrefslogtreecommitdiff
path: root/nova/tests/unit/integrated/v3
diff options
context:
space:
mode:
authorSean Dague <sean@dague.net>2014-11-07 14:27:03 +0100
committerSean Dague <sean@dague.net>2014-11-12 15:31:08 -0500
commit89cd6a0c493e26b5a9e017c99d731464292abbaf (patch)
treec2bf790d1684cd539b820247113492495123a163 /nova/tests/unit/integrated/v3
parent5c8bbaafef590e4d346a03051a0ba55c8be26c5c (diff)
downloadnova-89cd6a0c493e26b5a9e017c99d731464292abbaf.tar.gz
move all tests to nova/tests/unit
As part of the split of functional and unit tests we need to isolate the unit tests into a separate directory for having multiple test targets in a sane way. Part of bp:functional-tests-for-nova Change-Id: Id42ba373c1bda6a312b673ab2b489ca56da8c628
Diffstat (limited to 'nova/tests/unit/integrated/v3')
-rw-r--r--nova/tests/unit/integrated/v3/__init__.py0
-rw-r--r--nova/tests/unit/integrated/v3/api_sample_base.py79
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/all_extensions/server-get-resp.json.tpl76
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/all_extensions/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/all_extensions/server-post-resp.json.tpl24
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/all_extensions/servers-details-resp.json.tpl78
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/all_extensions/servers-list-resp.json.tpl18
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/consoles/consoles-create-req.json.tpl0
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/consoles/consoles-get-resp.json.tpl1
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/consoles/consoles-list-get-resp.json.tpl1
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/consoles/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/consoles/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/extension-info/extensions-get-resp.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/extension-info/extensions-list-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-add-tenant-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-add-tenant-resp.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-create-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-create-resp.json.tpl23
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-detail-resp.json.tpl109
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-list-resp.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-remove-tenant-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-remove-tenant-resp.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-show-resp.json.tpl23
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-create-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-create-resp.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-get-resp.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-list-resp.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-update-req.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-update-resp.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-manage/flavor-create-post-req.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavor-manage/flavor-create-post-resp.json.tpl23
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavors/flavor-get-resp.json.tpl23
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavors/flavors-detail-resp.json.tpl109
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/flavors/flavors-list-resp.json.tpl74
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/image-size/image-get-resp.json.tpl34
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/image-size/images-details-get-resp.json.tpl219
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/images/image-get-resp.json.tpl33
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/images/image-meta-key-get.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/images/image-meta-key-put-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/images/image-meta-key-put-resp.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/images/image-metadata-get-resp.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/images/image-metadata-post-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/images/image-metadata-post-resp.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/images/image-metadata-put-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/images/image-metadata-put-resp.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/images/images-details-get-resp.json.tpl212
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/images/images-list-get-resp.json.tpl137
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-get-resp.json.tpl13
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-import-post-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-import-post-resp.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-list-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-post-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-post-resp.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-action-rebuild-resp.json.tpl57
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-action-rebuild.json.tpl17
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-get-resp.json.tpl57
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-post-req.json.tpl18
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-post-resp.json.tpl18
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-put-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-put-resp.json.tpl56
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-access-ips/servers-details-resp.json.tpl59
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-access-ips/servers-list-resp.json.tpl18
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-inject-network-info.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-reset-network.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-reset-server-state.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-reset-state.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-admin-actions/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-admin-actions/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-admin-password/admin-password-change-password.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-admin-password/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-admin-password/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-agents/agent-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-agents/agent-post-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-agents/agent-update-put-req.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-agents/agent-update-put-resp.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-agents/agents-get-resp.json.tpl13
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-add-host-post-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-metadata-post-req.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-post-req.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-post-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-remove-host-post-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-update-post-req.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-update-post-resp.json.tpl15
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-add-host-post-resp.json.tpl17
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-get-resp.json.tpl15
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-list-get-resp.json.tpl17
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-metadata-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-remove-host-post-resp.json.tpl15
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-create-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-create-resp.json.tpl14
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-list-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-show-resp.json.tpl14
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-availability-zone/availability-zone-detail-resp.json.tpl69
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-availability-zone/availability-zone-list-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-availability-zone/server-post-req.json.tpl17
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-availability-zone/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-cells/cells-capacities-resp.json.tpl26
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-cells/cells-get-resp.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-cells/cells-list-empty-resp.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-cells/cells-list-resp.json.tpl39
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-certificates/certificate-create-req.json.tpl0
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-certificates/certificate-create-resp.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-certificates/certificate-get-root-resp.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-create-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-create-resp.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-get-resp.json.tpl13
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-update-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-config-drive/server-config-drive-get-resp.json.tpl56
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-config-drive/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-config-drive/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-config-drive/servers-config-drive-details-resp.json.tpl58
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/get-console-connect-info-get-resp.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/get-rdp-console-post-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-console-output/console-output-post-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-console-output/console-output-post-resp.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-console-output/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-console-output/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-create-backup/create-backup-req.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-create-backup/server-post-req.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-create-backup/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/force-delete-post-req.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/restore-post-req.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-disk-config/image-get-resp.json.tpl34
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-disk-config/image-list-resp.json.tpl214
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-disk-config/list-servers-detail-get.json.tpl58
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-action-rebuild-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-action-rebuild-resp.json.tpl56
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-get-resp.json.tpl56
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-post-req.json.tpl17
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-post-resp.json.tpl17
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-resize-post-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-update-put-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-update-put-resp.json.tpl55
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-find-host-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-find-host-resp.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-req.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-resp.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/server-get-resp.json.tpl56
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/servers-detail-resp.json.tpl58
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/server-get-resp.json.tpl58
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/servers-detail-resp.json.tpl60
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-status/server-get-resp.json.tpl60
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-status/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-status/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-status/servers-detail-resp.json.tpl60
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/attach-volume-req.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/detach-volume-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/server-get-resp.json.tpl59
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/servers-detail-resp.json.tpl60
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/swap-volume-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-fixed-ips/fixedip-post-req.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-fixed-ips/fixedips-get-resp.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json.tpl24
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json.tpl114
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.json.tpl24
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ip-pools/floatingippools-list-resp.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-create-req.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-create-resp.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-delete-req.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-delete-resp.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-list-by-host-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-list-resp.json.tpl25
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-fping/fping-get-details-resp.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-fping/fping-get-resp.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-fping/server-post-req.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-fping/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/server-get-resp.json.tpl47
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/servers-details-resp.json.tpl48
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/servers-list-resp.json.tpl18
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-reboot.json.tpl4
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-resp.json.tpl31
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-shutdown.json.tpl4
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-startup.json.tpl4
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hosts/host-put-maintenance-req.json.tpl4
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hosts/host-put-maintenance-resp.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hosts/hosts-list-compute-service-resp.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hosts/hosts-list-resp.json.tpl39
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl30
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-list-resp.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-search-resp.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-servers-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-show-resp.json.tpl28
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-statistics-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-uptime-resp.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-instance-actions/instance-action-get-resp.json.tpl27
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-instance-actions/instance-actions-list-resp.json.tpl22
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-instance-actions/instance-instance-get-resp.json.tpl27
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-lock-server/lock-server.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-lock-server/server-post-req.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-lock-server/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-lock-server/unlock-server.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-migrate-server/live-migrate-server.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-migrate-server/migrate-server.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-migrate-server/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-migrate-server/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-migrations/migrations-get.json.tpl32
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-multinic/multinic-add-fixed-ip-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-multinic/multinic-remove-fixed-ip-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-multinic/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-multinic/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-no-resv-post-req.json.tpl18
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-no-resv-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-post-req.json.tpl19
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-post-resp.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-associate-host-req.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-disassociate-host-req.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-disassociate-project-req.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-disassociate-req.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-networks/network-add-req.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-networks/network-create-req.json.tpl12
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-networks/network-create-resp.json.tpl36
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-networks/network-show-resp.json.tpl37
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-networks/networks-disassociate-req.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-networks/networks-list-resp.json.tpl72
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-pause-server/pause-server.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-pause-server/server-post-req.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-pause-server/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-pause-server/unpause-server.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-pci/hypervisors-pci-detail-resp.json.tpl42
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-pci/hypervisors-pci-show-resp.json.tpl40
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-pci/pci-detail-resp.json.tpl36
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-pci/pci-index-resp.json.tpl20
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-pci/pci-show-resp.json.tpl18
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-pci/server-get-resp.json.tpl60
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-pci/server-post-req.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-pci/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-pci/servers-detail-resp.json.tpl62
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl19
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl19
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.json.tpl19
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-force-resp.json.tpl19
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-post-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl19
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.json.tpl19
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.json.tpl19
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-rdp-console-post-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-rdp-console-post-resp.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-serial-console-post-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-serial-console-post-resp.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-spice-console-post-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-spice-console-post-resp.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-vnc-console-post-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-vnc-console-post-resp.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-rescue/server-get-resp-rescue.json.tpl54
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-rescue/server-get-resp-unrescue.json.tpl55
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-rescue/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-rescue/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-rescue/server-rescue-req-with-image-ref.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-rescue/server-rescue-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-rescue/server-rescue.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-rescue/server-unrescue-req.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-scheduler-hints/scheduler-hints-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-scheduler-hints/scheduler-hints-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-create-req.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-create-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-list-resp.json.tpl13
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-show-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-group-add-post-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-group-post-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-group-remove-post-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-groups-create-resp.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-groups-get-resp.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-groups-list-get-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-get-resp.json.tpl56
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-post-req.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-post-resp.json.tpl17
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-security-groups-list-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-security-groups/servers-detail-resp.json.tpl57
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-diagnostics/server-diagnostics-get-resp.json.tpl17
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-diagnostics/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-diagnostics/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-external-events/event-create-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-external-events/event-create-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-external-events/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-external-events/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-get-resp.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-list-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-post-req.json.tpl6
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-post-resp.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-usage/server-get-resp.json.tpl57
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-usage/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-usage/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-server-usage/servers-detail-resp.json.tpl58
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-log-put-req.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-log-put-resp.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-put-req.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-put-resp.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-services/service-enable-put-req.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-services/service-enable-put-resp.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-services/services-list-get-resp.json.tpl44
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-shelve/os-shelve-offload.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-shelve/os-shelve.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-shelve/os-unshelve.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-shelve/server-post-req.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-shelve/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/server-post-req.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json.tpl27
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json.tpl13
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-resume.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-suspend.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-tenant-networks/networks-list-res.json.tpl14
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-tenant-networks/networks-post-req.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-tenant-networks/networks-post-res.json.tpl7
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-used-limits/usedlimits-get-resp.json.tpl26
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-user-data/userdata-post-req.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-user-data/userdata-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-detail-resp.json.tpl24
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-get-resp.json.tpl22
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-index-resp.json.tpl24
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-post-req.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-post-resp.json.tpl21
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-volumes/server-post-req.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-volumes/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshot-create-req.json.tpl8
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshot-create-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshots-detail-resp.json.tpl31
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshots-list-resp.json.tpl31
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshots-show-resp.json.tpl11
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/server-ips/server-ips-network-resp.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/server-ips/server-ips-resp.json.tpl12
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/server-ips/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/server-ips/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-all-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-all-resp.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-req.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-resp.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/server-metadata/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/server-metadata/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-action-confirm-resize.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-action-create-image.json.tpl9
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-action-reboot.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild-preserve-ephemeral-resp.json.tpl55
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild-preserve-ephemeral.json.tpl17
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild-resp.json.tpl55
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-action-resize.json.tpl5
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-action-revert-resize.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-action-start.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-action-stop.json.tpl3
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-get-resp.json.tpl55
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-post-req.json.tpl10
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/server-post-resp.json.tpl16
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/servers-details-resp.json.tpl57
-rw-r--r--nova/tests/unit/integrated/v3/api_samples/servers/servers-list-resp.json.tpl18
-rw-r--r--nova/tests/unit/integrated/v3/test_access_ips.py93
-rw-r--r--nova/tests/unit/integrated/v3/test_admin_actions.py46
-rw-r--r--nova/tests/unit/integrated/v3/test_admin_password.py29
-rw-r--r--nova/tests/unit/integrated/v3/test_agents.py98
-rw-r--r--nova/tests/unit/integrated/v3/test_aggregates.py80
-rw-r--r--nova/tests/unit/integrated/v3/test_attach_interfaces.py166
-rw-r--r--nova/tests/unit/integrated/v3/test_availability_zone.py49
-rw-r--r--nova/tests/unit/integrated/v3/test_cells.py107
-rw-r--r--nova/tests/unit/integrated/v3/test_certificates.py31
-rw-r--r--nova/tests/unit/integrated/v3/test_cloudpipe.py80
-rw-r--r--nova/tests/unit/integrated/v3/test_config_drive.py48
-rw-r--r--nova/tests/unit/integrated/v3/test_console_auth_tokens.py51
-rw-r--r--nova/tests/unit/integrated/v3/test_console_output.py27
-rw-r--r--nova/tests/unit/integrated/v3/test_consoles.py55
-rw-r--r--nova/tests/unit/integrated/v3/test_create_backup.py38
-rw-r--r--nova/tests/unit/integrated/v3/test_deferred_delete.py42
-rw-r--r--nova/tests/unit/integrated/v3/test_disk_config.py80
-rw-r--r--nova/tests/unit/integrated/v3/test_evacuate.py91
-rw-r--r--nova/tests/unit/integrated/v3/test_extended_availability_zone.py34
-rw-r--r--nova/tests/unit/integrated/v3/test_extended_server_attributes.py42
-rw-r--r--nova/tests/unit/integrated/v3/test_extended_status.py35
-rw-r--r--nova/tests/unit/integrated/v3/test_extended_volumes.py151
-rw-r--r--nova/tests/unit/integrated/v3/test_extension_info.py71
-rw-r--r--nova/tests/unit/integrated/v3/test_fixed_ips.py109
-rw-r--r--nova/tests/unit/integrated/v3/test_flavor_access.py89
-rw-r--r--nova/tests/unit/integrated/v3/test_flavor_extraspecs.py62
-rw-r--r--nova/tests/unit/integrated/v3/test_flavor_manage.py43
-rw-r--r--nova/tests/unit/integrated/v3/test_flavor_rxtx.py46
-rw-r--r--nova/tests/unit/integrated/v3/test_flavors.py35
-rw-r--r--nova/tests/unit/integrated/v3/test_floating_ip_dns.py91
-rw-r--r--nova/tests/unit/integrated/v3/test_floating_ip_pools.py35
-rw-r--r--nova/tests/unit/integrated/v3/test_floating_ips_bulk.py86
-rw-r--r--nova/tests/unit/integrated/v3/test_fping.py45
-rw-r--r--nova/tests/unit/integrated/v3/test_hide_server_addresses.py39
-rw-r--r--nova/tests/unit/integrated/v3/test_hosts.py57
-rw-r--r--nova/tests/unit/integrated/v3/test_hypervisors.py69
-rw-r--r--nova/tests/unit/integrated/v3/test_image_size.py37
-rw-r--r--nova/tests/unit/integrated/v3/test_images.py85
-rw-r--r--nova/tests/unit/integrated/v3/test_instance_actions.py84
-rw-r--r--nova/tests/unit/integrated/v3/test_keypairs.py72
-rw-r--r--nova/tests/unit/integrated/v3/test_lock_server.py41
-rw-r--r--nova/tests/unit/integrated/v3/test_migrate_server.py71
-rw-r--r--nova/tests/unit/integrated/v3/test_migrations.py72
-rw-r--r--nova/tests/unit/integrated/v3/test_multinic.py49
-rw-r--r--nova/tests/unit/integrated/v3/test_multiple_create.py45
-rw-r--r--nova/tests/unit/integrated/v3/test_networks.py73
-rw-r--r--nova/tests/unit/integrated/v3/test_networks_associate.py76
-rw-r--r--nova/tests/unit/integrated/v3/test_pause_server.py41
-rw-r--r--nova/tests/unit/integrated/v3/test_pci.py182
-rw-r--r--nova/tests/unit/integrated/v3/test_quota_sets.py70
-rw-r--r--nova/tests/unit/integrated/v3/test_remote_consoles.py70
-rw-r--r--nova/tests/unit/integrated/v3/test_rescue.py82
-rw-r--r--nova/tests/unit/integrated/v3/test_scheduler_hints.py32
-rw-r--r--nova/tests/unit/integrated/v3/test_security_group_default_rules.py40
-rw-r--r--nova/tests/unit/integrated/v3/test_security_groups.py166
-rw-r--r--nova/tests/unit/integrated/v3/test_server_diagnostics.py27
-rw-r--r--nova/tests/unit/integrated/v3/test_server_external_events.py40
-rw-r--r--nova/tests/unit/integrated/v3/test_server_groups.py66
-rw-r--r--nova/tests/unit/integrated/v3/test_server_metadata.py80
-rw-r--r--nova/tests/unit/integrated/v3/test_server_usage.py39
-rw-r--r--nova/tests/unit/integrated/v3/test_servers.py188
-rw-r--r--nova/tests/unit/integrated/v3/test_servers_ips.py35
-rw-r--r--nova/tests/unit/integrated/v3/test_services.py87
-rw-r--r--nova/tests/unit/integrated/v3/test_shelve.py50
-rw-r--r--nova/tests/unit/integrated/v3/test_simple_tenant_usage.py61
-rw-r--r--nova/tests/unit/integrated/v3/test_suspend_server.py41
-rw-r--r--nova/tests/unit/integrated/v3/test_tenant_networks.py61
-rw-r--r--nova/tests/unit/integrated/v3/test_used_limits.py34
-rw-r--r--nova/tests/unit/integrated/v3/test_user_data.py36
-rw-r--r--nova/tests/unit/integrated/v3/test_volumes.py184
445 files changed, 11992 insertions, 0 deletions
diff --git a/nova/tests/unit/integrated/v3/__init__.py b/nova/tests/unit/integrated/v3/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/__init__.py
diff --git a/nova/tests/unit/integrated/v3/api_sample_base.py b/nova/tests/unit/integrated/v3/api_sample_base.py
new file mode 100644
index 0000000000..dad804328d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_sample_base.py
@@ -0,0 +1,79 @@
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import os
+
+from oslo.config import cfg
+
+from nova.api.openstack import API_V3_CORE_EXTENSIONS # noqa
+from nova import test
+from nova.tests.unit import fake_network
+from nova.tests.unit import fake_utils
+from nova.tests.unit.integrated import api_samples_test_base
+
+CONF = cfg.CONF
+
+
+class ApiSampleTestBaseV3(api_samples_test_base.ApiSampleTestBase):
+ _api_version = 'v3'
+ sample_dir = None
+ extra_extensions_to_load = None
+
+ def setUp(self):
+ self.flags(use_ipv6=False,
+ osapi_compute_link_prefix=self._get_host(),
+ osapi_glance_link_prefix=self._get_glance_host())
+ if not self.all_extensions:
+ # Set the whitelist to ensure only the extensions we are
+ # interested in are loaded so the api samples don't include
+ # data from extensions we are not interested in
+ whitelist = API_V3_CORE_EXTENSIONS.copy()
+ if self.extension_name:
+ whitelist.add(self.extension_name)
+ if self.extra_extensions_to_load:
+ whitelist.update(set(self.extra_extensions_to_load))
+
+ CONF.set_override('extensions_whitelist', whitelist,
+ 'osapi_v3')
+
+ super(ApiSampleTestBaseV3, self).setUp()
+ self.useFixture(test.SampleNetworks(host=self.network.host))
+ fake_network.stub_compute_with_ips(self.stubs)
+ fake_utils.stub_out_utils_spawn_n(self.stubs)
+ self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None
+
+ @classmethod
+ def _get_sample_path(cls, name, dirname, suffix=''):
+ parts = [dirname]
+ parts.append('api_samples')
+ if cls.all_extensions:
+ parts.append('all_extensions')
+ elif cls.sample_dir:
+ parts.append(cls.sample_dir)
+ elif cls.extension_name:
+ parts.append(cls.extension_name)
+ parts.append(name + "." + cls.ctype + suffix)
+ return os.path.join(*parts)
+
+ @classmethod
+ def _get_sample(cls, name):
+ dirname = os.path.dirname(os.path.abspath(__file__))
+ dirname = os.path.normpath(os.path.join(dirname,
+ "../../../../../doc/v3"))
+ return cls._get_sample_path(name, dirname)
+
+ @classmethod
+ def _get_template(cls, name):
+ dirname = os.path.dirname(os.path.abspath(__file__))
+ return cls._get_sample_path(name, dirname, suffix='.tpl')
diff --git a/nova/tests/unit/integrated/v3/api_samples/all_extensions/server-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/all_extensions/server-get-resp.json.tpl
new file mode 100644
index 0000000000..add1a44c32
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/all_extensions/server-get-resp.json.tpl
@@ -0,0 +1,76 @@
+{
+ "server": {
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "key_name": null,
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "config_drive": "",
+ "OS-DCF:diskConfig": "AUTO",
+ "OS-EXT-AZ:availability_zone": "nova",
+ "OS-EXT-SRV-ATTR:host": "%(compute_host)s",
+ "OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
+ "OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
+ "OS-EXT-STS:locked_by": null,
+ "OS-EXT-STS:power_state": 1,
+ "OS-EXT-STS:task_state": null,
+ "OS-EXT-STS:vm_state": "active",
+ "os-extended-volumes:volumes_attached": [],
+ "os-pci:pci_devices": [{"id": 1}],
+ "OS-SRV-USG:launched_at": "%(strtime)s",
+ "OS-SRV-USG:terminated_at": null,
+ "progress": 0,
+ "security_groups": [
+ {
+ "name": "default"
+ }
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/all_extensions/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/all_extensions/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/all_extensions/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/all_extensions/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/all_extensions/server-post-resp.json.tpl
new file mode 100644
index 0000000000..6f1d0b498e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/all_extensions/server-post-resp.json.tpl
@@ -0,0 +1,24 @@
+{
+ "server": {
+ "OS-DCF:diskConfig": "AUTO",
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "security_groups": [
+ {
+ "name": "default"
+ }
+ ],
+ "accessIPv4": "",
+ "accessIPv6": ""
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/all_extensions/servers-details-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/all_extensions/servers-details-resp.json.tpl
new file mode 100644
index 0000000000..1e9edd0592
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/all_extensions/servers-details-resp.json.tpl
@@ -0,0 +1,78 @@
+{
+ "servers": [
+ {
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "key_name": null,
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "config_drive": "",
+ "OS-DCF:diskConfig": "AUTO",
+ "OS-EXT-AZ:availability_zone": "nova",
+ "OS-EXT-SRV-ATTR:host": "%(compute_host)s",
+ "OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
+ "OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
+ "OS-EXT-STS:locked_by": null,
+ "OS-EXT-STS:power_state": 1,
+ "OS-EXT-STS:task_state": null,
+ "OS-EXT-STS:vm_state": "active",
+ "os-extended-volumes:volumes_attached": [],
+ "os-pci:pci_devices": [{"id": 1}],
+ "OS-SRV-USG:launched_at": "%(strtime)s",
+ "OS-SRV-USG:terminated_at": null,
+ "progress": 0,
+ "security_groups": [
+ {
+ "name": "default"
+ }
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/all_extensions/servers-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/all_extensions/servers-list-resp.json.tpl
new file mode 100644
index 0000000000..10a98858bf
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/all_extensions/servers-list-resp.json.tpl
@@ -0,0 +1,18 @@
+{
+ "servers": [
+ {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "new-server-test"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/consoles/consoles-create-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/consoles/consoles-create-req.json.tpl
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/consoles/consoles-create-req.json.tpl
diff --git a/nova/tests/unit/integrated/v3/api_samples/consoles/consoles-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/consoles/consoles-get-resp.json.tpl
new file mode 100644
index 0000000000..a2a6de6ed4
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/consoles/consoles-get-resp.json.tpl
@@ -0,0 +1 @@
+{"console": {"console_type": "fake", "port": 5999, "instance_name": "instance-00000001", "host": "fake", "password": "%(password)s", "id": 1}} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/consoles/consoles-list-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/consoles/consoles-list-get-resp.json.tpl
new file mode 100644
index 0000000000..9d908ad123
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/consoles/consoles-list-get-resp.json.tpl
@@ -0,0 +1 @@
+{"consoles": [{"console_type": "fake", "id": 1}]} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/consoles/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/consoles/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/consoles/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/consoles/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/consoles/server-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/consoles/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/extension-info/extensions-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/extension-info/extensions-get-resp.json.tpl
new file mode 100644
index 0000000000..75d286fb03
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/extension-info/extensions-get-resp.json.tpl
@@ -0,0 +1,8 @@
+{
+ "extension": {
+ "alias": "flavors",
+ "description": "Flavors Extension.",
+ "name": "Flavors",
+ "version": 1
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/extension-info/extensions-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/extension-info/extensions-list-resp.json.tpl
new file mode 100644
index 0000000000..8ddbe20ac7
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/extension-info/extensions-list-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "extensions": [
+ {
+ "alias": "extensions",
+ "description": "Extension information.",
+ "name": "Extensions",
+ "version": 1
+ },
+ {
+ "alias": "flavors",
+ "description": "Flavors Extension.",
+ "name": "Flavors",
+ "version": 1
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-add-tenant-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-add-tenant-req.json.tpl
new file mode 100644
index 0000000000..94f5439e04
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-add-tenant-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "addTenantAccess": {
+ "tenant": "%(tenant_id)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-add-tenant-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-add-tenant-resp.json.tpl
new file mode 100644
index 0000000000..d797155795
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-add-tenant-resp.json.tpl
@@ -0,0 +1,8 @@
+{
+ "flavor_access": [
+ {
+ "flavor_id": "%(flavor_id)s",
+ "tenant_id": "%(tenant_id)s"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-create-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-create-req.json.tpl
new file mode 100644
index 0000000000..02ac4e695d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-create-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "flavor": {
+ "name": "%(flavor_name)s",
+ "ram": 1024,
+ "vcpus": 2,
+ "disk": 10,
+ "id": "%(flavor_id)s",
+ "os-flavor-access:is_public": false
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-create-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-create-resp.json.tpl
new file mode 100644
index 0000000000..bd01300043
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-create-resp.json.tpl
@@ -0,0 +1,23 @@
+{
+ "flavor": {
+ "disk": 10,
+ "id": "%(flavor_id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/%(flavor_id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/%(flavor_id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "%(flavor_name)s",
+ "os-flavor-access:is_public": false,
+ "ram": 1024,
+ "vcpus": 2,
+ "OS-FLV-DISABLED:disabled": false,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "swap": ""
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-detail-resp.json.tpl
new file mode 100644
index 0000000000..5d593b4d62
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-detail-resp.json.tpl
@@ -0,0 +1,109 @@
+{
+ "flavors": [
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 1,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/1",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.tiny",
+ "os-flavor-access:is_public": true,
+ "ram": 512,
+ "swap": "",
+ "vcpus": 1
+ },
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 20,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "2",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/2",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/2",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.small",
+ "os-flavor-access:is_public": true,
+ "ram": 2048,
+ "swap": "",
+ "vcpus": 1
+ },
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 40,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "3",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/3",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/3",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.medium",
+ "os-flavor-access:is_public": true,
+ "ram": 4096,
+ "swap": "",
+ "vcpus": 2
+ },
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 80,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "4",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/4",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/4",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.large",
+ "os-flavor-access:is_public": true,
+ "ram": 8192,
+ "swap": "",
+ "vcpus": 4
+ },
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 160,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "5",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/5",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/5",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.xlarge",
+ "os-flavor-access:is_public": true,
+ "ram": 16384,
+ "swap": "",
+ "vcpus": 8
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-list-resp.json.tpl
new file mode 100644
index 0000000000..a6b6dbdcda
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-list-resp.json.tpl
@@ -0,0 +1,8 @@
+{
+ "flavor_access": [
+ {
+ "flavor_id": "%(flavor_id)s",
+ "tenant_id": "fake_tenant"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-remove-tenant-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-remove-tenant-req.json.tpl
new file mode 100644
index 0000000000..20711e02b4
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-remove-tenant-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "removeTenantAccess": {
+ "tenant": "%(tenant_id)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-remove-tenant-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-remove-tenant-resp.json.tpl
new file mode 100644
index 0000000000..5cab03334d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-remove-tenant-resp.json.tpl
@@ -0,0 +1,3 @@
+{
+ "flavor_access": []
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-show-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-show-resp.json.tpl
new file mode 100644
index 0000000000..255b122b7a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-access/flavor-access-show-resp.json.tpl
@@ -0,0 +1,23 @@
+{
+ "flavor": {
+ "disk": 1,
+ "id": "%(flavor_id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/%(flavor_id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/%(flavor_id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.tiny",
+ "os-flavor-access:is_public": true,
+ "ram": 512,
+ "vcpus": 1,
+ "OS-FLV-DISABLED:disabled": false,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "swap": ""
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-create-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-create-req.json.tpl
new file mode 100644
index 0000000000..dd858e76c5
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-create-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "extra_specs": {
+ "key1": "%(value1)s",
+ "key2": "%(value2)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-create-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-create-resp.json.tpl
new file mode 100644
index 0000000000..dd858e76c5
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-create-resp.json.tpl
@@ -0,0 +1,6 @@
+{
+ "extra_specs": {
+ "key1": "%(value1)s",
+ "key2": "%(value2)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-get-resp.json.tpl
new file mode 100644
index 0000000000..adfa77008f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-get-resp.json.tpl
@@ -0,0 +1,3 @@
+{
+ "key1": "%(value1)s"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-list-resp.json.tpl
new file mode 100644
index 0000000000..dd858e76c5
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-list-resp.json.tpl
@@ -0,0 +1,6 @@
+{
+ "extra_specs": {
+ "key1": "%(value1)s",
+ "key2": "%(value2)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-update-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-update-req.json.tpl
new file mode 100644
index 0000000000..adfa77008f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-update-req.json.tpl
@@ -0,0 +1,3 @@
+{
+ "key1": "%(value1)s"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-update-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-update-resp.json.tpl
new file mode 100644
index 0000000000..adfa77008f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-extra-specs/flavor-extra-specs-update-resp.json.tpl
@@ -0,0 +1,3 @@
+{
+ "key1": "%(value1)s"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-manage/flavor-create-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-manage/flavor-create-post-req.json.tpl
new file mode 100644
index 0000000000..5383e5d15e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-manage/flavor-create-post-req.json.tpl
@@ -0,0 +1,9 @@
+{
+ "flavor": {
+ "name": "%(flavor_name)s",
+ "ram": 1024,
+ "vcpus": 2,
+ "disk": 10,
+ "id": "%(flavor_id)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavor-manage/flavor-create-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavor-manage/flavor-create-post-resp.json.tpl
new file mode 100644
index 0000000000..3f4690b5bf
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavor-manage/flavor-create-post-resp.json.tpl
@@ -0,0 +1,23 @@
+{
+ "flavor": {
+ "disk": 10,
+ "id": "%(flavor_id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/%(flavor_id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/%(flavor_id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "%(flavor_name)s",
+ "os-flavor-access:is_public": true,
+ "ram": 1024,
+ "vcpus": 2,
+ "OS-FLV-DISABLED:disabled": false,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "swap": ""
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavors/flavor-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavors/flavor-get-resp.json.tpl
new file mode 100644
index 0000000000..5f8a90b5f6
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavors/flavor-get-resp.json.tpl
@@ -0,0 +1,23 @@
+{
+ "flavor": {
+ "disk": 1,
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/1",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.tiny",
+ "os-flavor-access:is_public": true,
+ "ram": 512,
+ "vcpus": 1,
+ "OS-FLV-DISABLED:disabled": false,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "swap": ""
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavors/flavors-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavors/flavors-detail-resp.json.tpl
new file mode 100644
index 0000000000..5d593b4d62
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavors/flavors-detail-resp.json.tpl
@@ -0,0 +1,109 @@
+{
+ "flavors": [
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 1,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/1",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.tiny",
+ "os-flavor-access:is_public": true,
+ "ram": 512,
+ "swap": "",
+ "vcpus": 1
+ },
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 20,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "2",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/2",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/2",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.small",
+ "os-flavor-access:is_public": true,
+ "ram": 2048,
+ "swap": "",
+ "vcpus": 1
+ },
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 40,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "3",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/3",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/3",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.medium",
+ "os-flavor-access:is_public": true,
+ "ram": 4096,
+ "swap": "",
+ "vcpus": 2
+ },
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 80,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "4",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/4",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/4",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.large",
+ "os-flavor-access:is_public": true,
+ "ram": 8192,
+ "swap": "",
+ "vcpus": 4
+ },
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 160,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "5",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/5",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/5",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.xlarge",
+ "os-flavor-access:is_public": true,
+ "ram": 16384,
+ "swap": "",
+ "vcpus": 8
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/flavors/flavors-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/flavors/flavors-list-resp.json.tpl
new file mode 100644
index 0000000000..fed9966909
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/flavors/flavors-list-resp.json.tpl
@@ -0,0 +1,74 @@
+{
+ "flavors": [
+ {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/1",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.tiny"
+ },
+ {
+ "id": "2",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/2",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/2",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.small"
+ },
+ {
+ "id": "3",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/3",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/3",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.medium"
+ },
+ {
+ "id": "4",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/4",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/4",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.large"
+ },
+ {
+ "id": "5",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/5",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/5",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.xlarge"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/image-size/image-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/image-size/image-get-resp.json.tpl
new file mode 100644
index 0000000000..9a5ebfbc11
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/image-size/image-get-resp.json.tpl
@@ -0,0 +1,34 @@
+{
+ "image": {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "%(image_id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/%(image_id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/%(image_id)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/%(image_id)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "auto_disk_config": "True",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage7",
+ "OS-EXT-IMG-SIZE:size": %(int)s,
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/image-size/images-details-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/image-size/images-details-get-resp.json.tpl
new file mode 100644
index 0000000000..2eba334009
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/image-size/images-details-get-resp.json.tpl
@@ -0,0 +1,219 @@
+{
+ "images": [
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "70a599e0-31e7-49b7-b260-868f441e862b",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "auto_disk_config": "True",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage7",
+ "OS-EXT-IMG-SIZE:size": %(int)s,
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "OS-EXT-IMG-SIZE:size": %(int)s,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "a2459075-d96c-40d5-893e-577ff92e721c",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/a2459075-d96c-40d5-893e-577ff92e721c",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/a2459075-d96c-40d5-893e-577ff92e721c",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/a2459075-d96c-40d5-893e-577ff92e721c",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "OS-EXT-IMG-SIZE:size": %(int)s,
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "a440c04b-79fa-479c-bed1-0b816eaec379",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/a440c04b-79fa-479c-bed1-0b816eaec379",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/a440c04b-79fa-479c-bed1-0b816eaec379",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/a440c04b-79fa-479c-bed1-0b816eaec379",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "auto_disk_config": "False",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage6",
+ "OS-EXT-IMG-SIZE:size": %(int)s,
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "c905cedb-7281-47e4-8a62-f26bc5fc4c77",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/c905cedb-7281-47e4-8a62-f26bc5fc4c77",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/c905cedb-7281-47e4-8a62-f26bc5fc4c77",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/c905cedb-7281-47e4-8a62-f26bc5fc4c77",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "ramdisk_id": null
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "OS-EXT-IMG-SIZE:size": %(int)s,
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "cedef40a-ed67-4d10-800e-17455edce175",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/cedef40a-ed67-4d10-800e-17455edce175",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/cedef40a-ed67-4d10-800e-17455edce175",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/cedef40a-ed67-4d10-800e-17455edce175",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "OS-EXT-IMG-SIZE:size": %(int)s,
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "76fa36fc-c930-4bf3-8c8a-ea2a2420deb6",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/76fa36fc-c930-4bf3-8c8a-ea2a2420deb6",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/76fa36fc-c930-4bf3-8c8a-ea2a2420deb6",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/76fa36fc-c930-4bf3-8c8a-ea2a2420deb6",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "OS-EXT-IMG-SIZE:size": %(int)s,
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/images/image-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/images/image-get-resp.json.tpl
new file mode 100644
index 0000000000..57ae88548d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/images/image-get-resp.json.tpl
@@ -0,0 +1,33 @@
+{
+ "image": {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "70a599e0-31e7-49b7-b260-868f441e862b",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "auto_disk_config": "True",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage7",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/images/image-meta-key-get.json.tpl b/nova/tests/unit/integrated/v3/api_samples/images/image-meta-key-get.json.tpl
new file mode 100644
index 0000000000..6d022eb97d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/images/image-meta-key-get.json.tpl
@@ -0,0 +1,5 @@
+{
+ "meta": {
+ "kernel_id": "nokernel"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/images/image-meta-key-put-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/images/image-meta-key-put-req.json.tpl
new file mode 100644
index 0000000000..01528f1ce6
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/images/image-meta-key-put-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "meta": {
+ "auto_disk_config": "False"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/images/image-meta-key-put-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/images/image-meta-key-put-resp.json.tpl
new file mode 100644
index 0000000000..3db563ec14
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/images/image-meta-key-put-resp.json.tpl
@@ -0,0 +1,5 @@
+{
+ "meta": {
+ "auto_disk_config": "False"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-get-resp.json.tpl
new file mode 100644
index 0000000000..588f688d5a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-get-resp.json.tpl
@@ -0,0 +1,8 @@
+{
+ "metadata": {
+ "architecture": "x86_64",
+ "auto_disk_config": "True",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-post-req.json.tpl
new file mode 100644
index 0000000000..b51e5f00fc
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-post-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "metadata": {
+ "kernel_id": "False",
+ "Label": "UpdatedImage"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-post-resp.json.tpl
new file mode 100644
index 0000000000..9479bb3395
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-post-resp.json.tpl
@@ -0,0 +1,9 @@
+{
+ "metadata": {
+ "Label": "UpdatedImage",
+ "architecture": "x86_64",
+ "auto_disk_config": "True",
+ "kernel_id": "False",
+ "ramdisk_id": "nokernel"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-put-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-put-req.json.tpl
new file mode 100644
index 0000000000..eec6152d77
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-put-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "metadata": {
+ "auto_disk_config": "True",
+ "Label": "Changed"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-put-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-put-resp.json.tpl
new file mode 100644
index 0000000000..c8c5ee9c4a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/images/image-metadata-put-resp.json.tpl
@@ -0,0 +1,6 @@
+{
+ "metadata": {
+ "Label": "Changed",
+ "auto_disk_config": "True"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/images/images-details-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/images/images-details-get-resp.json.tpl
new file mode 100644
index 0000000000..df8ecad0b8
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/images/images-details-get-resp.json.tpl
@@ -0,0 +1,212 @@
+{
+ "images": [
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "70a599e0-31e7-49b7-b260-868f441e862b",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "auto_disk_config": "True",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage7",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "a2459075-d96c-40d5-893e-577ff92e721c",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/a2459075-d96c-40d5-893e-577ff92e721c",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/a2459075-d96c-40d5-893e-577ff92e721c",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/a2459075-d96c-40d5-893e-577ff92e721c",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "a440c04b-79fa-479c-bed1-0b816eaec379",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/a440c04b-79fa-479c-bed1-0b816eaec379",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/a440c04b-79fa-479c-bed1-0b816eaec379",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/a440c04b-79fa-479c-bed1-0b816eaec379",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "auto_disk_config": "False",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage6",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "c905cedb-7281-47e4-8a62-f26bc5fc4c77",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/c905cedb-7281-47e4-8a62-f26bc5fc4c77",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/c905cedb-7281-47e4-8a62-f26bc5fc4c77",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/c905cedb-7281-47e4-8a62-f26bc5fc4c77",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "ramdisk_id": null
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "cedef40a-ed67-4d10-800e-17455edce175",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/cedef40a-ed67-4d10-800e-17455edce175",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/cedef40a-ed67-4d10-800e-17455edce175",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/cedef40a-ed67-4d10-800e-17455edce175",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "76fa36fc-c930-4bf3-8c8a-ea2a2420deb6",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/76fa36fc-c930-4bf3-8c8a-ea2a2420deb6",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/76fa36fc-c930-4bf3-8c8a-ea2a2420deb6",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/76fa36fc-c930-4bf3-8c8a-ea2a2420deb6",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/images/images-list-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/images/images-list-get-resp.json.tpl
new file mode 100644
index 0000000000..32ebd60cfa
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/images/images-list-get-resp.json.tpl
@@ -0,0 +1,137 @@
+{
+ "images": [
+ {
+ "id": "70a599e0-31e7-49b7-b260-868f441e862b",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "name": "fakeimage7"
+ },
+ {
+ "id": "155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/155d900f-4e14-4e4c-a73d-069cbf4541e6",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "name": "fakeimage123456"
+ },
+ {
+ "id": "a2459075-d96c-40d5-893e-577ff92e721c",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/a2459075-d96c-40d5-893e-577ff92e721c",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/a2459075-d96c-40d5-893e-577ff92e721c",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/a2459075-d96c-40d5-893e-577ff92e721c",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "name": "fakeimage123456"
+ },
+ {
+ "id": "a440c04b-79fa-479c-bed1-0b816eaec379",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/a440c04b-79fa-479c-bed1-0b816eaec379",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/a440c04b-79fa-479c-bed1-0b816eaec379",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/a440c04b-79fa-479c-bed1-0b816eaec379",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "name": "fakeimage6"
+ },
+ {
+ "id": "c905cedb-7281-47e4-8a62-f26bc5fc4c77",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/c905cedb-7281-47e4-8a62-f26bc5fc4c77",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/c905cedb-7281-47e4-8a62-f26bc5fc4c77",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/c905cedb-7281-47e4-8a62-f26bc5fc4c77",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "name": "fakeimage123456"
+ },
+ {
+ "id": "cedef40a-ed67-4d10-800e-17455edce175",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/cedef40a-ed67-4d10-800e-17455edce175",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/cedef40a-ed67-4d10-800e-17455edce175",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/cedef40a-ed67-4d10-800e-17455edce175",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "name": "fakeimage123456"
+ },
+ {
+ "id": "76fa36fc-c930-4bf3-8c8a-ea2a2420deb6",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/images/76fa36fc-c930-4bf3-8c8a-ea2a2420deb6",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/images/76fa36fc-c930-4bf3-8c8a-ea2a2420deb6",
+ "rel": "bookmark"
+ },
+ {
+ "href": "http://glance.openstack.example.com/images/76fa36fc-c930-4bf3-8c8a-ea2a2420deb6",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "name": "fakeimage123456"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-get-resp.json.tpl
new file mode 100644
index 0000000000..4fde60f14b
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-get-resp.json.tpl
@@ -0,0 +1,13 @@
+{
+ "keypair": {
+ "public_key": "%(public_key)s",
+ "name": "%(keypair_name)s",
+ "fingerprint": "%(fingerprint)s",
+ "user_id": "fake",
+ "deleted": false,
+ "created_at": "%(strtime)s",
+ "updated_at": null,
+ "deleted_at": null,
+ "id": 1
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-import-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-import-post-req.json.tpl
new file mode 100644
index 0000000000..2301fa05b2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-import-post-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "keypair": {
+ "name": "%(keypair_name)s",
+ "public_key": "%(public_key)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-import-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-import-post-resp.json.tpl
new file mode 100644
index 0000000000..ca7192d5dc
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-import-post-resp.json.tpl
@@ -0,0 +1,8 @@
+{
+ "keypair": {
+ "fingerprint": "%(fingerprint)s",
+ "name": "%(keypair_name)s",
+ "public_key": "%(public_key)s",
+ "user_id": "fake"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-list-resp.json.tpl
new file mode 100644
index 0000000000..29ba63c00b
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-list-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "keypairs": [
+ {
+ "keypair": {
+ "fingerprint": "%(fingerprint)s",
+ "name": "%(keypair_name)s",
+ "public_key": "%(public_key)s"
+ }
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-post-req.json.tpl
new file mode 100644
index 0000000000..68e2f03487
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-post-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "keypair": {
+ "name": "%(keypair_name)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-post-resp.json.tpl
new file mode 100644
index 0000000000..aace6f5ccc
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/keypairs/keypairs-post-resp.json.tpl
@@ -0,0 +1,9 @@
+{
+ "keypair": {
+ "fingerprint": "%(fingerprint)s",
+ "name": "%(keypair_name)s",
+ "private_key": "%(private_key)s",
+ "public_key": "%(public_key)s",
+ "user_id": "fake"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-action-rebuild-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-action-rebuild-resp.json.tpl
new file mode 100644
index 0000000000..e9b7921f30
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-action-rebuild-resp.json.tpl
@@ -0,0 +1,57 @@
+{
+ "server": {
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4,
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "adminPass": "%(password)s",
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(uuid)s",
+ "image": {
+ "id": "%(image_id)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(image_id)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "meta_var": "meta_val"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake",
+ "accessIPv4": "%(access_ip_v4)s",
+ "accessIPv6": "%(access_ip_v6)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-action-rebuild.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-action-rebuild.json.tpl
new file mode 100644
index 0000000000..603363b409
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-action-rebuild.json.tpl
@@ -0,0 +1,17 @@
+{
+ "rebuild" : {
+ "accessIPv4": "%(access_ip_v4)s",
+ "accessIPv6": "%(access_ip_v6)s",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "name" : "new-server-test",
+ "metadata" : {
+ "meta_var" : "meta_val"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6 b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-get-resp.json.tpl
new file mode 100644
index 0000000000..efe7801174
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-get-resp.json.tpl
@@ -0,0 +1,57 @@
+{
+ "server": {
+ "accessIPv4": "%(access_ip_v4)s",
+ "accessIPv6": "%(access_ip_v6)s",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake",
+ "key_name": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-post-req.json.tpl
new file mode 100644
index 0000000000..780f764cf5
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-post-req.json.tpl
@@ -0,0 +1,18 @@
+{
+ "server" : {
+ "accessIPv4": "%(access_ip_v4)s",
+ "accessIPv6": "%(access_ip_v6)s",
+ "name" : "new-server-test",
+ "imageRef" : "%(host)s/openstack/images/%(image_id)s",
+ "flavorRef" : "%(host)s/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-post-resp.json.tpl
new file mode 100644
index 0000000000..fb0c23b504
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-post-resp.json.tpl
@@ -0,0 +1,18 @@
+{
+ "server": {
+ "accessIPv4": "%(access_ip_v4)s",
+ "accessIPv6": "%(access_ip_v6)s",
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-put-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-put-req.json.tpl
new file mode 100644
index 0000000000..d38d967042
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-put-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "server": {
+ "accessIPv4": "%(access_ip_v4)s",
+ "accessIPv6": "%(access_ip_v6)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-put-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-put-resp.json.tpl
new file mode 100644
index 0000000000..b3e8c665e8
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/server-put-resp.json.tpl
@@ -0,0 +1,56 @@
+{
+ "server": {
+ "accessIPv4": "%(access_ip_v4)s",
+ "accessIPv6": "%(access_ip_v6)s",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-access-ips/servers-details-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/servers-details-resp.json.tpl
new file mode 100644
index 0000000000..041f1a1056
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/servers-details-resp.json.tpl
@@ -0,0 +1,59 @@
+{
+ "servers": [
+ {
+ "accessIPv4": "%(access_ip_v4)s",
+ "accessIPv6": "%(access_ip_v6)s",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake",
+ "key_name": null
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-access-ips/servers-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/servers-list-resp.json.tpl
new file mode 100644
index 0000000000..8797266b68
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-access-ips/servers-list-resp.json.tpl
@@ -0,0 +1,18 @@
+{
+ "servers": [
+ {
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "new-server-test"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-inject-network-info.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-inject-network-info.json.tpl
new file mode 100644
index 0000000000..62e16737b0
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-inject-network-info.json.tpl
@@ -0,0 +1,3 @@
+{
+ "injectNetworkInfo": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-reset-network.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-reset-network.json.tpl
new file mode 100644
index 0000000000..7c79cb68a5
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-reset-network.json.tpl
@@ -0,0 +1,3 @@
+{
+ "resetNetwork": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-reset-server-state.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-reset-server-state.json.tpl
new file mode 100644
index 0000000000..013aed4824
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-reset-server-state.json.tpl
@@ -0,0 +1,5 @@
+{
+ "os-resetState": {
+ "state": "active"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-reset-state.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-reset-state.json.tpl
new file mode 100644
index 0000000000..72d9478678
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/admin-actions-reset-state.json.tpl
@@ -0,0 +1,5 @@
+{
+ 'os-resetState': {
+ 'state': 'active'
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-admin-actions/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-admin-password/admin-password-change-password.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-admin-password/admin-password-change-password.json.tpl
new file mode 100644
index 0000000000..da615718fe
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-admin-password/admin-password-change-password.json.tpl
@@ -0,0 +1,5 @@
+{
+ "changePassword" : {
+ "adminPass" : "%(password)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-admin-password/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-admin-password/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-admin-password/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-admin-password/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-admin-password/server-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-admin-password/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-agents/agent-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-agents/agent-post-req.json.tpl
new file mode 100644
index 0000000000..6dbd2f17cb
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-agents/agent-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "agent": {
+ "hypervisor": "%(hypervisor)s",
+ "os": "%(os)s",
+ "architecture": "%(architecture)s",
+ "version": "%(version)s",
+ "md5hash": "%(md5hash)s",
+ "url": "%(url)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-agents/agent-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-agents/agent-post-resp.json.tpl
new file mode 100644
index 0000000000..24ddede90b
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-agents/agent-post-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "agent": {
+ "agent_id": 1,
+ "architecture": "x86",
+ "hypervisor": "hypervisor",
+ "md5hash": "add6bb58e139be103324d04d82d8f545",
+ "os": "os",
+ "url": "http://example.com/path/to/resource",
+ "version": "8.0"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-agents/agent-update-put-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-agents/agent-update-put-req.json.tpl
new file mode 100644
index 0000000000..d447350e0d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-agents/agent-update-put-req.json.tpl
@@ -0,0 +1,7 @@
+{
+ "para": {
+ "url": "%(url)s",
+ "md5hash": "%(md5hash)s",
+ "version": "%(version)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-agents/agent-update-put-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-agents/agent-update-put-resp.json.tpl
new file mode 100644
index 0000000000..2919d21388
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-agents/agent-update-put-resp.json.tpl
@@ -0,0 +1,8 @@
+{
+ "agent": {
+ "agent_id": "1",
+ "md5hash": "add6bb58e139be103324d04d82d8f545",
+ "url": "http://example.com/path/to/resource",
+ "version": "7.0"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-agents/agents-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-agents/agents-get-resp.json.tpl
new file mode 100644
index 0000000000..92e14e1dc5
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-agents/agents-get-resp.json.tpl
@@ -0,0 +1,13 @@
+{
+ "agents": [
+ {
+ "agent_id": 1,
+ "architecture": "x86",
+ "hypervisor": "hypervisor",
+ "md5hash": "add6bb58e139be103324d04d82d8f545",
+ "os": "os",
+ "url": "http://example.com/path/to/resource",
+ "version": "8.0"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-add-host-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-add-host-post-req.json.tpl
new file mode 100644
index 0000000000..97395bf2f2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-add-host-post-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "add_host": {
+ "host": "%(host_name)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-metadata-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-metadata-post-req.json.tpl
new file mode 100644
index 0000000000..63a2921cac
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-metadata-post-req.json.tpl
@@ -0,0 +1,9 @@
+{
+ "set_metadata":
+ {
+ "metadata":
+ {
+ "key": "value"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-post-req.json.tpl
new file mode 100644
index 0000000000..fc806061e8
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-post-req.json.tpl
@@ -0,0 +1,7 @@
+{
+ "aggregate":
+ {
+ "name": "name",
+ "availability_zone": "nova"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-post-resp.json.tpl
new file mode 100644
index 0000000000..935643d03c
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-post-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "aggregate": {
+ "availability_zone": "nova",
+ "created_at": "%(strtime)s",
+ "deleted": false,
+ "deleted_at": null,
+ "id": %(aggregate_id)s,
+ "name": "name",
+ "updated_at": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-remove-host-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-remove-host-post-req.json.tpl
new file mode 100644
index 0000000000..4663e52931
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-remove-host-post-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "remove_host": {
+ "host": "%(host_name)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-update-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-update-post-req.json.tpl
new file mode 100644
index 0000000000..55e4b09346
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-update-post-req.json.tpl
@@ -0,0 +1,7 @@
+{
+ "aggregate":
+ {
+ "name": "newname",
+ "availability_zone": "nova2"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-update-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-update-post-resp.json.tpl
new file mode 100644
index 0000000000..2e229a473a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregate-update-post-resp.json.tpl
@@ -0,0 +1,15 @@
+{
+ "aggregate": {
+ "availability_zone": "nova2",
+ "created_at": "%(strtime)s",
+ "deleted": false,
+ "deleted_at": null,
+ "hosts": [],
+ "id": 1,
+ "metadata": {
+ "availability_zone": "nova2"
+ },
+ "name": "newname",
+ "updated_at": "%(strtime)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-add-host-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-add-host-post-resp.json.tpl
new file mode 100644
index 0000000000..e5775c206d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-add-host-post-resp.json.tpl
@@ -0,0 +1,17 @@
+{
+ "aggregate": {
+ "availability_zone": "nova",
+ "created_at": "%(strtime)s",
+ "deleted": false,
+ "deleted_at": null,
+ "hosts": [
+ "%(compute_host)s"
+ ],
+ "id": 1,
+ "metadata": {
+ "availability_zone": "nova"
+ },
+ "name": "name",
+ "updated_at": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-get-resp.json.tpl
new file mode 100644
index 0000000000..b91781fae2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-get-resp.json.tpl
@@ -0,0 +1,15 @@
+{
+ "aggregate": {
+ "availability_zone": "nova",
+ "created_at": "%(strtime)s",
+ "deleted": false,
+ "deleted_at": null,
+ "hosts": [],
+ "id": 1,
+ "metadata": {
+ "availability_zone": "nova"
+ },
+ "name": "name",
+ "updated_at": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-list-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-list-get-resp.json.tpl
new file mode 100644
index 0000000000..642653d1e6
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-list-get-resp.json.tpl
@@ -0,0 +1,17 @@
+{
+ "aggregates": [
+ {
+ "availability_zone": "nova",
+ "created_at": "%(strtime)s",
+ "deleted": false,
+ "deleted_at": null,
+ "hosts": [],
+ "id": 1,
+ "metadata": {
+ "availability_zone": "nova"
+ },
+ "name": "name",
+ "updated_at": null
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-metadata-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-metadata-post-resp.json.tpl
new file mode 100644
index 0000000000..b15c40fa5d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-metadata-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "aggregate": {
+ "availability_zone": "nova",
+ "created_at": "%(strtime)s",
+ "deleted": false,
+ "deleted_at": null,
+ "hosts": [],
+ "id": 1,
+ "metadata": {
+ "availability_zone": "nova",
+ "key": "value"
+ },
+ "name": "name",
+ "updated_at": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-remove-host-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-remove-host-post-resp.json.tpl
new file mode 100644
index 0000000000..b91781fae2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-aggregates/aggregates-remove-host-post-resp.json.tpl
@@ -0,0 +1,15 @@
+{
+ "aggregate": {
+ "availability_zone": "nova",
+ "created_at": "%(strtime)s",
+ "deleted": false,
+ "deleted_at": null,
+ "hosts": [],
+ "id": 1,
+ "metadata": {
+ "availability_zone": "nova"
+ },
+ "name": "name",
+ "updated_at": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-create-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-create-req.json.tpl
new file mode 100644
index 0000000000..11dcf64373
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-create-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "interfaceAttachment": {
+ "port_id": "ce531f90-199f-48c0-816c-13e38010b442"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-create-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-create-resp.json.tpl
new file mode 100644
index 0000000000..9dff234366
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-create-resp.json.tpl
@@ -0,0 +1,14 @@
+{
+ "interfaceAttachment": {
+ "fixed_ips": [
+ {
+ "ip_address": "192.168.1.3",
+ "subnet_id": "f8a6e8f8-c2ec-497c-9f23-da9616de54ef"
+ }
+ ],
+ "mac_addr": "fa:16:3e:4c:2c:30",
+ "net_id": "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
+ "port_id": "ce531f90-199f-48c0-816c-13e38010b442",
+ "port_state": "ACTIVE"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-list-resp.json.tpl
new file mode 100644
index 0000000000..192f9a6487
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-list-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "interfaceAttachments": [
+ {
+ "fixed_ips": [
+ {
+ "ip_address": "192.168.1.3",
+ "subnet_id": "f8a6e8f8-c2ec-497c-9f23-da9616de54ef"
+ }
+ ],
+ "mac_addr": "fa:16:3e:4c:2c:30",
+ "net_id": "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
+ "port_id": "ce531f90-199f-48c0-816c-13e38010b442",
+ "port_state": "ACTIVE"
+ }
+ ]
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-show-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-show-resp.json.tpl
new file mode 100644
index 0000000000..9dff234366
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/attach-interfaces-show-resp.json.tpl
@@ -0,0 +1,14 @@
+{
+ "interfaceAttachment": {
+ "fixed_ips": [
+ {
+ "ip_address": "192.168.1.3",
+ "subnet_id": "f8a6e8f8-c2ec-497c-9f23-da9616de54ef"
+ }
+ ],
+ "mac_addr": "fa:16:3e:4c:2c:30",
+ "net_id": "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
+ "port_id": "ce531f90-199f-48c0-816c-13e38010b442",
+ "port_state": "ACTIVE"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/server-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-attach-interfaces/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-availability-zone/availability-zone-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-availability-zone/availability-zone-detail-resp.json.tpl
new file mode 100644
index 0000000000..d1b610e944
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-availability-zone/availability-zone-detail-resp.json.tpl
@@ -0,0 +1,69 @@
+{
+ "availabilityZoneInfo": [
+ {
+ "hosts": {
+ "consoleauth": {
+ "nova-consoleauth": {
+ "active": true,
+ "available": true,
+ "updated_at": %(strtime_or_none)s
+ }
+ },
+ "cert": {
+ "nova-cert": {
+ "active": true,
+ "available": true,
+ "updated_at": %(strtime_or_none)s
+ }
+ },
+ "conductor": {
+ "nova-conductor": {
+ "active": true,
+ "available": true,
+ "updated_at": %(strtime_or_none)s
+ }
+ },
+ "cells": {
+ "nova-cells": {
+ "active": true,
+ "available": true,
+ "updated_at": %(strtime_or_none)s
+ }
+ },
+ "scheduler": {
+ "nova-scheduler": {
+ "active": true,
+ "available": true,
+ "updated_at": %(strtime_or_none)s
+ }
+ },
+ "network": {
+ "nova-network": {
+ "active": true,
+ "available": true,
+ "updated_at": %(strtime_or_none)s
+ }
+ }
+ },
+ "zoneName": "internal",
+ "zoneState": {
+ "available": true
+ }
+ },
+ {
+ "hosts": {
+ "compute": {
+ "nova-compute": {
+ "active": true,
+ "available": true,
+ "updated_at": %(strtime_or_none)s
+ }
+ }
+ },
+ "zoneName": "nova",
+ "zoneState": {
+ "available": true
+ }
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-availability-zone/availability-zone-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-availability-zone/availability-zone-list-resp.json.tpl
new file mode 100644
index 0000000000..8190c5492f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-availability-zone/availability-zone-list-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "availabilityZoneInfo": [
+ {
+ "hosts": null,
+ "zoneName": "nova",
+ "zoneState": {
+ "available": true
+ }
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-availability-zone/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-availability-zone/server-post-req.json.tpl
new file mode 100644
index 0000000000..dcc1142f47
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-availability-zone/server-post-req.json.tpl
@@ -0,0 +1,17 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(host)s/openstack/images/%(image_id)s",
+ "flavorRef" : "%(host)s/openstack/flavors/1",
+ "availability_zone": "nova",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-availability-zone/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-availability-zone/server-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-availability-zone/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-cells/cells-capacities-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-cells/cells-capacities-resp.json.tpl
new file mode 100644
index 0000000000..5e067dd3aa
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-cells/cells-capacities-resp.json.tpl
@@ -0,0 +1,26 @@
+{
+ "cell": {
+ "capacities": {
+ "disk_free": {
+ "total_mb": 1052672,
+ "units_by_mb": {
+ "0": 0,
+ "163840": 5,
+ "20480": 46,
+ "40960": 23,
+ "81920": 11
+ }
+ },
+ "ram_free": {
+ "total_mb": 7680,
+ "units_by_mb": {
+ "16384": 0,
+ "2048": 3,
+ "4096": 1,
+ "512": 13,
+ "8192": 0
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-cells/cells-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-cells/cells-get-resp.json.tpl
new file mode 100644
index 0000000000..62eb8ec31d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-cells/cells-get-resp.json.tpl
@@ -0,0 +1,9 @@
+{
+ "cell": {
+ "name": "cell3",
+ "rpc_host": null,
+ "rpc_port": null,
+ "type": "child",
+ "username": "username3"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-cells/cells-list-empty-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-cells/cells-list-empty-resp.json.tpl
new file mode 100644
index 0000000000..5325a4e855
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-cells/cells-list-empty-resp.json.tpl
@@ -0,0 +1,3 @@
+{
+ "cells": []
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-cells/cells-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-cells/cells-list-resp.json.tpl
new file mode 100644
index 0000000000..97ea4c6dd3
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-cells/cells-list-resp.json.tpl
@@ -0,0 +1,39 @@
+{
+ "cells": [
+ {
+ "name": "cell1",
+ "rpc_host": null,
+ "rpc_port": null,
+ "type": "child",
+ "username": "username1"
+ },
+ {
+ "name": "cell3",
+ "rpc_host": null,
+ "rpc_port": null,
+ "type": "child",
+ "username": "username3"
+ },
+ {
+ "name": "cell5",
+ "rpc_host": null,
+ "rpc_port": null,
+ "type": "child",
+ "username": "username5"
+ },
+ {
+ "name": "cell2",
+ "rpc_host": null,
+ "rpc_port": null,
+ "type": "parent",
+ "username": "username2"
+ },
+ {
+ "name": "cell4",
+ "rpc_host": null,
+ "rpc_port": null,
+ "type": "parent",
+ "username": "username4"
+ }
+ ]
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-certificates/certificate-create-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-certificates/certificate-create-req.json.tpl
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-certificates/certificate-create-req.json.tpl
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-certificates/certificate-create-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-certificates/certificate-create-resp.json.tpl
new file mode 100644
index 0000000000..35c063c820
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-certificates/certificate-create-resp.json.tpl
@@ -0,0 +1,6 @@
+{
+ "certificate": {
+ "data": "%(text)s",
+ "private_key": "%(text)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-certificates/certificate-get-root-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-certificates/certificate-get-root-resp.json.tpl
new file mode 100644
index 0000000000..4938e92fba
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-certificates/certificate-get-root-resp.json.tpl
@@ -0,0 +1,6 @@
+{
+ "certificate": {
+ "data": "%(text)s",
+ "private_key": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-create-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-create-req.json.tpl
new file mode 100644
index 0000000000..c8fc75995a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-create-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "cloudpipe": {
+ "project_id": "%(project_id)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-create-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-create-resp.json.tpl
new file mode 100644
index 0000000000..6aa2ff60e2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-create-resp.json.tpl
@@ -0,0 +1,3 @@
+{
+ "instance_id": "%(id)s"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-get-resp.json.tpl
new file mode 100644
index 0000000000..698008802e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-get-resp.json.tpl
@@ -0,0 +1,13 @@
+{
+ "cloudpipes": [
+ {
+ "created_at": "%(isotime)s",
+ "instance_id": "%(uuid)s",
+ "internal_ip": "%(ip)s",
+ "project_id": "%(project_id)s",
+ "public_ip": "%(ip)s",
+ "public_port": 22,
+ "state": "down"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-update-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-update-req.json.tpl
new file mode 100644
index 0000000000..0ab9141aea
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-cloudpipe/cloud-pipe-update-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "configure_project": {
+ "vpn_ip": "%(vpn_ip)s",
+ "vpn_port": "%(vpn_port)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-config-drive/server-config-drive-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-config-drive/server-config-drive-get-resp.json.tpl
new file mode 100644
index 0000000000..a9e9bc6564
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-config-drive/server-config-drive-get-resp.json.tpl
@@ -0,0 +1,56 @@
+{
+ "server": {
+ "config_drive": "%(cdrive)s",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake",
+ "key_name": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-config-drive/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-config-drive/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-config-drive/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-config-drive/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-config-drive/server-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-config-drive/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-config-drive/servers-config-drive-details-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-config-drive/servers-config-drive-details-resp.json.tpl
new file mode 100644
index 0000000000..21ed41cf7d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-config-drive/servers-config-drive-details-resp.json.tpl
@@ -0,0 +1,58 @@
+{
+ "servers": [
+ {
+ "config_drive": "%(cdrive)s",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake",
+ "key_name": null
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/get-console-connect-info-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/get-console-connect-info-get-resp.json.tpl
new file mode 100644
index 0000000000..f5be11801e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/get-console-connect-info-get-resp.json.tpl
@@ -0,0 +1,8 @@
+{
+ "console": {
+ "instance_uuid": "%(id)s",
+ "host": "%(host)s",
+ "port": %(port)s,
+ "internal_access_path": "%(internal_access_path)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/get-rdp-console-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/get-rdp-console-post-req.json.tpl
new file mode 100644
index 0000000000..00956b90e4
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/get-rdp-console-post-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "os-getRDPConsole": {
+ "type": "rdp-html5"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-console-auth-tokens/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-console-output/console-output-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-console-output/console-output-post-req.json.tpl
new file mode 100644
index 0000000000..caeb2a5502
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-console-output/console-output-post-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "os-getConsoleOutput": {
+ "length": 50
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-console-output/console-output-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-console-output/console-output-post-resp.json.tpl
new file mode 100644
index 0000000000..27ffe7d4c2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-console-output/console-output-post-resp.json.tpl
@@ -0,0 +1,3 @@
+{
+ "output": "FAKE CONSOLE OUTPUT\nANOTHER\nLAST LINE"
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-console-output/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-console-output/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-console-output/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-console-output/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-console-output/server-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-console-output/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-create-backup/create-backup-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-create-backup/create-backup-req.json.tpl
new file mode 100644
index 0000000000..60f5e1d9fe
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-create-backup/create-backup-req.json.tpl
@@ -0,0 +1,7 @@
+{
+ "createBackup": {
+ "name": "Backup 1",
+ "backup_type": "daily",
+ "rotation": 1
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-create-backup/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-create-backup/server-post-req.json.tpl
new file mode 100644
index 0000000000..27557a3e9f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-create-backup/server-post-req.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-create-backup/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-create-backup/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-create-backup/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/force-delete-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/force-delete-post-req.json.tpl
new file mode 100644
index 0000000000..d3562d390d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/force-delete-post-req.json.tpl
@@ -0,0 +1,3 @@
+{
+ "forceDelete": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/restore-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/restore-post-req.json.tpl
new file mode 100644
index 0000000000..d38291fe08
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/restore-post-req.json.tpl
@@ -0,0 +1,3 @@
+{
+ "restore": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-deferred-delete/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-disk-config/image-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/image-get-resp.json.tpl
new file mode 100644
index 0000000000..b79c7c857e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/image-get-resp.json.tpl
@@ -0,0 +1,34 @@
+{
+ "image": {
+ "OS-DCF:diskConfig": "AUTO",
+ "created": "2011-01-01T01:02:03Z",
+ "id": "%(image_id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/%(image_id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/%(image_id)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/%(image_id)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "auto_disk_config": "True",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage7",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-disk-config/image-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/image-list-resp.json.tpl
new file mode 100644
index 0000000000..f74aeb7c85
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/image-list-resp.json.tpl
@@ -0,0 +1,214 @@
+{
+ "images": [
+ {
+ "OS-DCF:diskConfig": "AUTO",
+ "created": "2011-01-01T01:02:03Z",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/%(id)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/%(id)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "auto_disk_config": "True",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage7",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/%(id)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/%(id)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/%(uuid)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "OS-DCF:diskConfig": "MANUAL",
+ "created": "2011-01-01T01:02:03Z",
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/%(uuid)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "auto_disk_config": "False",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage6",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/%(id)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/%(id)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "%(id)s",
+ "ramdisk_id": null
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/%(id)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/%(id)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ },
+ {
+ "created": "2011-01-01T01:02:03Z",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/images/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/images/%(id)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/images/%(id)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "2011-01-01T01:02:03Z"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-disk-config/list-servers-detail-get.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/list-servers-detail-get.json.tpl
new file mode 100644
index 0000000000..8a08b3e011
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/list-servers-detail-get.json.tpl
@@ -0,0 +1,58 @@
+{
+ "servers": [
+ {
+ "OS-DCF:diskConfig": "AUTO",
+ "addresses": {
+ "private": [
+ {
+ "addr": "192.168.0.3",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "key_name": null,
+ "user_id": "fake"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-action-rebuild-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-action-rebuild-req.json.tpl
new file mode 100644
index 0000000000..3d98b99bcb
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-action-rebuild-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "rebuild": {
+ "imageRef" : "%(host)s/images/%(image_id)s",
+ "OS-DCF:diskConfig": "AUTO"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-action-rebuild-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-action-rebuild-resp.json.tpl
new file mode 100644
index 0000000000..ebb5f3d8a0
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-action-rebuild-resp.json.tpl
@@ -0,0 +1,56 @@
+{
+ "server": {
+ "OS-DCF:diskConfig": "AUTO",
+ "addresses": {
+ "private": [
+ {
+ "addr": "192.168.0.3",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "adminPass": "%(password)s",
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-get-resp.json.tpl
new file mode 100644
index 0000000000..f60c4af52f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-get-resp.json.tpl
@@ -0,0 +1,56 @@
+{
+ "server": {
+ "OS-DCF:diskConfig": "AUTO",
+ "addresses": {
+ "private": [
+ {
+ "addr": "192.168.0.3",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "key_name": null,
+ "user_id": "fake"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-post-req.json.tpl
new file mode 100644
index 0000000000..c012c48318
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-post-req.json.tpl
@@ -0,0 +1,17 @@
+{
+ "server" : {
+ "OS-DCF:diskConfig": "AUTO",
+ "name" : "new-server-test",
+ "imageRef" : "%(host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-post-resp.json.tpl
new file mode 100644
index 0000000000..91aa3432ea
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-post-resp.json.tpl
@@ -0,0 +1,17 @@
+{
+ "server": {
+ "OS-DCF:diskConfig": "AUTO",
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-resize-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-resize-post-req.json.tpl
new file mode 100644
index 0000000000..a290485e1c
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-resize-post-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "resize": {
+ "flavorRef": "3",
+ "OS-DCF:diskConfig": "AUTO"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-update-put-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-update-put-req.json.tpl
new file mode 100644
index 0000000000..4ac22820df
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-update-put-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "server": {
+ "OS-DCF:diskConfig": "AUTO"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-update-put-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-update-put-resp.json.tpl
new file mode 100644
index 0000000000..26cf74e80a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-disk-config/server-update-put-resp.json.tpl
@@ -0,0 +1,55 @@
+{
+ "server": {
+ "OS-DCF:diskConfig": "AUTO",
+ "addresses": {
+ "private": [
+ {
+ "addr": "192.168.0.3",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-find-host-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-find-host-req.json.tpl
new file mode 100644
index 0000000000..5e2c2e6ef0
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-find-host-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "evacuate": {
+ "adminPass": "%(adminPass)s",
+ "onSharedStorage": "%(onSharedStorage)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-find-host-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-find-host-resp.json.tpl
new file mode 100644
index 0000000000..0da07da5b8
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-find-host-resp.json.tpl
@@ -0,0 +1,3 @@
+{
+ "adminPass": "%(password)s"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-req.json.tpl
new file mode 100644
index 0000000000..179cddce73
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-req.json.tpl
@@ -0,0 +1,7 @@
+{
+ "evacuate": {
+ "host": "%(host)s",
+ "adminPass": "%(adminPass)s",
+ "onSharedStorage": "%(onSharedStorage)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-resp.json.tpl
new file mode 100644
index 0000000000..0da07da5b8
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-evacuate-resp.json.tpl
@@ -0,0 +1,3 @@
+{
+ "adminPass": "%(password)s"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-evacuate/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/server-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/server-get-resp.json.tpl
new file mode 100644
index 0000000000..d6436738ef
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/server-get-resp.json.tpl
@@ -0,0 +1,56 @@
+{
+ "server": {
+ "updated": "%(isotime)s",
+ "created": "%(isotime)s",
+ "OS-EXT-AZ:availability_zone": "nova",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4,
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(uuid)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "user_id": "fake",
+ "key_name": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/servers-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/servers-detail-resp.json.tpl
new file mode 100644
index 0000000000..c81acaf935
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-availability-zone/servers-detail-resp.json.tpl
@@ -0,0 +1,58 @@
+{
+ "servers": [
+ {
+ "updated": "%(isotime)s",
+ "created": "%(isotime)s",
+ "OS-EXT-AZ:availability_zone": "nova",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4,
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(uuid)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "user_id": "fake",
+ "key_name": null
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/server-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/server-get-resp.json.tpl
new file mode 100644
index 0000000000..a4c68a3e8b
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/server-get-resp.json.tpl
@@ -0,0 +1,58 @@
+{
+ "server": {
+ "OS-EXT-SRV-ATTR:host": "%(compute_host)s",
+ "OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
+ "OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
+ "updated": "%(isotime)s",
+ "created": "%(isotime)s",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4,
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(uuid)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "user_id": "fake",
+ "key_name": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/servers-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/servers-detail-resp.json.tpl
new file mode 100644
index 0000000000..8fc7dbcc4e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-server-attributes/servers-detail-resp.json.tpl
@@ -0,0 +1,60 @@
+{
+ "servers": [
+ {
+ "OS-EXT-SRV-ATTR:host": "%(compute_host)s",
+ "OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
+ "OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
+ "updated": "%(isotime)s",
+ "created": "%(isotime)s",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4,
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(uuid)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "user_id": "fake",
+ "key_name": null
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-status/server-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-status/server-get-resp.json.tpl
new file mode 100644
index 0000000000..a0b73e41d2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-status/server-get-resp.json.tpl
@@ -0,0 +1,60 @@
+{
+ "server": {
+ "OS-EXT-STS:task_state": null,
+ "OS-EXT-STS:vm_state": "active",
+ "OS-EXT-STS:power_state": 1,
+ "OS-EXT-STS:locked_by": null,
+ "updated": "%(isotime)s",
+ "created": "%(isotime)s",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4,
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(uuid)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "user_id": "fake",
+ "key_name": null
+ }
+}
+
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-status/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-status/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-status/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-status/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-status/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-status/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-status/servers-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-status/servers-detail-resp.json.tpl
new file mode 100644
index 0000000000..b8e17cd8cf
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-status/servers-detail-resp.json.tpl
@@ -0,0 +1,60 @@
+{
+ "servers": [
+ {
+ "OS-EXT-STS:task_state": null,
+ "OS-EXT-STS:vm_state": "active",
+ "OS-EXT-STS:power_state": 1,
+ "OS-EXT-STS:locked_by": null,
+ "updated": "%(isotime)s",
+ "created": "%(isotime)s",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4,
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(uuid)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "user_id": "fake",
+ "key_name": null
+ }]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/attach-volume-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/attach-volume-req.json.tpl
new file mode 100644
index 0000000000..683f67c98b
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/attach-volume-req.json.tpl
@@ -0,0 +1,8 @@
+{
+ "attach": {
+ "volume_id": "%(volume_id)s",
+ "device": "%(device)s",
+ "disk_bus": "%(disk_bus)s",
+ "device_type": "%(device_type)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/detach-volume-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/detach-volume-req.json.tpl
new file mode 100644
index 0000000000..c56f3c3b83
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/detach-volume-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "detach": {
+ "volume_id": "%(volume_id)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/server-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/server-get-resp.json.tpl
new file mode 100644
index 0000000000..1a28dd80ef
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/server-get-resp.json.tpl
@@ -0,0 +1,59 @@
+{
+ "server": {
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake",
+ "os-extended-volumes:volumes_attached": [
+ {"id": "volume_id1"},
+ {"id": "volume_id2"}
+ ],
+ "key_name": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/servers-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/servers-detail-resp.json.tpl
new file mode 100644
index 0000000000..bb8a9bb9cb
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/servers-detail-resp.json.tpl
@@ -0,0 +1,60 @@
+{
+ "servers": [
+ {
+ "updated": "%(isotime)s",
+ "created": "%(isotime)s",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4,
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(uuid)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "user_id": "fake",
+ "os-extended-volumes:volumes_attached": [
+ {"id": "volume_id1"},
+ {"id": "volume_id2"}
+ ],
+ "key_name": null
+ }]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/swap-volume-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/swap-volume-req.json.tpl
new file mode 100644
index 0000000000..07a3268421
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-extended-volumes/swap-volume-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "swap_volume_attachment": {
+ "old_volume_id": "%(old_volume_id)s",
+ "new_volume_id": "%(new_volume_id)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-fixed-ips/fixedip-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-fixed-ips/fixedip-post-req.json.tpl
new file mode 100644
index 0000000000..85ae4890ad
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-fixed-ips/fixedip-post-req.json.tpl
@@ -0,0 +1,3 @@
+{
+ "reserve": "%(reserve)s"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-fixed-ips/fixedips-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-fixed-ips/fixedips-get-resp.json.tpl
new file mode 100644
index 0000000000..a3d11475bf
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-fixed-ips/fixedips-get-resp.json.tpl
@@ -0,0 +1,8 @@
+{
+ "fixed_ip": {
+ "cidr": "%(cidr)s",
+ "hostname": "%(hostname)s",
+ "host": "%(host)s",
+ "address": "%(address)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json.tpl
new file mode 100644
index 0000000000..75d8f5aacd
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json.tpl
@@ -0,0 +1,24 @@
+{
+ "flavor": {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 1,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "1",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/flavors/1",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/flavors/1",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.tiny",
+ "os-flavor-access:is_public": true,
+ "ram": 512,
+ "rxtx_factor": 1.0,
+ "swap": "",
+ "vcpus": 1
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json.tpl
new file mode 100644
index 0000000000..1f7ea26cb0
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json.tpl
@@ -0,0 +1,114 @@
+{
+ "flavors": [
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 1,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "1",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/flavors/1",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/flavors/1",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.tiny",
+ "os-flavor-access:is_public": true,
+ "ram": 512,
+ "rxtx_factor": 1.0,
+ "swap": "",
+ "vcpus": 1
+ },
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 20,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "2",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/flavors/2",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/flavors/2",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.small",
+ "os-flavor-access:is_public": true,
+ "ram": 2048,
+ "rxtx_factor": 1.0,
+ "swap": "",
+ "vcpus": 1
+ },
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 40,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "3",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/flavors/3",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/flavors/3",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.medium",
+ "os-flavor-access:is_public": true,
+ "ram": 4096,
+ "rxtx_factor": 1.0,
+ "swap": "",
+ "vcpus": 2
+ },
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 80,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "4",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/flavors/4",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/flavors/4",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.large",
+ "os-flavor-access:is_public": true,
+ "ram": 8192,
+ "rxtx_factor": 1.0,
+ "swap": "",
+ "vcpus": 4
+ },
+ {
+ "OS-FLV-DISABLED:disabled": false,
+ "disk": 160,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "id": "5",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/flavors/5",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/flavors/5",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.xlarge",
+ "os-flavor-access:is_public": true,
+ "ram": 16384,
+ "rxtx_factor": 1.0,
+ "swap": "",
+ "vcpus": 8
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.json.tpl
new file mode 100644
index 0000000000..70d0a57de8
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "flavor": {
+ "name": "%(flavor_name)s",
+ "ram": 1024,
+ "vcpus": 2,
+ "disk": 10,
+ "id": "%(flavor_id)s",
+ "rxtx_factor": 2.0
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.json.tpl
new file mode 100644
index 0000000000..d3b4c231b2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.json.tpl
@@ -0,0 +1,24 @@
+{
+ "flavor": {
+ "disk": 10,
+ "id": "%(flavor_id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/flavors/%(flavor_id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/flavors/%(flavor_id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "%(flavor_name)s",
+ "os-flavor-access:is_public": true,
+ "ram": 1024,
+ "rxtx_factor": 2.0,
+ "vcpus": 2,
+ "OS-FLV-DISABLED:disabled": false,
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "swap": ""
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.json.tpl
new file mode 100644
index 0000000000..000c5e1231
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "dns_entry": {
+ "ip": "%(ip)s",
+ "dns_type": "%(dns_type)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.json.tpl
new file mode 100644
index 0000000000..3ec0743ba7
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.json.tpl
@@ -0,0 +1,9 @@
+{
+ "dns_entry": {
+ "domain": "%(domain)s",
+ "id": null,
+ "ip": "%(ip)s",
+ "name": "%(name)s",
+ "type": "%(dns_type)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.json.tpl
new file mode 100644
index 0000000000..f6685f5d3f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "domain_entry": {
+ "scope": "%(scope)s",
+ "project": "%(project)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.json.tpl
new file mode 100644
index 0000000000..a14d395d23
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.json.tpl
@@ -0,0 +1,8 @@
+{
+ "domain_entry": {
+ "availability_zone": null,
+ "domain": "%(domain)s",
+ "project": "%(project)s",
+ "scope": "%(scope)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.json.tpl
new file mode 100644
index 0000000000..8edd0603f7
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.json.tpl
@@ -0,0 +1,9 @@
+{
+ "dns_entry": {
+ "domain": "%(domain)s",
+ "id": null,
+ "ip": "%(ip)s",
+ "name": "%(name)s",
+ "type": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.json.tpl
new file mode 100644
index 0000000000..831cda7b55
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "dns_entries": [
+ {
+ "domain": "%(domain)s",
+ "id": null,
+ "ip": "%(ip)s",
+ "name": "%(name)s",
+ "type": null
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.json.tpl
new file mode 100644
index 0000000000..a6055cfecc
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.json.tpl
@@ -0,0 +1,10 @@
+{
+ "domain_entries": [
+ {
+ "availability_zone": null,
+ "domain": "%(domain)s",
+ "project": "%(project)s",
+ "scope": "%(scope)s"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-pools/floatingippools-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-pools/floatingippools-list-resp.json.tpl
new file mode 100644
index 0000000000..607109d70d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ip-pools/floatingippools-list-resp.json.tpl
@@ -0,0 +1,10 @@
+{
+ "floating_ip_pools": [
+ {
+ "name": "%(pool1)s"
+ },
+ {
+ "name": "%(pool2)s"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-create-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-create-req.json.tpl
new file mode 100644
index 0000000000..2f16cf07cb
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-create-req.json.tpl
@@ -0,0 +1,7 @@
+{
+ "floating_ips_bulk_create": {
+ "ip_range": "%(ip_range)s",
+ "pool": "%(pool)s",
+ "interface": "%(interface)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-create-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-create-resp.json.tpl
new file mode 100644
index 0000000000..ef1cbfb17f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-create-resp.json.tpl
@@ -0,0 +1,7 @@
+{
+ "floating_ips_bulk_create": {
+ "interface": "eth0",
+ "ip_range": "192.168.1.0/24",
+ "pool": "nova"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-delete-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-delete-req.json.tpl
new file mode 100644
index 0000000000..d630d669cd
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-delete-req.json.tpl
@@ -0,0 +1,3 @@
+{
+ "ip_range": "%(ip_range)s"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-delete-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-delete-resp.json.tpl
new file mode 100644
index 0000000000..166984b24a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-delete-resp.json.tpl
@@ -0,0 +1,3 @@
+{
+ "floating_ips_bulk_delete": "192.168.1.0/24"
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-list-by-host-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-list-by-host-resp.json.tpl
new file mode 100644
index 0000000000..0eaaf75ae0
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-list-by-host-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "floating_ip_info": [
+ {
+ "address": "10.10.10.3",
+ "instance_uuid": null,
+ "interface": "eth0",
+ "pool": "nova",
+ "project_id": null
+ }
+ ]
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-list-resp.json.tpl
new file mode 100644
index 0000000000..de1e622bb1
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-floating-ips-bulk/floating-ips-bulk-list-resp.json.tpl
@@ -0,0 +1,25 @@
+{
+ "floating_ip_info": [
+ {
+ "address": "10.10.10.1",
+ "instance_uuid": null,
+ "interface": "eth0",
+ "pool": "nova",
+ "project_id": null
+ },
+ {
+ "address": "10.10.10.2",
+ "instance_uuid": null,
+ "interface": "eth0",
+ "pool": "nova",
+ "project_id": null
+ },
+ {
+ "address": "10.10.10.3",
+ "instance_uuid": null,
+ "interface": "eth0",
+ "pool": "nova",
+ "project_id": null
+ }
+ ]
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-fping/fping-get-details-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-fping/fping-get-details-resp.json.tpl
new file mode 100644
index 0000000000..f3b222c399
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-fping/fping-get-details-resp.json.tpl
@@ -0,0 +1,7 @@
+{
+ "server": {
+ "alive": false,
+ "id": "%(uuid)s",
+ "project_id": "openstack"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-fping/fping-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-fping/fping-get-resp.json.tpl
new file mode 100644
index 0000000000..b33e80668b
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-fping/fping-get-resp.json.tpl
@@ -0,0 +1,9 @@
+{
+ "servers": [
+ {
+ "alive": false,
+ "id": "%(uuid)s",
+ "project_id": "openstack"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-fping/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-fping/server-post-req.json.tpl
new file mode 100644
index 0000000000..3271a58a7d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-fping/server-post-req.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "name": "new-server-test",
+ "imageRef": "%(host)s/openstack/images/%(image_id)s",
+ "flavorRef": "%(host)s/openstack/flavors/1",
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "personality": [
+ {
+ "path": "/etc/banner.txt",
+ "contents": "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-fping/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-fping/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-fping/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/server-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/server-get-resp.json.tpl
new file mode 100644
index 0000000000..3a69fcd321
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/server-get-resp.json.tpl
@@ -0,0 +1,47 @@
+{
+ "server": {
+ "addresses": {
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "key_name": null,
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/server-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/servers-details-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/servers-details-resp.json.tpl
new file mode 100644
index 0000000000..353d29f480
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/servers-details-resp.json.tpl
@@ -0,0 +1,48 @@
+{
+ "servers": [
+ {
+ "addresses": {},
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "key_name": null,
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/servers-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/servers-list-resp.json.tpl
new file mode 100644
index 0000000000..8797266b68
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hide-server-addresses/servers-list-resp.json.tpl
@@ -0,0 +1,18 @@
+{
+ "servers": [
+ {
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "new-server-test"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-reboot.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-reboot.json.tpl
new file mode 100644
index 0000000000..4ed89a182d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-reboot.json.tpl
@@ -0,0 +1,4 @@
+{
+ "host": "%(host_name)s",
+ "power_action": "reboot"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-resp.json.tpl
new file mode 100644
index 0000000000..efb234b436
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-resp.json.tpl
@@ -0,0 +1,31 @@
+{
+ "host": [
+ {
+ "resource": {
+ "cpu": 1,
+ "disk_gb": 1028,
+ "host": "%(host_name)s",
+ "memory_mb": 8192,
+ "project": "(total)"
+ }
+ },
+ {
+ "resource": {
+ "cpu": 0,
+ "disk_gb": 0,
+ "host": "%(host_name)s",
+ "memory_mb": 512,
+ "project": "(used_now)"
+ }
+ },
+ {
+ "resource": {
+ "cpu": 0,
+ "disk_gb": 0,
+ "host": "%(host_name)s",
+ "memory_mb": 0,
+ "project": "(used_max)"
+ }
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-shutdown.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-shutdown.json.tpl
new file mode 100644
index 0000000000..c0df4481a2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-shutdown.json.tpl
@@ -0,0 +1,4 @@
+{
+ "host": "%(host_name)s",
+ "power_action": "shutdown"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-startup.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-startup.json.tpl
new file mode 100644
index 0000000000..90f5ac7bcb
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-get-startup.json.tpl
@@ -0,0 +1,4 @@
+{
+ "host": "%(host_name)s",
+ "power_action": "startup"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-put-maintenance-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-put-maintenance-req.json.tpl
new file mode 100644
index 0000000000..c1da8f4f9d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-put-maintenance-req.json.tpl
@@ -0,0 +1,4 @@
+{
+ "status": "enable",
+ "maintenance_mode": "disable"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-put-maintenance-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-put-maintenance-resp.json.tpl
new file mode 100644
index 0000000000..92f73892b3
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hosts/host-put-maintenance-resp.json.tpl
@@ -0,0 +1,5 @@
+{
+ "host": "%(host_name)s",
+ "maintenance_mode": "off_maintenance",
+ "status": "enabled"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hosts/hosts-list-compute-service-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hosts/hosts-list-compute-service-resp.json.tpl
new file mode 100644
index 0000000000..846988bd80
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hosts/hosts-list-compute-service-resp.json.tpl
@@ -0,0 +1,9 @@
+{
+ "hosts": [
+ {
+ "host_name": "%(host_name)s",
+ "service": "compute",
+ "zone": "nova"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hosts/hosts-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hosts/hosts-list-resp.json.tpl
new file mode 100644
index 0000000000..cd5bfdf999
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hosts/hosts-list-resp.json.tpl
@@ -0,0 +1,39 @@
+{
+ "hosts": [
+ {
+ "host_name": "%(host_name)s",
+ "service": "conductor",
+ "zone": "internal"
+ },
+ {
+ "host_name": "%(host_name)s",
+ "service": "compute",
+ "zone": "nova"
+ },
+ {
+ "host_name": "%(host_name)s",
+ "service": "cert",
+ "zone": "internal"
+ },
+ {
+ "host_name": "%(host_name)s",
+ "service": "consoleauth",
+ "zone": "internal"
+ },
+ {
+ "host_name": "%(host_name)s",
+ "service": "network",
+ "zone": "internal"
+ },
+ {
+ "host_name": "%(host_name)s",
+ "service": "scheduler",
+ "zone": "internal"
+ },
+ {
+ "host_name": "%(host_name)s",
+ "service": "cells",
+ "zone": "internal"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl
new file mode 100644
index 0000000000..2777eb4887
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl
@@ -0,0 +1,30 @@
+{
+ "hypervisors": [
+ {
+ "cpu_info": "?",
+ "current_workload": 0,
+ "state": "up",
+ "status": "enabled",
+ "disk_available_least": 0,
+ "host_ip": "%(ip)s",
+ "free_disk_gb": 1028,
+ "free_ram_mb": 7680,
+ "hypervisor_hostname": "fake-mini",
+ "hypervisor_type": "fake",
+ "hypervisor_version": 1000,
+ "id": %(hypervisor_id)s,
+ "local_gb": 1028,
+ "local_gb_used": 0,
+ "memory_mb": 8192,
+ "memory_mb_used": 512,
+ "running_vms": 0,
+ "service": {
+ "host": "%(host_name)s",
+ "id": 2,
+ "disabled_reason": null
+ },
+ "vcpus": 1,
+ "vcpus_used": 0
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-list-resp.json.tpl
new file mode 100644
index 0000000000..710cdfcf9c
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-list-resp.json.tpl
@@ -0,0 +1,10 @@
+{
+ "hypervisors": [
+ {
+ "hypervisor_hostname": "fake-mini",
+ "state": "up",
+ "status": "enabled",
+ "id": 1
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-search-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-search-resp.json.tpl
new file mode 100644
index 0000000000..375627499d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-search-resp.json.tpl
@@ -0,0 +1,10 @@
+{
+ "hypervisors": [
+ {
+ "hypervisor_hostname": "fake-mini",
+ "id": 1,
+ "state": "up",
+ "status": "enabled"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-servers-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-servers-resp.json.tpl
new file mode 100644
index 0000000000..857a1b2166
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-servers-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "hypervisors": [
+ {
+ "hypervisor_hostname": "fake-mini",
+ "id": 1,
+ "state": "up",
+ "status": "enabled",
+ "servers": []
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-show-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-show-resp.json.tpl
new file mode 100644
index 0000000000..f125da01af
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-show-resp.json.tpl
@@ -0,0 +1,28 @@
+{
+ "hypervisor": {
+ "cpu_info": "?",
+ "current_workload": 0,
+ "disk_available_least": 0,
+ "state": "up",
+ "status": "enabled",
+ "host_ip": "%(ip)s",
+ "free_disk_gb": 1028,
+ "free_ram_mb": 7680,
+ "hypervisor_hostname": "fake-mini",
+ "hypervisor_type": "fake",
+ "hypervisor_version": 1000,
+ "id": %(hypervisor_id)s,
+ "local_gb": 1028,
+ "local_gb_used": 0,
+ "memory_mb": 8192,
+ "memory_mb_used": 512,
+ "running_vms": 0,
+ "service": {
+ "host": "%(host_name)s",
+ "id": 2,
+ "disabled_reason": null
+ },
+ "vcpus": 1,
+ "vcpus_used": 0
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-statistics-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-statistics-resp.json.tpl
new file mode 100644
index 0000000000..2cfb51e703
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-statistics-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "hypervisor_statistics": {
+ "count": 1,
+ "current_workload": 0,
+ "disk_available_least": 0,
+ "free_disk_gb": 1028,
+ "free_ram_mb": 7680,
+ "local_gb": 1028,
+ "local_gb_used": 0,
+ "memory_mb": 8192,
+ "memory_mb_used": 512,
+ "running_vms": 0,
+ "vcpus": 1,
+ "vcpus_used": 0
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-uptime-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-uptime-resp.json.tpl
new file mode 100644
index 0000000000..e2f6d2e47e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-hypervisors/hypervisors-uptime-resp.json.tpl
@@ -0,0 +1,9 @@
+{
+ "hypervisor": {
+ "hypervisor_hostname": "fake-mini",
+ "id": %(hypervisor_id)s,
+ "state": "up",
+ "status": "enabled",
+ "uptime": " 08:32:11 up 93 days, 18:25, 12 users, load average: 0.20, 0.12, 0.14"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-instance-actions/instance-action-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-instance-actions/instance-action-get-resp.json.tpl
new file mode 100644
index 0000000000..7cd5325239
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-instance-actions/instance-action-get-resp.json.tpl
@@ -0,0 +1,27 @@
+{
+ "instanceAction": {
+ "action": "%(action)s",
+ "instance_uuid": "%(instance_uuid)s",
+ "request_id": "%(request_id)s",
+ "user_id": "%(integer_id)s",
+ "project_id": "%(integer_id)s",
+ "start_time": "%(strtime)s",
+ "message": "",
+ "events": [
+ {
+ "event": "%(event)s",
+ "start_time": "%(strtime)s",
+ "finish_time": "%(strtime)s",
+ "result": "%(result)s",
+ "traceback": ""
+ },
+ {
+ "event": "%(event)s",
+ "start_time": "%(strtime)s",
+ "finish_time": "%(strtime)s",
+ "result": "%(result)s",
+ "traceback": ""
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-instance-actions/instance-actions-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-instance-actions/instance-actions-list-resp.json.tpl
new file mode 100644
index 0000000000..0fdc33916a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-instance-actions/instance-actions-list-resp.json.tpl
@@ -0,0 +1,22 @@
+{
+ "instanceActions": [
+ {
+ "action": "%(action)s",
+ "instance_uuid": "%(uuid)s",
+ "request_id": "%(request_id)s",
+ "user_id": "%(integer_id)s",
+ "project_id": "%(integer_id)s",
+ "start_time": "%(strtime)s",
+ "message": ""
+ },
+ {
+ "action": "%(action)s",
+ "instance_uuid": "%(uuid)s",
+ "request_id": "%(request_id)s",
+ "user_id": "%(integer_id)s",
+ "project_id": "%(integer_id)s",
+ "start_time": "%(strtime)s",
+ "message": ""
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-instance-actions/instance-instance-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-instance-actions/instance-instance-get-resp.json.tpl
new file mode 100644
index 0000000000..f259deefdb
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-instance-actions/instance-instance-get-resp.json.tpl
@@ -0,0 +1,27 @@
+{
+ "instanceAction": {
+ "action": "reboot",
+ "events": [
+ {
+ "event": "schedule",
+ "finish_time": "2012-12-05T01:02:00.000000",
+ "result": "Success",
+ "start_time": "2012-12-05T01:00:02.000000",
+ "traceback": ""
+ },
+ {
+ "event": "compute_create",
+ "finish_time": "2012-12-05T01:04:00.000000",
+ "result": "Success",
+ "start_time": "2012-12-05T01:03:00.000000",
+ "traceback": ""
+ }
+ ],
+ "instance_uuid": "b48316c5-71e8-45e4-9884-6c78055b9b13",
+ "message": "",
+ "project_id": "147",
+ "request_id": "req-3293a3f1-b44c-4609-b8d2-d81b105636b8",
+ "start_time": "2012-12-05T00:00:00.000000",
+ "user_id": "789"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-lock-server/lock-server.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-lock-server/lock-server.json.tpl
new file mode 100644
index 0000000000..a1863f2f39
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-lock-server/lock-server.json.tpl
@@ -0,0 +1,3 @@
+{
+ "lock": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-lock-server/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-lock-server/server-post-req.json.tpl
new file mode 100644
index 0000000000..27557a3e9f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-lock-server/server-post-req.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-lock-server/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-lock-server/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-lock-server/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-lock-server/unlock-server.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-lock-server/unlock-server.json.tpl
new file mode 100644
index 0000000000..9e905ca2b9
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-lock-server/unlock-server.json.tpl
@@ -0,0 +1,3 @@
+{
+ "unlock": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-migrate-server/live-migrate-server.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-migrate-server/live-migrate-server.json.tpl
new file mode 100644
index 0000000000..4800d4aa11
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-migrate-server/live-migrate-server.json.tpl
@@ -0,0 +1,7 @@
+{
+ "os-migrateLive": {
+ "host": "%(hostname)s",
+ "block_migration": false,
+ "disk_over_commit": false
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-migrate-server/migrate-server.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-migrate-server/migrate-server.json.tpl
new file mode 100644
index 0000000000..a9bf8c483e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-migrate-server/migrate-server.json.tpl
@@ -0,0 +1,3 @@
+{
+ "migrate": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-migrate-server/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-migrate-server/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-migrate-server/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-migrate-server/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-migrate-server/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-migrate-server/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-migrations/migrations-get.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-migrations/migrations-get.json.tpl
new file mode 100644
index 0000000000..91775be775
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-migrations/migrations-get.json.tpl
@@ -0,0 +1,32 @@
+{
+ "migrations": [
+ {
+ "created_at": "2012-10-29T13:42:02.000000",
+ "dest_compute": "compute2",
+ "dest_host": "1.2.3.4",
+ "dest_node": "node2",
+ "id": 1234,
+ "instance_uuid": "instance_id_123",
+ "new_instance_type_id": 2,
+ "old_instance_type_id": 1,
+ "source_compute": "compute1",
+ "source_node": "node1",
+ "status": "Done",
+ "updated_at": "2012-10-29T13:42:02.000000"
+ },
+ {
+ "created_at": "2013-10-22T13:42:02.000000",
+ "dest_compute": "compute20",
+ "dest_host": "5.6.7.8",
+ "dest_node": "node20",
+ "id": 5678,
+ "instance_uuid": "instance_id_456",
+ "new_instance_type_id": 6,
+ "old_instance_type_id": 5,
+ "source_compute": "compute10",
+ "source_node": "node10",
+ "status": "Done",
+ "updated_at": "2013-10-22T13:42:02.000000"
+ }
+ ]
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-multinic/multinic-add-fixed-ip-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-multinic/multinic-add-fixed-ip-req.json.tpl
new file mode 100644
index 0000000000..b9744ab2c7
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-multinic/multinic-add-fixed-ip-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "addFixedIp":{
+ "networkId": %(networkId)s
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-multinic/multinic-remove-fixed-ip-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-multinic/multinic-remove-fixed-ip-req.json.tpl
new file mode 100644
index 0000000000..7367e1242c
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-multinic/multinic-remove-fixed-ip-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "removeFixedIp":{
+ "address": "%(ip)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-multinic/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-multinic/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-multinic/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-multinic/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-multinic/server-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-multinic/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-no-resv-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-no-resv-post-req.json.tpl
new file mode 100644
index 0000000000..19ede54ec2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-no-resv-post-req.json.tpl
@@ -0,0 +1,18 @@
+{
+ "server": {
+ "name": "new-server-test",
+ "imageRef": "%(host)s/openstack/images/%(image_id)s",
+ "flavorRef": "%(host)s/openstack/flavors/1",
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "min_count": "%(min_count)s",
+ "max_count": "%(max_count)s",
+ "personality": [
+ {
+ "path": "/etc/banner.txt",
+ "contents": "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-no-resv-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-no-resv-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-no-resv-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-post-req.json.tpl
new file mode 100644
index 0000000000..e2f949f09d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-post-req.json.tpl
@@ -0,0 +1,19 @@
+{
+ "server": {
+ "name": "new-server-test",
+ "imageRef": "%(host)s/openstack/images/%(image_id)s",
+ "flavorRef": "%(host)s/openstack/flavors/1",
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "return_reservation_id": "True",
+ "min_count": "%(min_count)s",
+ "max_count": "%(max_count)s",
+ "personality": [
+ {
+ "path": "/etc/banner.txt",
+ "contents": "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-post-resp.json.tpl
new file mode 100644
index 0000000000..22d2880feb
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-multiple-create/multiple-create-post-resp.json.tpl
@@ -0,0 +1,3 @@
+{
+ "reservation_id": "%(reservation_id)s"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-associate-host-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-associate-host-req.json.tpl
new file mode 100644
index 0000000000..762e881751
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-associate-host-req.json.tpl
@@ -0,0 +1,3 @@
+{
+ "associate_host": "%(host)s"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-disassociate-host-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-disassociate-host-req.json.tpl
new file mode 100644
index 0000000000..46f69b3e81
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-disassociate-host-req.json.tpl
@@ -0,0 +1,3 @@
+{
+ "disassociate_host": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-disassociate-project-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-disassociate-project-req.json.tpl
new file mode 100644
index 0000000000..63b6eb6839
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-disassociate-project-req.json.tpl
@@ -0,0 +1,3 @@
+{
+ "disassociate_project": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-disassociate-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-disassociate-req.json.tpl
new file mode 100644
index 0000000000..2e09d15a60
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-networks-associate/network-disassociate-req.json.tpl
@@ -0,0 +1,3 @@
+{
+ "disassociate": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-networks/network-add-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-networks/network-add-req.json.tpl
new file mode 100644
index 0000000000..aca6770b3b
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-networks/network-add-req.json.tpl
@@ -0,0 +1,3 @@
+{
+ "id": "1"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-networks/network-create-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-networks/network-create-req.json.tpl
new file mode 100644
index 0000000000..18515bd6c4
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-networks/network-create-req.json.tpl
@@ -0,0 +1,12 @@
+{
+ "network": {
+ "label": "new net 111",
+ "cidr": "10.20.105.0/24",
+ "mtu": 9000,
+ "dhcp_server": "10.20.105.2",
+ "enable_dhcp": false,
+ "share_address": true,
+ "allowed_start": "10.20.105.10",
+ "allowed_end": "10.20.105.200"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-networks/network-create-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-networks/network-create-resp.json.tpl
new file mode 100644
index 0000000000..5cf155b13f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-networks/network-create-resp.json.tpl
@@ -0,0 +1,36 @@
+{
+ "network": {
+ "bridge": null,
+ "vpn_public_port": null,
+ "dhcp_start": "%(ip)s",
+ "bridge_interface": null,
+ "updated_at": null,
+ "id": "%(id)s",
+ "cidr_v6": null,
+ "deleted_at": null,
+ "gateway": "%(ip)s",
+ "rxtx_base": null,
+ "label": "new net 111",
+ "priority": null,
+ "project_id": null,
+ "vpn_private_address": null,
+ "deleted": null,
+ "vlan": null,
+ "broadcast": "%(ip)s",
+ "netmask": "%(ip)s",
+ "injected": null,
+ "cidr": "10.20.105.0/24",
+ "vpn_public_address": null,
+ "multi_host": null,
+ "dns2": null,
+ "created_at": null,
+ "host": null,
+ "gateway_v6": null,
+ "netmask_v6": null,
+ "dns1": null,
+ "mtu": 9000,
+ "dhcp_server": "10.20.105.2",
+ "enable_dhcp": false,
+ "share_address": true
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-networks/network-show-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-networks/network-show-resp.json.tpl
new file mode 100644
index 0000000000..ac75fe7fb1
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-networks/network-show-resp.json.tpl
@@ -0,0 +1,37 @@
+{
+ "network":
+ {
+ "bridge": "br100",
+ "bridge_interface": "eth0",
+ "broadcast": "%(ip)s",
+ "cidr": "10.0.0.0/29",
+ "cidr_v6": null,
+ "created_at": "%(strtime)s",
+ "deleted": false,
+ "deleted_at": null,
+ "dhcp_start": "%(ip)s",
+ "dns1": null,
+ "dns2": null,
+ "gateway": "%(ip)s",
+ "gateway_v6": null,
+ "host": "nsokolov-desktop",
+ "id": "%(id)s",
+ "injected": false,
+ "label": "mynet_0",
+ "multi_host": false,
+ "netmask": "%(ip)s",
+ "netmask_v6": null,
+ "priority": null,
+ "project_id": "1234",
+ "rxtx_base": null,
+ "updated_at": "%(strtime)s",
+ "vlan": 100,
+ "vpn_private_address": "%(ip)s",
+ "vpn_public_address": "%(ip)s",
+ "vpn_public_port": 1000,
+ "mtu": null,
+ "dhcp_server": "%(ip)s",
+ "enable_dhcp": true,
+ "share_address": false
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-networks/networks-disassociate-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-networks/networks-disassociate-req.json.tpl
new file mode 100644
index 0000000000..2e09d15a60
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-networks/networks-disassociate-req.json.tpl
@@ -0,0 +1,3 @@
+{
+ "disassociate": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-networks/networks-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-networks/networks-list-resp.json.tpl
new file mode 100644
index 0000000000..ccdd586a0f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-networks/networks-list-resp.json.tpl
@@ -0,0 +1,72 @@
+{
+ "networks": [
+ {
+ "bridge": "br100",
+ "bridge_interface": "eth0",
+ "broadcast": "%(ip)s",
+ "cidr": "10.0.0.0/29",
+ "cidr_v6": null,
+ "created_at": "%(strtime)s",
+ "deleted": false,
+ "deleted_at": null,
+ "dhcp_start": "%(ip)s",
+ "dns1": null,
+ "dns2": null,
+ "gateway": "%(ip)s",
+ "gateway_v6": null,
+ "host": "nsokolov-desktop",
+ "id": "%(id)s",
+ "injected": false,
+ "label": "mynet_0",
+ "multi_host": false,
+ "netmask": "%(ip)s",
+ "netmask_v6": null,
+ "priority": null,
+ "project_id": "1234",
+ "rxtx_base": null,
+ "updated_at": "%(strtime)s",
+ "vlan": 100,
+ "vpn_private_address": "%(ip)s",
+ "vpn_public_address": "%(ip)s",
+ "vpn_public_port": 1000,
+ "mtu": null,
+ "dhcp_server": "%(ip)s",
+ "enable_dhcp": true,
+ "share_address": false
+ },
+ {
+ "bridge": "br101",
+ "bridge_interface": "eth0",
+ "broadcast": "%(ip)s",
+ "cidr": "10.0.0.10/29",
+ "cidr_v6": null,
+ "created_at": "%(strtime)s",
+ "deleted": false,
+ "deleted_at": null,
+ "dhcp_start": "%(ip)s",
+ "dns1": null,
+ "dns2": null,
+ "gateway": "%(ip)s",
+ "gateway_v6": null,
+ "host": null,
+ "id": "%(id)s",
+ "injected": false,
+ "label": "mynet_1",
+ "multi_host": false,
+ "netmask": "%(ip)s",
+ "netmask_v6": null,
+ "priority": null,
+ "project_id": null,
+ "rxtx_base": null,
+ "updated_at": null,
+ "vlan": 101,
+ "vpn_private_address": "%(ip)s",
+ "vpn_public_address": null,
+ "vpn_public_port": 1001,
+ "mtu": null,
+ "dhcp_server": "%(ip)s",
+ "enable_dhcp": true,
+ "share_address": false
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-pause-server/pause-server.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-pause-server/pause-server.json.tpl
new file mode 100644
index 0000000000..2e7c1fad30
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-pause-server/pause-server.json.tpl
@@ -0,0 +1,3 @@
+{
+ "pause": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-pause-server/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-pause-server/server-post-req.json.tpl
new file mode 100644
index 0000000000..27557a3e9f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-pause-server/server-post-req.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-pause-server/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-pause-server/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-pause-server/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-pause-server/unpause-server.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-pause-server/unpause-server.json.tpl
new file mode 100644
index 0000000000..ce5024f0c9
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-pause-server/unpause-server.json.tpl
@@ -0,0 +1,3 @@
+{
+ "unpause": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-pci/hypervisors-pci-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-pci/hypervisors-pci-detail-resp.json.tpl
new file mode 100644
index 0000000000..f2bf2bc02c
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-pci/hypervisors-pci-detail-resp.json.tpl
@@ -0,0 +1,42 @@
+{
+ "hypervisors": [
+ {
+ "cpu_info": "?",
+ "state": "up",
+ "status": "enabled",
+ "current_workload": 0,
+ "disk_available_least": 0,
+ "host_ip": "%(ip)s",
+ "free_disk_gb": 1028,
+ "free_ram_mb": 7680,
+ "hypervisor_hostname": "fake-mini",
+ "hypervisor_type": "fake",
+ "hypervisor_version": 1000,
+ "id": 1,
+ "local_gb": 1028,
+ "local_gb_used": 0,
+ "memory_mb": 8192,
+ "memory_mb_used": 512,
+ "os-pci:pci_stats": [
+ {
+ "count": 5,
+ "extra_info": {
+ "key1": "value1",
+ "phys_function": "[[\"0x0000\", \"0x04\", \"0x00\", \"0x1\"]]"
+ },
+ "keya": "valuea",
+ "product_id": "1520",
+ "vendor_id": "8086"
+ }
+ ],
+ "running_vms": 0,
+ "service": {
+ "host": "043b3cacf6f34c90a7245151fc8ebcda",
+ "id": 2,
+ "disabled_reason": null
+ },
+ "vcpus": 1,
+ "vcpus_used": 0
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-pci/hypervisors-pci-show-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-pci/hypervisors-pci-show-resp.json.tpl
new file mode 100644
index 0000000000..3c0fc0abcd
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-pci/hypervisors-pci-show-resp.json.tpl
@@ -0,0 +1,40 @@
+{
+ "hypervisor": {
+ "cpu_info": "?",
+ "current_workload": 0,
+ "state": "up",
+ "status": "enabled",
+ "disk_available_least": 0,
+ "host_ip": "%(ip)s",
+ "free_disk_gb": 1028,
+ "free_ram_mb": 7680,
+ "hypervisor_hostname": "fake-mini",
+ "hypervisor_type": "fake",
+ "hypervisor_version": 1000,
+ "id": 1,
+ "local_gb": 1028,
+ "local_gb_used": 0,
+ "memory_mb": 8192,
+ "memory_mb_used": 512,
+ "os-pci:pci_stats": [
+ {
+ "count": 5,
+ "extra_info": {
+ "key1": "value1",
+ "phys_function": "[[\"0x0000\", \"0x04\", \"0x00\", \"0x1\"]]"
+ },
+ "keya": "valuea",
+ "product_id": "1520",
+ "vendor_id": "8086"
+ }
+ ],
+ "running_vms": 0,
+ "service": {
+ "host": "043b3cacf6f34c90a7245151fc8ebcda",
+ "id": 2,
+ "disabled_reason": null
+ },
+ "vcpus": 1,
+ "vcpus_used": 0
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-pci/pci-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-pci/pci-detail-resp.json.tpl
new file mode 100644
index 0000000000..61cb17c6b4
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-pci/pci-detail-resp.json.tpl
@@ -0,0 +1,36 @@
+{
+ "pci_devices": [
+ {
+ "address": "0000:04:10.0",
+ "compute_node_id": 1,
+ "dev_id": "pci_0000_04_10_0",
+ "dev_type": "type-VF",
+ "extra_info": {
+ "key1": "value1",
+ "key2": "value2"
+ },
+ "id": 1,
+ "server_uuid": "69ba1044-0766-4ec0-b60d-09595de034a1",
+ "label": "label_8086_1520",
+ "product_id": "1520",
+ "status": "available",
+ "vendor_id": "8086"
+ },
+ {
+ "address": "0000:04:10.1",
+ "compute_node_id": 1,
+ "dev_id": "pci_0000_04_10_1",
+ "dev_type": "type-VF",
+ "extra_info": {
+ "key3": "value3",
+ "key4": "value4"
+ },
+ "id": 2,
+ "server_uuid": "d5b446a6-a1b4-4d01-b4f0-eac37b3a62fc",
+ "label": "label_8086_1520",
+ "product_id": "1520",
+ "status": "available",
+ "vendor_id": "8086"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-pci/pci-index-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-pci/pci-index-resp.json.tpl
new file mode 100644
index 0000000000..6268f316df
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-pci/pci-index-resp.json.tpl
@@ -0,0 +1,20 @@
+{
+ "pci_devices": [
+ {
+ "address": "0000:04:10.0",
+ "compute_node_id": 1,
+ "id": 1,
+ "product_id": "1520",
+ "status": "available",
+ "vendor_id": "8086"
+ },
+ {
+ "address": "0000:04:10.1",
+ "compute_node_id": 1,
+ "id": 2,
+ "product_id": "1520",
+ "status": "available",
+ "vendor_id": "8086"
+ }
+ ]
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-pci/pci-show-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-pci/pci-show-resp.json.tpl
new file mode 100644
index 0000000000..9977769881
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-pci/pci-show-resp.json.tpl
@@ -0,0 +1,18 @@
+{
+ "pci_device": {
+ "address": "0000:04:10.0",
+ "compute_node_id": 1,
+ "dev_id": "pci_0000_04_10_0",
+ "dev_type": "type-VF",
+ "extra_info": {
+ "key1": "value1",
+ "key2": "value2"
+ },
+ "id": 1,
+ "server_uuid": "69ba1044-0766-4ec0-b60d-09595de034a1",
+ "label": "label_8086_1520",
+ "product_id": "1520",
+ "status": "available",
+ "vendor_id": "8086"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-pci/server-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-pci/server-get-resp.json.tpl
new file mode 100644
index 0000000000..b94f013f28
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-pci/server-get-resp.json.tpl
@@ -0,0 +1,60 @@
+{
+ "server": {
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "key_name": null,
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "os-pci:pci_devices": [
+ {
+ "id": 1
+ }
+ ],
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-pci/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-pci/server-post-req.json.tpl
new file mode 100644
index 0000000000..27557a3e9f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-pci/server-post-req.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-pci/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-pci/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-pci/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-pci/servers-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-pci/servers-detail-resp.json.tpl
new file mode 100644
index 0000000000..d152ae31ec
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-pci/servers-detail-resp.json.tpl
@@ -0,0 +1,62 @@
+{
+ "servers": [
+ {
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "key_name": null,
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "os-pci:pci_devices": [
+ {
+ "id": 1
+ }
+ ],
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl
new file mode 100644
index 0000000000..f66f22cd2d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl
@@ -0,0 +1,19 @@
+{
+ "quota_set": {
+ "cores": 20,
+ "floating_ips": 10,
+ "fixed_ips": -1,
+ "id": "fake_tenant",
+ "injected_file_content_bytes": 10240,
+ "injected_file_path_bytes": 255,
+ "injected_files": 5,
+ "instances": 10,
+ "key_pairs": 100,
+ "metadata_items": 128,
+ "ram": 51200,
+ "security_group_rules": 20,
+ "security_groups": 10,
+ "server_groups": 10,
+ "server_group_members": 10
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl
new file mode 100644
index 0000000000..f66f22cd2d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl
@@ -0,0 +1,19 @@
+{
+ "quota_set": {
+ "cores": 20,
+ "floating_ips": 10,
+ "fixed_ips": -1,
+ "id": "fake_tenant",
+ "injected_file_content_bytes": 10240,
+ "injected_file_path_bytes": 255,
+ "injected_files": 5,
+ "instances": 10,
+ "key_pairs": 100,
+ "metadata_items": 128,
+ "ram": 51200,
+ "security_group_rules": 20,
+ "security_groups": 10,
+ "server_groups": 10,
+ "server_group_members": 10
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-req.json.tpl
new file mode 100644
index 0000000000..a58a179123
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "quota_set": {
+ "force": "True",
+ "instances": 45
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.json.tpl
new file mode 100644
index 0000000000..97c456d4d4
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.json.tpl
@@ -0,0 +1,19 @@
+{
+ "quota_set": {
+ "cores": 20,
+ "fixed_ips": -1,
+ "floating_ips": 10,
+ "id": "fake_tenant",
+ "injected_file_content_bytes": 10240,
+ "injected_file_path_bytes": 255,
+ "injected_files": 5,
+ "instances": 45,
+ "key_pairs": 100,
+ "metadata_items": 128,
+ "ram": 51200,
+ "security_group_rules": 20,
+ "security_groups": 10,
+ "server_groups": 10,
+ "server_group_members": 10
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-force-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-force-resp.json.tpl
new file mode 100644
index 0000000000..ff23ff6ae4
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-force-resp.json.tpl
@@ -0,0 +1,19 @@
+{
+ "quota_set": {
+ "cores": 20,
+ "floating_ips": 10,
+ "fixed_ips": -1,
+ "injected_file_content_bytes": 10240,
+ "injected_file_path_bytes": 255,
+ "injected_files": 5,
+ "instances": 45,
+ "key_pairs": 100,
+ "metadata_items": 128,
+ "ram": 51200,
+ "security_group_rules": 20,
+ "security_groups": 10,
+ "server_groups": 10,
+ "server_group_members": 10,
+ "id": "fake_tenant"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-post-req.json.tpl
new file mode 100644
index 0000000000..1f12caa045
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-post-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "quota_set": {
+ "security_groups": 45
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl
new file mode 100644
index 0000000000..f7c276e3f7
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl
@@ -0,0 +1,19 @@
+{
+ "quota_set": {
+ "cores": 20,
+ "floating_ips": 10,
+ "fixed_ips": -1,
+ "id": "fake_tenant",
+ "injected_file_content_bytes": 10240,
+ "injected_file_path_bytes": 255,
+ "injected_files": 5,
+ "instances": 10,
+ "key_pairs": 100,
+ "metadata_items": 128,
+ "ram": 51200,
+ "security_group_rules": 20,
+ "security_groups": 45,
+ "server_groups": 10,
+ "server_group_members": 10
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.json.tpl
new file mode 100644
index 0000000000..f66f22cd2d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.json.tpl
@@ -0,0 +1,19 @@
+{
+ "quota_set": {
+ "cores": 20,
+ "floating_ips": 10,
+ "fixed_ips": -1,
+ "id": "fake_tenant",
+ "injected_file_content_bytes": 10240,
+ "injected_file_path_bytes": 255,
+ "injected_files": 5,
+ "instances": 10,
+ "key_pairs": 100,
+ "metadata_items": 128,
+ "ram": 51200,
+ "security_group_rules": 20,
+ "security_groups": 10,
+ "server_groups": 10,
+ "server_group_members": 10
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-req.json.tpl
new file mode 100644
index 0000000000..b322b2a870
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "quota_set": {
+ "force": "True",
+ "instances": 9
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.json.tpl
new file mode 100644
index 0000000000..a17757aafe
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.json.tpl
@@ -0,0 +1,19 @@
+{
+ "quota_set": {
+ "cores": 20,
+ "floating_ips": 10,
+ "fixed_ips": -1,
+ "id": "fake_tenant",
+ "injected_file_content_bytes": 10240,
+ "injected_file_path_bytes": 255,
+ "injected_files": 5,
+ "instances": 9,
+ "key_pairs": 100,
+ "metadata_items": 128,
+ "ram": 51200,
+ "security_group_rules": 20,
+ "security_groups": 10,
+ "server_groups": 10,
+ "server_group_members": 10
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-rdp-console-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-rdp-console-post-req.json.tpl
new file mode 100644
index 0000000000..00956b90e4
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-rdp-console-post-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "os-getRDPConsole": {
+ "type": "rdp-html5"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-rdp-console-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-rdp-console-post-resp.json.tpl
new file mode 100644
index 0000000000..c3955d6ac0
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-rdp-console-post-resp.json.tpl
@@ -0,0 +1,6 @@
+{
+ "console": {
+ "type": "rdp-html5",
+ "url": "http://127.0.0.1:6083/?token=%(uuid)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-serial-console-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-serial-console-post-req.json.tpl
new file mode 100644
index 0000000000..1d754d6608
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-serial-console-post-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "os-getSerialConsole": {
+ "type": "serial"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-serial-console-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-serial-console-post-resp.json.tpl
new file mode 100644
index 0000000000..721ce2b2ea
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-serial-console-post-resp.json.tpl
@@ -0,0 +1,6 @@
+{
+ "console": {
+ "type": "serial",
+ "url": "ws://127.0.0.1:6083/?token=%(uuid)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-spice-console-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-spice-console-post-req.json.tpl
new file mode 100644
index 0000000000..d04f7c7ae9
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-spice-console-post-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "os-getSPICEConsole": {
+ "type": "spice-html5"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-spice-console-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-spice-console-post-resp.json.tpl
new file mode 100644
index 0000000000..65b72a866f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-spice-console-post-resp.json.tpl
@@ -0,0 +1,6 @@
+{
+ "console": {
+ "type": "spice-html5",
+ "url": "http://127.0.0.1:6082/spice_auto.html?token=%(uuid)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-vnc-console-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-vnc-console-post-req.json.tpl
new file mode 100644
index 0000000000..1926119ced
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-vnc-console-post-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "os-getVNCConsole": {
+ "type": "novnc"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-vnc-console-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-vnc-console-post-resp.json.tpl
new file mode 100644
index 0000000000..2eeee7c543
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/get-vnc-console-post-resp.json.tpl
@@ -0,0 +1,6 @@
+{
+ "console": {
+ "type": "novnc",
+ "url": "http://127.0.0.1:6080/vnc_auto.html?token=%(uuid)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-remote-consoles/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-get-resp-rescue.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-get-resp-rescue.json.tpl
new file mode 100644
index 0000000000..02547e994f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-get-resp-rescue.json.tpl
@@ -0,0 +1,54 @@
+{
+ "server": {
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4,
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "status": "%(status)s",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake",
+ "key_name": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-get-resp-unrescue.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-get-resp-unrescue.json.tpl
new file mode 100644
index 0000000000..cd6ded9be3
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-get-resp-unrescue.json.tpl
@@ -0,0 +1,55 @@
+{
+ "server": {
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4,
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "%(status)s",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake",
+ "key_name": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-rescue-req-with-image-ref.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-rescue-req-with-image-ref.json.tpl
new file mode 100644
index 0000000000..8a4ad0d52a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-rescue-req-with-image-ref.json.tpl
@@ -0,0 +1,6 @@
+{
+ "rescue": {
+ "adminPass": "MySecretPass",
+ "rescue_image_ref": "70a599e0-31e7-49b7-b260-868f441e862b"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-rescue-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-rescue-req.json.tpl
new file mode 100644
index 0000000000..f946b74f53
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-rescue-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "rescue": {
+ "adminPass": "%(password)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-rescue.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-rescue.json.tpl
new file mode 100644
index 0000000000..0da07da5b8
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-rescue.json.tpl
@@ -0,0 +1,3 @@
+{
+ "adminPass": "%(password)s"
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-unrescue-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-unrescue-req.json.tpl
new file mode 100644
index 0000000000..cafc9b13a8
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-rescue/server-unrescue-req.json.tpl
@@ -0,0 +1,3 @@
+{
+ "unrescue": null
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-scheduler-hints/scheduler-hints-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-scheduler-hints/scheduler-hints-post-req.json.tpl
new file mode 100644
index 0000000000..a381df7444
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-scheduler-hints/scheduler-hints-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/openstack/images/%(image_id)s",
+ "flavorRef" : "%(host)s/openstack/flavors/1"
+ },
+ "OS-SCH-HNT:scheduler_hints": {
+ "same_host": "%(uuid)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-scheduler-hints/scheduler-hints-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-scheduler-hints/scheduler-hints-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-scheduler-hints/scheduler-hints-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-create-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-create-req.json.tpl
new file mode 100644
index 0000000000..8836d0eecc
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-create-req.json.tpl
@@ -0,0 +1,8 @@
+{
+ "security_group_default_rule": {
+ "ip_protocol": "TCP",
+ "from_port": "80",
+ "to_port": "80",
+ "cidr": "10.10.10.0/24"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-create-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-create-resp.json.tpl
new file mode 100644
index 0000000000..ae6c62bfd6
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-create-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "security_group_default_rule": {
+ "from_port": 80,
+ "id": 1,
+ "ip_protocol": "TCP",
+ "ip_range":{
+ "cidr": "10.10.10.0/24"
+ },
+ "to_port": 80
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-list-resp.json.tpl
new file mode 100644
index 0000000000..c083640c3e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-list-resp.json.tpl
@@ -0,0 +1,13 @@
+{
+ "security_group_default_rules": [
+ {
+ "from_port": 80,
+ "id": 1,
+ "ip_protocol": "TCP",
+ "ip_range": {
+ "cidr": "10.10.10.0/24"
+ },
+ "to_port": 80
+ }
+ ]
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-show-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-show-resp.json.tpl
new file mode 100644
index 0000000000..97b5259a18
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-group-default-rules/security-group-default-rules-show-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "security_group_default_rule": {
+ "id": 1,
+ "from_port": 80,
+ "to_port": 80,
+ "ip_protocol": "TCP",
+ "ip_range": {
+ "cidr": "10.10.10.0/24"
+ }
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-group-add-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-group-add-post-req.json.tpl
new file mode 100644
index 0000000000..19a6ed2cb8
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-group-add-post-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "addSecurityGroup": {
+ "name": "%(group_name)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-group-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-group-post-req.json.tpl
new file mode 100644
index 0000000000..3f54ab6856
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-group-post-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "security_group": {
+ "name": "%(group_name)s",
+ "description": "description"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-group-remove-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-group-remove-post-req.json.tpl
new file mode 100644
index 0000000000..7f550036b8
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-group-remove-post-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "removeSecurityGroup": {
+ "name": "%(group_name)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-groups-create-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-groups-create-resp.json.tpl
new file mode 100644
index 0000000000..e51714e3ee
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-groups-create-resp.json.tpl
@@ -0,0 +1,9 @@
+{
+ "security_group": {
+ "description": "%(description)s",
+ "id": 1,
+ "name": "%(group_name)s",
+ "rules": [],
+ "tenant_id": "openstack"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-groups-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-groups-get-resp.json.tpl
new file mode 100644
index 0000000000..0372512744
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-groups-get-resp.json.tpl
@@ -0,0 +1,9 @@
+{
+ "security_group": {
+ "description": "default",
+ "id": 1,
+ "name": "default",
+ "rules": [],
+ "tenant_id": "openstack"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-groups-list-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-groups-list-get-resp.json.tpl
new file mode 100644
index 0000000000..1771f2dff1
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/security-groups-list-get-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "security_groups": [
+ {
+ "description": "default",
+ "id": 1,
+ "name": "default",
+ "rules": [],
+ "tenant_id": "openstack"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-get-resp.json.tpl
new file mode 100644
index 0000000000..47ed3c1f22
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-get-resp.json.tpl
@@ -0,0 +1,56 @@
+{
+ "server": {
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake",
+ "security_groups": [{"name": "test"}],
+ "key_name": null
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-post-req.json.tpl
new file mode 100644
index 0000000000..6657700682
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-post-req.json.tpl
@@ -0,0 +1,11 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/openstack/images/%(image_id)s",
+ "flavorRef" : "%(host)s/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "security_groups": [{"name": "test"}]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-post-resp.json.tpl
new file mode 100644
index 0000000000..c87c1ee064
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-post-resp.json.tpl
@@ -0,0 +1,17 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "security_groups": [{"name": "test"}]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-security-groups-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-security-groups-list-resp.json.tpl
new file mode 100644
index 0000000000..1771f2dff1
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/server-security-groups-list-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "security_groups": [
+ {
+ "description": "default",
+ "id": 1,
+ "name": "default",
+ "rules": [],
+ "tenant_id": "openstack"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-security-groups/servers-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/servers-detail-resp.json.tpl
new file mode 100644
index 0000000000..519292d50a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-security-groups/servers-detail-resp.json.tpl
@@ -0,0 +1,57 @@
+{
+ "servers": [
+ {
+ "updated": "%(isotime)s",
+ "created": "%(isotime)s",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4,
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(uuid)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "user_id": "fake",
+ "security_groups": [{"name": "test"}],
+ "key_name": null
+ }]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-diagnostics/server-diagnostics-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-diagnostics/server-diagnostics-get-resp.json.tpl
new file mode 100644
index 0000000000..1afedaee9c
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-diagnostics/server-diagnostics-get-resp.json.tpl
@@ -0,0 +1,17 @@
+{
+ "cpu0_time": 17300000000,
+ "memory": 524288,
+ "vda_errors": -1,
+ "vda_read": 262144,
+ "vda_read_req": 112,
+ "vda_write": 5778432,
+ "vda_write_req": 488,
+ "vnet1_rx": 2070139,
+ "vnet1_rx_drop": 0,
+ "vnet1_rx_errors": 0,
+ "vnet1_rx_packets": 26701,
+ "vnet1_tx": 140208,
+ "vnet1_tx_drop": 0,
+ "vnet1_tx_errors": 0,
+ "vnet1_tx_packets": 662
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-diagnostics/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-diagnostics/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-diagnostics/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-diagnostics/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-diagnostics/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-diagnostics/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-external-events/event-create-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-external-events/event-create-req.json.tpl
new file mode 100644
index 0000000000..43c3b6b407
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-external-events/event-create-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "events": [
+ {
+ "name": "%(name)s",
+ "tag": "%(tag)s",
+ "status": "%(status)s",
+ "server_uuid": "%(uuid)s"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-external-events/event-create-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-external-events/event-create-resp.json.tpl
new file mode 100644
index 0000000000..aa11b62c83
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-external-events/event-create-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "events": [
+ {
+ "code": 200,
+ "name": "%(name)s",
+ "server_uuid": "%(uuid)s",
+ "status": "%(status)s",
+ "tag": "%(tag)s"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-external-events/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-external-events/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-external-events/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-external-events/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-external-events/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-external-events/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-get-resp.json.tpl
new file mode 100644
index 0000000000..ba72643b6d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-get-resp.json.tpl
@@ -0,0 +1,9 @@
+{
+ "server_group": {
+ "id": "%(id)s",
+ "name": "%(name)s",
+ "policies": ["anti-affinity"],
+ "members": [],
+ "metadata": {}
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-list-resp.json.tpl
new file mode 100644
index 0000000000..f01d451dd2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-list-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "server_groups": [
+ {
+ "id": "%(id)s",
+ "name": "test",
+ "policies": ["anti-affinity"],
+ "members": [],
+ "metadata": {}
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-post-req.json.tpl
new file mode 100644
index 0000000000..1cc2328320
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-post-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "server_group": {
+ "name": "%(name)s",
+ "policies": ["anti-affinity"]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-post-resp.json.tpl
new file mode 100644
index 0000000000..ee9c37e82c
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-groups/server-groups-post-resp.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server_group": {
+ "id": "%(id)s",
+ "name": "%(name)s",
+ "policies": ["anti-affinity"],
+ "members": [],
+ "metadata": {}
+ }
+}
+
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-usage/server-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-usage/server-get-resp.json.tpl
new file mode 100644
index 0000000000..90e75947e5
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-usage/server-get-resp.json.tpl
@@ -0,0 +1,57 @@
+{
+ "server": {
+ "OS-SRV-USG:launched_at": "%(strtime)s",
+ "OS-SRV-USG:terminated_at": null,
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "key_name": null,
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-usage/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-usage/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-usage/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-usage/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-usage/server-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-usage/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-server-usage/servers-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-server-usage/servers-detail-resp.json.tpl
new file mode 100644
index 0000000000..ae20daabf7
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-server-usage/servers-detail-resp.json.tpl
@@ -0,0 +1,58 @@
+{
+ "servers": [
+ {
+ "status": "ACTIVE",
+ "created": "%(isotime)s",
+ "OS-SRV-USG:launched_at": "%(strtime)s",
+ "user_id": "fake",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "key_name": null,
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "updated": "%(isotime)s",
+ "name": "new-server-test",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "id": "%(uuid)s",
+ "OS-SRV-USG:terminated_at": null,
+ "tenant_id": "openstack",
+ "progress": 0,
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "metadata": {
+ "My Server Name": "Apache1"
+ }
+ }]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-log-put-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-log-put-req.json.tpl
new file mode 100644
index 0000000000..f11cca3739
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-log-put-req.json.tpl
@@ -0,0 +1,8 @@
+{
+ "service":
+ {
+ "host": "%(host)s",
+ "binary": "%(binary)s",
+ "disabled_reason": "%(disabled_reason)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-log-put-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-log-put-resp.json.tpl
new file mode 100644
index 0000000000..442e2099f9
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-log-put-resp.json.tpl
@@ -0,0 +1,8 @@
+{
+ "service": {
+ "binary": "nova-compute",
+ "disabled_reason": "test2",
+ "host": "host1",
+ "status": "disabled"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-put-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-put-req.json.tpl
new file mode 100644
index 0000000000..1323ef50f5
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-put-req.json.tpl
@@ -0,0 +1,7 @@
+{
+ "service":
+ {
+ "host": "%(host)s",
+ "binary": "%(binary)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-put-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-put-resp.json.tpl
new file mode 100644
index 0000000000..d7fe948d01
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-services/service-disable-put-resp.json.tpl
@@ -0,0 +1,7 @@
+{
+ "service": {
+ "binary": "nova-compute",
+ "host": "host1",
+ "status": "disabled"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-services/service-enable-put-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-services/service-enable-put-req.json.tpl
new file mode 100644
index 0000000000..1323ef50f5
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-services/service-enable-put-req.json.tpl
@@ -0,0 +1,7 @@
+{
+ "service":
+ {
+ "host": "%(host)s",
+ "binary": "%(binary)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-services/service-enable-put-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-services/service-enable-put-resp.json.tpl
new file mode 100644
index 0000000000..0a6b2668df
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-services/service-enable-put-resp.json.tpl
@@ -0,0 +1,7 @@
+{
+ "service": {
+ "binary": "nova-compute",
+ "host": "host1",
+ "status": "enabled"
+ }
+} \ No newline at end of file
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-services/services-list-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-services/services-list-get-resp.json.tpl
new file mode 100644
index 0000000000..174b443d0b
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-services/services-list-get-resp.json.tpl
@@ -0,0 +1,44 @@
+{
+ "services": [
+ {
+ "binary": "nova-scheduler",
+ "disabled_reason": "test1",
+ "host": "host1",
+ "id": 1,
+ "state": "up",
+ "status": "disabled",
+ "updated_at": "%(strtime)s",
+ "zone": "internal"
+ },
+ {
+ "binary": "nova-compute",
+ "disabled_reason": "test2",
+ "host": "host1",
+ "id": 2,
+ "state": "up",
+ "status": "disabled",
+ "updated_at": "%(strtime)s",
+ "zone": "nova"
+ },
+ {
+ "binary": "nova-scheduler",
+ "disabled_reason": null,
+ "host": "host2",
+ "id": 3,
+ "state": "down",
+ "status": "enabled",
+ "updated_at": "%(strtime)s",
+ "zone": "internal"
+ },
+ {
+ "binary": "nova-compute",
+ "disabled_reason": "test4",
+ "host": "host2",
+ "id": 4,
+ "state": "down",
+ "status": "disabled",
+ "updated_at": "%(strtime)s",
+ "zone": "nova"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-shelve/os-shelve-offload.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-shelve/os-shelve-offload.json.tpl
new file mode 100644
index 0000000000..5a19f85cff
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-shelve/os-shelve-offload.json.tpl
@@ -0,0 +1,3 @@
+{
+ "%(action)s": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-shelve/os-shelve.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-shelve/os-shelve.json.tpl
new file mode 100644
index 0000000000..5a19f85cff
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-shelve/os-shelve.json.tpl
@@ -0,0 +1,3 @@
+{
+ "%(action)s": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-shelve/os-unshelve.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-shelve/os-unshelve.json.tpl
new file mode 100644
index 0000000000..5a19f85cff
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-shelve/os-unshelve.json.tpl
@@ -0,0 +1,3 @@
+{
+ "%(action)s": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-shelve/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-shelve/server-post-req.json.tpl
new file mode 100644
index 0000000000..6f9336d3c0
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-shelve/server-post-req.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/openstack/images/%(image_id)s",
+ "flavorRef" : "%(host)s/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-shelve/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-shelve/server-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-shelve/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/server-post-req.json.tpl
new file mode 100644
index 0000000000..d3916d1aa6
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/server-post-req.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(host)s/openstack/images/%(image_id)s",
+ "flavorRef" : "%(host)s/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json.tpl
new file mode 100644
index 0000000000..f37083013d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json.tpl
@@ -0,0 +1,27 @@
+{
+ "tenant_usage": {
+ "server_usages": [
+ {
+ "ended_at": null,
+ "flavor": "m1.tiny",
+ "hours": 1.0,
+ "instance_id": "%(uuid)s",
+ "local_gb": 1,
+ "memory_mb": 512,
+ "name": "new-server-test",
+ "started_at": "%(strtime)s",
+ "state": "active",
+ "tenant_id": "openstack",
+ "uptime": 3600,
+ "vcpus": 1
+ }
+ ],
+ "start": "%(strtime)s",
+ "stop": "%(strtime)s",
+ "tenant_id": "openstack",
+ "total_hours": 1.0,
+ "total_local_gb_usage": 1.0,
+ "total_memory_mb_usage": 512.0,
+ "total_vcpus_usage": 1.0
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json.tpl
new file mode 100644
index 0000000000..25b5ff2b84
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json.tpl
@@ -0,0 +1,13 @@
+{
+ "tenant_usages": [
+ {
+ "start": "%(strtime)s",
+ "stop": "%(strtime)s",
+ "tenant_id": "openstack",
+ "total_hours": 1.0,
+ "total_local_gb_usage": 1.0,
+ "total_memory_mb_usage": 512.0,
+ "total_vcpus_usage": 1.0
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-resume.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-resume.json.tpl
new file mode 100644
index 0000000000..ff00d97a14
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-resume.json.tpl
@@ -0,0 +1,3 @@
+{
+ "resume": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-suspend.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-suspend.json.tpl
new file mode 100644
index 0000000000..8c2206a063
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-suspend-server/server-suspend.json.tpl
@@ -0,0 +1,3 @@
+{
+ "suspend": null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-tenant-networks/networks-list-res.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-tenant-networks/networks-list-res.json.tpl
new file mode 100644
index 0000000000..757084d2f3
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-tenant-networks/networks-list-res.json.tpl
@@ -0,0 +1,14 @@
+{
+ "networks": [
+ {
+ "cidr": "10.0.0.0/29",
+ "id": "%(id)s",
+ "label": "test_0"
+ },
+ {
+ "cidr": "10.0.0.8/29",
+ "id": "%(id)s",
+ "label": "test_1"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-tenant-networks/networks-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-tenant-networks/networks-post-req.json.tpl
new file mode 100644
index 0000000000..fb1c2d3d06
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-tenant-networks/networks-post-req.json.tpl
@@ -0,0 +1,9 @@
+{
+ "network": {
+ "label": "public",
+ "cidr": "172.0.0.0/24",
+ "vlan_start": 1,
+ "num_networks": 1,
+ "network_size": 255
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-tenant-networks/networks-post-res.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-tenant-networks/networks-post-res.json.tpl
new file mode 100644
index 0000000000..ff9e2273d3
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-tenant-networks/networks-post-res.json.tpl
@@ -0,0 +1,7 @@
+{
+ "network": {
+ "cidr": "172.0.0.0/24",
+ "id": "%(id)s",
+ "label": "public"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-used-limits/usedlimits-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-used-limits/usedlimits-get-resp.json.tpl
new file mode 100644
index 0000000000..28309af04c
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-used-limits/usedlimits-get-resp.json.tpl
@@ -0,0 +1,26 @@
+{
+ "limits": {
+ "absolute": {
+ "maxImageMeta": 128,
+ "maxPersonality": 5,
+ "maxPersonalitySize": 10240,
+ "maxSecurityGroupRules": 20,
+ "maxSecurityGroups": 10,
+ "maxServerMeta": 128,
+ "maxTotalCores": 20,
+ "maxTotalFloatingIps": 10,
+ "maxTotalInstances": 10,
+ "maxTotalKeypairs": 100,
+ "maxTotalRAMSize": 51200,
+ "maxServerGroups": 10,
+ "maxServerGroupMembers": 10,
+ "totalCoresUsed": 0,
+ "totalInstancesUsed": 0,
+ "totalRAMUsed": 0,
+ "totalSecurityGroupsUsed": 0,
+ "totalFloatingIpsUsed": 0,
+ "totalServerGroupsUsed": 0
+ },
+ "rate": []
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-user-data/userdata-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-user-data/userdata-post-req.json.tpl
new file mode 100644
index 0000000000..37f0a75d0a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-user-data/userdata-post-req.json.tpl
@@ -0,0 +1,11 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(host)s/openstack/images/%(image_id)s",
+ "flavorRef" : "%(host)s/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "user_data" : "%(user_data)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-user-data/userdata-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-user-data/userdata-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-user-data/userdata-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-detail-resp.json.tpl
new file mode 100644
index 0000000000..82a63eda5f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-detail-resp.json.tpl
@@ -0,0 +1,24 @@
+{
+ "volumes": [
+ {
+ "attachments": [
+ {
+ "device": "/",
+ "id": "%(uuid)s",
+ "serverId": "%(uuid)s",
+ "volumeId": "%(uuid)s"
+ }
+ ],
+ "availabilityZone": "zone1:host1",
+ "createdAt": "%(strtime)s",
+ "displayDescription": "%(volume_desc)s",
+ "displayName": "%(volume_name)s",
+ "id": "%(uuid)s",
+ "metadata": {},
+ "size": 100,
+ "snapshotId": null,
+ "status": "in-use",
+ "volumeType": "Backup"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-get-resp.json.tpl
new file mode 100644
index 0000000000..84bfdd2a5b
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-get-resp.json.tpl
@@ -0,0 +1,22 @@
+{
+ "volume": {
+ "attachments": [
+ {
+ "device": "/",
+ "id": "%(uuid)s",
+ "serverId": "%(uuid)s",
+ "volumeId": "%(uuid)s"
+ }
+ ],
+ "availabilityZone": "zone1:host1",
+ "createdAt": "%(strtime)s",
+ "displayDescription": "%(volume_desc)s",
+ "displayName": "%(volume_name)s",
+ "id": "%(uuid)s",
+ "metadata": {},
+ "size": 100,
+ "snapshotId": null,
+ "status": "in-use",
+ "volumeType": "Backup"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-index-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-index-resp.json.tpl
new file mode 100644
index 0000000000..82a63eda5f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-index-resp.json.tpl
@@ -0,0 +1,24 @@
+{
+ "volumes": [
+ {
+ "attachments": [
+ {
+ "device": "/",
+ "id": "%(uuid)s",
+ "serverId": "%(uuid)s",
+ "volumeId": "%(uuid)s"
+ }
+ ],
+ "availabilityZone": "zone1:host1",
+ "createdAt": "%(strtime)s",
+ "displayDescription": "%(volume_desc)s",
+ "displayName": "%(volume_name)s",
+ "id": "%(uuid)s",
+ "metadata": {},
+ "size": 100,
+ "snapshotId": null,
+ "status": "in-use",
+ "volumeType": "Backup"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-post-req.json.tpl
new file mode 100644
index 0000000000..33e9a68944
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-post-req.json.tpl
@@ -0,0 +1,8 @@
+{
+ "volume": {
+ "availability_zone": "zone1:host1",
+ "display_name": "%(volume_name)s",
+ "display_description": "%(volume_desc)s",
+ "size": 100
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-post-resp.json.tpl
new file mode 100644
index 0000000000..d13ce20cc3
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-volumes/os-volumes-post-resp.json.tpl
@@ -0,0 +1,21 @@
+{
+ "volume": {
+ "status": "in-use",
+ "displayDescription": "%(volume_desc)s",
+ "availabilityZone": "zone1:host1",
+ "displayName": "%(volume_name)s",
+ "attachments": [
+ { "device": "/",
+ "serverId": "%(uuid)s",
+ "id": "%(uuid)s",
+ "volumeId": "%(uuid)s"
+ }
+ ],
+ "volumeType": "Backup",
+ "snapshotId": null,
+ "metadata": {},
+ "id": "%(uuid)s",
+ "createdAt": "%(strtime)s",
+ "size": 100
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-volumes/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-volumes/server-post-req.json.tpl
new file mode 100644
index 0000000000..3271a58a7d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-volumes/server-post-req.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "name": "new-server-test",
+ "imageRef": "%(host)s/openstack/images/%(image_id)s",
+ "flavorRef": "%(host)s/openstack/flavors/1",
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "personality": [
+ {
+ "path": "/etc/banner.txt",
+ "contents": "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-volumes/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-volumes/server-post-resp.json.tpl
new file mode 100644
index 0000000000..adfaaa381e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-volumes/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshot-create-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshot-create-req.json.tpl
new file mode 100644
index 0000000000..a8d47ea031
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshot-create-req.json.tpl
@@ -0,0 +1,8 @@
+{
+ "snapshot": {
+ "display_name": "%(snapshot_name)s",
+ "display_description": "%(description)s",
+ "volume_id": "%(volume_id)s",
+ "force": false
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshot-create-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshot-create-resp.json.tpl
new file mode 100644
index 0000000000..6153e8140e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshot-create-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "snapshot": {
+ "createdAt": "%(strtime)s",
+ "displayDescription": "%(description)s",
+ "displayName": "%(snapshot_name)s",
+ "id": 100,
+ "size": 100,
+ "status": "available",
+ "volumeId": "%(uuid)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshots-detail-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshots-detail-resp.json.tpl
new file mode 100644
index 0000000000..1b509d54f8
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshots-detail-resp.json.tpl
@@ -0,0 +1,31 @@
+{
+ "snapshots": [
+ {
+ "createdAt": "%(strtime)s",
+ "displayDescription": "Default description",
+ "displayName": "Default name",
+ "id": 100,
+ "size": 100,
+ "status": "available",
+ "volumeId": 12
+ },
+ {
+ "createdAt": "%(strtime)s",
+ "displayDescription": "Default description",
+ "displayName": "Default name",
+ "id": 101,
+ "size": 100,
+ "status": "available",
+ "volumeId": 12
+ },
+ {
+ "createdAt": "%(strtime)s",
+ "displayDescription": "Default description",
+ "displayName": "Default name",
+ "id": 102,
+ "size": 100,
+ "status": "available",
+ "volumeId": 12
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshots-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshots-list-resp.json.tpl
new file mode 100644
index 0000000000..c65d073ad7
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshots-list-resp.json.tpl
@@ -0,0 +1,31 @@
+{
+ "snapshots": [
+ {
+ "createdAt": "%(strtime)s",
+ "displayDescription": "%(text)s",
+ "displayName": "%(text)s",
+ "id": 100,
+ "size": 100,
+ "status": "available",
+ "volumeId": 12
+ },
+ {
+ "createdAt": "%(strtime)s",
+ "displayDescription": "%(text)s",
+ "displayName": "%(text)s",
+ "id": 101,
+ "size": 100,
+ "status": "available",
+ "volumeId": 12
+ },
+ {
+ "createdAt": "%(strtime)s",
+ "displayDescription": "%(text)s",
+ "displayName": "%(text)s",
+ "id": 102,
+ "size": 100,
+ "status": "available",
+ "volumeId": 12
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshots-show-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshots-show-resp.json.tpl
new file mode 100644
index 0000000000..a9ab6240d6
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/os-volumes/snapshots-show-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "snapshot": {
+ "createdAt": "%(strtime)s",
+ "displayDescription": "%(description)s",
+ "displayName": "%(snapshot_name)s",
+ "id": "100",
+ "size": 100,
+ "status": "available",
+ "volumeId": 12
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/server-ips/server-ips-network-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/server-ips/server-ips-network-resp.json.tpl
new file mode 100644
index 0000000000..404649a36e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/server-ips/server-ips-network-resp.json.tpl
@@ -0,0 +1,10 @@
+{
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/server-ips/server-ips-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/server-ips/server-ips-resp.json.tpl
new file mode 100644
index 0000000000..322ff19802
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/server-ips/server-ips-resp.json.tpl
@@ -0,0 +1,12 @@
+{
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/server-ips/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/server-ips/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/server-ips/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/server-ips/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/server-ips/server-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/server-ips/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-all-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-all-req.json.tpl
new file mode 100644
index 0000000000..3812a26c88
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-all-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "metadata": {
+ "foo": "%(value)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-all-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-all-resp.json.tpl
new file mode 100644
index 0000000000..3812a26c88
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-all-resp.json.tpl
@@ -0,0 +1,5 @@
+{
+ "metadata": {
+ "foo": "%(value)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-req.json.tpl
new file mode 100644
index 0000000000..85d69ec956
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "meta": {
+ "foo": "%(value)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-resp.json.tpl
new file mode 100644
index 0000000000..85d69ec956
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-metadata-resp.json.tpl
@@ -0,0 +1,5 @@
+{
+ "meta": {
+ "foo": "%(value)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/server-metadata/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-action-confirm-resize.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-confirm-resize.json.tpl
new file mode 100644
index 0000000000..432f6126e9
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-confirm-resize.json.tpl
@@ -0,0 +1,3 @@
+{
+ "confirmResize" : null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-action-create-image.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-create-image.json.tpl
new file mode 100644
index 0000000000..19c2c489a4
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-create-image.json.tpl
@@ -0,0 +1,9 @@
+{
+ "createImage" : {
+ "name" : "%(name)s",
+ "metadata": {
+ "meta_var": "meta_val"
+ }
+ }
+}
+
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-action-reboot.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-reboot.json.tpl
new file mode 100644
index 0000000000..18eda9b9ab
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-reboot.json.tpl
@@ -0,0 +1,5 @@
+{
+ "reboot" : {
+ "type" : "%(type)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild-preserve-ephemeral-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild-preserve-ephemeral-resp.json.tpl
new file mode 100644
index 0000000000..3c44eb8d7e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild-preserve-ephemeral-resp.json.tpl
@@ -0,0 +1,55 @@
+{
+ "server": {
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4,
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "adminPass": "%(password)s",
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(uuid)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "meta_var": "meta_val"
+ },
+ "name": "%(name)s",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild-preserve-ephemeral.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild-preserve-ephemeral.json.tpl
new file mode 100644
index 0000000000..8f38088c19
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild-preserve-ephemeral.json.tpl
@@ -0,0 +1,17 @@
+{
+ "rebuild" : {
+ "imageRef" : "%(glance_host)s/images/%(uuid)s",
+ "name" : "%(name)s",
+ "adminPass" : "%(pass)s",
+ "metadata" : {
+ "meta_var" : "meta_val"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6 b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ],
+ "preserve_ephemeral": %(preserve_ephemeral)s
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild-resp.json.tpl
new file mode 100644
index 0000000000..3c44eb8d7e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild-resp.json.tpl
@@ -0,0 +1,55 @@
+{
+ "server": {
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4,
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "adminPass": "%(password)s",
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(uuid)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "meta_var": "meta_val"
+ },
+ "name": "%(name)s",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild.json.tpl
new file mode 100644
index 0000000000..6385f10593
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-rebuild.json.tpl
@@ -0,0 +1,16 @@
+{
+ "rebuild" : {
+ "imageRef" : "%(glance_host)s/images/%(uuid)s",
+ "name" : "%(name)s",
+ "adminPass" : "%(pass)s",
+ "metadata" : {
+ "meta_var" : "meta_val"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6 b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-action-resize.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-resize.json.tpl
new file mode 100644
index 0000000000..468a88da24
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-resize.json.tpl
@@ -0,0 +1,5 @@
+{
+ "resize" : {
+ "flavorRef" : "%(id)s"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-action-revert-resize.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-revert-resize.json.tpl
new file mode 100644
index 0000000000..2ddf6e5ab0
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-revert-resize.json.tpl
@@ -0,0 +1,3 @@
+{
+ "revertResize" : null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-action-start.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-start.json.tpl
new file mode 100644
index 0000000000..883d0247a2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-start.json.tpl
@@ -0,0 +1,3 @@
+{
+ "%(action)s" : null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-action-stop.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-stop.json.tpl
new file mode 100644
index 0000000000..883d0247a2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-action-stop.json.tpl
@@ -0,0 +1,3 @@
+{
+ "%(action)s" : null
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-get-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-get-resp.json.tpl
new file mode 100644
index 0000000000..3c7cc62999
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-get-resp.json.tpl
@@ -0,0 +1,55 @@
+{
+ "server": {
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "key_name": null,
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-post-req.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-post-req.json.tpl
new file mode 100644
index 0000000000..ab0a3bb797
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(glance_host)s/images/%(image_id)s",
+ "flavorRef" : "%(host)s/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ }
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/server-post-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/server-post-resp.json.tpl
new file mode 100644
index 0000000000..71654b4b8a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/servers-details-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/servers-details-resp.json.tpl
new file mode 100644
index 0000000000..1d4f8d9031
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/servers-details-resp.json.tpl
@@ -0,0 +1,57 @@
+{
+ "servers": [
+ {
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
+ "OS-EXT-IPS:type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(isotime)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "key_name": null,
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(isotime)s",
+ "user_id": "fake"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/api_samples/servers/servers-list-resp.json.tpl b/nova/tests/unit/integrated/v3/api_samples/servers/servers-list-resp.json.tpl
new file mode 100644
index 0000000000..8797266b68
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/api_samples/servers/servers-list-resp.json.tpl
@@ -0,0 +1,18 @@
+{
+ "servers": [
+ {
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "new-server-test"
+ }
+ ]
+}
diff --git a/nova/tests/unit/integrated/v3/test_access_ips.py b/nova/tests/unit/integrated/v3/test_access_ips.py
new file mode 100644
index 0000000000..d0af25f281
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_access_ips.py
@@ -0,0 +1,93 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.image import fake
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class AccessIPsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = 'os-access-ips'
+
+ def _servers_post(self, subs):
+ response = self._do_post('servers', 'server-post-req', subs)
+ subs.update(self._get_regexes())
+ return self._verify_response('server-post-resp', subs, response, 202)
+
+ def test_servers_post(self):
+ subs = {
+ 'image_id': fake.get_valid_image_id(),
+ 'host': self._get_host(),
+ 'access_ip_v4': '1.2.3.4',
+ 'access_ip_v6': 'fe80::'
+ }
+ self._servers_post(subs)
+
+ def test_servers_get(self):
+ subs = {
+ 'image_id': fake.get_valid_image_id(),
+ 'host': self._get_host(),
+ 'access_ip_v4': '1.2.3.4',
+ 'access_ip_v6': 'fe80::'
+ }
+ uuid = self._servers_post(subs)
+ response = self._do_get('servers/%s' % uuid)
+ subs['hostid'] = '[a-f0-9]+'
+ subs['id'] = uuid
+ self._verify_response('server-get-resp', subs, response, 200)
+
+ def test_servers_details(self):
+ subs = {
+ 'image_id': fake.get_valid_image_id(),
+ 'host': self._get_host(),
+ 'access_ip_v4': '1.2.3.4',
+ 'access_ip_v6': 'fe80::'
+ }
+ uuid = self._servers_post(subs)
+ response = self._do_get('servers/detail')
+ subs['hostid'] = '[a-f0-9]+'
+ subs['id'] = uuid
+ self._verify_response('servers-details-resp', subs, response, 200)
+
+ def test_servers_rebuild(self):
+ subs = {
+ 'image_id': fake.get_valid_image_id(),
+ 'host': self._get_host(),
+ 'access_ip_v4': '1.2.3.4',
+ 'access_ip_v6': 'fe80::'
+ }
+ uuid = self._servers_post(subs)
+ subs['access_ip_v4'] = "4.3.2.1"
+ subs['access_ip_v6'] = '80fe::'
+ response = self._do_post('servers/%s/action' % uuid,
+ 'server-action-rebuild', subs)
+ subs['hostid'] = '[a-f0-9]+'
+ subs['id'] = uuid
+ self._verify_response('server-action-rebuild-resp',
+ subs, response, 202)
+
+ def test_servers_update(self):
+ subs = {
+ 'image_id': fake.get_valid_image_id(),
+ 'host': self._get_host(),
+ 'access_ip_v4': '1.2.3.4',
+ 'access_ip_v6': 'fe80::'
+ }
+ uuid = self._servers_post(subs)
+ subs['access_ip_v4'] = "4.3.2.1"
+ subs['access_ip_v6'] = '80fe::'
+ response = self._do_put('servers/%s' % uuid, 'server-put-req', subs)
+ subs['hostid'] = '[a-f0-9]+'
+ subs['id'] = uuid
+ self._verify_response('server-put-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_admin_actions.py b/nova/tests/unit/integrated/v3/test_admin_actions.py
new file mode 100644
index 0000000000..7530066438
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_admin_actions.py
@@ -0,0 +1,46 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class AdminActionsSamplesJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-admin-actions"
+
+ def setUp(self):
+ """setUp Method for AdminActions api samples extension
+
+ This method creates the server that will be used in each tests
+ """
+ super(AdminActionsSamplesJsonTest, self).setUp()
+ self.uuid = self._post_server()
+
+ def test_post_reset_network(self):
+ # Get api samples to reset server network request.
+ response = self._do_post('servers/%s/action' % self.uuid,
+ 'admin-actions-reset-network', {})
+ self.assertEqual(response.status_code, 202)
+
+ def test_post_inject_network_info(self):
+ # Get api samples to inject network info request.
+ response = self._do_post('servers/%s/action' % self.uuid,
+ 'admin-actions-inject-network-info', {})
+ self.assertEqual(response.status_code, 202)
+
+ def test_post_reset_state(self):
+ # get api samples to server reset state request.
+ response = self._do_post('servers/%s/action' % self.uuid,
+ 'admin-actions-reset-server-state', {})
+ self.assertEqual(response.status_code, 202)
diff --git a/nova/tests/unit/integrated/v3/test_admin_password.py b/nova/tests/unit/integrated/v3/test_admin_password.py
new file mode 100644
index 0000000000..2062e857df
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_admin_password.py
@@ -0,0 +1,29 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class AdminPasswordJsonTest(test_servers.ServersSampleBase):
+ extension_name = 'os-admin-password'
+
+ def test_server_password(self):
+ uuid = self._post_server()
+ subs = {"password": "foo"}
+ response = self._do_post('servers/%s/action' % uuid,
+ 'admin-password-change-password',
+ subs)
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, "")
diff --git a/nova/tests/unit/integrated/v3/test_agents.py b/nova/tests/unit/integrated/v3/test_agents.py
new file mode 100644
index 0000000000..ade59e6ec0
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_agents.py
@@ -0,0 +1,98 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova import db
+from nova.db.sqlalchemy import models
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class AgentsJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-agents"
+
+ def setUp(self):
+ super(AgentsJsonTest, self).setUp()
+
+ fake_agents_list = [{'url': 'http://example.com/path/to/resource',
+ 'hypervisor': 'hypervisor',
+ 'architecture': 'x86',
+ 'os': 'os',
+ 'version': '8.0',
+ 'md5hash': 'add6bb58e139be103324d04d82d8f545',
+ 'id': 1}]
+
+ def fake_agent_build_create(context, values):
+ values['id'] = 1
+ agent_build_ref = models.AgentBuild()
+ agent_build_ref.update(values)
+ return agent_build_ref
+
+ def fake_agent_build_get_all(context, hypervisor):
+ agent_build_all = []
+ for agent in fake_agents_list:
+ if hypervisor and hypervisor != agent['hypervisor']:
+ continue
+ agent_build_ref = models.AgentBuild()
+ agent_build_ref.update(agent)
+ agent_build_all.append(agent_build_ref)
+ return agent_build_all
+
+ def fake_agent_build_update(context, agent_build_id, values):
+ pass
+
+ def fake_agent_build_destroy(context, agent_update_id):
+ pass
+
+ self.stubs.Set(db, "agent_build_create",
+ fake_agent_build_create)
+ self.stubs.Set(db, "agent_build_get_all",
+ fake_agent_build_get_all)
+ self.stubs.Set(db, "agent_build_update",
+ fake_agent_build_update)
+ self.stubs.Set(db, "agent_build_destroy",
+ fake_agent_build_destroy)
+
+ def test_agent_create(self):
+ # Creates a new agent build.
+ project = {'url': 'http://example.com/path/to/resource',
+ 'hypervisor': 'hypervisor',
+ 'architecture': 'x86',
+ 'os': 'os',
+ 'version': '8.0',
+ 'md5hash': 'add6bb58e139be103324d04d82d8f545'
+ }
+ response = self._do_post('os-agents', 'agent-post-req',
+ project)
+ self._verify_response('agent-post-resp', project, response, 200)
+
+ def test_agent_list(self):
+ # Return a list of all agent builds.
+ response = self._do_get('os-agents')
+ self._verify_response('agents-get-resp', {}, response, 200)
+
+ def test_agent_update(self):
+ # Update an existing agent build.
+ agent_id = 1
+ subs = {'version': '7.0',
+ 'url': 'http://example.com/path/to/resource',
+ 'md5hash': 'add6bb58e139be103324d04d82d8f545'}
+ response = self._do_put('os-agents/%s' % agent_id,
+ 'agent-update-put-req', subs)
+ self._verify_response('agent-update-put-resp', subs, response, 200)
+
+ def test_agent_delete(self):
+ # Deletes an existing agent build.
+ agent_id = 1
+ response = self._do_delete('os-agents/%s' % agent_id)
+ self.assertEqual(response.status_code, 200)
diff --git a/nova/tests/unit/integrated/v3/test_aggregates.py b/nova/tests/unit/integrated/v3/test_aggregates.py
new file mode 100644
index 0000000000..6e29ea0403
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_aggregates.py
@@ -0,0 +1,80 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class AggregatesSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-aggregates"
+
+ def test_aggregate_create(self):
+ subs = {
+ "aggregate_id": '(?P<id>\d+)'
+ }
+ response = self._do_post('os-aggregates', 'aggregate-post-req', subs)
+ subs.update(self._get_regexes())
+ return self._verify_response('aggregate-post-resp',
+ subs, response, 200)
+
+ def test_list_aggregates(self):
+ self.test_aggregate_create()
+ response = self._do_get('os-aggregates')
+ subs = self._get_regexes()
+ self._verify_response('aggregates-list-get-resp', subs, response, 200)
+
+ def test_aggregate_get(self):
+ agg_id = self.test_aggregate_create()
+ response = self._do_get('os-aggregates/%s' % agg_id)
+ subs = self._get_regexes()
+ self._verify_response('aggregates-get-resp', subs, response, 200)
+
+ def test_add_metadata(self):
+ agg_id = self.test_aggregate_create()
+ response = self._do_post('os-aggregates/%s/action' % agg_id,
+ 'aggregate-metadata-post-req',
+ {'action': 'set_metadata'})
+ subs = self._get_regexes()
+ self._verify_response('aggregates-metadata-post-resp', subs,
+ response, 200)
+
+ def test_add_host(self):
+ aggregate_id = self.test_aggregate_create()
+ subs = {
+ "host_name": self.compute.host,
+ }
+ response = self._do_post('os-aggregates/%s/action' % aggregate_id,
+ 'aggregate-add-host-post-req', subs)
+ subs.update(self._get_regexes())
+ self._verify_response('aggregates-add-host-post-resp', subs,
+ response, 200)
+
+ def test_remove_host(self):
+ self.test_add_host()
+ subs = {
+ "host_name": self.compute.host,
+ }
+ response = self._do_post('os-aggregates/1/action',
+ 'aggregate-remove-host-post-req', subs)
+ subs.update(self._get_regexes())
+ self._verify_response('aggregates-remove-host-post-resp',
+ subs, response, 200)
+
+ def test_update_aggregate(self):
+ aggregate_id = self.test_aggregate_create()
+ response = self._do_put('os-aggregates/%s' % aggregate_id,
+ 'aggregate-update-post-req', {})
+ subs = self._get_regexes()
+ self._verify_response('aggregate-update-post-resp',
+ subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_attach_interfaces.py b/nova/tests/unit/integrated/v3/test_attach_interfaces.py
new file mode 100644
index 0000000000..f35edcb740
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_attach_interfaces.py
@@ -0,0 +1,166 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.compute import api as compute_api
+from nova import exception
+from nova.network import api as network_api
+from nova.tests.unit import fake_network_cache_model
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class AttachInterfacesSampleJsonTest(test_servers.ServersSampleBase):
+ extension_name = 'os-attach-interfaces'
+
+ def setUp(self):
+ super(AttachInterfacesSampleJsonTest, self).setUp()
+
+ def fake_list_ports(self, *args, **kwargs):
+ uuid = kwargs.get('device_id', None)
+ if not uuid:
+ raise exception.InstanceNotFound(instance_id=None)
+ port_data = {
+ "id": "ce531f90-199f-48c0-816c-13e38010b442",
+ "network_id": "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
+ "admin_state_up": True,
+ "status": "ACTIVE",
+ "mac_address": "fa:16:3e:4c:2c:30",
+ "fixed_ips": [
+ {
+ "ip_address": "192.168.1.3",
+ "subnet_id": "f8a6e8f8-c2ec-497c-9f23-da9616de54ef"
+ }
+ ],
+ "device_id": uuid,
+ }
+ ports = {'ports': [port_data]}
+ return ports
+
+ def fake_show_port(self, context, port_id=None):
+ if not port_id:
+ raise exception.PortNotFound(port_id=None)
+ port_data = {
+ "id": port_id,
+ "network_id": "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
+ "admin_state_up": True,
+ "status": "ACTIVE",
+ "mac_address": "fa:16:3e:4c:2c:30",
+ "fixed_ips": [
+ {
+ "ip_address": "192.168.1.3",
+ "subnet_id": "f8a6e8f8-c2ec-497c-9f23-da9616de54ef"
+ }
+ ],
+ "device_id": 'bece68a3-2f8b-4e66-9092-244493d6aba7',
+ }
+ port = {'port': port_data}
+ return port
+
+ def fake_attach_interface(self, context, instance,
+ network_id, port_id,
+ requested_ip='192.168.1.3'):
+ if not network_id:
+ network_id = "fake_net_uuid"
+ if not port_id:
+ port_id = "fake_port_uuid"
+ vif = fake_network_cache_model.new_vif()
+ vif['id'] = port_id
+ vif['network']['id'] = network_id
+ vif['network']['subnets'][0]['ips'][0] = requested_ip
+ return vif
+
+ def fake_detach_interface(self, context, instance, port_id):
+ pass
+
+ self.stubs.Set(network_api.API, 'list_ports', fake_list_ports)
+ self.stubs.Set(network_api.API, 'show_port', fake_show_port)
+ self.stubs.Set(compute_api.API, 'attach_interface',
+ fake_attach_interface)
+ self.stubs.Set(compute_api.API, 'detach_interface',
+ fake_detach_interface)
+ self.flags(auth_strategy=None, group='neutron')
+ self.flags(url='http://anyhost/', group='neutron')
+ self.flags(url_timeout=30, group='neutron')
+
+ def generalize_subs(self, subs, vanilla_regexes):
+ subs['subnet_id'] = vanilla_regexes['uuid']
+ subs['net_id'] = vanilla_regexes['uuid']
+ subs['port_id'] = vanilla_regexes['uuid']
+ subs['mac_addr'] = '(?:[a-f0-9]{2}:){5}[a-f0-9]{2}'
+ subs['ip_address'] = vanilla_regexes['ip']
+ return subs
+
+ def test_list_interfaces(self):
+ instance_uuid = self._post_server()
+ response = self._do_get('servers/%s/os-interface'
+ % instance_uuid)
+ subs = {
+ 'ip_address': '192.168.1.3',
+ 'subnet_id': 'f8a6e8f8-c2ec-497c-9f23-da9616de54ef',
+ 'mac_addr': 'fa:16:3e:4c:2c:30',
+ 'net_id': '3cb9bc59-5699-4588-a4b1-b87f96708bc6',
+ 'port_id': 'ce531f90-199f-48c0-816c-13e38010b442',
+ 'port_state': 'ACTIVE'
+ }
+ self._verify_response('attach-interfaces-list-resp', subs,
+ response, 200)
+
+ def _stub_show_for_instance(self, instance_uuid, port_id):
+ show_port = network_api.API().show_port(None, port_id)
+ show_port['port']['device_id'] = instance_uuid
+ self.stubs.Set(network_api.API, 'show_port', lambda *a, **k: show_port)
+
+ def test_show_interfaces(self):
+ instance_uuid = self._post_server()
+ port_id = 'ce531f90-199f-48c0-816c-13e38010b442'
+ self._stub_show_for_instance(instance_uuid, port_id)
+ response = self._do_get('servers/%s/os-interface/%s' %
+ (instance_uuid, port_id))
+ subs = {
+ 'ip_address': '192.168.1.3',
+ 'subnet_id': 'f8a6e8f8-c2ec-497c-9f23-da9616de54ef',
+ 'mac_addr': 'fa:16:3e:4c:2c:30',
+ 'net_id': '3cb9bc59-5699-4588-a4b1-b87f96708bc6',
+ 'port_id': port_id,
+ 'port_state': 'ACTIVE'
+ }
+ self._verify_response('attach-interfaces-show-resp', subs,
+ response, 200)
+
+ def test_create_interfaces(self, instance_uuid=None):
+ if instance_uuid is None:
+ instance_uuid = self._post_server()
+ subs = {
+ 'net_id': '3cb9bc59-5699-4588-a4b1-b87f96708bc6',
+ 'port_id': 'ce531f90-199f-48c0-816c-13e38010b442',
+ 'subnet_id': 'f8a6e8f8-c2ec-497c-9f23-da9616de54ef',
+ 'ip_address': '192.168.1.3',
+ 'port_state': 'ACTIVE',
+ 'mac_addr': 'fa:16:3e:4c:2c:30',
+ }
+ self._stub_show_for_instance(instance_uuid, subs['port_id'])
+ response = self._do_post('servers/%s/os-interface'
+ % instance_uuid,
+ 'attach-interfaces-create-req', subs)
+ subs.update(self._get_regexes())
+ self._verify_response('attach-interfaces-create-resp', subs,
+ response, 200)
+
+ def test_delete_interfaces(self):
+ instance_uuid = self._post_server()
+ port_id = 'ce531f90-199f-48c0-816c-13e38010b442'
+ response = self._do_delete('servers/%s/os-interface/%s' %
+ (instance_uuid, port_id))
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, '')
diff --git a/nova/tests/unit/integrated/v3/test_availability_zone.py b/nova/tests/unit/integrated/v3/test_availability_zone.py
new file mode 100644
index 0000000000..6f59e2c264
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_availability_zone.py
@@ -0,0 +1,49 @@
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from oslo.config import cfg
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+CONF = cfg.CONF
+CONF.import_opt('manager', 'nova.cells.opts', group='cells')
+
+
+class AvailabilityZoneJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-availability-zone"
+
+ def _setup_services(self):
+ self.conductor = self.start_service('conductor',
+ host='conductor', manager=CONF.conductor.manager)
+ self.compute = self.start_service('compute', host='compute')
+ self.cert = self.start_service('cert', host='cert')
+ self.consoleauth = self.start_service('consoleauth',
+ host='consoleauth')
+ self.network = self.start_service('network', host='network')
+ self.scheduler = self.start_service('scheduler', host='scheduler')
+ self.cells = self.start_service('cells', host='cells',
+ manager=CONF.cells.manager)
+
+ def test_availability_zone_list(self):
+ response = self._do_get('os-availability-zone')
+ self._verify_response('availability-zone-list-resp', {}, response, 200)
+
+ def test_availability_zone_detail(self):
+ response = self._do_get('os-availability-zone/detail')
+ subs = self._get_regexes()
+ self._verify_response('availability-zone-detail-resp', subs, response,
+ 200)
+
+ def test_availability_zone_post(self):
+ self._post_server()
diff --git a/nova/tests/unit/integrated/v3/test_cells.py b/nova/tests/unit/integrated/v3/test_cells.py
new file mode 100644
index 0000000000..2d7aea9542
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_cells.py
@@ -0,0 +1,107 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.cells import rpcapi as cells_rpcapi
+from nova.cells import state
+from nova import db
+from nova.db.sqlalchemy import models
+from nova import exception
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class CellsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-cells"
+
+ def setUp(self):
+ # db_check_interval < 0 makes cells manager always hit the DB
+ self.flags(enable=True, db_check_interval=-1, group='cells')
+ super(CellsSampleJsonTest, self).setUp()
+ self._stub_cells()
+
+ def _stub_cells(self, num_cells=5):
+ self.cell_list = []
+ self.cells_next_id = 1
+
+ def _fake_cell_get_all(context):
+ return self.cell_list
+
+ def _fake_cell_get(inst, context, cell_name):
+ for cell in self.cell_list:
+ if cell['name'] == cell_name:
+ return cell
+ raise exception.CellNotFound(cell_name=cell_name)
+
+ for x in xrange(num_cells):
+ cell = models.Cell()
+ our_id = self.cells_next_id
+ self.cells_next_id += 1
+ cell.update({'id': our_id,
+ 'name': 'cell%s' % our_id,
+ 'transport_url': 'rabbit://username%s@/' % our_id,
+ 'is_parent': our_id % 2 == 0})
+ self.cell_list.append(cell)
+
+ self.stubs.Set(db, 'cell_get_all', _fake_cell_get_all)
+ self.stubs.Set(cells_rpcapi.CellsAPI, 'cell_get', _fake_cell_get)
+
+ def test_cells_empty_list(self):
+ # Override this
+ self._stub_cells(num_cells=0)
+ response = self._do_get('os-cells')
+ subs = self._get_regexes()
+ self._verify_response('cells-list-empty-resp', subs, response, 200)
+
+ def test_cells_list(self):
+ response = self._do_get('os-cells')
+ subs = self._get_regexes()
+ self._verify_response('cells-list-resp', subs, response, 200)
+
+ def test_cells_get(self):
+ response = self._do_get('os-cells/cell3')
+ subs = self._get_regexes()
+ self._verify_response('cells-get-resp', subs, response, 200)
+
+ def test_get_cell_capacity(self):
+ self._mock_cell_capacity()
+ state_manager = state.CellStateManager()
+ my_state = state_manager.get_my_state()
+ response = self._do_get('os-cells/%s/capacities' %
+ my_state.name)
+ subs = self._get_regexes()
+ return self._verify_response('cells-capacities-resp',
+ subs, response, 200)
+
+ def test_get_all_cells_capacity(self):
+ self._mock_cell_capacity()
+ response = self._do_get('os-cells/capacities')
+ subs = self._get_regexes()
+ return self._verify_response('cells-capacities-resp',
+ subs, response, 200)
+
+ def _mock_cell_capacity(self):
+ self.mox.StubOutWithMock(self.cells.manager.state_manager,
+ 'get_our_capacities')
+ response = {"ram_free":
+ {"units_by_mb": {"8192": 0, "512": 13,
+ "4096": 1, "2048": 3, "16384": 0},
+ "total_mb": 7680},
+ "disk_free":
+ {"units_by_mb": {"81920": 11, "20480": 46,
+ "40960": 23, "163840": 5, "0": 0},
+ "total_mb": 1052672}
+ }
+ self.cells.manager.state_manager.get_our_capacities(). \
+ AndReturn(response)
+ self.mox.ReplayAll()
diff --git a/nova/tests/unit/integrated/v3/test_certificates.py b/nova/tests/unit/integrated/v3/test_certificates.py
new file mode 100644
index 0000000000..96cbbc711c
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_certificates.py
@@ -0,0 +1,31 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class CertificatesSamplesJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-certificates"
+
+ def test_create_certificates(self):
+ response = self._do_post('os-certificates',
+ 'certificate-create-req', {})
+ subs = self._get_regexes()
+ self._verify_response('certificate-create-resp', subs, response, 200)
+
+ def test_get_root_certificate(self):
+ response = self._do_get('os-certificates/root')
+ subs = self._get_regexes()
+ self._verify_response('certificate-get-root-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_cloudpipe.py b/nova/tests/unit/integrated/v3/test_cloudpipe.py
new file mode 100644
index 0000000000..b8cb28d077
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_cloudpipe.py
@@ -0,0 +1,80 @@
+# Copyright 2014 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import uuid as uuid_lib
+
+from oslo.config import cfg
+
+from nova.cloudpipe import pipelib
+from nova.network import api as network_api
+from nova.tests.unit.image import fake
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+CONF = cfg.CONF
+CONF.import_opt('vpn_image_id', 'nova.cloudpipe.pipelib')
+
+
+class CloudPipeSampleTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-cloudpipe"
+
+ def setUp(self):
+ super(CloudPipeSampleTest, self).setUp()
+
+ def get_user_data(self, project_id):
+ """Stub method to generate user data for cloudpipe tests."""
+ return "VVNFUiBEQVRB\n"
+
+ def network_api_get(self, context, network_uuid):
+ """Stub to get a valid network and its information."""
+ return {'vpn_public_address': '127.0.0.1',
+ 'vpn_public_port': 22}
+
+ self.stubs.Set(pipelib.CloudPipe, 'get_encoded_zip', get_user_data)
+ self.stubs.Set(network_api.API, "get",
+ network_api_get)
+
+ def generalize_subs(self, subs, vanilla_regexes):
+ subs['project_id'] = '[0-9a-f-]+'
+ return subs
+
+ def test_cloud_pipe_create(self):
+ # Get api samples of cloud pipe extension creation.
+ self.flags(vpn_image_id=fake.get_valid_image_id())
+ project = {'project_id': str(uuid_lib.uuid4().hex)}
+ response = self._do_post('os-cloudpipe', 'cloud-pipe-create-req',
+ project)
+ subs = self._get_regexes()
+ subs.update(project)
+ subs['image_id'] = CONF.vpn_image_id
+ self._verify_response('cloud-pipe-create-resp', subs, response, 200)
+ return project
+
+ def test_cloud_pipe_list(self):
+ # Get api samples of cloud pipe extension get request.
+ project = self.test_cloud_pipe_create()
+ response = self._do_get('os-cloudpipe')
+ subs = self._get_regexes()
+ subs.update(project)
+ subs['image_id'] = CONF.vpn_image_id
+ self._verify_response('cloud-pipe-get-resp', subs, response, 200)
+
+ def test_cloud_pipe_update(self):
+ subs = {'vpn_ip': '192.168.1.1',
+ 'vpn_port': 2000}
+ response = self._do_put('os-cloudpipe/configure-project',
+ 'cloud-pipe-update-req',
+ subs)
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, "")
diff --git a/nova/tests/unit/integrated/v3/test_config_drive.py b/nova/tests/unit/integrated/v3/test_config_drive.py
new file mode 100644
index 0000000000..b8e7fc207a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_config_drive.py
@@ -0,0 +1,48 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.api.openstack import fakes
+from nova.tests.unit.image import fake
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ConfigDriveSampleJsonTest(test_servers.ServersSampleBase):
+ extension_name = 'os-config-drive'
+
+ def setUp(self):
+ super(ConfigDriveSampleJsonTest, self).setUp()
+ fakes.stub_out_networking(self.stubs)
+ fakes.stub_out_rate_limiting(self.stubs)
+ fake.stub_out_image_service(self.stubs)
+
+ def test_config_drive_show(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/%s' % uuid)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ # config drive can be a string for True or empty value for False
+ subs['cdrive'] = '.*'
+ self._verify_response('server-config-drive-get-resp', subs,
+ response, 200)
+
+ def test_config_drive_detail(self):
+ self._post_server()
+ response = self._do_get('servers/detail')
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ # config drive can be a string for True or empty value for False
+ subs['cdrive'] = '.*'
+ self._verify_response('servers-config-drive-details-resp',
+ subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_console_auth_tokens.py b/nova/tests/unit/integrated/v3/test_console_auth_tokens.py
new file mode 100644
index 0000000000..d286458678
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_console_auth_tokens.py
@@ -0,0 +1,51 @@
+# Copyright 2013 Cloudbase Solutions Srl
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import re
+
+from oslo.serialization import jsonutils
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ConsoleAuthTokensSampleJsonTests(test_servers.ServersSampleBase):
+ extension_name = "os-console-auth-tokens"
+ extra_extensions_to_load = ["os-remote-consoles"]
+
+ def _get_console_url(self, data):
+ return jsonutils.loads(data)["console"]["url"]
+
+ def _get_console_token(self, uuid):
+ response = self._do_post('servers/%s/action' % uuid,
+ 'get-rdp-console-post-req',
+ {'action': 'os-getRDPConsole'})
+
+ url = self._get_console_url(response.content)
+ return re.match('.+?token=([^&]+)', url).groups()[0]
+
+ def test_get_console_connect_info(self):
+ self.flags(enabled=True, group='rdp')
+
+ uuid = self._post_server()
+ token = self._get_console_token(uuid)
+
+ response = self._do_get('os-console-auth-tokens/%s' % token)
+
+ subs = self._get_regexes()
+ subs["uuid"] = uuid
+ subs["host"] = r"[\w\.\-]+"
+ subs["port"] = "[0-9]+"
+ subs["internal_access_path"] = ".*"
+ self._verify_response('get-console-connect-info-get-resp', subs,
+ response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_console_output.py b/nova/tests/unit/integrated/v3/test_console_output.py
new file mode 100644
index 0000000000..6ad9a1d9e6
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_console_output.py
@@ -0,0 +1,27 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ConsoleOutputSampleJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-console-output"
+
+ def test_get_console_output(self):
+ uuid = self._post_server()
+ response = self._do_post('servers/%s/action' % uuid,
+ 'console-output-post-req', {})
+ subs = self._get_regexes()
+ self._verify_response('console-output-post-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_consoles.py b/nova/tests/unit/integrated/v3/test_consoles.py
new file mode 100644
index 0000000000..7a889aa4cf
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_consoles.py
@@ -0,0 +1,55 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ConsolesSamplesJsonTest(test_servers.ServersSampleBase):
+ sample_dir = "consoles"
+
+ def setUp(self):
+ super(ConsolesSamplesJsonTest, self).setUp()
+ self.flags(console_public_hostname='fake')
+ self.flags(console_host='fake')
+ self.flags(console_driver='nova.console.fake.FakeConsoleProxy')
+ self.console = self.start_service('console', host='fake')
+
+ def _create_consoles(self, server_uuid):
+ response = self._do_post('servers/%s/consoles' % server_uuid,
+ 'consoles-create-req', {})
+ self.assertEqual(response.status_code, 201)
+
+ def test_create_consoles(self):
+ uuid = self._post_server()
+ self._create_consoles(uuid)
+
+ def test_list_consoles(self):
+ uuid = self._post_server()
+ self._create_consoles(uuid)
+ response = self._do_get('servers/%s/consoles' % uuid)
+ self._verify_response('consoles-list-get-resp', {}, response, 200)
+
+ def test_console_get(self):
+ uuid = self._post_server()
+ self._create_consoles(uuid)
+ response = self._do_get('servers/%s/consoles/1' % uuid)
+ subs = self._get_regexes()
+ self._verify_response('consoles-get-resp', subs, response, 200)
+
+ def test_console_delete(self):
+ uuid = self._post_server()
+ self._create_consoles(uuid)
+ response = self._do_delete('servers/%s/consoles/1' % uuid)
+ self.assertEqual(response.status_code, 202)
diff --git a/nova/tests/unit/integrated/v3/test_create_backup.py b/nova/tests/unit/integrated/v3/test_create_backup.py
new file mode 100644
index 0000000000..089a61fb5f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_create_backup.py
@@ -0,0 +1,38 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import mock
+
+from nova.tests.unit.image import fake
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class CreateBackupSamplesJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-create-backup"
+
+ def setUp(self):
+ """setUp Method for PauseServer api samples extension
+
+ This method creates the server that will be used in each tests
+ """
+ super(CreateBackupSamplesJsonTest, self).setUp()
+ self.uuid = self._post_server()
+
+ @mock.patch.object(fake._FakeImageService, 'detail', return_value=[])
+ def test_post_backup_server(self, mock_method):
+ # Get api samples to backup server request.
+ response = self._do_post('servers/%s/action' % self.uuid,
+ 'create-backup-req', {})
+ self.assertEqual(202, response.status_code)
diff --git a/nova/tests/unit/integrated/v3/test_deferred_delete.py b/nova/tests/unit/integrated/v3/test_deferred_delete.py
new file mode 100644
index 0000000000..0b8d970900
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_deferred_delete.py
@@ -0,0 +1,42 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class DeferredDeleteSampleJsonTests(test_servers.ServersSampleBase):
+ extension_name = "os-deferred-delete"
+
+ def setUp(self):
+ super(DeferredDeleteSampleJsonTests, self).setUp()
+ self.flags(reclaim_instance_interval=1)
+
+ def test_restore(self):
+ uuid = self._post_server()
+ response = self._do_delete('servers/%s' % uuid)
+
+ response = self._do_post('servers/%s/action' % uuid,
+ 'restore-post-req', {})
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, '')
+
+ def test_force_delete(self):
+ uuid = self._post_server()
+ response = self._do_delete('servers/%s' % uuid)
+
+ response = self._do_post('servers/%s/action' % uuid,
+ 'force-delete-post-req', {})
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, '')
diff --git a/nova/tests/unit/integrated/v3/test_disk_config.py b/nova/tests/unit/integrated/v3/test_disk_config.py
new file mode 100644
index 0000000000..97eeb31ace
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_disk_config.py
@@ -0,0 +1,80 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.image import fake
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class DiskConfigJsonTest(test_servers.ServersSampleBase):
+ extension_name = 'os-disk-config'
+ extra_extensions_to_load = ["images"]
+
+ def test_list_servers_detail(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/detail')
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ subs['id'] = uuid
+ self._verify_response('list-servers-detail-get', subs, response, 200)
+
+ def test_get_server(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/%s' % uuid)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('server-get-resp', subs, response, 200)
+
+ def test_update_server(self):
+ uuid = self._post_server()
+ response = self._do_put('servers/%s' % uuid,
+ 'server-update-put-req', {})
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('server-update-put-resp', subs, response, 200)
+
+ def test_resize_server(self):
+ self.flags(allow_resize_to_same_host=True)
+ uuid = self._post_server()
+ response = self._do_post('servers/%s/action' % uuid,
+ 'server-resize-post-req', {})
+ self.assertEqual(response.status_code, 202)
+ # NOTE(tmello): Resize does not return response body
+ # Bug #1085213.
+ self.assertEqual(response.content, "")
+
+ def test_rebuild_server(self):
+ uuid = self._post_server()
+ subs = {
+ 'image_id': fake.get_valid_image_id(),
+ 'host': self._get_host(),
+ }
+ response = self._do_post('servers/%s/action' % uuid,
+ 'server-action-rebuild-req', subs)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('server-action-rebuild-resp',
+ subs, response, 202)
+
+ def test_get_image(self):
+ image_id = fake.get_valid_image_id()
+ response = self._do_get('images/%s' % image_id)
+ subs = self._get_regexes()
+ subs['image_id'] = image_id
+ self._verify_response('image-get-resp', subs, response, 200)
+
+ def test_list_images(self):
+ response = self._do_get('images/detail')
+ subs = self._get_regexes()
+ self._verify_response('image-list-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_evacuate.py b/nova/tests/unit/integrated/v3/test_evacuate.py
new file mode 100644
index 0000000000..1d63404b6d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_evacuate.py
@@ -0,0 +1,91 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import mock
+
+from nova.compute import api as compute_api
+from nova.compute import manager as compute_manager
+from nova.servicegroup import api as service_group_api
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class EvacuateJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-evacuate"
+
+ def _test_evacuate(self, req_subs, server_req, server_resp,
+ expected_resp_code):
+ self.uuid = self._post_server()
+
+ def fake_service_is_up(self, service):
+ """Simulate validation of instance host is down."""
+ return False
+
+ def fake_service_get_by_compute_host(self, context, host):
+ """Simulate that given host is a valid host."""
+ return {
+ 'host_name': host,
+ 'service': 'compute',
+ 'zone': 'nova'
+ }
+
+ def fake_check_instance_exists(self, context, instance):
+ """Simulate validation of instance does not exist."""
+ return False
+
+ self.stubs.Set(service_group_api.API, 'service_is_up',
+ fake_service_is_up)
+ self.stubs.Set(compute_api.HostAPI, 'service_get_by_compute_host',
+ fake_service_get_by_compute_host)
+ self.stubs.Set(compute_manager.ComputeManager,
+ '_check_instance_exists',
+ fake_check_instance_exists)
+
+ response = self._do_post('servers/%s/action' % self.uuid,
+ server_req, req_subs)
+ subs = self._get_regexes()
+ self._verify_response(server_resp, subs, response, expected_resp_code)
+
+ @mock.patch('nova.conductor.manager.ComputeTaskManager.rebuild_instance')
+ def test_server_evacuate(self, rebuild_mock):
+ # Note (wingwj): The host can't be the same one
+ req_subs = {
+ 'host': 'testHost',
+ "adminPass": "MySecretPass",
+ "onSharedStorage": 'False'
+ }
+ self._test_evacuate(req_subs, 'server-evacuate-req',
+ 'server-evacuate-resp', 200)
+ rebuild_mock.assert_called_once_with(mock.ANY, instance=mock.ANY,
+ orig_image_ref=mock.ANY, image_ref=mock.ANY,
+ injected_files=mock.ANY, new_pass="MySecretPass",
+ orig_sys_metadata=mock.ANY, bdms=mock.ANY, recreate=mock.ANY,
+ on_shared_storage=False, preserve_ephemeral=mock.ANY,
+ host='testHost')
+
+ @mock.patch('nova.conductor.manager.ComputeTaskManager.rebuild_instance')
+ def test_server_evacuate_find_host(self, rebuild_mock):
+ req_subs = {
+ "adminPass": "MySecretPass",
+ "onSharedStorage": 'False'
+ }
+ self._test_evacuate(req_subs, 'server-evacuate-find-host-req',
+ 'server-evacuate-find-host-resp', 200)
+
+ rebuild_mock.assert_called_once_with(mock.ANY, instance=mock.ANY,
+ orig_image_ref=mock.ANY, image_ref=mock.ANY,
+ injected_files=mock.ANY, new_pass="MySecretPass",
+ orig_sys_metadata=mock.ANY, bdms=mock.ANY, recreate=mock.ANY,
+ on_shared_storage=False, preserve_ephemeral=mock.ANY,
+ host=None)
diff --git a/nova/tests/unit/integrated/v3/test_extended_availability_zone.py b/nova/tests/unit/integrated/v3/test_extended_availability_zone.py
new file mode 100644
index 0000000000..accd4a2cdf
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_extended_availability_zone.py
@@ -0,0 +1,34 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ExtendedAvailabilityZoneJsonTests(test_servers.ServersSampleBase):
+ extension_name = "os-extended-availability-zone"
+
+ def test_show(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/%s' % uuid)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('server-get-resp', subs, response, 200)
+
+ def test_detail(self):
+ self._post_server()
+ response = self._do_get('servers/detail')
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('servers-detail-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_extended_server_attributes.py b/nova/tests/unit/integrated/v3/test_extended_server_attributes.py
new file mode 100644
index 0000000000..1a00f45237
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_extended_server_attributes.py
@@ -0,0 +1,42 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ExtendedServerAttributesJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-extended-server-attributes"
+
+ def test_show(self):
+ uuid = self._post_server()
+
+ response = self._do_get('servers/%s' % uuid)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ subs['id'] = uuid
+ subs['instance_name'] = 'instance-\d{8}'
+ subs['hypervisor_hostname'] = r'[\w\.\-]+'
+ self._verify_response('server-get-resp', subs, response, 200)
+
+ def test_detail(self):
+ uuid = self._post_server()
+
+ response = self._do_get('servers/detail')
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ subs['id'] = uuid
+ subs['instance_name'] = 'instance-\d{8}'
+ subs['hypervisor_hostname'] = r'[\w\.\-]+'
+ self._verify_response('servers-detail-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_extended_status.py b/nova/tests/unit/integrated/v3/test_extended_status.py
new file mode 100644
index 0000000000..8f952eaacc
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_extended_status.py
@@ -0,0 +1,35 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ExtendedStatusSampleJsonTests(test_servers.ServersSampleBase):
+ extension_name = "os-extended-status"
+
+ def test_show(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/%s' % uuid)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('server-get-resp', subs, response, 200)
+
+ def test_detail(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/detail')
+ subs = self._get_regexes()
+ subs['id'] = uuid
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('servers-detail-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_extended_volumes.py b/nova/tests/unit/integrated/v3/test_extended_volumes.py
new file mode 100644
index 0000000000..f6500eaac6
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_extended_volumes.py
@@ -0,0 +1,151 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.compute import api as compute_api
+from nova.compute import manager as compute_manager
+from nova import context
+from nova import db
+from nova import objects
+from nova.tests.unit.api.openstack import fakes
+from nova.tests.unit import fake_block_device
+from nova.tests.unit import fake_instance
+from nova.tests.unit.integrated.v3 import test_servers
+from nova.volume import cinder
+
+
+class ExtendedVolumesSampleJsonTests(test_servers.ServersSampleBase):
+ extension_name = "os-extended-volumes"
+
+ def _stub_compute_api_get_instance_bdms(self, server_id):
+
+ def fake_bdms_get_all_by_instance(context, instance_uuid,
+ use_slave=False):
+ bdms = [
+ fake_block_device.FakeDbBlockDeviceDict(
+ {'id': 1, 'volume_id': 'a26887c6-c47b-4654-abb5-dfadf7d3f803',
+ 'instance_uuid': server_id, 'source_type': 'volume',
+ 'destination_type': 'volume', 'device_name': '/dev/sdd'}),
+ fake_block_device.FakeDbBlockDeviceDict(
+ {'id': 2, 'volume_id': 'a26887c6-c47b-4654-abb5-dfadf7d3f804',
+ 'instance_uuid': server_id, 'source_type': 'volume',
+ 'destination_type': 'volume', 'device_name': '/dev/sdc'})
+ ]
+ return bdms
+
+ self.stubs.Set(db, 'block_device_mapping_get_all_by_instance',
+ fake_bdms_get_all_by_instance)
+
+ def _stub_compute_api_get(self):
+ def fake_compute_api_get(self, context, instance_id, **kwargs):
+ want_objects = kwargs.get('want_objects')
+ if want_objects:
+ return fake_instance.fake_instance_obj(
+ context, **{'uuid': instance_id})
+ else:
+ return {'uuid': instance_id}
+
+ self.stubs.Set(compute_api.API, 'get', fake_compute_api_get)
+
+ def test_show(self):
+ uuid = self._post_server()
+ self.stubs.Set(db, 'block_device_mapping_get_all_by_instance',
+ fakes.stub_bdm_get_all_by_instance)
+ response = self._do_get('servers/%s' % uuid)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('server-get-resp', subs, response, 200)
+
+ def test_detail(self):
+ uuid = self._post_server()
+ self.stubs.Set(db, 'block_device_mapping_get_all_by_instance',
+ fakes.stub_bdm_get_all_by_instance)
+ response = self._do_get('servers/detail')
+ subs = self._get_regexes()
+ subs['id'] = uuid
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('servers-detail-resp', subs, response, 200)
+
+ def test_attach_volume(self):
+ bdm = objects.BlockDeviceMapping()
+ device_name = '/dev/vdd'
+ bdm['device_name'] = device_name
+ self.stubs.Set(cinder.API, 'get', fakes.stub_volume_get)
+ self.stubs.Set(cinder.API, 'check_attach', lambda *a, **k: None)
+ self.stubs.Set(cinder.API, 'reserve_volume', lambda *a, **k: None)
+ self.stubs.Set(compute_manager.ComputeManager,
+ "reserve_block_device_name",
+ lambda *a, **k: bdm)
+ self.stubs.Set(compute_manager.ComputeManager,
+ 'attach_volume',
+ lambda *a, **k: None)
+
+ volume = fakes.stub_volume_get(None, context.get_admin_context(),
+ 'a26887c6-c47b-4654-abb5-dfadf7d3f803')
+ subs = {
+ 'volume_id': volume['id'],
+ 'device': device_name,
+ 'disk_bus': 'ide',
+ 'device_type': 'cdrom'
+ }
+ server_id = self._post_server()
+ response = self._do_post('servers/%s/action'
+ % server_id,
+ 'attach-volume-req', subs)
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, '')
+
+ def test_detach_volume(self):
+ server_id = self._post_server()
+ attach_id = "a26887c6-c47b-4654-abb5-dfadf7d3f803"
+ self._stub_compute_api_get_instance_bdms(server_id)
+ self._stub_compute_api_get()
+ self.stubs.Set(cinder.API, 'get', fakes.stub_volume_get)
+ self.stubs.Set(compute_api.API, 'detach_volume', lambda *a, **k: None)
+ subs = {
+ 'volume_id': attach_id,
+ }
+ response = self._do_post('servers/%s/action'
+ % server_id, 'detach-volume-req', subs)
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, '')
+
+ def test_swap_volume(self):
+ server_id = self._post_server()
+ old_volume_id = "a26887c6-c47b-4654-abb5-dfadf7d3f803"
+ old_new_volume = 'a26887c6-c47b-4654-abb5-dfadf7d3f805'
+ self._stub_compute_api_get_instance_bdms(server_id)
+
+ def stub_volume_get(self, context, volume_id):
+ if volume_id == old_volume_id:
+ return fakes.stub_volume(volume_id, instance_uuid=server_id)
+ else:
+ return fakes.stub_volume(volume_id, instance_uuid=None,
+ attach_status='detached')
+
+ self.stubs.Set(cinder.API, 'get', stub_volume_get)
+ self.stubs.Set(cinder.API, 'begin_detaching', lambda *a, **k: None)
+ self.stubs.Set(cinder.API, 'check_attach', lambda *a, **k: None)
+ self.stubs.Set(cinder.API, 'check_detach', lambda *a, **k: None)
+ self.stubs.Set(cinder.API, 'reserve_volume', lambda *a, **k: None)
+ self.stubs.Set(compute_manager.ComputeManager, 'swap_volume',
+ lambda *a, **k: None)
+ subs = {
+ 'old_volume_id': old_volume_id,
+ 'new_volume_id': old_new_volume
+ }
+ response = self._do_post('servers/%s/action' % server_id,
+ 'swap-volume-req', subs)
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, '')
diff --git a/nova/tests/unit/integrated/v3/test_extension_info.py b/nova/tests/unit/integrated/v3/test_extension_info.py
new file mode 100644
index 0000000000..c23339b96e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_extension_info.py
@@ -0,0 +1,71 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import re
+
+import mock
+from oslo.serialization import jsonutils
+
+from nova.api.openstack import extensions as api_extensions
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class ExtensionInfoSamplesJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ sample_dir = "extension-info"
+
+ def test_list_extensions(self):
+ response = self._do_get('extensions')
+ subs = self._get_regexes()
+ self._verify_response('extensions-list-resp', subs, response, 200)
+
+ def test_get_extensions(self):
+ response = self._do_get('extensions/flavors')
+ subs = self._get_regexes()
+ self._verify_response('extensions-get-resp', subs, response, 200)
+
+
+class ExtensionInfoFormatTest(api_sample_base.ApiSampleTestBaseV3):
+ # NOTE: To check all extension formats, here makes authorize() return True
+ # always instead of fake_policy.py because most extensions are not set as
+ # "discoverable" in fake_policy.py.
+ all_extensions = True
+
+ def _test_list_extensions(self, key, pattern):
+ with mock.patch.object(api_extensions,
+ 'soft_extension_authorizer') as api_mock:
+ def fake_soft_extension_authorizer(api_name, extension_name):
+ def authorize(context, action=None):
+ return True
+ return authorize
+
+ api_mock.side_effect = fake_soft_extension_authorizer
+ response = self._do_get('extensions')
+ response = jsonutils.loads(response.content)
+ extensions = response['extensions']
+ pattern_comp = re.compile(pattern)
+ for ext in extensions:
+ self.assertIsNotNone(pattern_comp.match(ext[key]),
+ '%s does not match with %s' % (ext[key],
+ pattern))
+
+ def test_list_extensions_name_format(self):
+ # name should be CamelCase.
+ pattern = '^[A-Z]{1}[a-z]{1}[a-zA-Z]*$'
+ self._test_list_extensions('name', pattern)
+
+ def test_list_extensions_alias_format(self):
+ # alias should contain lowercase chars and '-' only.
+ pattern = '^[a-z-]+$'
+ self._test_list_extensions('alias', pattern)
diff --git a/nova/tests/unit/integrated/v3/test_fixed_ips.py b/nova/tests/unit/integrated/v3/test_fixed_ips.py
new file mode 100644
index 0000000000..cabeac018a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_fixed_ips.py
@@ -0,0 +1,109 @@
+# Copyright 2014 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova import db
+from nova import exception
+from nova.tests.unit.integrated.v3 import test_servers
+from nova.tests.unit.objects import test_network
+from nova.tests.unit import utils as test_utils
+
+
+class FixedIpTest(test_servers.ServersSampleBase):
+ extension_name = "os-fixed-ips"
+
+ def setUp(self):
+ super(FixedIpTest, self).setUp()
+
+ instance = dict(test_utils.get_test_instance(),
+ hostname='openstack', host='host')
+ fake_fixed_ips = [{'id': 1,
+ 'address': '192.168.1.1',
+ 'network_id': 1,
+ 'virtual_interface_id': 1,
+ 'instance_uuid': '1',
+ 'allocated': False,
+ 'leased': False,
+ 'reserved': False,
+ 'created_at': None,
+ 'deleted_at': None,
+ 'updated_at': None,
+ 'deleted': None,
+ 'instance': instance,
+ 'network': test_network.fake_network,
+ 'host': None},
+ {'id': 2,
+ 'address': '192.168.1.2',
+ 'network_id': 1,
+ 'virtual_interface_id': 2,
+ 'instance_uuid': '2',
+ 'allocated': False,
+ 'leased': False,
+ 'reserved': False,
+ 'created_at': None,
+ 'deleted_at': None,
+ 'updated_at': None,
+ 'deleted': None,
+ 'instance': instance,
+ 'network': test_network.fake_network,
+ 'host': None},
+ ]
+
+ def fake_fixed_ip_get_by_address(context, address,
+ columns_to_join=None):
+ for fixed_ip in fake_fixed_ips:
+ if fixed_ip['address'] == address:
+ return fixed_ip
+ raise exception.FixedIpNotFoundForAddress(address=address)
+
+ def fake_fixed_ip_get_by_address_detailed(context, address):
+ network = {'id': 1,
+ 'cidr': "192.168.1.0/24"}
+ host = {'host': "host",
+ 'hostname': 'openstack'}
+ for fixed_ip in fake_fixed_ips:
+ if fixed_ip['address'] == address:
+ return (fixed_ip, network, host)
+ raise exception.FixedIpNotFoundForAddress(address=address)
+
+ def fake_fixed_ip_update(context, address, values):
+ fixed_ip = fake_fixed_ip_get_by_address(context, address)
+ if fixed_ip is None:
+ raise exception.FixedIpNotFoundForAddress(address=address)
+ else:
+ for key in values:
+ fixed_ip[key] = values[key]
+
+ self.stubs.Set(db, "fixed_ip_get_by_address",
+ fake_fixed_ip_get_by_address)
+ self.stubs.Set(db, "fixed_ip_get_by_address_detailed",
+ fake_fixed_ip_get_by_address_detailed)
+ self.stubs.Set(db, "fixed_ip_update", fake_fixed_ip_update)
+
+ def test_fixed_ip_reserve(self):
+ # Reserve a Fixed IP.
+ project = {'reserve': None}
+ response = self._do_post('os-fixed-ips/192.168.1.1/action',
+ 'fixedip-post-req',
+ project)
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, "")
+
+ def test_get_fixed_ip(self):
+ # Return data about the given fixed ip.
+ response = self._do_get('os-fixed-ips/192.168.1.1')
+ project = {'cidr': '192.168.1.0/24',
+ 'hostname': 'openstack',
+ 'host': 'host',
+ 'address': '192.168.1.1'}
+ self._verify_response('fixedips-get-resp', project, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_flavor_access.py b/nova/tests/unit/integrated/v3/test_flavor_access.py
new file mode 100644
index 0000000000..66316856a3
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_flavor_access.py
@@ -0,0 +1,89 @@
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class FlavorAccessSampleJsonTests(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = 'flavor-access'
+
+ def _add_tenant(self):
+ subs = {
+ 'tenant_id': 'fake_tenant',
+ 'flavor_id': 10,
+ }
+ response = self._do_post('flavors/10/action',
+ 'flavor-access-add-tenant-req',
+ subs)
+ self._verify_response('flavor-access-add-tenant-resp',
+ subs, response, 200)
+
+ def _create_flavor(self):
+ subs = {
+ 'flavor_id': 10,
+ 'flavor_name': 'test_flavor'
+ }
+ response = self._do_post("flavors",
+ "flavor-access-create-req",
+ subs)
+ subs.update(self._get_regexes())
+ self._verify_response("flavor-access-create-resp", subs, response, 200)
+
+ def test_flavor_access_create(self):
+ self._create_flavor()
+
+ def test_flavor_access_detail(self):
+ response = self._do_get('flavors/detail')
+ subs = self._get_regexes()
+ self._verify_response('flavor-access-detail-resp', subs, response, 200)
+
+ def test_flavor_access_list(self):
+ self._create_flavor()
+ self._add_tenant()
+ flavor_id = 10
+ response = self._do_get('flavors/%s/os-flavor-access' % flavor_id)
+ subs = {
+ 'flavor_id': flavor_id,
+ 'tenant_id': 'fake_tenant',
+ }
+ self._verify_response('flavor-access-list-resp', subs, response, 200)
+
+ def test_flavor_access_show(self):
+ flavor_id = 1
+ response = self._do_get('flavors/%s' % flavor_id)
+ subs = {
+ 'flavor_id': flavor_id
+ }
+ subs.update(self._get_regexes())
+ self._verify_response('flavor-access-show-resp', subs, response, 200)
+
+ def test_flavor_access_add_tenant(self):
+ self._create_flavor()
+ self._add_tenant()
+
+ def test_flavor_access_remove_tenant(self):
+ self._create_flavor()
+ self._add_tenant()
+ subs = {
+ 'tenant_id': 'fake_tenant',
+ }
+ response = self._do_post('flavors/10/action',
+ "flavor-access-remove-tenant-req",
+ subs)
+ exp_subs = {
+ "tenant_id": self.api.project_id,
+ "flavor_id": "10"
+ }
+ self._verify_response('flavor-access-remove-tenant-resp',
+ exp_subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_flavor_extraspecs.py b/nova/tests/unit/integrated/v3/test_flavor_extraspecs.py
new file mode 100644
index 0000000000..ba823c7c24
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_flavor_extraspecs.py
@@ -0,0 +1,62 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class FlavorExtraSpecsSampleJsonTests(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = 'flavor-extra-specs'
+
+ def _flavor_extra_specs_create(self):
+ subs = {'value1': 'value1',
+ 'value2': 'value2'
+ }
+ response = self._do_post('flavors/1/os-extra_specs',
+ 'flavor-extra-specs-create-req', subs)
+ self._verify_response('flavor-extra-specs-create-resp',
+ subs, response, 200)
+
+ def test_flavor_extra_specs_get(self):
+ subs = {'value1': 'value1'}
+ self._flavor_extra_specs_create()
+ response = self._do_get('flavors/1/os-extra_specs/key1')
+ self._verify_response('flavor-extra-specs-get-resp',
+ subs, response, 200)
+
+ def test_flavor_extra_specs_list(self):
+ subs = {'value1': 'value1',
+ 'value2': 'value2'
+ }
+ self._flavor_extra_specs_create()
+ response = self._do_get('flavors/1/os-extra_specs')
+ self._verify_response('flavor-extra-specs-list-resp',
+ subs, response, 200)
+
+ def test_flavor_extra_specs_create(self):
+ self._flavor_extra_specs_create()
+
+ def test_flavor_extra_specs_update(self):
+ subs = {'value1': 'new_value1'}
+ self._flavor_extra_specs_create()
+ response = self._do_put('flavors/1/os-extra_specs/key1',
+ 'flavor-extra-specs-update-req', subs)
+ self._verify_response('flavor-extra-specs-update-resp',
+ subs, response, 200)
+
+ def test_flavor_extra_specs_delete(self):
+ self._flavor_extra_specs_create()
+ response = self._do_delete('flavors/1/os-extra_specs/key1')
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.content, '')
diff --git a/nova/tests/unit/integrated/v3/test_flavor_manage.py b/nova/tests/unit/integrated/v3/test_flavor_manage.py
new file mode 100644
index 0000000000..e7911ef0a6
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_flavor_manage.py
@@ -0,0 +1,43 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class FlavorManageSampleJsonTests(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = 'flavor-manage'
+
+ def _create_flavor(self):
+ """Create a flavor."""
+ subs = {
+ 'flavor_id': 10,
+ 'flavor_name': "test_flavor"
+ }
+ response = self._do_post("flavors",
+ "flavor-create-post-req",
+ subs)
+ subs.update(self._get_regexes())
+ self._verify_response("flavor-create-post-resp", subs, response, 200)
+
+ def test_create_flavor(self):
+ # Get api sample to create a flavor.
+ self._create_flavor()
+
+ def test_delete_flavor(self):
+ # Get api sample to delete a flavor.
+ self._create_flavor()
+ response = self._do_delete("flavors/10")
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, '')
diff --git a/nova/tests/unit/integrated/v3/test_flavor_rxtx.py b/nova/tests/unit/integrated/v3/test_flavor_rxtx.py
new file mode 100644
index 0000000000..2b0840259e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_flavor_rxtx.py
@@ -0,0 +1,46 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class FlavorRxtxJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = 'os-flavor-rxtx'
+
+ def test_flavor_rxtx_get(self):
+ flavor_id = 1
+ response = self._do_get('flavors/%s' % flavor_id)
+ subs = {
+ 'flavor_id': flavor_id,
+ 'flavor_name': 'm1.tiny'
+ }
+ subs.update(self._get_regexes())
+ self._verify_response('flavor-rxtx-get-resp', subs, response, 200)
+
+ def test_flavors_rxtx_detail(self):
+ response = self._do_get('flavors/detail')
+ subs = self._get_regexes()
+ self._verify_response('flavor-rxtx-list-resp', subs, response, 200)
+
+ def test_flavors_rxtx_create(self):
+ subs = {
+ 'flavor_id': 100,
+ 'flavor_name': 'flavortest'
+ }
+ response = self._do_post('flavors',
+ 'flavor-rxtx-post-req',
+ subs)
+ subs.update(self._get_regexes())
+ self._verify_response('flavor-rxtx-post-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_flavors.py b/nova/tests/unit/integrated/v3/test_flavors.py
new file mode 100644
index 0000000000..e8db9bc5a1
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_flavors.py
@@ -0,0 +1,35 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class FlavorsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ sample_dir = 'flavors'
+
+ def test_flavors_get(self):
+ response = self._do_get('flavors/1')
+ subs = self._get_regexes()
+ self._verify_response('flavor-get-resp', subs, response, 200)
+
+ def test_flavors_list(self):
+ response = self._do_get('flavors')
+ subs = self._get_regexes()
+ self._verify_response('flavors-list-resp', subs, response, 200)
+
+ def test_flavors_detail(self):
+ response = self._do_get('flavors/detail')
+ subs = self._get_regexes()
+ self._verify_response('flavors-detail-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_floating_ip_dns.py b/nova/tests/unit/integrated/v3/test_floating_ip_dns.py
new file mode 100644
index 0000000000..d0326b6535
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_floating_ip_dns.py
@@ -0,0 +1,91 @@
+# Copyright 2014 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class FloatingIpDNSTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-floating-ip-dns"
+
+ domain = 'domain1.example.org'
+ name = 'instance1'
+ scope = 'public'
+ project = 'project1'
+ dns_type = 'A'
+ ip = '192.168.1.1'
+
+ def _create_or_update(self):
+ subs = {'project': self.project,
+ 'scope': self.scope}
+ response = self._do_put('os-floating-ip-dns/%s' % self.domain,
+ 'floating-ip-dns-create-or-update-req', subs)
+ subs.update({'domain': self.domain})
+ self._verify_response('floating-ip-dns-create-or-update-resp', subs,
+ response, 200)
+
+ def _create_or_update_entry(self):
+ subs = {'ip': self.ip, 'dns_type': self.dns_type}
+ response = self._do_put('os-floating-ip-dns/%s/entries/%s'
+ % (self.domain, self.name),
+ 'floating-ip-dns-create-or-update-entry-req',
+ subs)
+ subs.update({'name': self.name, 'domain': self.domain})
+ self._verify_response('floating-ip-dns-create-or-update-entry-resp',
+ subs, response, 200)
+
+ def test_floating_ip_dns_list(self):
+ self._create_or_update()
+ response = self._do_get('os-floating-ip-dns')
+ subs = {'domain': self.domain,
+ 'project': self.project,
+ 'scope': self.scope}
+ self._verify_response('floating-ip-dns-list-resp', subs,
+ response, 200)
+
+ def test_floating_ip_dns_create_or_update(self):
+ self._create_or_update()
+
+ def test_floating_ip_dns_delete(self):
+ self._create_or_update()
+ response = self._do_delete('os-floating-ip-dns/%s' % self.domain)
+ self.assertEqual(response.status_code, 202)
+
+ def test_floating_ip_dns_create_or_update_entry(self):
+ self._create_or_update_entry()
+
+ def test_floating_ip_dns_entry_get(self):
+ self._create_or_update_entry()
+ response = self._do_get('os-floating-ip-dns/%s/entries/%s'
+ % (self.domain, self.name))
+ subs = {'domain': self.domain,
+ 'ip': self.ip,
+ 'name': self.name}
+ self._verify_response('floating-ip-dns-entry-get-resp', subs,
+ response, 200)
+
+ def test_floating_ip_dns_entry_delete(self):
+ self._create_or_update_entry()
+ response = self._do_delete('os-floating-ip-dns/%s/entries/%s'
+ % (self.domain, self.name))
+ self.assertEqual(response.status_code, 202)
+
+ def test_floating_ip_dns_entry_list(self):
+ self._create_or_update_entry()
+ response = self._do_get('os-floating-ip-dns/%s/entries/%s'
+ % (self.domain, self.ip))
+ subs = {'domain': self.domain,
+ 'ip': self.ip,
+ 'name': self.name}
+ self._verify_response('floating-ip-dns-entry-list-resp', subs,
+ response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_floating_ip_pools.py b/nova/tests/unit/integrated/v3/test_floating_ip_pools.py
new file mode 100644
index 0000000000..4db76801c7
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_floating_ip_pools.py
@@ -0,0 +1,35 @@
+# Copyright 2014 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.network import api as network_api
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class FloatingIPPoolsSampleTests(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-floating-ip-pools"
+
+ def test_list_floatingippools(self):
+ pool_list = ["pool1", "pool2"]
+
+ def fake_get_floating_ip_pools(self, context):
+ return pool_list
+
+ self.stubs.Set(network_api.API, "get_floating_ip_pools",
+ fake_get_floating_ip_pools)
+ response = self._do_get('os-floating-ip-pools')
+ subs = {
+ 'pool1': pool_list[0],
+ 'pool2': pool_list[1]
+ }
+ self._verify_response('floatingippools-list-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_floating_ips_bulk.py b/nova/tests/unit/integrated/v3/test_floating_ips_bulk.py
new file mode 100644
index 0000000000..9459b1bf61
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_floating_ips_bulk.py
@@ -0,0 +1,86 @@
+# Copyright 2014 IBM Corp.
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from oslo.config import cfg
+
+from nova import context
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+CONF = cfg.CONF
+CONF.import_opt('default_floating_pool', 'nova.network.floating_ips')
+CONF.import_opt('public_interface', 'nova.network.linux_net')
+
+
+class FloatingIpsBulkTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-floating-ips-bulk"
+
+ def setUp(self):
+ super(FloatingIpsBulkTest, self).setUp()
+ pool = CONF.default_floating_pool
+ interface = CONF.public_interface
+
+ self.ip_pool = [
+ {
+ 'address': "10.10.10.1",
+ 'pool': pool,
+ 'interface': interface
+ },
+ {
+ 'address': "10.10.10.2",
+ 'pool': pool,
+ 'interface': interface
+ },
+ {
+ 'address': "10.10.10.3",
+ 'pool': pool,
+ 'interface': interface,
+ 'host': "testHost"
+ },
+ ]
+ self.compute.db.floating_ip_bulk_create(
+ context.get_admin_context(), self.ip_pool)
+
+ self.addCleanup(self.compute.db.floating_ip_bulk_destroy,
+ context.get_admin_context(), self.ip_pool)
+
+ def test_floating_ips_bulk_list(self):
+ response = self._do_get('os-floating-ips-bulk')
+ subs = self._get_regexes()
+ self._verify_response('floating-ips-bulk-list-resp',
+ subs, response, 200)
+
+ def test_floating_ips_bulk_list_by_host(self):
+ response = self._do_get('os-floating-ips-bulk/testHost')
+ subs = self._get_regexes()
+ self._verify_response('floating-ips-bulk-list-by-host-resp',
+ subs, response, 200)
+
+ def test_floating_ips_bulk_create(self):
+ response = self._do_post('os-floating-ips-bulk',
+ 'floating-ips-bulk-create-req',
+ {"ip_range": "192.168.1.0/24",
+ "pool": CONF.default_floating_pool,
+ "interface": CONF.public_interface})
+ subs = self._get_regexes()
+ self._verify_response('floating-ips-bulk-create-resp', subs,
+ response, 200)
+
+ def test_floating_ips_bulk_delete(self):
+ response = self._do_put('os-floating-ips-bulk/delete',
+ 'floating-ips-bulk-delete-req',
+ {"ip_range": "192.168.1.0/24"})
+ subs = self._get_regexes()
+ self._verify_response('floating-ips-bulk-delete-resp', subs,
+ response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_fping.py b/nova/tests/unit/integrated/v3/test_fping.py
new file mode 100644
index 0000000000..000c6d2484
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_fping.py
@@ -0,0 +1,45 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+from nova.api.openstack.compute.plugins.v3 import fping
+from nova.tests.unit.api.openstack.compute.contrib import test_fping
+from nova.tests.unit.integrated.v3 import test_servers
+from nova import utils
+
+
+class FpingSampleJsonTests(test_servers.ServersSampleBase):
+ extension_name = "os-fping"
+
+ def setUp(self):
+ super(FpingSampleJsonTests, self).setUp()
+
+ def fake_check_fping(self):
+ pass
+ self.stubs.Set(utils, "execute", test_fping.execute)
+ self.stubs.Set(fping.FpingController, "check_fping",
+ fake_check_fping)
+
+ def test_get_fping(self):
+ self._post_server()
+ response = self._do_get('os-fping')
+ subs = self._get_regexes()
+ self._verify_response('fping-get-resp', subs, response, 200)
+
+ def test_get_fping_details(self):
+ uuid = self._post_server()
+ response = self._do_get('os-fping/%s' % (uuid))
+ subs = self._get_regexes()
+ self._verify_response('fping-get-details-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_hide_server_addresses.py b/nova/tests/unit/integrated/v3/test_hide_server_addresses.py
new file mode 100644
index 0000000000..908fef62d1
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_hide_server_addresses.py
@@ -0,0 +1,39 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from oslo.config import cfg
+
+from nova.compute import vm_states
+from nova.tests.unit.integrated.v3 import test_servers
+
+CONF = cfg.CONF
+CONF.import_opt('osapi_hide_server_address_states',
+ 'nova.api.openstack.compute.plugins.v3.hide_server_addresses')
+
+
+class ServersSampleHideAddressesJsonTest(test_servers.ServersSampleJsonTest):
+ extension_name = 'os-hide-server-addresses'
+ # Override the sample dirname because
+ # test_servers.ServersSampleJsonTest does and so it won't default
+ # to the extension name
+ sample_dir = extension_name
+
+ def setUp(self):
+ # We override osapi_hide_server_address_states in order
+ # to have an example of in the json samples of the
+ # addresses being hidden
+ CONF.set_override("osapi_hide_server_address_states",
+ [vm_states.ACTIVE])
+ super(ServersSampleHideAddressesJsonTest, self).setUp()
diff --git a/nova/tests/unit/integrated/v3/test_hosts.py b/nova/tests/unit/integrated/v3/test_hosts.py
new file mode 100644
index 0000000000..7142ee885a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_hosts.py
@@ -0,0 +1,57 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class HostsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-hosts"
+
+ def test_host_startup(self):
+ response = self._do_get('os-hosts/%s/startup' % self.compute.host)
+ subs = self._get_regexes()
+ self._verify_response('host-get-startup', subs, response, 200)
+
+ def test_host_reboot(self):
+ response = self._do_get('os-hosts/%s/reboot' % self.compute.host)
+ subs = self._get_regexes()
+ self._verify_response('host-get-reboot', subs, response, 200)
+
+ def test_host_shutdown(self):
+ response = self._do_get('os-hosts/%s/shutdown' % self.compute.host)
+ subs = self._get_regexes()
+ self._verify_response('host-get-shutdown', subs, response, 200)
+
+ def test_host_maintenance(self):
+ response = self._do_put('os-hosts/%s' % self.compute.host,
+ 'host-put-maintenance-req', {})
+ subs = self._get_regexes()
+ self._verify_response('host-put-maintenance-resp', subs, response, 200)
+
+ def test_host_get(self):
+ response = self._do_get('os-hosts/%s' % self.compute.host)
+ subs = self._get_regexes()
+ self._verify_response('host-get-resp', subs, response, 200)
+
+ def test_hosts_list(self):
+ response = self._do_get('os-hosts')
+ subs = self._get_regexes()
+ self._verify_response('hosts-list-resp', subs, response, 200)
+
+ def test_hosts_list_compute_service(self):
+ response = self._do_get('os-hosts?service=compute')
+ subs = self._get_regexes()
+ self._verify_response('hosts-list-compute-service-resp',
+ subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_hypervisors.py b/nova/tests/unit/integrated/v3/test_hypervisors.py
new file mode 100644
index 0000000000..f36f35ec84
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_hypervisors.py
@@ -0,0 +1,69 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.compute import api as compute_api
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class HypervisorsSampleJsonTests(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-hypervisors"
+
+ def test_hypervisors_list(self):
+ response = self._do_get('os-hypervisors')
+ self._verify_response('hypervisors-list-resp', {}, response, 200)
+
+ def test_hypervisors_search(self):
+ response = self._do_get('os-hypervisors/fake/search')
+ self._verify_response('hypervisors-search-resp', {}, response, 200)
+
+ def test_hypervisors_servers(self):
+ response = self._do_get('os-hypervisors/fake/servers')
+ self._verify_response('hypervisors-servers-resp', {}, response, 200)
+
+ def test_hypervisors_detail(self):
+ hypervisor_id = 1
+ subs = {
+ 'hypervisor_id': hypervisor_id
+ }
+ response = self._do_get('os-hypervisors/detail')
+ subs.update(self._get_regexes())
+ self._verify_response('hypervisors-detail-resp', subs, response, 200)
+
+ def test_hypervisors_show(self):
+ hypervisor_id = 1
+ subs = {
+ 'hypervisor_id': hypervisor_id
+ }
+ response = self._do_get('os-hypervisors/%s' % hypervisor_id)
+ subs.update(self._get_regexes())
+ self._verify_response('hypervisors-show-resp', subs, response, 200)
+
+ def test_hypervisors_statistics(self):
+ response = self._do_get('os-hypervisors/statistics')
+ self._verify_response('hypervisors-statistics-resp', {}, response, 200)
+
+ def test_hypervisors_uptime(self):
+ def fake_get_host_uptime(self, context, hyp):
+ return (" 08:32:11 up 93 days, 18:25, 12 users, load average:"
+ " 0.20, 0.12, 0.14")
+
+ self.stubs.Set(compute_api.HostAPI,
+ 'get_host_uptime', fake_get_host_uptime)
+ hypervisor_id = 1
+ response = self._do_get('os-hypervisors/%s/uptime' % hypervisor_id)
+ subs = {
+ 'hypervisor_id': hypervisor_id,
+ }
+ self._verify_response('hypervisors-uptime-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_image_size.py b/nova/tests/unit/integrated/v3/test_image_size.py
new file mode 100644
index 0000000000..8aeb08e9d8
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_image_size.py
@@ -0,0 +1,37 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+from nova.tests.unit.image import fake
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class ImageSizeSampleJsonTests(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "image-size"
+ extra_extensions_to_load = ["images", "image-metadata"]
+
+ def test_show(self):
+ # Get api sample of one single image details request.
+ image_id = fake.get_valid_image_id()
+ response = self._do_get('images/%s' % image_id)
+ subs = self._get_regexes()
+ subs['image_id'] = image_id
+ self._verify_response('image-get-resp', subs, response, 200)
+
+ def test_detail(self):
+ # Get api sample of all images details request.
+ response = self._do_get('images/detail')
+ subs = self._get_regexes()
+ self._verify_response('images-details-get-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_images.py b/nova/tests/unit/integrated/v3/test_images.py
new file mode 100644
index 0000000000..95dd0c971b
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_images.py
@@ -0,0 +1,85 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+from nova.tests.unit.image import fake
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class ImagesSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = 'images'
+ extra_extensions_to_load = ["image-metadata"]
+
+ def test_images_list(self):
+ # Get api sample of images get list request.
+ response = self._do_get('images')
+ subs = self._get_regexes()
+ self._verify_response('images-list-get-resp', subs, response, 200)
+
+ def test_image_get(self):
+ # Get api sample of one single image details request.
+ image_id = fake.get_valid_image_id()
+ response = self._do_get('images/%s' % image_id)
+ subs = self._get_regexes()
+ subs['image_id'] = image_id
+ self._verify_response('image-get-resp', subs, response, 200)
+
+ def test_images_details(self):
+ # Get api sample of all images details request.
+ response = self._do_get('images/detail')
+ subs = self._get_regexes()
+ self._verify_response('images-details-get-resp', subs, response, 200)
+
+ def test_image_metadata_get(self):
+ # Get api sample of an image metadata request.
+ image_id = fake.get_valid_image_id()
+ response = self._do_get('images/%s/metadata' % image_id)
+ subs = self._get_regexes()
+ subs['image_id'] = image_id
+ self._verify_response('image-metadata-get-resp', subs, response, 200)
+
+ def test_image_metadata_post(self):
+ # Get api sample to update metadata of an image metadata request.
+ image_id = fake.get_valid_image_id()
+ response = self._do_post(
+ 'images/%s/metadata' % image_id,
+ 'image-metadata-post-req', {})
+ subs = self._get_regexes()
+ self._verify_response('image-metadata-post-resp', subs, response, 200)
+
+ def test_image_metadata_put(self):
+ # Get api sample of image metadata put request.
+ image_id = fake.get_valid_image_id()
+ response = self._do_put('images/%s/metadata' % image_id,
+ 'image-metadata-put-req', {})
+ subs = self._get_regexes()
+ self._verify_response('image-metadata-put-resp', subs, response, 200)
+
+ def test_image_meta_key_get(self):
+ # Get api sample of an image metadata key request.
+ image_id = fake.get_valid_image_id()
+ key = "kernel_id"
+ response = self._do_get('images/%s/metadata/%s' % (image_id, key))
+ subs = self._get_regexes()
+ self._verify_response('image-meta-key-get', subs, response, 200)
+
+ def test_image_meta_key_put(self):
+ # Get api sample of image metadata key put request.
+ image_id = fake.get_valid_image_id()
+ key = "auto_disk_config"
+ response = self._do_put('images/%s/metadata/%s' % (image_id, key),
+ 'image-meta-key-put-req', {})
+ subs = self._get_regexes()
+ self._verify_response('image-meta-key-put-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_instance_actions.py b/nova/tests/unit/integrated/v3/test_instance_actions.py
new file mode 100644
index 0000000000..3285fa4a69
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_instance_actions.py
@@ -0,0 +1,84 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import copy
+
+from nova.compute import api as compute_api
+from nova import db
+from nova.tests.unit import fake_server_actions
+from nova.tests.unit.integrated.v3 import api_sample_base
+from nova.tests.unit import utils as test_utils
+
+
+class ServerActionsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = 'os-instance-actions'
+
+ def setUp(self):
+ super(ServerActionsSampleJsonTest, self).setUp()
+ self.actions = fake_server_actions.FAKE_ACTIONS
+ self.events = fake_server_actions.FAKE_EVENTS
+ self.instance = test_utils.get_test_instance()
+
+ def fake_instance_action_get_by_request_id(context, uuid, request_id):
+ return copy.deepcopy(self.actions[uuid][request_id])
+
+ def fake_server_actions_get(context, uuid):
+ return [copy.deepcopy(value) for value in
+ self.actions[uuid].itervalues()]
+
+ def fake_instance_action_events_get(context, action_id):
+ return copy.deepcopy(self.events[action_id])
+
+ def fake_instance_get_by_uuid(context, instance_id):
+ return self.instance
+
+ def fake_get(self, context, instance_uuid, **kwargs):
+ return {'uuid': instance_uuid}
+
+ self.stubs.Set(db, 'action_get_by_request_id',
+ fake_instance_action_get_by_request_id)
+ self.stubs.Set(db, 'actions_get', fake_server_actions_get)
+ self.stubs.Set(db, 'action_events_get',
+ fake_instance_action_events_get)
+ self.stubs.Set(db, 'instance_get_by_uuid', fake_instance_get_by_uuid)
+ self.stubs.Set(compute_api.API, 'get', fake_get)
+
+ def test_instance_action_get(self):
+ fake_uuid = fake_server_actions.FAKE_UUID
+ fake_request_id = fake_server_actions.FAKE_REQUEST_ID1
+ fake_action = self.actions[fake_uuid][fake_request_id]
+
+ response = self._do_get('servers/%s/os-instance-actions/%s' %
+ (fake_uuid, fake_request_id))
+ subs = self._get_regexes()
+ subs['action'] = '(reboot)|(resize)'
+ subs['instance_uuid'] = fake_uuid
+ subs['integer_id'] = '[0-9]+'
+ subs['request_id'] = fake_action['request_id']
+ subs['start_time'] = fake_action['start_time']
+ subs['result'] = '(Success)|(Error)'
+ subs['event'] = '(schedule)|(compute_create)'
+ self._verify_response('instance-action-get-resp', subs, response, 200)
+
+ def test_instance_actions_list(self):
+ fake_uuid = fake_server_actions.FAKE_UUID
+ response = self._do_get('servers/%s/os-instance-actions' % (fake_uuid))
+ subs = self._get_regexes()
+ subs['action'] = '(reboot)|(resize)'
+ subs['integer_id'] = '[0-9]+'
+ subs['request_id'] = ('req-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}'
+ '-[0-9a-f]{4}-[0-9a-f]{12}')
+ self._verify_response('instance-actions-list-resp', subs,
+ response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_keypairs.py b/nova/tests/unit/integrated/v3/test_keypairs.py
new file mode 100644
index 0000000000..d079407985
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_keypairs.py
@@ -0,0 +1,72 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import uuid
+
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class KeyPairsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ sample_dir = "keypairs"
+
+ def generalize_subs(self, subs, vanilla_regexes):
+ subs['keypair_name'] = 'keypair-[0-9a-f-]+'
+ return subs
+
+ def test_keypairs_post(self, public_key=None):
+ """Get api sample of key pairs post request."""
+ key_name = 'keypair-' + str(uuid.uuid4())
+ response = self._do_post('os-keypairs', 'keypairs-post-req',
+ {'keypair_name': key_name})
+ subs = self._get_regexes()
+ subs['keypair_name'] = '(%s)' % key_name
+ self._verify_response('keypairs-post-resp', subs, response, 200)
+ # NOTE(maurosr): return the key_name is necessary cause the
+ # verification returns the label of the last compared information in
+ # the response, not necessarily the key name.
+ return key_name
+
+ def test_keypairs_import_key_post(self):
+ # Get api sample of key pairs post to import user's key.
+ key_name = 'keypair-' + str(uuid.uuid4())
+ subs = {
+ 'keypair_name': key_name,
+ 'public_key': "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGg"
+ "B4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0l"
+ "RE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv"
+ "9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYc"
+ "pSxsIbECHw== Generated-by-Nova"
+ }
+ response = self._do_post('os-keypairs', 'keypairs-import-post-req',
+ subs)
+ subs = self._get_regexes()
+ subs['keypair_name'] = '(%s)' % key_name
+ self._verify_response('keypairs-import-post-resp', subs, response, 200)
+
+ def test_keypairs_list(self):
+ # Get api sample of key pairs list request.
+ key_name = self.test_keypairs_post()
+ response = self._do_get('os-keypairs')
+ subs = self._get_regexes()
+ subs['keypair_name'] = '(%s)' % key_name
+ self._verify_response('keypairs-list-resp', subs, response, 200)
+
+ def test_keypairs_get(self):
+ # Get api sample of key pairs get request.
+ key_name = self.test_keypairs_post()
+ response = self._do_get('os-keypairs/%s' % key_name)
+ subs = self._get_regexes()
+ subs['keypair_name'] = '(%s)' % key_name
+ self._verify_response('keypairs-get-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_lock_server.py b/nova/tests/unit/integrated/v3/test_lock_server.py
new file mode 100644
index 0000000000..0eb9676fbf
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_lock_server.py
@@ -0,0 +1,41 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class LockServerSamplesJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-lock-server"
+
+ def setUp(self):
+ """setUp Method for LockServer api samples extension
+
+ This method creates the server that will be used in each tests
+ """
+ super(LockServerSamplesJsonTest, self).setUp()
+ self.uuid = self._post_server()
+
+ def test_post_lock_server(self):
+ # Get api samples to lock server request.
+ response = self._do_post('servers/%s/action' % self.uuid,
+ 'lock-server', {})
+ self.assertEqual(202, response.status_code)
+
+ def test_post_unlock_server(self):
+ # Get api samples to unlock server request.
+ self.test_post_lock_server()
+ response = self._do_post('servers/%s/action' % self.uuid,
+ 'unlock-server', {})
+ self.assertEqual(202, response.status_code)
diff --git a/nova/tests/unit/integrated/v3/test_migrate_server.py b/nova/tests/unit/integrated/v3/test_migrate_server.py
new file mode 100644
index 0000000000..a43703fbc2
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_migrate_server.py
@@ -0,0 +1,71 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import mock
+
+from nova.conductor import manager as conductor_manager
+from nova import db
+from nova.tests.unit.integrated.v3 import test_servers
+from nova import utils
+
+
+class MigrateServerSamplesJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-migrate-server"
+ ctype = 'json'
+
+ def setUp(self):
+ """setUp Method for MigrateServer api samples extension
+
+ This method creates the server that will be used in each tests
+ """
+ super(MigrateServerSamplesJsonTest, self).setUp()
+ self.uuid = self._post_server()
+
+ @mock.patch('nova.conductor.manager.ComputeTaskManager._cold_migrate')
+ def test_post_migrate(self, mock_cold_migrate):
+ # Get api samples to migrate server request.
+ response = self._do_post('servers/%s/action' % self.uuid,
+ 'migrate-server', {})
+ self.assertEqual(202, response.status_code)
+
+ def test_post_live_migrate_server(self):
+ # Get api samples to server live migrate request.
+ def fake_live_migrate(_self, context, instance, scheduler_hint,
+ block_migration, disk_over_commit):
+ self.assertEqual(self.uuid, instance["uuid"])
+ host = scheduler_hint["host"]
+ self.assertEqual(self.compute.host, host)
+
+ self.stubs.Set(conductor_manager.ComputeTaskManager,
+ '_live_migrate',
+ fake_live_migrate)
+
+ def fake_get_compute(context, host):
+ service = dict(host=host,
+ binary='nova-compute',
+ topic='compute',
+ report_count=1,
+ updated_at='foo',
+ hypervisor_type='bar',
+ hypervisor_version=utils.convert_version_to_int(
+ '1.0'),
+ disabled=False)
+ return {'compute_node': [service]}
+ self.stubs.Set(db, "service_get_by_compute_host", fake_get_compute)
+
+ response = self._do_post('servers/%s/action' % self.uuid,
+ 'live-migrate-server',
+ {'hostname': self.compute.host})
+ self.assertEqual(202, response.status_code)
diff --git a/nova/tests/unit/integrated/v3/test_migrations.py b/nova/tests/unit/integrated/v3/test_migrations.py
new file mode 100644
index 0000000000..ab8b214f6e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_migrations.py
@@ -0,0 +1,72 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import datetime
+
+from nova.compute import api as compute_api
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class MigrationsSamplesJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-migrations"
+
+ def _stub_migrations(self, context, filters):
+ fake_migrations = [
+ {
+ 'id': 1234,
+ 'source_node': 'node1',
+ 'dest_node': 'node2',
+ 'source_compute': 'compute1',
+ 'dest_compute': 'compute2',
+ 'dest_host': '1.2.3.4',
+ 'status': 'Done',
+ 'instance_uuid': 'instance_id_123',
+ 'old_instance_type_id': 1,
+ 'new_instance_type_id': 2,
+ 'created_at': datetime.datetime(2012, 10, 29, 13, 42, 2),
+ 'updated_at': datetime.datetime(2012, 10, 29, 13, 42, 2),
+ 'deleted_at': None,
+ 'deleted': False
+ },
+ {
+ 'id': 5678,
+ 'source_node': 'node10',
+ 'dest_node': 'node20',
+ 'source_compute': 'compute10',
+ 'dest_compute': 'compute20',
+ 'dest_host': '5.6.7.8',
+ 'status': 'Done',
+ 'instance_uuid': 'instance_id_456',
+ 'old_instance_type_id': 5,
+ 'new_instance_type_id': 6,
+ 'created_at': datetime.datetime(2013, 10, 22, 13, 42, 2),
+ 'updated_at': datetime.datetime(2013, 10, 22, 13, 42, 2),
+ 'deleted_at': None,
+ 'deleted': False
+ }
+ ]
+ return fake_migrations
+
+ def setUp(self):
+ super(MigrationsSamplesJsonTest, self).setUp()
+ self.stubs.Set(compute_api.API, 'get_migrations',
+ self._stub_migrations)
+
+ def test_get_migrations(self):
+ response = self._do_get('os-migrations')
+ subs = self._get_regexes()
+
+ self.assertEqual(response.status_code, 200)
+ self._verify_response('migrations-get', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_multinic.py b/nova/tests/unit/integrated/v3/test_multinic.py
new file mode 100644
index 0000000000..3d55387632
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_multinic.py
@@ -0,0 +1,49 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class MultinicSampleJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-multinic"
+
+ def _disable_instance_dns_manager(self):
+ # NOTE(markmc): it looks like multinic and instance_dns_manager are
+ # incompatible. See:
+ # https://bugs.launchpad.net/nova/+bug/1213251
+ self.flags(
+ instance_dns_manager='nova.network.noop_dns_driver.NoopDNSDriver')
+
+ def setUp(self):
+ self._disable_instance_dns_manager()
+ super(MultinicSampleJsonTest, self).setUp()
+ self.uuid = self._post_server()
+
+ def _add_fixed_ip(self):
+ subs = {"networkId": 1}
+ response = self._do_post('servers/%s/action' % (self.uuid),
+ 'multinic-add-fixed-ip-req', subs)
+ self.assertEqual(response.status_code, 202)
+
+ def test_add_fixed_ip(self):
+ self._add_fixed_ip()
+
+ def test_remove_fixed_ip(self):
+ self._add_fixed_ip()
+
+ subs = {"ip": "10.0.0.4"}
+ response = self._do_post('servers/%s/action' % (self.uuid),
+ 'multinic-remove-fixed-ip-req', subs)
+ self.assertEqual(response.status_code, 202)
diff --git a/nova/tests/unit/integrated/v3/test_multiple_create.py b/nova/tests/unit/integrated/v3/test_multiple_create.py
new file mode 100644
index 0000000000..76c2083b0d
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_multiple_create.py
@@ -0,0 +1,45 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2014 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.image import fake
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class MultipleCreateJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-multiple-create"
+
+ def test_multiple_create(self):
+ subs = {
+ 'image_id': fake.get_valid_image_id(),
+ 'host': self._get_host(),
+ 'min_count': "2",
+ 'max_count': "3"
+ }
+ response = self._do_post('servers', 'multiple-create-post-req', subs)
+ subs.update(self._get_regexes())
+ self._verify_response('multiple-create-post-resp', subs, response, 202)
+
+ def test_multiple_create_without_reservation_id(self):
+ subs = {
+ 'image_id': fake.get_valid_image_id(),
+ 'host': self._get_host(),
+ 'min_count': "2",
+ 'max_count': "3"
+ }
+ response = self._do_post('servers', 'multiple-create-no-resv-post-req',
+ subs)
+ subs.update(self._get_regexes())
+ self._verify_response('multiple-create-no-resv-post-resp', subs,
+ response, 202)
diff --git a/nova/tests/unit/integrated/v3/test_networks.py b/nova/tests/unit/integrated/v3/test_networks.py
new file mode 100644
index 0000000000..555c682c78
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_networks.py
@@ -0,0 +1,73 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.network import api as network_api
+from nova.tests.unit.api.openstack.compute.contrib import test_networks
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class NetworksJsonTests(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-networks"
+
+ def setUp(self):
+ super(NetworksJsonTests, self).setUp()
+ fake_network_api = test_networks.FakeNetworkAPI()
+ self.stubs.Set(network_api.API, "get_all",
+ fake_network_api.get_all)
+ self.stubs.Set(network_api.API, "get",
+ fake_network_api.get)
+ self.stubs.Set(network_api.API, "associate",
+ fake_network_api.associate)
+ self.stubs.Set(network_api.API, "delete",
+ fake_network_api.delete)
+ self.stubs.Set(network_api.API, "create",
+ fake_network_api.create)
+ self.stubs.Set(network_api.API, "add_network_to_project",
+ fake_network_api.add_network_to_project)
+
+ def test_network_list(self):
+ response = self._do_get('os-networks')
+ subs = self._get_regexes()
+ self._verify_response('networks-list-resp', subs, response, 200)
+
+ def test_network_disassociate(self):
+ uuid = test_networks.FAKE_NETWORKS[0]['uuid']
+ response = self._do_post('os-networks/%s/action' % uuid,
+ 'networks-disassociate-req', {})
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, "")
+
+ def test_network_show(self):
+ uuid = test_networks.FAKE_NETWORKS[0]['uuid']
+ response = self._do_get('os-networks/%s' % uuid)
+ subs = self._get_regexes()
+ self._verify_response('network-show-resp', subs, response, 200)
+
+ def test_network_create(self):
+ response = self._do_post("os-networks",
+ 'network-create-req', {})
+ subs = self._get_regexes()
+ self._verify_response('network-create-resp', subs, response, 200)
+
+ def test_network_add(self):
+ response = self._do_post("os-networks/add",
+ 'network-add-req', {})
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, "")
+
+ def test_network_delete(self):
+ response = self._do_delete('os-networks/always_delete')
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, "")
diff --git a/nova/tests/unit/integrated/v3/test_networks_associate.py b/nova/tests/unit/integrated/v3/test_networks_associate.py
new file mode 100644
index 0000000000..fe109d4d6c
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_networks_associate.py
@@ -0,0 +1,76 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2014 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from oslo.config import cfg
+
+from nova.network import api as network_api
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+CONF = cfg.CONF
+CONF.import_opt('osapi_compute_extension',
+ 'nova.api.openstack.compute.extensions')
+
+
+class NetworksAssociateJsonTests(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-networks-associate"
+ extra_extensions_to_load = ["os-networks"]
+
+ _sentinel = object()
+
+ def _get_flags(self):
+ f = super(NetworksAssociateJsonTests, self)._get_flags()
+ f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
+ # Networks_associate requires Networks to be update
+ f['osapi_compute_extension'].append(
+ 'nova.api.openstack.compute.contrib.os_networks.Os_networks')
+ return f
+
+ def setUp(self):
+ super(NetworksAssociateJsonTests, self).setUp()
+
+ def fake_associate(self, context, network_id,
+ host=NetworksAssociateJsonTests._sentinel,
+ project=NetworksAssociateJsonTests._sentinel):
+ return True
+
+ self.stubs.Set(network_api.API, "associate", fake_associate)
+
+ def test_disassociate(self):
+ response = self._do_post('os-networks/1/action',
+ 'network-disassociate-req',
+ {})
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, "")
+
+ def test_disassociate_host(self):
+ response = self._do_post('os-networks/1/action',
+ 'network-disassociate-host-req',
+ {})
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, "")
+
+ def test_disassociate_project(self):
+ response = self._do_post('os-networks/1/action',
+ 'network-disassociate-project-req',
+ {})
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, "")
+
+ def test_associate_host(self):
+ response = self._do_post('os-networks/1/action',
+ 'network-associate-host-req',
+ {"host": "testHost"})
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, "")
diff --git a/nova/tests/unit/integrated/v3/test_pause_server.py b/nova/tests/unit/integrated/v3/test_pause_server.py
new file mode 100644
index 0000000000..4993dc1048
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_pause_server.py
@@ -0,0 +1,41 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class PauseServerSamplesJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-pause-server"
+
+ def setUp(self):
+ """setUp Method for PauseServer api samples extension
+
+ This method creates the server that will be used in each test
+ """
+ super(PauseServerSamplesJsonTest, self).setUp()
+ self.uuid = self._post_server()
+
+ def test_post_pause(self):
+ # Get api samples to pause server request.
+ response = self._do_post('servers/%s/action' % self.uuid,
+ 'pause-server', {})
+ self.assertEqual(202, response.status_code)
+
+ def test_post_unpause(self):
+ # Get api samples to unpause server request.
+ self.test_post_pause()
+ response = self._do_post('servers/%s/action' % self.uuid,
+ 'unpause-server', {})
+ self.assertEqual(202, response.status_code)
diff --git a/nova/tests/unit/integrated/v3/test_pci.py b/nova/tests/unit/integrated/v3/test_pci.py
new file mode 100644
index 0000000000..bb655a0ef0
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_pci.py
@@ -0,0 +1,182 @@
+# Copyright 2013 Intel.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import mock
+from oslo.serialization import jsonutils
+
+from nova import db
+from nova.tests.unit.integrated.v3 import api_sample_base
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+fake_db_dev_1 = {
+ 'created_at': None,
+ 'updated_at': None,
+ 'deleted_at': None,
+ 'deleted': None,
+ 'id': 1,
+ 'compute_node_id': 1,
+ 'address': '0000:04:10.0',
+ 'vendor_id': '8086',
+ 'product_id': '1520',
+ 'dev_type': 'type-VF',
+ 'status': 'available',
+ 'dev_id': 'pci_0000_04_10_0',
+ 'label': 'label_8086_1520',
+ 'instance_uuid': '69ba1044-0766-4ec0-b60d-09595de034a1',
+ 'request_id': None,
+ 'extra_info': '{"key1": "value1", "key2": "value2"}'
+ }
+
+fake_db_dev_2 = {
+ 'created_at': None,
+ 'updated_at': None,
+ 'deleted_at': None,
+ 'deleted': None,
+ 'id': 2,
+ 'compute_node_id': 1,
+ 'address': '0000:04:10.1',
+ 'vendor_id': '8086',
+ 'product_id': '1520',
+ 'dev_type': 'type-VF',
+ 'status': 'available',
+ 'dev_id': 'pci_0000_04_10_1',
+ 'label': 'label_8086_1520',
+ 'instance_uuid': 'd5b446a6-a1b4-4d01-b4f0-eac37b3a62fc',
+ 'request_id': None,
+ 'extra_info': '{"key3": "value3", "key4": "value4"}'
+ }
+
+
+class ExtendedServerPciSampleJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-pci"
+
+ def test_show(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/%s' % uuid)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('server-get-resp', subs, response, 200)
+
+ def test_detail(self):
+ self._post_server()
+ response = self._do_get('servers/detail')
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('servers-detail-resp', subs, response, 200)
+
+
+class ExtendedHyervisorPciSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extra_extensions_to_load = ['os-hypervisors']
+ extension_name = 'os-pci'
+
+ def setUp(self):
+ super(ExtendedHyervisorPciSampleJsonTest, self).setUp()
+ self.fake_compute_node = {"cpu_info": "?",
+ "current_workload": 0,
+ "disk_available_least": 0,
+ "host_ip": "1.1.1.1",
+ "state": "up",
+ "status": "enabled",
+ "free_disk_gb": 1028,
+ "free_ram_mb": 7680,
+ "hypervisor_hostname": "fake-mini",
+ "hypervisor_type": "fake",
+ "hypervisor_version": 1000,
+ "id": 1,
+ "local_gb": 1028,
+ "local_gb_used": 0,
+ "memory_mb": 8192,
+ "memory_mb_used": 512,
+ "running_vms": 0,
+ "service": {"host": '043b3cacf6f34c90a'
+ '7245151fc8ebcda',
+ "disabled": False,
+ "disabled_reason": None},
+ "vcpus": 1,
+ "vcpus_used": 0,
+ "service_id": 2,
+ "pci_stats": [
+ {"count": 5,
+ "vendor_id": "8086",
+ "product_id": "1520",
+ "keya": "valuea",
+ "extra_info": {
+ "phys_function": '[["0x0000", '
+ '"0x04", "0x00",'
+ ' "0x1"]]',
+ "key1": "value1"}}]}
+
+ @mock.patch("nova.servicegroup.API.service_is_up", return_value=True)
+ @mock.patch("nova.db.compute_node_get")
+ def test_pci_show(self, mock_db, mock_service):
+ self.fake_compute_node['pci_stats'] = jsonutils.dumps(
+ self.fake_compute_node['pci_stats'])
+ mock_db.return_value = self.fake_compute_node
+ hypervisor_id = 1
+ response = self._do_get('os-hypervisors/%s' % hypervisor_id)
+ subs = {
+ 'hypervisor_id': hypervisor_id,
+ }
+ subs.update(self._get_regexes())
+ self._verify_response('hypervisors-pci-show-resp',
+ subs, response, 200)
+
+ @mock.patch("nova.servicegroup.API.service_is_up", return_value=True)
+ @mock.patch("nova.db.compute_node_get_all")
+ def test_pci_detail(self, mock_db, mock_service):
+ self.fake_compute_node['pci_stats'] = jsonutils.dumps(
+ self.fake_compute_node['pci_stats'])
+
+ mock_db.return_value = [self.fake_compute_node]
+ hypervisor_id = 1
+ subs = {
+ 'hypervisor_id': hypervisor_id
+ }
+ response = self._do_get('os-hypervisors/detail')
+
+ subs.update(self._get_regexes())
+ self._verify_response('hypervisors-pci-detail-resp',
+ subs, response, 200)
+
+
+class PciSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-pci"
+
+ def _fake_pci_device_get_by_id(self, context, id):
+ return fake_db_dev_1
+
+ def _fake_pci_device_get_all_by_node(self, context, id):
+ return [fake_db_dev_1, fake_db_dev_2]
+
+ def test_pci_show(self):
+ self.stubs.Set(db, 'pci_device_get_by_id',
+ self._fake_pci_device_get_by_id)
+ response = self._do_get('os-pci/1')
+ subs = self._get_regexes()
+ self._verify_response('pci-show-resp', subs, response, 200)
+
+ def test_pci_index(self):
+ self.stubs.Set(db, 'pci_device_get_all_by_node',
+ self._fake_pci_device_get_all_by_node)
+ response = self._do_get('os-pci')
+ subs = self._get_regexes()
+ self._verify_response('pci-index-resp', subs, response, 200)
+
+ def test_pci_detail(self):
+ self.stubs.Set(db, 'pci_device_get_all_by_node',
+ self._fake_pci_device_get_all_by_node)
+ response = self._do_get('os-pci/detail')
+ subs = self._get_regexes()
+ self._verify_response('pci-detail-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_quota_sets.py b/nova/tests/unit/integrated/v3/test_quota_sets.py
new file mode 100644
index 0000000000..8848fd9d2a
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_quota_sets.py
@@ -0,0 +1,70 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class QuotaSetsSampleJsonTests(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-quota-sets"
+
+ def test_show_quotas(self):
+ # Get api sample to show quotas.
+ response = self._do_get('os-quota-sets/fake_tenant')
+ self._verify_response('quotas-show-get-resp', {}, response, 200)
+
+ def test_show_quotas_defaults(self):
+ # Get api sample to show quotas defaults.
+ response = self._do_get('os-quota-sets/fake_tenant/defaults')
+ self._verify_response('quotas-show-defaults-get-resp',
+ {}, response, 200)
+
+ def test_update_quotas(self):
+ # Get api sample to update quotas.
+ response = self._do_put('os-quota-sets/fake_tenant',
+ 'quotas-update-post-req',
+ {})
+ self._verify_response('quotas-update-post-resp', {}, response, 200)
+
+ def test_delete_quotas(self):
+ # Get api sample to delete quota.
+ response = self._do_delete('os-quota-sets/fake_tenant')
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, '')
+
+ def test_update_quotas_force(self):
+ # Get api sample to update quotas.
+ response = self._do_put('os-quota-sets/fake_tenant',
+ 'quotas-update-force-post-req',
+ {})
+ return self._verify_response('quotas-update-force-post-resp', {},
+ response, 200)
+
+ def test_show_quotas_for_user(self):
+ # Get api sample to show quotas for user.
+ response = self._do_get('os-quota-sets/fake_tenant?user_id=1')
+ self._verify_response('user-quotas-show-get-resp', {}, response, 200)
+
+ def test_delete_quotas_for_user(self):
+ response = self._do_delete('os-quota-sets/fake_tenant?user_id=1')
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, '')
+
+ def test_update_quotas_for_user(self):
+ # Get api sample to update quotas for user.
+ response = self._do_put('os-quota-sets/fake_tenant?user_id=1',
+ 'user-quotas-update-post-req',
+ {})
+ return self._verify_response('user-quotas-update-post-resp', {},
+ response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_remote_consoles.py b/nova/tests/unit/integrated/v3/test_remote_consoles.py
new file mode 100644
index 0000000000..6f35aafb34
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_remote_consoles.py
@@ -0,0 +1,70 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ConsolesSampleJsonTests(test_servers.ServersSampleBase):
+ extension_name = "os-remote-consoles"
+
+ def setUp(self):
+ super(ConsolesSampleJsonTests, self).setUp()
+ self.flags(vnc_enabled=True)
+ self.flags(enabled=True, group='spice')
+ self.flags(enabled=True, group='rdp')
+ self.flags(enabled=True, group='serial_console')
+
+ def test_get_vnc_console(self):
+ uuid = self._post_server()
+ response = self._do_post('servers/%s/action' % uuid,
+ 'get-vnc-console-post-req',
+ {'action': 'os-getVNCConsole'})
+ subs = self._get_regexes()
+ subs["url"] = \
+ "((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)"
+ self._verify_response('get-vnc-console-post-resp', subs, response, 200)
+
+ def test_get_spice_console(self):
+ uuid = self._post_server()
+ response = self._do_post('servers/%s/action' % uuid,
+ 'get-spice-console-post-req',
+ {'action': 'os-getSPICEConsole'})
+ subs = self._get_regexes()
+ subs["url"] = \
+ "((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)"
+ self._verify_response('get-spice-console-post-resp', subs,
+ response, 200)
+
+ def test_get_rdp_console(self):
+ uuid = self._post_server()
+ response = self._do_post('servers/%s/action' % uuid,
+ 'get-rdp-console-post-req',
+ {'action': 'os-getRDPConsole'})
+ subs = self._get_regexes()
+ subs["url"] = \
+ "((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)"
+ self._verify_response('get-rdp-console-post-resp', subs,
+ response, 200)
+
+ def test_get_serial_console(self):
+ uuid = self._post_server()
+ response = self._do_post('servers/%s/action' % uuid,
+ 'get-serial-console-post-req',
+ {'action': 'os-getSerialConsole'})
+ subs = self._get_regexes()
+ subs["url"] = \
+ "((ws?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)"
+ self._verify_response('get-serial-console-post-resp', subs,
+ response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_rescue.py b/nova/tests/unit/integrated/v3/test_rescue.py
new file mode 100644
index 0000000000..65532607d5
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_rescue.py
@@ -0,0 +1,82 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class RescueJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-rescue"
+
+ def _rescue(self, uuid):
+ req_subs = {
+ 'password': 'MySecretPass'
+ }
+ response = self._do_post('servers/%s/action' % uuid,
+ 'server-rescue-req', req_subs)
+ self._verify_response('server-rescue', req_subs, response, 200)
+
+ def _unrescue(self, uuid):
+ response = self._do_post('servers/%s/action' % uuid,
+ 'server-unrescue-req', {})
+ self.assertEqual(response.status_code, 202)
+
+ def test_server_rescue(self):
+ uuid = self._post_server()
+
+ self._rescue(uuid)
+
+ # Do a server get to make sure that the 'RESCUE' state is set
+ response = self._do_get('servers/%s' % uuid)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ subs['id'] = uuid
+ subs['status'] = 'RESCUE'
+
+ self._verify_response('server-get-resp-rescue', subs, response, 200)
+
+ def test_server_rescue_with_image_ref_specified(self):
+ uuid = self._post_server()
+
+ req_subs = {
+ 'password': 'MySecretPass',
+ 'image_ref': '2341-Abc'
+ }
+ response = self._do_post('servers/%s/action' % uuid,
+ 'server-rescue-req-with-image-ref', req_subs)
+ self._verify_response('server-rescue', req_subs, response, 200)
+
+ # Do a server get to make sure that the 'RESCUE' state is set
+ response = self._do_get('servers/%s' % uuid)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ subs['id'] = uuid
+ subs['status'] = 'RESCUE'
+
+ self._verify_response('server-get-resp-rescue', subs, response, 200)
+
+ def test_server_unrescue(self):
+ uuid = self._post_server()
+
+ self._rescue(uuid)
+ self._unrescue(uuid)
+
+ # Do a server get to make sure that the 'ACTIVE' state is back
+ response = self._do_get('servers/%s' % uuid)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ subs['id'] = uuid
+ subs['status'] = 'ACTIVE'
+
+ self._verify_response('server-get-resp-unrescue', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_scheduler_hints.py b/nova/tests/unit/integrated/v3/test_scheduler_hints.py
new file mode 100644
index 0000000000..6ecea5efc7
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_scheduler_hints.py
@@ -0,0 +1,32 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import uuid
+
+from nova.tests.unit.image import fake
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class SchedulerHintsJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-scheduler-hints"
+
+ def test_scheduler_hints_post(self):
+ # Get api sample of scheduler hint post request.
+ subs = self._get_regexes()
+ subs.update({'image_id': fake.get_valid_image_id(),
+ 'image_near': str(uuid.uuid4())})
+ response = self._do_post('servers', 'scheduler-hints-post-req',
+ subs)
+ self._verify_response('scheduler-hints-post-resp', subs, response, 202)
diff --git a/nova/tests/unit/integrated/v3/test_security_group_default_rules.py b/nova/tests/unit/integrated/v3/test_security_group_default_rules.py
new file mode 100644
index 0000000000..e0c2ec8132
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_security_group_default_rules.py
@@ -0,0 +1,40 @@
+# Copyright 2014 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class SecurityGroupDefaultRulesSampleJsonTest(
+ api_sample_base.ApiSampleTestBaseV3):
+ extension_name = 'os-security-group-default-rules'
+
+ def test_security_group_default_rules_create(self):
+ response = self._do_post('os-security-group-default-rules',
+ 'security-group-default-rules-create-req',
+ {})
+ self._verify_response('security-group-default-rules-create-resp',
+ {}, response, 200)
+
+ def test_security_group_default_rules_list(self):
+ self.test_security_group_default_rules_create()
+ response = self._do_get('os-security-group-default-rules')
+ self._verify_response('security-group-default-rules-list-resp',
+ {}, response, 200)
+
+ def test_security_group_default_rules_show(self):
+ self.test_security_group_default_rules_create()
+ rule_id = '1'
+ response = self._do_get('os-security-group-default-rules/%s' % rule_id)
+ self._verify_response('security-group-default-rules-show-resp',
+ {}, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_security_groups.py b/nova/tests/unit/integrated/v3/test_security_groups.py
new file mode 100644
index 0000000000..3afb26a06f
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_security_groups.py
@@ -0,0 +1,166 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.network.security_group import neutron_driver
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+def fake_get(*args, **kwargs):
+ nova_group = {}
+ nova_group['id'] = 1
+ nova_group['description'] = 'default'
+ nova_group['name'] = 'default'
+ nova_group['project_id'] = 'openstack'
+ nova_group['rules'] = []
+ return nova_group
+
+
+def fake_get_instances_security_groups_bindings(self, context, servers,
+ detailed=False):
+ result = {}
+ for s in servers:
+ result[s.get('id')] = [{'name': 'test'}]
+ return result
+
+
+def fake_add_to_instance(self, context, instance, security_group_name):
+ pass
+
+
+def fake_remove_from_instance(self, context, instance, security_group_name):
+ pass
+
+
+def fake_list(self, context, names=None, ids=None, project=None,
+ search_opts=None):
+ return [fake_get()]
+
+
+def fake_get_instance_security_groups(self, context, instance_uuid,
+ detailed=False):
+ return [fake_get()]
+
+
+def fake_create_security_group(self, context, name, description):
+ return fake_get()
+
+
+class SecurityGroupsJsonTest(test_servers.ServersSampleBase):
+ extension_name = 'os-security-groups'
+
+ def setUp(self):
+ self.flags(security_group_api=('neutron'))
+ super(SecurityGroupsJsonTest, self).setUp()
+ self.stubs.Set(neutron_driver.SecurityGroupAPI, 'get', fake_get)
+ self.stubs.Set(neutron_driver.SecurityGroupAPI,
+ 'get_instances_security_groups_bindings',
+ fake_get_instances_security_groups_bindings)
+ self.stubs.Set(neutron_driver.SecurityGroupAPI,
+ 'add_to_instance',
+ fake_add_to_instance)
+ self.stubs.Set(neutron_driver.SecurityGroupAPI,
+ 'remove_from_instance',
+ fake_remove_from_instance)
+ self.stubs.Set(neutron_driver.SecurityGroupAPI,
+ 'list',
+ fake_list)
+ self.stubs.Set(neutron_driver.SecurityGroupAPI,
+ 'get_instance_security_groups',
+ fake_get_instance_security_groups)
+ self.stubs.Set(neutron_driver.SecurityGroupAPI,
+ 'create_security_group',
+ fake_create_security_group)
+
+ def test_server_create(self):
+ self._post_server()
+
+ def test_server_get(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/%s' % uuid)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('server-get-resp', subs, response, 200)
+
+ def test_server_detail(self):
+ self._post_server()
+ response = self._do_get('servers/detail')
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('servers-detail-resp', subs, response, 200)
+
+ def _get_create_subs(self):
+ return {
+ 'group_name': 'default',
+ "description": "default",
+ }
+
+ def _create_security_group(self):
+ subs = self._get_create_subs()
+ return self._do_post('os-security-groups',
+ 'security-group-post-req', subs)
+
+ def _add_group(self, uuid):
+ subs = {
+ 'group_name': 'test'
+ }
+ return self._do_post('servers/%s/action' % uuid,
+ 'security-group-add-post-req', subs)
+
+ def test_security_group_create(self):
+ response = self._create_security_group()
+ subs = self._get_create_subs()
+ self._verify_response('security-groups-create-resp', subs,
+ response, 200)
+
+ def test_security_groups_list(self):
+ # Get api sample of security groups get list request.
+ response = self._do_get('os-security-groups')
+ subs = self._get_regexes()
+ self._verify_response('security-groups-list-get-resp',
+ subs, response, 200)
+
+ def test_security_groups_get(self):
+ # Get api sample of security groups get request.
+ security_group_id = '11111111-1111-1111-1111-111111111111'
+ response = self._do_get('os-security-groups/%s' % security_group_id)
+ subs = self._get_regexes()
+ self._verify_response('security-groups-get-resp', subs, response, 200)
+
+ def test_security_groups_list_server(self):
+ # Get api sample of security groups for a specific server.
+ uuid = self._post_server()
+ response = self._do_get('servers/%s/os-security-groups' % uuid)
+ subs = self._get_regexes()
+ self._verify_response('server-security-groups-list-resp',
+ subs, response, 200)
+
+ def test_security_groups_add(self):
+ self._create_security_group()
+ uuid = self._post_server()
+ response = self._add_group(uuid)
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, '')
+
+ def test_security_groups_remove(self):
+ self._create_security_group()
+ uuid = self._post_server()
+ self._add_group(uuid)
+ subs = {
+ 'group_name': 'test'
+ }
+ response = self._do_post('servers/%s/action' % uuid,
+ 'security-group-remove-post-req', subs)
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, '')
diff --git a/nova/tests/unit/integrated/v3/test_server_diagnostics.py b/nova/tests/unit/integrated/v3/test_server_diagnostics.py
new file mode 100644
index 0000000000..b2c41225e3
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_server_diagnostics.py
@@ -0,0 +1,27 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ServerDiagnosticsSamplesJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-server-diagnostics"
+
+ def test_server_diagnostics_get(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/%s/diagnostics' % uuid)
+ subs = self._get_regexes()
+ self._verify_response('server-diagnostics-get-resp', subs,
+ response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_server_external_events.py b/nova/tests/unit/integrated/v3/test_server_external_events.py
new file mode 100644
index 0000000000..9d2675a11c
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_server_external_events.py
@@ -0,0 +1,40 @@
+# Copyright 2014 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ServerExternalEventsSamplesJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-server-external-events"
+
+ def setUp(self):
+ """setUp Method for AdminActions api samples extension
+
+ This method creates the server that will be used in each tests
+ """
+ super(ServerExternalEventsSamplesJsonTest, self).setUp()
+ self.uuid = self._post_server()
+
+ def test_create_event(self):
+ subs = {
+ 'uuid': self.uuid,
+ 'name': 'network-changed',
+ 'status': 'completed',
+ 'tag': 'foo',
+ }
+ response = self._do_post('os-server-external-events',
+ 'event-create-req',
+ subs)
+ subs.update(self._get_regexes())
+ self._verify_response('event-create-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_server_groups.py b/nova/tests/unit/integrated/v3/test_server_groups.py
new file mode 100644
index 0000000000..f5cc253cc9
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_server_groups.py
@@ -0,0 +1,66 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2014 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ServerGroupsSampleJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-server-groups"
+
+ def _get_create_subs(self):
+ return {'name': 'test'}
+
+ def _post_server_group(self):
+ """Verify the response status and returns the UUID of the
+ newly created server group.
+ """
+ subs = self._get_create_subs()
+ response = self._do_post('os-server-groups',
+ 'server-groups-post-req', subs)
+ subs = self._get_regexes()
+ subs['name'] = 'test'
+ return self._verify_response('server-groups-post-resp',
+ subs, response, 200)
+
+ def _create_server_group(self):
+ subs = self._get_create_subs()
+ return self._do_post('os-server-groups',
+ 'server-groups-post-req', subs)
+
+ def test_server_groups_post(self):
+ return self._post_server_group()
+
+ def test_server_groups_list(self):
+ subs = self._get_create_subs()
+ uuid = self._post_server_group()
+ response = self._do_get('os-server-groups')
+ subs.update(self._get_regexes())
+ subs['id'] = uuid
+ self._verify_response('server-groups-list-resp',
+ subs, response, 200)
+
+ def test_server_groups_get(self):
+ # Get api sample of server groups get request.
+ subs = {'name': 'test'}
+ uuid = self._post_server_group()
+ subs['id'] = uuid
+ response = self._do_get('os-server-groups/%s' % uuid)
+
+ self._verify_response('server-groups-get-resp', subs, response, 200)
+
+ def test_server_groups_delete(self):
+ uuid = self._post_server_group()
+ response = self._do_delete('os-server-groups/%s' % uuid)
+ self.assertEqual(response.status_code, 204)
diff --git a/nova/tests/unit/integrated/v3/test_server_metadata.py b/nova/tests/unit/integrated/v3/test_server_metadata.py
new file mode 100644
index 0000000000..9b45af3d07
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_server_metadata.py
@@ -0,0 +1,80 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ServersMetadataJsonTest(test_servers.ServersSampleBase):
+ extends_name = 'core_only'
+ sample_dir = 'server-metadata'
+
+ def _create_and_set(self, subs):
+ uuid = self._post_server()
+ response = self._do_put('servers/%s/metadata' % uuid,
+ 'server-metadata-all-req',
+ subs)
+ self._verify_response('server-metadata-all-resp', subs, response, 200)
+ return uuid
+
+ def generalize_subs(self, subs, vanilla_regexes):
+ subs['value'] = '(Foo|Bar) Value'
+ return subs
+
+ def test_metadata_put_all(self):
+ # Test setting all metadata for a server.
+ subs = {'value': 'Foo Value'}
+ self._create_and_set(subs)
+
+ def test_metadata_post_all(self):
+ # Test updating all metadata for a server.
+ subs = {'value': 'Foo Value'}
+ uuid = self._create_and_set(subs)
+ subs['value'] = 'Bar Value'
+ response = self._do_post('servers/%s/metadata' % uuid,
+ 'server-metadata-all-req',
+ subs)
+ self._verify_response('server-metadata-all-resp', subs, response, 200)
+
+ def test_metadata_get_all(self):
+ # Test getting all metadata for a server.
+ subs = {'value': 'Foo Value'}
+ uuid = self._create_and_set(subs)
+ response = self._do_get('servers/%s/metadata' % uuid)
+ self._verify_response('server-metadata-all-resp', subs, response, 200)
+
+ def test_metadata_put(self):
+ # Test putting an individual metadata item for a server.
+ subs = {'value': 'Foo Value'}
+ uuid = self._create_and_set(subs)
+ subs['value'] = 'Bar Value'
+ response = self._do_put('servers/%s/metadata/foo' % uuid,
+ 'server-metadata-req',
+ subs)
+ self._verify_response('server-metadata-resp', subs, response, 200)
+
+ def test_metadata_get(self):
+ # Test getting an individual metadata item for a server.
+ subs = {'value': 'Foo Value'}
+ uuid = self._create_and_set(subs)
+ response = self._do_get('servers/%s/metadata/foo' % uuid)
+ self._verify_response('server-metadata-resp', subs, response, 200)
+
+ def test_metadata_delete(self):
+ # Test deleting an individual metadata item for a server.
+ subs = {'value': 'Foo Value'}
+ uuid = self._create_and_set(subs)
+ response = self._do_delete('servers/%s/metadata/foo' % uuid)
+ self.assertEqual(response.status_code, 204)
+ self.assertEqual(response.content, '')
diff --git a/nova/tests/unit/integrated/v3/test_server_usage.py b/nova/tests/unit/integrated/v3/test_server_usage.py
new file mode 100644
index 0000000000..1b6358bd43
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_server_usage.py
@@ -0,0 +1,39 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ServerUsageSampleJsonTest(test_servers.ServersSampleBase):
+ extension_name = 'os-server-usage'
+
+ def setUp(self):
+ """setUp method for server usage."""
+ super(ServerUsageSampleJsonTest, self).setUp()
+ self.uuid = self._post_server()
+
+ def test_show(self):
+ response = self._do_get('servers/%s' % self.uuid)
+ subs = self._get_regexes()
+ subs['id'] = self.uuid
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('server-get-resp', subs, response, 200)
+
+ def test_details(self):
+ response = self._do_get('servers/detail')
+ subs = self._get_regexes()
+ subs['id'] = self.uuid
+ subs['hostid'] = '[a-f0-9]+'
+ self._verify_response('servers-detail-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_servers.py b/nova/tests/unit/integrated/v3/test_servers.py
new file mode 100644
index 0000000000..dfa8f5a9d9
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_servers.py
@@ -0,0 +1,188 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.compute import api as compute_api
+from nova.tests.unit.image import fake
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class ServersSampleBase(api_sample_base.ApiSampleTestBaseV3):
+ def _post_server(self):
+ subs = {
+ 'image_id': fake.get_valid_image_id(),
+ 'host': self._get_host(),
+ 'glance_host': self._get_glance_host()
+ }
+ response = self._do_post('servers', 'server-post-req', subs)
+ subs = self._get_regexes()
+ return self._verify_response('server-post-resp', subs, response, 202)
+
+
+class ServersSampleJsonTest(ServersSampleBase):
+ sample_dir = 'servers'
+
+ def test_servers_post(self):
+ return self._post_server()
+
+ def test_servers_get(self):
+ uuid = self.test_servers_post()
+ response = self._do_get('servers/%s' % uuid)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ subs['id'] = uuid
+ subs['hypervisor_hostname'] = r'[\w\.\-]+'
+ subs['mac_addr'] = '(?:[a-f0-9]{2}:){5}[a-f0-9]{2}'
+ self._verify_response('server-get-resp', subs, response, 200)
+
+ def test_servers_list(self):
+ uuid = self._post_server()
+ response = self._do_get('servers')
+ subs = self._get_regexes()
+ subs['id'] = uuid
+ self._verify_response('servers-list-resp', subs, response, 200)
+
+ def test_servers_details(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/detail')
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ subs['id'] = uuid
+ subs['hypervisor_hostname'] = r'[\w\.\-]+'
+ subs['mac_addr'] = '(?:[a-f0-9]{2}:){5}[a-f0-9]{2}'
+ self._verify_response('servers-details-resp', subs, response, 200)
+
+
+class ServersSampleAllExtensionJsonTest(ServersSampleJsonTest):
+ all_extensions = True
+
+
+class ServersActionsJsonTest(ServersSampleBase):
+ sample_dir = 'servers'
+
+ def _test_server_action(self, uuid, action, req_tpl,
+ subs=None, resp_tpl=None, code=202):
+ subs = subs or {}
+ subs.update({'action': action,
+ 'glance_host': self._get_glance_host()})
+ response = self._do_post('servers/%s/action' % uuid,
+ req_tpl,
+ subs)
+ if resp_tpl:
+ subs.update(self._get_regexes())
+ self._verify_response(resp_tpl, subs, response, code)
+ else:
+ self.assertEqual(response.status_code, code)
+ self.assertEqual(response.content, "")
+
+ def test_server_reboot_hard(self):
+ uuid = self._post_server()
+ self._test_server_action(uuid, "reboot",
+ 'server-action-reboot',
+ {"type": "HARD"})
+
+ def test_server_reboot_soft(self):
+ uuid = self._post_server()
+ self._test_server_action(uuid, "reboot",
+ 'server-action-reboot',
+ {"type": "SOFT"})
+
+ def test_server_rebuild(self):
+ uuid = self._post_server()
+ image = fake.get_valid_image_id()
+ subs = {'host': self._get_host(),
+ 'uuid': image,
+ 'name': 'foobar',
+ 'pass': 'seekr3t',
+ 'hostid': '[a-f0-9]+',
+ }
+ self._test_server_action(uuid, 'rebuild',
+ 'server-action-rebuild',
+ subs,
+ 'server-action-rebuild-resp')
+
+ def _test_server_rebuild_preserve_ephemeral(self, value):
+ uuid = self._post_server()
+ image = fake.get_valid_image_id()
+ subs = {'host': self._get_host(),
+ 'uuid': image,
+ 'name': 'foobar',
+ 'pass': 'seekr3t',
+ 'hostid': '[a-f0-9]+',
+ 'preserve_ephemeral': str(value).lower(),
+ 'action': 'rebuild',
+ 'glance_host': self._get_glance_host(),
+ }
+
+ def fake_rebuild(self_, context, instance, image_href, admin_password,
+ files_to_inject=None, **kwargs):
+ self.assertEqual(kwargs['preserve_ephemeral'], value)
+ self.stubs.Set(compute_api.API, 'rebuild', fake_rebuild)
+
+ response = self._do_post('servers/%s/action' % uuid,
+ 'server-action-rebuild-preserve-ephemeral',
+ subs)
+ self.assertEqual(response.status_code, 202)
+
+ def test_server_rebuild_preserve_ephemeral_true(self):
+ self._test_server_rebuild_preserve_ephemeral(True)
+
+ def test_server_rebuild_preserve_ephemeral_false(self):
+ self._test_server_rebuild_preserve_ephemeral(False)
+
+ def test_server_resize(self):
+ self.flags(allow_resize_to_same_host=True)
+ uuid = self._post_server()
+ self._test_server_action(uuid, "resize",
+ 'server-action-resize',
+ {"id": 2,
+ "host": self._get_host()})
+ return uuid
+
+ def test_server_revert_resize(self):
+ uuid = self.test_server_resize()
+ self._test_server_action(uuid, "revertResize",
+ 'server-action-revert-resize')
+
+ def test_server_confirm_resize(self):
+ uuid = self.test_server_resize()
+ self._test_server_action(uuid, "confirmResize",
+ 'server-action-confirm-resize',
+ code=204)
+
+ def test_server_create_image(self):
+ uuid = self._post_server()
+ self._test_server_action(uuid, 'createImage',
+ 'server-action-create-image',
+ {'name': 'foo-image'})
+
+
+class ServerStartStopJsonTest(ServersSampleBase):
+ sample_dir = 'servers'
+
+ def _test_server_action(self, uuid, action, req_tpl):
+ response = self._do_post('servers/%s/action' % uuid,
+ req_tpl,
+ {'action': action})
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, "")
+
+ def test_server_start(self):
+ uuid = self._post_server()
+ self._test_server_action(uuid, 'os-stop', 'server-action-stop')
+ self._test_server_action(uuid, 'os-start', 'server-action-start')
+
+ def test_server_stop(self):
+ uuid = self._post_server()
+ self._test_server_action(uuid, 'os-stop', 'server-action-stop')
diff --git a/nova/tests/unit/integrated/v3/test_servers_ips.py b/nova/tests/unit/integrated/v3/test_servers_ips.py
new file mode 100644
index 0000000000..7c0b24b66b
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_servers_ips.py
@@ -0,0 +1,35 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class ServersIpsJsonTest(test_servers.ServersSampleBase):
+ extends_name = 'core_only'
+ sample_dir = 'server-ips'
+
+ def test_get(self):
+ # Test getting a server's IP information.
+ uuid = self._post_server()
+ response = self._do_get('servers/%s/ips' % uuid)
+ subs = self._get_regexes()
+ self._verify_response('server-ips-resp', subs, response, 200)
+
+ def test_get_by_network(self):
+ # Test getting a server's IP information by network id.
+ uuid = self._post_server()
+ response = self._do_get('servers/%s/ips/private' % uuid)
+ subs = self._get_regexes()
+ self._verify_response('server-ips-network-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_services.py b/nova/tests/unit/integrated/v3/test_services.py
new file mode 100644
index 0000000000..9ce9ffdbe7
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_services.py
@@ -0,0 +1,87 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from oslo.utils import timeutils
+
+from nova import db
+from nova.tests.unit.api.openstack.compute.plugins.v3 import test_services
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class ServicesJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-services"
+
+ def setUp(self):
+ super(ServicesJsonTest, self).setUp()
+ self.stubs.Set(db, "service_get_all",
+ test_services.fake_db_api_service_get_all)
+ self.stubs.Set(timeutils, "utcnow", test_services.fake_utcnow)
+ self.stubs.Set(timeutils, "utcnow_ts",
+ test_services.fake_utcnow_ts)
+ self.stubs.Set(db, "service_get_by_args",
+ test_services.fake_service_get_by_host_binary)
+ self.stubs.Set(db, "service_update",
+ test_services.fake_service_update)
+
+ def tearDown(self):
+ super(ServicesJsonTest, self).tearDown()
+ timeutils.clear_time_override()
+
+ def test_services_list(self):
+ """Return a list of all agent builds."""
+ response = self._do_get('os-services')
+ subs = {'binary': 'nova-compute',
+ 'host': 'host1',
+ 'zone': 'nova',
+ 'status': 'disabled',
+ 'state': 'up'}
+ subs.update(self._get_regexes())
+ self._verify_response('services-list-get-resp', subs, response, 200)
+
+ def test_service_enable(self):
+ """Enable an existing agent build."""
+ subs = {"host": "host1",
+ 'binary': 'nova-compute'}
+ response = self._do_put('os-services/enable',
+ 'service-enable-put-req', subs)
+ subs = {"host": "host1",
+ "binary": "nova-compute"}
+ self._verify_response('service-enable-put-resp', subs, response, 200)
+
+ def test_service_disable(self):
+ """Disable an existing agent build."""
+ subs = {"host": "host1",
+ 'binary': 'nova-compute'}
+ response = self._do_put('os-services/disable',
+ 'service-disable-put-req', subs)
+ subs = {"host": "host1",
+ "binary": "nova-compute"}
+ self._verify_response('service-disable-put-resp', subs, response, 200)
+
+ def test_service_disable_log_reason(self):
+ """Disable an existing service and log the reason."""
+ subs = {"host": "host1",
+ 'binary': 'nova-compute',
+ 'disabled_reason': 'test2'}
+ response = self._do_put('os-services/disable-log-reason',
+ 'service-disable-log-put-req', subs)
+ return self._verify_response('service-disable-log-put-resp',
+ subs, response, 200)
+
+ def test_service_delete(self):
+ """Delete an existing service."""
+ response = self._do_delete('os-services/1')
+ self.assertEqual(response.status_code, 204)
+ self.assertEqual(response.content, "")
diff --git a/nova/tests/unit/integrated/v3/test_shelve.py b/nova/tests/unit/integrated/v3/test_shelve.py
new file mode 100644
index 0000000000..4a2224e783
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_shelve.py
@@ -0,0 +1,50 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from oslo.config import cfg
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+CONF = cfg.CONF
+CONF.import_opt('shelved_offload_time', 'nova.compute.manager')
+
+
+class ShelveJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-shelve"
+
+ def setUp(self):
+ super(ShelveJsonTest, self).setUp()
+ # Don't offload instance, so we can test the offload call.
+ CONF.set_override('shelved_offload_time', -1)
+
+ def _test_server_action(self, uuid, template, action):
+ response = self._do_post('servers/%s/action' % uuid,
+ template, {'action': action})
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, "")
+
+ def test_shelve(self):
+ uuid = self._post_server()
+ self._test_server_action(uuid, 'os-shelve', 'shelve')
+
+ def test_shelve_offload(self):
+ uuid = self._post_server()
+ self._test_server_action(uuid, 'os-shelve', 'shelve')
+ self._test_server_action(uuid, 'os-shelve-offload', 'shelveOffload')
+
+ def test_unshelve(self):
+ uuid = self._post_server()
+ self._test_server_action(uuid, 'os-shelve', 'shelve')
+ self._test_server_action(uuid, 'os-unshelve', 'unshelve')
diff --git a/nova/tests/unit/integrated/v3/test_simple_tenant_usage.py b/nova/tests/unit/integrated/v3/test_simple_tenant_usage.py
new file mode 100644
index 0000000000..4508a36f8b
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_simple_tenant_usage.py
@@ -0,0 +1,61 @@
+# Copyright 2014 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import datetime
+import urllib
+
+from oslo.utils import timeutils
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class SimpleTenantUsageSampleJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-simple-tenant-usage"
+
+ def setUp(self):
+ """setUp method for simple tenant usage."""
+ super(SimpleTenantUsageSampleJsonTest, self).setUp()
+
+ started = timeutils.utcnow()
+ now = started + datetime.timedelta(hours=1)
+
+ timeutils.set_time_override(started)
+ self._post_server()
+ timeutils.set_time_override(now)
+
+ self.query = {
+ 'start': str(started),
+ 'end': str(now)
+ }
+
+ def tearDown(self):
+ """tearDown method for simple tenant usage."""
+ super(SimpleTenantUsageSampleJsonTest, self).tearDown()
+ timeutils.clear_time_override()
+
+ def test_get_tenants_usage(self):
+ # Get api sample to get all tenants usage request.
+ response = self._do_get('os-simple-tenant-usage?%s' % (
+ urllib.urlencode(self.query)))
+ subs = self._get_regexes()
+ self._verify_response('simple-tenant-usage-get', subs, response, 200)
+
+ def test_get_tenant_usage_details(self):
+ # Get api sample to get specific tenant usage request.
+ tenant_id = 'openstack'
+ response = self._do_get('os-simple-tenant-usage/%s?%s' % (tenant_id,
+ urllib.urlencode(self.query)))
+ subs = self._get_regexes()
+ self._verify_response('simple-tenant-usage-get-specific', subs,
+ response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_suspend_server.py b/nova/tests/unit/integrated/v3/test_suspend_server.py
new file mode 100644
index 0000000000..11053b3e3e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_suspend_server.py
@@ -0,0 +1,41 @@
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.unit.integrated.v3 import test_servers
+
+
+class SuspendServerSamplesJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-suspend-server"
+ ctype = 'json'
+
+ def setUp(self):
+ """setUp Method for SuspendServer api samples extension
+
+ This method creates the server that will be used in each tests
+ """
+ super(SuspendServerSamplesJsonTest, self).setUp()
+ self.uuid = self._post_server()
+
+ def test_post_suspend(self):
+ # Get api samples to suspend server request.
+ response = self._do_post('servers/%s/action' % self.uuid,
+ 'server-suspend', {})
+ self.assertEqual(response.status_code, 202)
+
+ def test_post_resume(self):
+ # Get api samples to server resume request.
+ self.test_post_suspend()
+ response = self._do_post('servers/%s/action' % self.uuid,
+ 'server-resume', {})
+ self.assertEqual(response.status_code, 202)
diff --git a/nova/tests/unit/integrated/v3/test_tenant_networks.py b/nova/tests/unit/integrated/v3/test_tenant_networks.py
new file mode 100644
index 0000000000..72a888ba93
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_tenant_networks.py
@@ -0,0 +1,61 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2014 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+from oslo.config import cfg
+from oslo.serialization import jsonutils
+
+import nova.quota
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+CONF = cfg.CONF
+CONF.import_opt('enable_network_quota',
+ 'nova.api.openstack.compute.contrib.os_tenant_networks')
+
+
+class TenantNetworksJsonTests(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-tenant-networks"
+
+ def setUp(self):
+ super(TenantNetworksJsonTests, self).setUp()
+ CONF.set_override("enable_network_quota", True)
+
+ def fake(*args, **kwargs):
+ pass
+
+ self.stubs.Set(nova.quota.QUOTAS, "reserve", fake)
+ self.stubs.Set(nova.quota.QUOTAS, "commit", fake)
+ self.stubs.Set(nova.quota.QUOTAS, "rollback", fake)
+ self.stubs.Set(nova.quota.QuotaEngine, "reserve", fake)
+ self.stubs.Set(nova.quota.QuotaEngine, "commit", fake)
+ self.stubs.Set(nova.quota.QuotaEngine, "rollback", fake)
+
+ def test_list_networks(self):
+ response = self._do_get('os-tenant-networks')
+ subs = self._get_regexes()
+ self._verify_response('networks-list-res', subs, response, 200)
+
+ def test_create_network(self):
+ response = self._do_post('os-tenant-networks', "networks-post-req", {})
+ subs = self._get_regexes()
+ self._verify_response('networks-post-res', subs, response, 200)
+
+ def test_delete_network(self):
+ response = self._do_post('os-tenant-networks', "networks-post-req", {})
+ net = jsonutils.loads(response.content)
+ response = self._do_delete('os-tenant-networks/%s' %
+ net["network"]["id"])
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, "")
diff --git a/nova/tests/unit/integrated/v3/test_used_limits.py b/nova/tests/unit/integrated/v3/test_used_limits.py
new file mode 100644
index 0000000000..6682246c9e
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_used_limits.py
@@ -0,0 +1,34 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class UsedLimitsSamplesJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-used-limits"
+ extra_extensions_to_load = ["limits"]
+
+ def test_get_used_limits(self):
+ # Get api sample to used limits.
+ response = self._do_get('limits')
+ subs = self._get_regexes()
+ self._verify_response('usedlimits-get-resp', subs, response, 200)
+
+ def test_get_used_limits_for_admin(self):
+ tenant_id = 'openstack'
+ response = self._do_get('limits?tenant_id=%s' % tenant_id)
+ subs = self._get_regexes()
+ self._verify_response('usedlimits-get-resp', subs, response, 200)
diff --git a/nova/tests/unit/integrated/v3/test_user_data.py b/nova/tests/unit/integrated/v3/test_user_data.py
new file mode 100644
index 0000000000..6410fa5a24
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_user_data.py
@@ -0,0 +1,36 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import base64
+
+from nova.tests.unit.image import fake
+from nova.tests.unit.integrated.v3 import api_sample_base
+
+
+class UserDataJsonTest(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-user-data"
+
+ def test_user_data_post(self):
+ user_data_contents = '#!/bin/bash\n/bin/su\necho "I am in you!"\n'
+ user_data = base64.b64encode(user_data_contents)
+ subs = {
+ 'image_id': fake.get_valid_image_id(),
+ 'host': self._get_host(),
+ 'user_data': user_data
+ }
+ response = self._do_post('servers', 'userdata-post-req', subs)
+
+ subs.update(self._get_regexes())
+ self._verify_response('userdata-post-resp', subs, response, 202)
diff --git a/nova/tests/unit/integrated/v3/test_volumes.py b/nova/tests/unit/integrated/v3/test_volumes.py
new file mode 100644
index 0000000000..3c7ff6e460
--- /dev/null
+++ b/nova/tests/unit/integrated/v3/test_volumes.py
@@ -0,0 +1,184 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2014 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import datetime
+
+from nova.tests.unit.api.openstack import fakes
+from nova.tests.unit.integrated.v3 import api_sample_base
+from nova.tests.unit.integrated.v3 import test_servers
+from nova.volume import cinder
+
+
+class SnapshotsSampleJsonTests(api_sample_base.ApiSampleTestBaseV3):
+ extension_name = "os-volumes"
+
+ create_subs = {
+ 'snapshot_name': 'snap-001',
+ 'description': 'Daily backup',
+ 'volume_id': '521752a6-acf6-4b2d-bc7a-119f9148cd8c'
+ }
+
+ def setUp(self):
+ super(SnapshotsSampleJsonTests, self).setUp()
+ self.stubs.Set(cinder.API, "get_all_snapshots",
+ fakes.stub_snapshot_get_all)
+ self.stubs.Set(cinder.API, "get_snapshot", fakes.stub_snapshot_get)
+
+ def _create_snapshot(self):
+ self.stubs.Set(cinder.API, "create_snapshot",
+ fakes.stub_snapshot_create)
+
+ response = self._do_post("os-snapshots",
+ "snapshot-create-req",
+ self.create_subs)
+ return response
+
+ def test_snapshots_create(self):
+ response = self._create_snapshot()
+ self.create_subs.update(self._get_regexes())
+ self._verify_response("snapshot-create-resp",
+ self.create_subs, response, 200)
+
+ def test_snapshots_delete(self):
+ self.stubs.Set(cinder.API, "delete_snapshot",
+ fakes.stub_snapshot_delete)
+ self._create_snapshot()
+ response = self._do_delete('os-snapshots/100')
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, '')
+
+ def test_snapshots_detail(self):
+ response = self._do_get('os-snapshots/detail')
+ subs = self._get_regexes()
+ self._verify_response('snapshots-detail-resp', subs, response, 200)
+
+ def test_snapshots_list(self):
+ response = self._do_get('os-snapshots')
+ subs = self._get_regexes()
+ self._verify_response('snapshots-list-resp', subs, response, 200)
+
+ def test_snapshots_show(self):
+ response = self._do_get('os-snapshots/100')
+ subs = {
+ 'snapshot_name': 'Default name',
+ 'description': 'Default description'
+ }
+ subs.update(self._get_regexes())
+ self._verify_response('snapshots-show-resp', subs, response, 200)
+
+
+class VolumesSampleJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-volumes"
+
+ def _get_volume_id(self):
+ return 'a26887c6-c47b-4654-abb5-dfadf7d3f803'
+
+ def _stub_volume(self, id, displayname="Volume Name",
+ displaydesc="Volume Description", size=100):
+ volume = {
+ 'id': id,
+ 'size': size,
+ 'availability_zone': 'zone1:host1',
+ 'instance_uuid': '3912f2b4-c5ba-4aec-9165-872876fe202e',
+ 'mountpoint': '/',
+ 'status': 'in-use',
+ 'attach_status': 'attached',
+ 'name': 'vol name',
+ 'display_name': displayname,
+ 'display_description': displaydesc,
+ 'created_at': datetime.datetime(2008, 12, 1, 11, 1, 55),
+ 'snapshot_id': None,
+ 'volume_type_id': 'fakevoltype',
+ 'volume_metadata': [],
+ 'volume_type': {'name': 'Backup'}
+ }
+ return volume
+
+ def _stub_volume_get(self, context, volume_id):
+ return self._stub_volume(volume_id)
+
+ def _stub_volume_delete(self, context, *args, **param):
+ pass
+
+ def _stub_volume_get_all(self, context, search_opts=None):
+ id = self._get_volume_id()
+ return [self._stub_volume(id)]
+
+ def _stub_volume_create(self, context, size, name, description, snapshot,
+ **param):
+ id = self._get_volume_id()
+ return self._stub_volume(id)
+
+ def setUp(self):
+ super(VolumesSampleJsonTest, self).setUp()
+ fakes.stub_out_networking(self.stubs)
+ fakes.stub_out_rate_limiting(self.stubs)
+
+ self.stubs.Set(cinder.API, "delete", self._stub_volume_delete)
+ self.stubs.Set(cinder.API, "get", self._stub_volume_get)
+ self.stubs.Set(cinder.API, "get_all", self._stub_volume_get_all)
+
+ def _post_volume(self):
+ subs_req = {
+ 'volume_name': "Volume Name",
+ 'volume_desc': "Volume Description",
+ }
+
+ self.stubs.Set(cinder.API, "create", self._stub_volume_create)
+ response = self._do_post('os-volumes', 'os-volumes-post-req',
+ subs_req)
+ subs = self._get_regexes()
+ subs.update(subs_req)
+ self._verify_response('os-volumes-post-resp', subs, response, 200)
+
+ def test_volumes_show(self):
+ subs = {
+ 'volume_name': "Volume Name",
+ 'volume_desc': "Volume Description",
+ }
+ vol_id = self._get_volume_id()
+ response = self._do_get('os-volumes/%s' % vol_id)
+ subs.update(self._get_regexes())
+ self._verify_response('os-volumes-get-resp', subs, response, 200)
+
+ def test_volumes_index(self):
+ subs = {
+ 'volume_name': "Volume Name",
+ 'volume_desc': "Volume Description",
+ }
+ response = self._do_get('os-volumes')
+ subs.update(self._get_regexes())
+ self._verify_response('os-volumes-index-resp', subs, response, 200)
+
+ def test_volumes_detail(self):
+ # For now, index and detail are the same.
+ # See the volumes api
+ subs = {
+ 'volume_name': "Volume Name",
+ 'volume_desc': "Volume Description",
+ }
+ response = self._do_get('os-volumes/detail')
+ subs.update(self._get_regexes())
+ self._verify_response('os-volumes-detail-resp', subs, response, 200)
+
+ def test_volumes_create(self):
+ self._post_volume()
+
+ def test_volumes_delete(self):
+ self._post_volume()
+ vol_id = self._get_volume_id()
+ response = self._do_delete('os-volumes/%s' % vol_id)
+ self.assertEqual(response.status_code, 202)
+ self.assertEqual(response.content, '')