From 4a6193b5d2cab2aaf4a5b3dfeb9b460d77677a2d Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Mon, 27 Aug 2012 09:36:36 -0700 Subject: Adds api sample testing for extensions endpoint Includes minor updates to base class to handle multiline descriptions and makes the extensions endpoint use a sorted list of extensions. Change-Id: I3604e3969b892646d5bbe08af44d454ee40e6f9e --- nova/api/openstack/extensions.py | 2 +- .../all_extensions/extensions-get-resp.json | 324 +++++++++++++++++++++ .../all_extensions/extensions-get-resp.json.tpl | 324 +++++++++++++++++++++ .../all_extensions/extensions-get-resp.xml | 137 +++++++++ .../all_extensions/extensions-get-resp.xml.tpl | 123 ++++++++ nova/tests/integrated/test_api_samples.py | 42 ++- 6 files changed, 943 insertions(+), 9 deletions(-) create mode 100644 nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.json create mode 100644 nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.json.tpl create mode 100644 nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.xml create mode 100644 nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.xml.tpl diff --git a/nova/api/openstack/extensions.py b/nova/api/openstack/extensions.py index 716dccd75..e7334123a 100644 --- a/nova/api/openstack/extensions.py +++ b/nova/api/openstack/extensions.py @@ -151,7 +151,7 @@ class ExtensionsResource(wsgi.Resource): @wsgi.serializers(xml=ExtensionsTemplate) def index(self, req): extensions = [] - for _alias, ext in self.extension_manager.extensions.iteritems(): + for ext in self.extension_manager.sorted_extensions(): extensions.append(self._translate(ext)) return dict(extensions=extensions) diff --git a/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.json b/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.json new file mode 100644 index 000000000..16922dd14 --- /dev/null +++ b/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.json @@ -0,0 +1,324 @@ +{ + "extensions": [ + { + "alias": "NMN", + "description": "Multiple network support", + "links": [], + "name": "Multinic", + "namespace": "http://docs.openstack.org/compute/ext/multinic/api/v1.1", + "updated": "2011-06-09T00:00:00+00:00" + }, + { + "alias": "OS-DCF", + "description": "Disk Management Extension", + "links": [], + "name": "DiskConfig", + "namespace": "http://docs.openstack.org/compute/ext/disk_config/api/v1.1", + "updated": "2011-09-27T00:00:00+00:00" + }, + { + "alias": "OS-EXT-SRV-ATTR", + "description": "Extended Server Attributes support.", + "links": [], + "name": "ExtendedServerAttributes", + "namespace": "http://docs.openstack.org/compute/ext/extended_status/api/v1.1", + "updated": "2011-11-03T00:00:00+00:00" + }, + { + "alias": "OS-EXT-STS", + "description": "Extended Status support", + "links": [], + "name": "ExtendedStatus", + "namespace": "http://docs.openstack.org/compute/ext/extended_status/api/v1.1", + "updated": "2011-11-03T00:00:00+00:00" + }, + { + "alias": "OS-FLV-EXT-DATA", + "description": "Provide additional data for flavors", + "links": [], + "name": "FlavorExtraData", + "namespace": "http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1", + "updated": "2011-09-14T00:00:00+00:00" + }, + { + "alias": "os-admin-actions", + "description": "Enable admin-only server actions\n\n Actions include: pause, unpause, suspend, resume, migrate,\n resetNetwork, injectNetworkInfo, lock, unlock, createBackup\n ", + "links": [], + "name": "AdminActions", + "namespace": "http://docs.openstack.org/compute/ext/admin-actions/api/v1.1", + "updated": "2011-09-20T00:00:00+00:00" + }, + { + "alias": "os-aggregates", + "description": "Admin-only aggregate administration", + "links": [], + "name": "Aggregates", + "namespace": "http://docs.openstack.org/compute/ext/aggregates/api/v1.1", + "updated": "2012-01-12T00:00:00+00:00" + }, + { + "alias": "os-availability-zone", + "description": "Add availability_zone to the Create Server v1.1 API", + "links": [], + "name": "AvailabilityZone", + "namespace": "http://docs.openstack.org/compute/ext/availabilityzone/api/v1.1", + "updated": "2012-08-09T00:00:00+00:00" + }, + { + "alias": "os-certificates", + "description": "Certificates support", + "links": [], + "name": "Certificates", + "namespace": "http://docs.openstack.org/compute/ext/certificates/api/v1.1", + "updated": "2012-01-19T00:00:00+00:00" + }, + { + "alias": "os-cloudpipe", + "description": "Adds actions to create cloudpipe instances.\n\n When running with the Vlan network mode, you need a mechanism to route\n from the public Internet to your vlans. This mechanism is known as a\n cloudpipe.\n\n At the time of creating this class, only OpenVPN is supported. Support for\n a SSH Bastion host is forthcoming.\n ", + "links": [], + "name": "Cloudpipe", + "namespace": "http://docs.openstack.org/compute/ext/cloudpipe/api/v1.1", + "updated": "2011-12-16T00:00:00+00:00" + }, + { + "alias": "os-config-drive", + "description": "Config Drive Extension", + "links": [], + "name": "ConfigDrive", + "namespace": "http://docs.openstack.org/compute/ext/config_drive/api/v1.1", + "updated": "2012-07-16T00:00:00+00:00" + }, + { + "alias": "os-console-output", + "description": "Console log output support, with tailing ability.", + "links": [], + "name": "ConsoleOutput", + "namespace": "http://docs.openstack.org/compute/ext/os-console-output/api/v2", + "updated": "2011-12-08T00:00:00+00:00" + }, + { + "alias": "os-consoles", + "description": "Interactive Console support.", + "links": [], + "name": "Consoles", + "namespace": "http://docs.openstack.org/compute/ext/os-consoles/api/v2", + "updated": "2011-12-23T00:00:00+00:00" + }, + { + "alias": "os-create-server-ext", + "description": "Extended support to the Create Server v1.1 API", + "links": [], + "name": "Createserverext", + "namespace": "http://docs.openstack.org/compute/ext/createserverext/api/v1.1", + "updated": "2011-07-19T00:00:00+00:00" + }, + { + "alias": "os-deferred-delete", + "description": "Instance deferred delete", + "links": [], + "name": "DeferredDelete", + "namespace": "http://docs.openstack.org/compute/ext/deferred-delete/api/v1.1", + "updated": "2011-09-01T00:00:00+00:00" + }, + { + "alias": "os-flavor-access", + "description": "Flavor access supprt", + "links": [], + "name": "FlavorAccess", + "namespace": "http://docs.openstack.org/compute/ext/flavor_access/api/v2", + "updated": "2012-08-01T00:00:00+00:00" + }, + { + "alias": "os-flavor-extra-specs", + "description": "Instance type (flavor) extra specs", + "links": [], + "name": "FlavorExtraSpecs", + "namespace": "http://docs.openstack.org/compute/ext/flavor_extra_specs/api/v1.1", + "updated": "2011-06-23T00:00:00+00:00" + }, + { + "alias": "os-flavor-manage", + "description": "\n Flavor create/delete API support\n ", + "links": [], + "name": "FlavorManage", + "namespace": "http://docs.openstack.org/compute/ext/flavor_manage/api/v1.1", + "updated": "2012-01-19T00:00:00+00:00" + }, + { + "alias": "os-floating-ip-dns", + "description": "Floating IP DNS support", + "links": [], + "name": "FloatingIpDns", + "namespace": "http://docs.openstack.org/ext/floating_ip_dns/api/v1.1", + "updated": "2011-12-23T00:00:00+00:00" + }, + { + "alias": "os-floating-ip-pools", + "description": "Floating IPs support", + "links": [], + "name": "FloatingIpPools", + "namespace": "http://docs.openstack.org/compute/ext/floating_ip_pools/api/v1.1", + "updated": "2012-01-04T00:00:00+00:00" + }, + { + "alias": "os-floating-ips", + "description": "Floating IPs support", + "links": [], + "name": "FloatingIps", + "namespace": "http://docs.openstack.org/compute/ext/floating_ips/api/v1.1", + "updated": "2011-06-16T00:00:00+00:00" + }, + { + "alias": "os-hosts", + "description": "Admin-only host administration", + "links": [], + "name": "Hosts", + "namespace": "http://docs.openstack.org/compute/ext/hosts/api/v1.1", + "updated": "2011-06-29T00:00:00+00:00" + }, + { + "alias": "os-hypervisors", + "description": "Admin-only hypervisor administration", + "links": [], + "name": "Hypervisors", + "namespace": "http://docs.openstack.org/compute/ext/hypervisors/api/v1.1", + "updated": "2012-06-21T00:00:00+00:00" + }, + { + "alias": "os-instance_usage_audit_log", + "description": "Admin-only Task Log Monitoring", + "links": [], + "name": "OSInstanceUsageAuditLog", + "namespace": "http://docs.openstack.org/ext/services/api/v1.1", + "updated": "2012-07-06T01:00:00+00:00" + }, + { + "alias": "os-keypairs", + "description": "Keypair Support", + "links": [], + "name": "Keypairs", + "namespace": "http://docs.openstack.org/compute/ext/keypairs/api/v1.1", + "updated": "2011-08-08T00:00:00+00:00" + }, + { + "alias": "os-multiple-create", + "description": "Allow multiple create in the Create Server v1.1 API", + "links": [], + "name": "MultipleCreate", + "namespace": "http://docs.openstack.org/compute/ext/multiplecreate/api/v1.1", + "updated": "2012-08-07T00:00:00+00:00" + }, + { + "alias": "os-networks", + "description": "Admin-only Network Management Extension", + "links": [], + "name": "Networks", + "namespace": "http://docs.openstack.org/compute/ext/networks/api/v1.1", + "updated": "2011-12-23T00:00:00+00:00" + }, + { + "alias": "os-quota-class-sets", + "description": "Quota classes management support", + "links": [], + "name": "QuotaClasses", + "namespace": "http://docs.openstack.org/compute/ext/quota-classes-sets/api/v1.1", + "updated": "2012-03-12T00:00:00+00:00" + }, + { + "alias": "os-quota-sets", + "description": "Quotas management support", + "links": [], + "name": "Quotas", + "namespace": "http://docs.openstack.org/compute/ext/quotas-sets/api/v1.1", + "updated": "2011-08-08T00:00:00+00:00" + }, + { + "alias": "os-rescue", + "description": "Instance rescue mode", + "links": [], + "name": "Rescue", + "namespace": "http://docs.openstack.org/compute/ext/rescue/api/v1.1", + "updated": "2011-08-18T00:00:00+00:00" + }, + { + "alias": "os-scheduler-hints", + "description": "Pass arbitrary key/value pairs to the scheduler", + "links": [], + "name": "SchedulerHints", + "namespace": "http://docs.openstack.org/compute/ext/scheduler-hints/api/v2", + "updated": "2011-07-19T00:00:00+00:00" + }, + { + "alias": "os-security-groups", + "description": "Security group support", + "links": [], + "name": "SecurityGroups", + "namespace": "http://docs.openstack.org/compute/ext/securitygroups/api/v1.1", + "updated": "2011-07-21T00:00:00+00:00" + }, + { + "alias": "os-server-diagnostics", + "description": "Allow Admins to view server diagnostics through server action", + "links": [], + "name": "ServerDiagnostics", + "namespace": "http://docs.openstack.org/compute/ext/server-diagnostics/api/v1.1", + "updated": "2011-12-21T00:00:00+00:00" + }, + { + "alias": "os-server-start-stop", + "description": "Start/Stop instance compute API support", + "links": [], + "name": "ServerStartStop", + "namespace": "http://docs.openstack.org/compute/ext/servers/api/v1.1", + "updated": "2012-01-23T00:00:00+00:00" + }, + { + "alias": "os-simple-tenant-usage", + "description": "Simple tenant usage extension", + "links": [], + "name": "SimpleTenantUsage", + "namespace": "http://docs.openstack.org/compute/ext/os-simple-tenant-usage/api/v1.1", + "updated": "2011-08-19T00:00:00+00:00" + }, + { + "alias": "os-used-limits", + "description": "Provide data on limited resources that are being used.", + "links": [], + "name": "UsedLimits", + "namespace": "http://docs.openstack.org/compute/ext/used_limits/api/v1.1", + "updated": "2012-07-13T00:00:00+00:00" + }, + { + "alias": "os-user-data", + "description": "Add user_data to the Create Server v1.1 API", + "links": [], + "name": "UserData", + "namespace": "http://docs.openstack.org/compute/ext/userdata/api/v1.1", + "updated": "2012-08-07T00:00:00+00:00" + }, + { + "alias": "os-virtual-interfaces", + "description": "Virtual interface support", + "links": [], + "name": "VirtualInterfaces", + "namespace": "http://docs.openstack.org/compute/ext/virtual_interfaces/api/v1.1", + "updated": "2011-08-17T00:00:00+00:00" + }, + { + "alias": "os-volume-types", + "description": "Volume types support", + "links": [], + "name": "VolumeTypes", + "namespace": "http://docs.openstack.org/compute/ext/volume_types/api/v1.1", + "updated": "2011-08-24T00:00:00+00:00" + }, + { + "alias": "os-volumes", + "description": "Volumes support", + "links": [], + "name": "Volumes", + "namespace": "http://docs.openstack.org/compute/ext/volumes/api/v1.1", + "updated": "2011-03-25T00:00:00+00:00" + } + ] +} \ No newline at end of file diff --git a/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.json.tpl b/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.json.tpl new file mode 100644 index 000000000..06a824602 --- /dev/null +++ b/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.json.tpl @@ -0,0 +1,324 @@ +{ + "extensions": [ + { + "alias": "NMN", + "description": "%(text)s", + "links": [], + "name": "Multinic", + "namespace": "http://docs.openstack.org/compute/ext/multinic/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "OS-DCF", + "description": "%(text)s", + "links": [], + "name": "DiskConfig", + "namespace": "http://docs.openstack.org/compute/ext/disk_config/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "OS-EXT-SRV-ATTR", + "description": "%(text)s", + "links": [], + "name": "ExtendedServerAttributes", + "namespace": "http://docs.openstack.org/compute/ext/extended_status/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "OS-EXT-STS", + "description": "%(text)s", + "links": [], + "name": "ExtendedStatus", + "namespace": "http://docs.openstack.org/compute/ext/extended_status/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "OS-FLV-EXT-DATA", + "description": "%(text)s", + "links": [], + "name": "FlavorExtraData", + "namespace": "http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-admin-actions", + "description": "%(text)s", + "links": [], + "name": "AdminActions", + "namespace": "http://docs.openstack.org/compute/ext/admin-actions/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-aggregates", + "description": "%(text)s", + "links": [], + "name": "Aggregates", + "namespace": "http://docs.openstack.org/compute/ext/aggregates/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-availability-zone", + "description": "%(text)s", + "links": [], + "name": "AvailabilityZone", + "namespace": "http://docs.openstack.org/compute/ext/availabilityzone/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-certificates", + "description": "%(text)s", + "links": [], + "name": "Certificates", + "namespace": "http://docs.openstack.org/compute/ext/certificates/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-cloudpipe", + "description": "%(text)s", + "links": [], + "name": "Cloudpipe", + "namespace": "http://docs.openstack.org/compute/ext/cloudpipe/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-config-drive", + "description": "%(text)s", + "links": [], + "name": "ConfigDrive", + "namespace": "http://docs.openstack.org/compute/ext/config_drive/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-console-output", + "description": "%(text)s", + "links": [], + "name": "ConsoleOutput", + "namespace": "http://docs.openstack.org/compute/ext/os-console-output/api/v2", + "updated": "%(timestamp)s" + }, + { + "alias": "os-consoles", + "description": "%(text)s", + "links": [], + "name": "Consoles", + "namespace": "http://docs.openstack.org/compute/ext/os-consoles/api/v2", + "updated": "%(timestamp)s" + }, + { + "alias": "os-create-server-ext", + "description": "%(text)s", + "links": [], + "name": "Createserverext", + "namespace": "http://docs.openstack.org/compute/ext/createserverext/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-deferred-delete", + "description": "%(text)s", + "links": [], + "name": "DeferredDelete", + "namespace": "http://docs.openstack.org/compute/ext/deferred-delete/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-flavor-access", + "description": "%(text)s", + "links": [], + "name": "FlavorAccess", + "namespace": "http://docs.openstack.org/compute/ext/flavor_access/api/v2", + "updated": "%(timestamp)s" + }, + { + "alias": "os-flavor-extra-specs", + "description": "%(text)s", + "links": [], + "name": "FlavorExtraSpecs", + "namespace": "http://docs.openstack.org/compute/ext/flavor_extra_specs/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-flavor-manage", + "description": "%(text)s", + "links": [], + "name": "FlavorManage", + "namespace": "http://docs.openstack.org/compute/ext/flavor_manage/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-floating-ip-dns", + "description": "%(text)s", + "links": [], + "name": "FloatingIpDns", + "namespace": "http://docs.openstack.org/ext/floating_ip_dns/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-floating-ip-pools", + "description": "%(text)s", + "links": [], + "name": "FloatingIpPools", + "namespace": "http://docs.openstack.org/compute/ext/floating_ip_pools/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-floating-ips", + "description": "%(text)s", + "links": [], + "name": "FloatingIps", + "namespace": "http://docs.openstack.org/compute/ext/floating_ips/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-hosts", + "description": "%(text)s", + "links": [], + "name": "Hosts", + "namespace": "http://docs.openstack.org/compute/ext/hosts/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-hypervisors", + "description": "%(text)s", + "links": [], + "name": "Hypervisors", + "namespace": "http://docs.openstack.org/compute/ext/hypervisors/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-instance_usage_audit_log", + "description": "%(text)s", + "links": [], + "name": "OSInstanceUsageAuditLog", + "namespace": "http://docs.openstack.org/ext/services/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-keypairs", + "description": "%(text)s", + "links": [], + "name": "Keypairs", + "namespace": "http://docs.openstack.org/compute/ext/keypairs/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-multiple-create", + "description": "%(text)s", + "links": [], + "name": "MultipleCreate", + "namespace": "http://docs.openstack.org/compute/ext/multiplecreate/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-networks", + "description": "%(text)s", + "links": [], + "name": "Networks", + "namespace": "http://docs.openstack.org/compute/ext/networks/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-quota-class-sets", + "description": "%(text)s", + "links": [], + "name": "QuotaClasses", + "namespace": "http://docs.openstack.org/compute/ext/quota-classes-sets/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-quota-sets", + "description": "%(text)s", + "links": [], + "name": "Quotas", + "namespace": "http://docs.openstack.org/compute/ext/quotas-sets/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-rescue", + "description": "%(text)s", + "links": [], + "name": "Rescue", + "namespace": "http://docs.openstack.org/compute/ext/rescue/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-scheduler-hints", + "description": "%(text)s", + "links": [], + "name": "SchedulerHints", + "namespace": "http://docs.openstack.org/compute/ext/scheduler-hints/api/v2", + "updated": "%(timestamp)s" + }, + { + "alias": "os-security-groups", + "description": "%(text)s", + "links": [], + "name": "SecurityGroups", + "namespace": "http://docs.openstack.org/compute/ext/securitygroups/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-server-diagnostics", + "description": "%(text)s", + "links": [], + "name": "ServerDiagnostics", + "namespace": "http://docs.openstack.org/compute/ext/server-diagnostics/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-server-start-stop", + "description": "%(text)s", + "links": [], + "name": "ServerStartStop", + "namespace": "http://docs.openstack.org/compute/ext/servers/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-simple-tenant-usage", + "description": "%(text)s", + "links": [], + "name": "SimpleTenantUsage", + "namespace": "http://docs.openstack.org/compute/ext/os-simple-tenant-usage/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-used-limits", + "description": "%(text)s", + "links": [], + "name": "UsedLimits", + "namespace": "http://docs.openstack.org/compute/ext/used_limits/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-user-data", + "description": "%(text)s", + "links": [], + "name": "UserData", + "namespace": "http://docs.openstack.org/compute/ext/userdata/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-virtual-interfaces", + "description": "%(text)s", + "links": [], + "name": "VirtualInterfaces", + "namespace": "http://docs.openstack.org/compute/ext/virtual_interfaces/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-volume-types", + "description": "%(text)s", + "links": [], + "name": "VolumeTypes", + "namespace": "http://docs.openstack.org/compute/ext/volume_types/api/v1.1", + "updated": "%(timestamp)s" + }, + { + "alias": "os-volumes", + "description": "%(text)s", + "links": [], + "name": "Volumes", + "namespace": "http://docs.openstack.org/compute/ext/volumes/api/v1.1", + "updated": "%(timestamp)s" + } + ] +} diff --git a/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.xml b/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.xml new file mode 100644 index 000000000..a512bbc86 --- /dev/null +++ b/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.xml @@ -0,0 +1,137 @@ + + + + Multiple network support + + + Disk Management Extension + + + Extended Server Attributes support. + + + Extended Status support + + + Provide additional data for flavors + + + Enable admin-only server actions + + Actions include: pause, unpause, suspend, resume, migrate, + resetNetwork, injectNetworkInfo, lock, unlock, createBackup + + + + Admin-only aggregate administration + + + Add availability_zone to the Create Server v1.1 API + + + Certificates support + + + Adds actions to create cloudpipe instances. + + When running with the Vlan network mode, you need a mechanism to route + from the public Internet to your vlans. This mechanism is known as a + cloudpipe. + + At the time of creating this class, only OpenVPN is supported. Support for + a SSH Bastion host is forthcoming. + + + + Config Drive Extension + + + Console log output support, with tailing ability. + + + Interactive Console support. + + + Extended support to the Create Server v1.1 API + + + Instance deferred delete + + + Flavor access supprt + + + Instance type (flavor) extra specs + + + + Flavor create/delete API support + + + + Floating IP DNS support + + + Floating IPs support + + + Floating IPs support + + + Admin-only host administration + + + Admin-only hypervisor administration + + + Admin-only Task Log Monitoring + + + Keypair Support + + + Allow multiple create in the Create Server v1.1 API + + + Admin-only Network Management Extension + + + Quota classes management support + + + Quotas management support + + + Instance rescue mode + + + Pass arbitrary key/value pairs to the scheduler + + + Security group support + + + Allow Admins to view server diagnostics through server action + + + Start/Stop instance compute API support + + + Simple tenant usage extension + + + Provide data on limited resources that are being used. + + + Add user_data to the Create Server v1.1 API + + + Virtual interface support + + + Volume types support + + + Volumes support + + \ No newline at end of file diff --git a/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.xml.tpl b/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.xml.tpl new file mode 100644 index 000000000..0ee0cfd4b --- /dev/null +++ b/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.xml.tpl @@ -0,0 +1,123 @@ + + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + + %(text)s + + diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index 4d67ea51d..87012db25 100644 --- a/nova/tests/integrated/test_api_samples.py +++ b/nova/tests/integrated/test_api_samples.py @@ -44,15 +44,22 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase): fake_network.stub_compute_with_ips(self.stubs) self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None - def _pretty_data(self, data): + def _pretty_data(self, data, strip_text=True): if self.ctype == 'json': data = jsonutils.dumps(jsonutils.loads(data), sort_keys=True, indent=4) else: - data = etree.tostring(etree.XML(data), encoding="UTF-8", + xml = etree.XML(data) + # NOTE(vish): strip newlines from text blobs for matching + if strip_text: + for text in xml.xpath('//text()'): + parent = text.getparent() + parent.text = parent.text.replace('\n', '') + + data = etree.tostring(xml, encoding="UTF-8", xml_declaration=True, pretty_print=True) - return '\n'.join(line.rstrip() for line in data.split('\n')) + return '\n'.join(line.rstrip() for line in data.split('\n')).strip() @classmethod def _get_sample(cls, name, suffix=''): @@ -75,7 +82,7 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase): def _write_sample(self, name, data): with open(self._get_sample(name), 'w') as outf: - outf.write(data) + outf.write(self._pretty_data(data, False)) def _verify_response(self, name, subs, response): expected = self._read_template(name) @@ -86,9 +93,9 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase): expected = expected % subs data = response.read() - result = self._pretty_data(data).strip() + result = self._pretty_data(data) if self.generate_samples: - self._write_sample(name, result) + self._write_sample(name, data) result_lines = result.split('\n') expected_lines = expected.split('\n') if len(result_lines) != len(expected_lines): @@ -113,9 +120,14 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase): return 'http://openstack.example.com' def _get_regexes(self): + if self.ctype == 'json': + text = r'(\\"|[^"])*' + else: + text = r'[^<]*' return { 'timestamp': '[0-9]{4}-[0,1][0-9]-[0-3][0-9]T' - '[0-9]{2}:[0-9]{2}:[0-9]{2}Z', + '[0-9]{2}:[0-9]{2}:[0-9]{2}' + '(Z|(\+|-)[0-9]{2}:[0-9]{2})', 'password': '[0-9a-zA-Z]{12}', 'ip': '[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}', 'id': '([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}' @@ -124,6 +136,7 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase): '-[0-9a-f]{4}-[0-9a-f]{12}', 'host': self._get_host(), 'compute_host': self.compute.host, + 'text': text, } def _get_response(self, url, method, body=None): @@ -139,7 +152,7 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase): def _do_post(self, url, name, subs): body = self._read_template(name) % subs if self.generate_samples: - self._write_sample(name, self._pretty_data(body)) + self._write_sample(name, body) return self._get_response(url, 'POST', body) @@ -172,3 +185,16 @@ class ServersSampleAllExtensionJsonTest(ServersSampleJsonTest): class ServersSampleAllExtensionXmlTest(ServersSampleXmlTest): all_extensions = True + + +class ExtensionsSampleJsonTest(ApiSampleTestBase): + all_extensions = True + + def test_extensions_get(self): + response = self._do_get('extensions') + subs = self._get_regexes() + return self._verify_response('extensions-get-resp', subs, response) + + +class ExtensionsSampleXmlTest(ExtensionsSampleJsonTest): + ctype = 'xml' -- cgit