diff --git a/doc/v3/api_samples/all_extensions/extensions-list-resp.json b/doc/v3/api_samples/all_extensions/extensions-list-resp.json new file mode 100644 index 000000000000..ee42fb48de7a --- /dev/null +++ b/doc/v3/api_samples/all_extensions/extensions-list-resp.json @@ -0,0 +1,652 @@ +{ + "extensions": [ + { + "alias": "consoles", + "description": "Consoles.", + "links": [], + "name": "Consoles", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "extensions", + "description": "Extension information.", + "links": [], + "name": "Extensions", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "flavor-extra-specs", + "description": "Flavors extra specs support.", + "links": [], + "name": "FlavorsExtraSpecs", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "flavor-manage", + "description": "Flavor create/delete API support.", + "links": [], + "name": "FlavorManage", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "flavors", + "description": "Flavors Extension.", + "links": [], + "name": "Flavors", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "image-metadata", + "description": "Image Metadata API.", + "links": [], + "name": "ImageMetadata", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "image-size", + "description": "Adds image size to image listings.", + "links": [], + "name": "ImageSize", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "images", + "description": "Proxying API for Images.", + "links": [], + "name": "Images", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "ips", + "description": "Server addresses.", + "links": [], + "name": "Ips", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "limits", + "description": "Limits support.", + "links": [], + "name": "Limits", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-access-ips", + "description": "Access IPs support.", + "links": [], + "name": "AccessIPs", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-admin-actions", + "description": "Enable admin-only server actions\n\n Actions include: pause, unpause, suspend, resume, migrate,\n reset_network, inject_network_info, lock, unlock, create_backup\n ", + "links": [], + "name": "AdminActions", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-admin-password", + "description": "Admin password management support.", + "links": [], + "name": "AdminPassword", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-agents", + "description": "Agents support.", + "links": [], + "name": "Agents", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-aggregates", + "description": "Admin-only aggregate administration.", + "links": [], + "name": "Aggregates", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-assisted-volume-snapshots", + "description": "Assisted volume snapshots.", + "links": [], + "name": "AssistedVolumeSnapshots", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-attach-interfaces", + "description": "Attach interface support.", + "links": [], + "name": "AttachInterfaces", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-availability-zone", + "description": "1. Add availability_zone to the Create Server API.\n 2. Add availability zones describing.\n ", + "links": [], + "name": "AvailabilityZone", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-baremetal-nodes", + "description": "Admin-only bare-metal node administration.", + "links": [], + "name": "BareMetalNodes", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-block-device-mapping", + "description": "Block device mapping boot support.", + "links": [], + "name": "BlockDeviceMapping", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-cells", + "description": "Enables cells-related functionality such as adding neighbor cells,\n listing neighbor cells, and getting the capabilities of the local cell.\n ", + "links": [], + "name": "Cells", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-certificates", + "description": "Certificates support.", + "links": [], + "name": "Certificates", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "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/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-config-drive", + "description": "Config Drive Extension.", + "links": [], + "name": "ConfigDrive", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-console-auth-tokens", + "description": "Console token authentication support.", + "links": [], + "name": "ConsoleAuthTokens", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-console-output", + "description": "Console log output support, with tailing ability.", + "links": [], + "name": "ConsoleOutput", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-create-backup", + "description": "Create a backup of a server.", + "links": [], + "name": "CreateBackup", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-deferred-delete", + "description": "Instance deferred delete.", + "links": [], + "name": "DeferredDelete", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-disk-config", + "description": "Disk Management Extension.", + "links": [], + "name": "DiskConfig", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-evacuate", + "description": "Enables server evacuation.", + "links": [], + "name": "Evacuate", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-extended-availability-zone", + "description": "Extended Availability Zone support.", + "links": [], + "name": "ExtendedAvailabilityZone", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-extended-server-attributes", + "description": "Extended Server Attributes support.", + "links": [], + "name": "ExtendedServerAttributes", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-extended-status", + "description": "Extended Status support.", + "links": [], + "name": "ExtendedStatus", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-extended-volumes", + "description": "Extended Volumes support.", + "links": [], + "name": "ExtendedVolumes", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-fixed-ips", + "description": "Fixed IPs support.", + "links": [], + "name": "FixedIPs", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-flavor-access", + "description": "Flavor access support.", + "links": [], + "name": "FlavorAccess", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-flavor-rxtx", + "description": "Support to show the rxtx status of a flavor.", + "links": [], + "name": "FlavorRxtx", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-floating-ip-dns", + "description": "Floating IP DNS support.", + "links": [], + "name": "FloatingIpDns", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-floating-ip-pools", + "description": "Floating IPs support.", + "links": [], + "name": "FloatingIpPools", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-floating-ips", + "description": "Floating IPs support.", + "links": [], + "name": "FloatingIps", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-floating-ips-bulk", + "description": "Bulk handling of Floating IPs.", + "links": [], + "name": "FloatingIpsBulk", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-fping", + "description": "Fping Management Extension.", + "links": [], + "name": "Fping", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-hide-server-addresses", + "description": "Support hiding server addresses in certain states.", + "links": [], + "name": "HideServerAddresses", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-hosts", + "description": "Admin-only host administration.", + "links": [], + "name": "Hosts", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-hypervisors", + "description": "Admin-only hypervisor administration.", + "links": [], + "name": "Hypervisors", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-instance-actions", + "description": "View a log of actions and events taken on an instance.", + "links": [], + "name": "InstanceActions", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-instance-usage-audit-log", + "description": "Admin-only Task Log Monitoring.", + "links": [], + "name": "InstanceUsageAuditLog", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-keypairs", + "description": "Keypair Support.", + "links": [], + "name": "Keypairs", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-lock-server", + "description": "Enable lock/unlock server actions.", + "links": [], + "name": "LockServer", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-migrate-server", + "description": "Enable migrate and live-migrate server actions.", + "links": [], + "name": "MigrateServer", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-migrations", + "description": "Provide data on migrations.", + "links": [], + "name": "Migrations", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-multinic", + "description": "Multiple network support.", + "links": [], + "name": "Multinic", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-multiple-create", + "description": "Allow multiple create in the Create Server v3 API.", + "links": [], + "name": "MultipleCreate", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-networks", + "description": "Admin-only Network Management Extension.", + "links": [], + "name": "Networks", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-networks-associate", + "description": "Network association support.", + "links": [], + "name": "NetworkAssociationSupport", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-pause-server", + "description": "Enable pause/unpause server actions.", + "links": [], + "name": "PauseServer", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-pci", + "description": "Pci access support.", + "links": [], + "name": "PciAccess", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-personality", + "description": "Personality support.", + "links": [], + "name": "Personality", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-quota-class-sets", + "description": "Quota classes management support.", + "links": [], + "name": "QuotaClasses", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-quota-sets", + "description": "Quotas management support.", + "links": [], + "name": "Quotas", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-remote-consoles", + "description": "Interactive Console support.", + "links": [], + "name": "RemoteConsoles", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-rescue", + "description": "Instance rescue mode.", + "links": [], + "name": "Rescue", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-scheduler-hints", + "description": "Pass arbitrary key/value pairs to the scheduler.", + "links": [], + "name": "SchedulerHints", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-security-group-default-rules", + "description": "Default rules for security group support.", + "links": [], + "name": "SecurityGroupDefaultRules", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-security-groups", + "description": "Security group support.", + "links": [], + "name": "SecurityGroups", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-server-diagnostics", + "description": "Allow Admins to view server diagnostics through server action.", + "links": [], + "name": "ServerDiagnostics", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-server-external-events", + "description": "Server External Event Triggers.", + "links": [], + "name": "ServerExternalEvents", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-server-groups", + "description": "Server group support.", + "links": [], + "name": "ServerGroups", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-server-password", + "description": "Server password support.", + "links": [], + "name": "ServerPassword", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-server-usage", + "description": "Adds launched_at and terminated_at on Servers.", + "links": [], + "name": "ServerUsage", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-services", + "description": "Services support.", + "links": [], + "name": "Services", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-shelve", + "description": "Instance shelve mode.", + "links": [], + "name": "Shelve", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-simple-tenant-usage", + "description": "Simple tenant usage extension.", + "links": [], + "name": "SimpleTenantUsage", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-suspend-server", + "description": "Enable suspend/resume server actions.", + "links": [], + "name": "SuspendServer", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-tenant-networks", + "description": "Tenant-based Network Management Extension.", + "links": [], + "name": "TenantNetworks", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-used-limits", + "description": "Provide data on limited resources that are being used.", + "links": [], + "name": "UsedLimits", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-virtual-interfaces", + "description": "Virtual interface support.", + "links": [], + "name": "VirtualInterfaces", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-volumes", + "description": "Volumes support.", + "links": [], + "name": "Volumes", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "server-metadata", + "description": "Server Metadata API.", + "links": [], + "name": "ServerMetadata", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "servers", + "description": "Servers.", + "links": [], + "name": "Servers", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "versions", + "description": "API Version information.", + "links": [], + "name": "Versions", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + } + ] +} diff --git a/doc/v3/api_samples/extension-info/extensions-get-resp.json b/doc/v3/api_samples/extension-info/extensions-get-resp.json index 75d286fb039b..659e826f0c1f 100644 --- a/doc/v3/api_samples/extension-info/extensions-get-resp.json +++ b/doc/v3/api_samples/extension-info/extensions-get-resp.json @@ -1,8 +1,10 @@ { "extension": { - "alias": "flavors", - "description": "Flavors Extension.", - "name": "Flavors", - "version": 1 + "alias": "os-create-backup", + "description": "Create a backup of a server.", + "links": [], + "name": "CreateBackup", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" } } diff --git a/doc/v3/api_samples/extension-info/extensions-list-resp.json b/doc/v3/api_samples/extension-info/extensions-list-resp.json deleted file mode 100644 index 8ddbe20ac70c..000000000000 --- a/doc/v3/api_samples/extension-info/extensions-list-resp.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extensions": [ - { - "alias": "extensions", - "description": "Extension information.", - "name": "Extensions", - "version": 1 - }, - { - "alias": "flavors", - "description": "Flavors Extension.", - "name": "Flavors", - "version": 1 - } - ] -} diff --git a/nova/api/openstack/compute/plugins/v3/extension_info.py b/nova/api/openstack/compute/plugins/v3/extension_info.py index 5ad02841b44f..1f6804dbe3ab 100644 --- a/nova/api/openstack/compute/plugins/v3/extension_info.py +++ b/nova/api/openstack/compute/plugins/v3/extension_info.py @@ -21,6 +21,20 @@ from nova.openstack.common import log as logging LOG = logging.getLogger(__name__) +# V2.1 does not support XML but we need to keep an entry in the +# /extensions information returned to the user for backwards +# compatibility +FAKE_XML_URL = "http://docs.openstack.org/compute/ext/fake_xml" +FAKE_UPDATED_DATE = "2014-12-03T00:00:00Z" + + +class FakeExtension(object): + def __init__(self, name, alias): + self.name = name + self.alias = alias + self.__doc__ = "" + self.version = -1 + class ExtensionInfoController(wsgi.Controller): @@ -32,7 +46,9 @@ class ExtensionInfoController(wsgi.Controller): ext_data['name'] = ext.name ext_data['alias'] = ext.alias ext_data['description'] = ext.__doc__ - ext_data['version'] = ext.version + ext_data['namespace'] = FAKE_XML_URL + ext_data['updated'] = FAKE_UPDATED_DATE + ext_data['links'] = [] return ext_data def _get_extensions(self, context): diff --git a/nova/tests/functional/v3/api_samples/all_extensions/extensions-list-resp.json.tpl b/nova/tests/functional/v3/api_samples/all_extensions/extensions-list-resp.json.tpl new file mode 100644 index 000000000000..ee42fb48de7a --- /dev/null +++ b/nova/tests/functional/v3/api_samples/all_extensions/extensions-list-resp.json.tpl @@ -0,0 +1,652 @@ +{ + "extensions": [ + { + "alias": "consoles", + "description": "Consoles.", + "links": [], + "name": "Consoles", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "extensions", + "description": "Extension information.", + "links": [], + "name": "Extensions", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "flavor-extra-specs", + "description": "Flavors extra specs support.", + "links": [], + "name": "FlavorsExtraSpecs", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "flavor-manage", + "description": "Flavor create/delete API support.", + "links": [], + "name": "FlavorManage", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "flavors", + "description": "Flavors Extension.", + "links": [], + "name": "Flavors", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "image-metadata", + "description": "Image Metadata API.", + "links": [], + "name": "ImageMetadata", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "image-size", + "description": "Adds image size to image listings.", + "links": [], + "name": "ImageSize", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "images", + "description": "Proxying API for Images.", + "links": [], + "name": "Images", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "ips", + "description": "Server addresses.", + "links": [], + "name": "Ips", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "limits", + "description": "Limits support.", + "links": [], + "name": "Limits", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-access-ips", + "description": "Access IPs support.", + "links": [], + "name": "AccessIPs", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-admin-actions", + "description": "Enable admin-only server actions\n\n Actions include: pause, unpause, suspend, resume, migrate,\n reset_network, inject_network_info, lock, unlock, create_backup\n ", + "links": [], + "name": "AdminActions", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-admin-password", + "description": "Admin password management support.", + "links": [], + "name": "AdminPassword", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-agents", + "description": "Agents support.", + "links": [], + "name": "Agents", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-aggregates", + "description": "Admin-only aggregate administration.", + "links": [], + "name": "Aggregates", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-assisted-volume-snapshots", + "description": "Assisted volume snapshots.", + "links": [], + "name": "AssistedVolumeSnapshots", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-attach-interfaces", + "description": "Attach interface support.", + "links": [], + "name": "AttachInterfaces", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-availability-zone", + "description": "1. Add availability_zone to the Create Server API.\n 2. Add availability zones describing.\n ", + "links": [], + "name": "AvailabilityZone", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-baremetal-nodes", + "description": "Admin-only bare-metal node administration.", + "links": [], + "name": "BareMetalNodes", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-block-device-mapping", + "description": "Block device mapping boot support.", + "links": [], + "name": "BlockDeviceMapping", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-cells", + "description": "Enables cells-related functionality such as adding neighbor cells,\n listing neighbor cells, and getting the capabilities of the local cell.\n ", + "links": [], + "name": "Cells", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-certificates", + "description": "Certificates support.", + "links": [], + "name": "Certificates", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "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/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-config-drive", + "description": "Config Drive Extension.", + "links": [], + "name": "ConfigDrive", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-console-auth-tokens", + "description": "Console token authentication support.", + "links": [], + "name": "ConsoleAuthTokens", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-console-output", + "description": "Console log output support, with tailing ability.", + "links": [], + "name": "ConsoleOutput", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-create-backup", + "description": "Create a backup of a server.", + "links": [], + "name": "CreateBackup", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-deferred-delete", + "description": "Instance deferred delete.", + "links": [], + "name": "DeferredDelete", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-disk-config", + "description": "Disk Management Extension.", + "links": [], + "name": "DiskConfig", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-evacuate", + "description": "Enables server evacuation.", + "links": [], + "name": "Evacuate", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-extended-availability-zone", + "description": "Extended Availability Zone support.", + "links": [], + "name": "ExtendedAvailabilityZone", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-extended-server-attributes", + "description": "Extended Server Attributes support.", + "links": [], + "name": "ExtendedServerAttributes", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-extended-status", + "description": "Extended Status support.", + "links": [], + "name": "ExtendedStatus", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-extended-volumes", + "description": "Extended Volumes support.", + "links": [], + "name": "ExtendedVolumes", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-fixed-ips", + "description": "Fixed IPs support.", + "links": [], + "name": "FixedIPs", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-flavor-access", + "description": "Flavor access support.", + "links": [], + "name": "FlavorAccess", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-flavor-rxtx", + "description": "Support to show the rxtx status of a flavor.", + "links": [], + "name": "FlavorRxtx", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-floating-ip-dns", + "description": "Floating IP DNS support.", + "links": [], + "name": "FloatingIpDns", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-floating-ip-pools", + "description": "Floating IPs support.", + "links": [], + "name": "FloatingIpPools", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-floating-ips", + "description": "Floating IPs support.", + "links": [], + "name": "FloatingIps", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-floating-ips-bulk", + "description": "Bulk handling of Floating IPs.", + "links": [], + "name": "FloatingIpsBulk", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-fping", + "description": "Fping Management Extension.", + "links": [], + "name": "Fping", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-hide-server-addresses", + "description": "Support hiding server addresses in certain states.", + "links": [], + "name": "HideServerAddresses", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-hosts", + "description": "Admin-only host administration.", + "links": [], + "name": "Hosts", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-hypervisors", + "description": "Admin-only hypervisor administration.", + "links": [], + "name": "Hypervisors", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-instance-actions", + "description": "View a log of actions and events taken on an instance.", + "links": [], + "name": "InstanceActions", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-instance-usage-audit-log", + "description": "Admin-only Task Log Monitoring.", + "links": [], + "name": "InstanceUsageAuditLog", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-keypairs", + "description": "Keypair Support.", + "links": [], + "name": "Keypairs", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-lock-server", + "description": "Enable lock/unlock server actions.", + "links": [], + "name": "LockServer", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-migrate-server", + "description": "Enable migrate and live-migrate server actions.", + "links": [], + "name": "MigrateServer", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-migrations", + "description": "Provide data on migrations.", + "links": [], + "name": "Migrations", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-multinic", + "description": "Multiple network support.", + "links": [], + "name": "Multinic", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-multiple-create", + "description": "Allow multiple create in the Create Server v3 API.", + "links": [], + "name": "MultipleCreate", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-networks", + "description": "Admin-only Network Management Extension.", + "links": [], + "name": "Networks", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-networks-associate", + "description": "Network association support.", + "links": [], + "name": "NetworkAssociationSupport", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-pause-server", + "description": "Enable pause/unpause server actions.", + "links": [], + "name": "PauseServer", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-pci", + "description": "Pci access support.", + "links": [], + "name": "PciAccess", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-personality", + "description": "Personality support.", + "links": [], + "name": "Personality", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-quota-class-sets", + "description": "Quota classes management support.", + "links": [], + "name": "QuotaClasses", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-quota-sets", + "description": "Quotas management support.", + "links": [], + "name": "Quotas", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-remote-consoles", + "description": "Interactive Console support.", + "links": [], + "name": "RemoteConsoles", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-rescue", + "description": "Instance rescue mode.", + "links": [], + "name": "Rescue", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-scheduler-hints", + "description": "Pass arbitrary key/value pairs to the scheduler.", + "links": [], + "name": "SchedulerHints", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-security-group-default-rules", + "description": "Default rules for security group support.", + "links": [], + "name": "SecurityGroupDefaultRules", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-security-groups", + "description": "Security group support.", + "links": [], + "name": "SecurityGroups", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-server-diagnostics", + "description": "Allow Admins to view server diagnostics through server action.", + "links": [], + "name": "ServerDiagnostics", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-server-external-events", + "description": "Server External Event Triggers.", + "links": [], + "name": "ServerExternalEvents", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-server-groups", + "description": "Server group support.", + "links": [], + "name": "ServerGroups", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-server-password", + "description": "Server password support.", + "links": [], + "name": "ServerPassword", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-server-usage", + "description": "Adds launched_at and terminated_at on Servers.", + "links": [], + "name": "ServerUsage", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-services", + "description": "Services support.", + "links": [], + "name": "Services", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-shelve", + "description": "Instance shelve mode.", + "links": [], + "name": "Shelve", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-simple-tenant-usage", + "description": "Simple tenant usage extension.", + "links": [], + "name": "SimpleTenantUsage", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-suspend-server", + "description": "Enable suspend/resume server actions.", + "links": [], + "name": "SuspendServer", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-tenant-networks", + "description": "Tenant-based Network Management Extension.", + "links": [], + "name": "TenantNetworks", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-used-limits", + "description": "Provide data on limited resources that are being used.", + "links": [], + "name": "UsedLimits", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-virtual-interfaces", + "description": "Virtual interface support.", + "links": [], + "name": "VirtualInterfaces", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "os-volumes", + "description": "Volumes support.", + "links": [], + "name": "Volumes", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "server-metadata", + "description": "Server Metadata API.", + "links": [], + "name": "ServerMetadata", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "servers", + "description": "Servers.", + "links": [], + "name": "Servers", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + }, + { + "alias": "versions", + "description": "API Version information.", + "links": [], + "name": "Versions", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" + } + ] +} diff --git a/nova/tests/functional/v3/api_samples/extension-info/extensions-get-resp.json.tpl b/nova/tests/functional/v3/api_samples/extension-info/extensions-get-resp.json.tpl index 75d286fb039b..659e826f0c1f 100644 --- a/nova/tests/functional/v3/api_samples/extension-info/extensions-get-resp.json.tpl +++ b/nova/tests/functional/v3/api_samples/extension-info/extensions-get-resp.json.tpl @@ -1,8 +1,10 @@ { "extension": { - "alias": "flavors", - "description": "Flavors Extension.", - "name": "Flavors", - "version": 1 + "alias": "os-create-backup", + "description": "Create a backup of a server.", + "links": [], + "name": "CreateBackup", + "namespace": "http://docs.openstack.org/compute/ext/fake_xml", + "updated": "2014-12-03T00:00:00Z" } } diff --git a/nova/tests/functional/v3/api_samples/extension-info/extensions-list-resp.json.tpl b/nova/tests/functional/v3/api_samples/extension-info/extensions-list-resp.json.tpl deleted file mode 100644 index 8ddbe20ac70c..000000000000 --- a/nova/tests/functional/v3/api_samples/extension-info/extensions-list-resp.json.tpl +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extensions": [ - { - "alias": "extensions", - "description": "Extension information.", - "name": "Extensions", - "version": 1 - }, - { - "alias": "flavors", - "description": "Flavors Extension.", - "name": "Flavors", - "version": 1 - } - ] -} diff --git a/nova/tests/functional/v3/test_extension_info.py b/nova/tests/functional/v3/test_extension_info.py index 874365753b17..b4f596112600 100644 --- a/nova/tests/functional/v3/test_extension_info.py +++ b/nova/tests/functional/v3/test_extension_info.py @@ -22,16 +22,31 @@ from nova.api.openstack import extensions as api_extensions from nova.tests.functional.v3 import api_sample_base -class ExtensionInfoSamplesJsonTest(api_sample_base.ApiSampleTestBaseV3): - sample_dir = "extension-info" +def fake_soft_extension_authorizer(api_name, extension_name): + def authorize(context, action=None): + return True + return authorize - def test_list_extensions(self): + +class ExtensionInfoAllSamplesJsonTest(api_sample_base.ApiSampleTestBaseV3): + all_extensions = True + + @mock.patch.object(api_extensions, 'soft_extension_authorizer') + def test_list_extensions(self, soft_auth): + soft_auth.side_effect = fake_soft_extension_authorizer 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') + +class ExtensionInfoSamplesJsonTest(api_sample_base.ApiSampleTestBaseV3): + sample_dir = "extension-info" + extra_extensions_to_load = ["os-create-backup"] + + @mock.patch.object(api_extensions, 'soft_extension_authorizer') + def test_get_extensions(self, soft_auth): + soft_auth.side_effect = fake_soft_extension_authorizer + response = self._do_get('extensions/os-create-backup') subs = self._get_regexes() self._verify_response('extensions-get-resp', subs, response, 200) @@ -64,8 +79,3 @@ class ExtensionInfoFormatTest(api_sample_base.ApiSampleTestBaseV3): # 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/api/openstack/compute/plugins/v3/test_extension_info.py b/nova/tests/unit/api/openstack/compute/plugins/v3/test_extension_info.py index ee4e9d18b90c..7e9c6d2ee8a0 100644 --- a/nova/tests/unit/api/openstack/compute/plugins/v3/test_extension_info.py +++ b/nova/tests/unit/api/openstack/compute/plugins/v3/test_extension_info.py @@ -20,6 +20,9 @@ from nova import test from nova.tests.unit.api.openstack import fakes +FAKE_UPDATED_DATE = extension_info.FAKE_UPDATED_DATE + + class fake_extension(object): def __init__(self, name, alias, description, version): self.name = name @@ -35,6 +38,18 @@ fake_extensions = { } +simulated_extension_list = { + 'servers': fake_extension('Servers', 'servers', 'Servers.', 1), + 'images': fake_extension('Images', 'images', 'Images.', 2), + 'os-quota-sets': fake_extension('Quotas', 'os-quota-sets', + 'Quotas management support', 1), + 'os-cells': fake_extension('Cells', 'os-cells', + 'Cells description', 1), + 'os-flavor-access': fake_extension('FlavorAccess', 'os-flavor-access', + 'Flavor access support.', 1) +} + + def fake_policy_enforce(context, action, target, do_raise=True): return True @@ -65,8 +80,9 @@ class ExtensionInfoTest(test.NoDBTestCase): self.assertEqual(e['alias'], fake_extensions[e['alias']].alias) self.assertEqual(e['description'], fake_extensions[e['alias']].__doc__) - self.assertEqual(e['version'], - fake_extensions[e['alias']].version) + self.assertEqual(e['updated'], FAKE_UPDATED_DATE) + self.assertEqual(e['links'], []) + self.assertEqual(6, len(e)) def test_extension_info_show(self): self.stubs.Set(policy, 'enforce', fake_policy_enforce) @@ -79,8 +95,9 @@ class ExtensionInfoTest(test.NoDBTestCase): fake_extensions['ext1-alias'].alias) self.assertEqual(res_dict['extension']['description'], fake_extensions['ext1-alias'].__doc__) - self.assertEqual(res_dict['extension']['version'], - fake_extensions['ext1-alias'].version) + self.assertEqual(res_dict['extension']['updated'], FAKE_UPDATED_DATE) + self.assertEqual(res_dict['extension']['links'], []) + self.assertEqual(6, len(res_dict['extension'])) def test_extension_info_list_not_all_discoverable(self): self.stubs.Set(policy, 'enforce', fake_policy_enforce_selective) @@ -94,5 +111,47 @@ class ExtensionInfoTest(test.NoDBTestCase): self.assertEqual(e['alias'], fake_extensions[e['alias']].alias) self.assertEqual(e['description'], fake_extensions[e['alias']].__doc__) - self.assertEqual(e['version'], - fake_extensions[e['alias']].version) + self.assertEqual(e['updated'], FAKE_UPDATED_DATE) + self.assertEqual(e['links'], []) + self.assertEqual(6, len(e)) + + +class ExtensionInfoV21Test(test.NoDBTestCase): + + def setUp(self): + super(ExtensionInfoV21Test, self).setUp() + ext_info = plugins.LoadedExtensionInfo() + ext_info.extensions = simulated_extension_list + self.controller = extension_info.ExtensionInfoController(ext_info) + self.stubs.Set(policy, 'enforce', fake_policy_enforce) + + def test_extension_info_list(self): + req = fakes.HTTPRequest.blank('/extensions') + res_dict = self.controller.index(req) + self.assertEqual(5, len(res_dict['extensions'])) + + expected_output = simulated_extension_list + + for e in res_dict['extensions']: + self.assertIn(e['alias'], expected_output) + self.assertEqual(e['name'], expected_output[e['alias']].name) + self.assertEqual(e['alias'], expected_output[e['alias']].alias) + self.assertEqual(e['description'], + expected_output[e['alias']].__doc__) + self.assertEqual(e['updated'], FAKE_UPDATED_DATE) + self.assertEqual(e['links'], []) + self.assertEqual(6, len(e)) + + def test_extension_info_show(self): + req = fakes.HTTPRequest.blank('/extensions/os-cells') + res_dict = self.controller.show(req, 'os-cells') + self.assertEqual(1, len(res_dict)) + self.assertEqual(res_dict['extension']['name'], + simulated_extension_list['os-cells'].name) + self.assertEqual(res_dict['extension']['alias'], + simulated_extension_list['os-cells'].alias) + self.assertEqual(res_dict['extension']['description'], + simulated_extension_list['os-cells'].__doc__) + self.assertEqual(res_dict['extension']['updated'], FAKE_UPDATED_DATE) + self.assertEqual(res_dict['extension']['links'], []) + self.assertEqual(6, len(res_dict['extension']))