From 00b29d86e28b3d00cc8d854a0a721f4b29ab4cd5 Mon Sep 17 00:00:00 2001 From: ghanshyam Date: Wed, 8 Jun 2016 12:46:15 +0900 Subject: [PATCH] Remove v2 extension setting from functional tests Now v2 API legacy code has been removed, functional tests do not need to set the v2 extensions. This patch removes the extension setting on osapi_compute_extension flag. Partially implements blueprint remove-legacy-v2-api-code Change-Id: If5db4b141702fa94777fc5706dec6c3fb6c9c594 --- nova/api/openstack/extensions.py | 7 ---- .../api_sample_tests/api_sample_base.py | 1 - .../api_sample_tests/test_access_ips.py | 15 -------- .../api_sample_tests/test_admin_actions.py | 10 ------ .../api_sample_tests/test_agents.py | 10 ------ .../api_sample_tests/test_aggregates.py | 10 ------ .../test_assisted_volume_snapshots.py | 11 ------ .../test_attach_interfaces.py | 11 ------ .../test_availability_zone.py | 11 ------ .../api_sample_tests/test_baremetal_nodes.py | 10 ------ .../test_block_device_mapping_boot.py | 8 ----- .../functional/api_sample_tests/test_cells.py | 9 ----- .../api_sample_tests/test_certificates.py | 10 ------ .../api_sample_tests/test_cloudpipe.py | 9 ----- .../api_sample_tests/test_config_drive.py | 17 --------- .../test_console_auth_tokens.py | 13 ------- .../api_sample_tests/test_console_output.py | 11 ------ .../api_sample_tests/test_create_backup.py | 10 ------ .../api_sample_tests/test_deferred_delete.py | 11 ------ .../api_sample_tests/test_disk_config.py | 18 ---------- .../api_sample_tests/test_evacuate.py | 13 ------- .../test_extended_availability_zone.py | 18 ---------- .../test_extended_server_attributes.py | 18 ---------- .../api_sample_tests/test_extended_status.py | 18 ---------- .../api_sample_tests/test_extended_volumes.py | 20 ----------- .../api_sample_tests/test_fixed_ips.py | 10 ------ .../api_sample_tests/test_flavor_access.py | 24 ------------- .../test_flavor_extraspecs.py | 11 ------ .../api_sample_tests/test_flavor_manage.py | 23 ------------ .../api_sample_tests/test_flavor_rxtx.py | 26 -------------- .../api_sample_tests/test_flavors.py | 21 ----------- .../api_sample_tests/test_floating_ip_dns.py | 10 ------ .../test_floating_ip_pools.py | 10 ------ .../api_sample_tests/test_floating_ips.py | 9 ----- .../test_floating_ips_bulk.py | 7 ---- .../functional/api_sample_tests/test_fping.py | 10 ------ .../test_hide_server_addresses.py | 7 ---- .../functional/api_sample_tests/test_hosts.py | 10 ------ .../api_sample_tests/test_hypervisors.py | 26 -------------- .../api_sample_tests/test_instance_actions.py | 10 ------ .../test_instance_usage_audit_log.py | 11 ------ .../api_sample_tests/test_keypairs.py | 10 ------ .../api_sample_tests/test_limits.py | 8 ----- .../api_sample_tests/test_lock_server.py | 10 ------ .../api_sample_tests/test_migrate_server.py | 11 ------ .../api_sample_tests/test_migrations.py | 10 ------ .../api_sample_tests/test_multinic.py | 10 ------ .../api_sample_tests/test_multiple_create.py | 11 ------ .../api_sample_tests/test_networks.py | 12 ------- .../test_networks_associate.py | 14 -------- .../api_sample_tests/test_pause_server.py | 10 ------ .../test_preserve_ephemeral_rebuild.py | 11 ------ .../api_sample_tests/test_quota_classes.py | 11 ------ .../api_sample_tests/test_quota_sets.py | 17 --------- .../api_sample_tests/test_remote_consoles.py | 10 ------ .../api_sample_tests/test_rescue.py | 20 ----------- .../api_sample_tests/test_scheduler_hints.py | 11 ------ .../test_security_group_default_rules.py | 11 ------ .../api_sample_tests/test_security_groups.py | 18 ---------- .../test_server_diagnostics.py | 11 ------ .../test_server_external_events.py | 11 ------ .../api_sample_tests/test_server_groups.py | 10 ------ .../api_sample_tests/test_server_password.py | 11 ------ .../api_sample_tests/test_server_usage.py | 17 --------- .../api_sample_tests/test_servers.py | 36 ------------------- .../api_sample_tests/test_services.py | 16 --------- .../api_sample_tests/test_shelve.py | 7 ---- .../test_simple_tenant_usage.py | 11 ------ .../api_sample_tests/test_suspend_server.py | 10 ------ .../api_sample_tests/test_tenant_networks.py | 7 ---- .../api_sample_tests/test_user_data.py | 10 ------ .../test_virtual_interfaces.py | 8 ----- .../api_sample_tests/test_volumes.py | 27 -------------- 73 files changed, 931 deletions(-) diff --git a/nova/api/openstack/extensions.py b/nova/api/openstack/extensions.py index 8297f53445c2..24da0b500cb6 100644 --- a/nova/api/openstack/extensions.py +++ b/nova/api/openstack/extensions.py @@ -210,13 +210,6 @@ class ExtensionManager(object): LOG.debug("Loading extension %s", ext_factory) if isinstance(ext_factory, six.string_types): - if ext_factory.startswith('nova.api.openstack.compute.contrib'): - LOG.warning(_LW("The legacy v2 API module already moved into" - "'nova.api.openstack.compute.legacy_v2.contrib'. " - "Use new path instead of old path %s"), - ext_factory) - ext_factory = ext_factory.replace('contrib', - 'legacy_v2.contrib') # Load the factory factory = importutils.import_class(ext_factory) else: diff --git a/nova/tests/functional/api_sample_tests/api_sample_base.py b/nova/tests/functional/api_sample_tests/api_sample_base.py index 000bb9b3f2b8..74b66fa1652b 100644 --- a/nova/tests/functional/api_sample_tests/api_sample_base.py +++ b/nova/tests/functional/api_sample_tests/api_sample_base.py @@ -84,7 +84,6 @@ class ApiSampleTestBaseV21(testscenarios.WithScenarios, osapi_compute_link_prefix=self._get_host(), osapi_glance_link_prefix=self._get_glance_host()) if not self.all_extensions: - self.flags(osapi_compute_extension=[]) # 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 diff --git a/nova/tests/functional/api_sample_tests/test_access_ips.py b/nova/tests/functional/api_sample_tests/test_access_ips.py index a07a4d68f24c..9ac90ec05583 100644 --- a/nova/tests/functional/api_sample_tests/test_access_ips.py +++ b/nova/tests/functional/api_sample_tests/test_access_ips.py @@ -13,28 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.unit.image import fake -CONF = nova.conf.CONF - class AccessIPsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): extension_name = 'os-access-ips' - def _get_flags(self): - f = super(AccessIPsSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.keypairs.Keypairs') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips.Extended_ips') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips_mac.' - 'Extended_ips_mac') - return f - def _servers_post(self, subs): response = self._do_post('servers', 'server-post-req', subs) return self._verify_response('server-post-resp', subs, response, 202) diff --git a/nova/tests/functional/api_sample_tests/test_admin_actions.py b/nova/tests/functional/api_sample_tests/test_admin_actions.py index ac157b15f17e..b7c2e0872eee 100644 --- a/nova/tests/functional/api_sample_tests/test_admin_actions.py +++ b/nova/tests/functional/api_sample_tests/test_admin_actions.py @@ -13,22 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class AdminActionsSamplesJsonTest(test_servers.ServersSampleBase): extension_name = "os-admin-actions" - def _get_flags(self): - f = super(AdminActionsSamplesJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.admin_actions.Admin_actions') - return f - def setUp(self): """setUp Method for AdminActions api samples extension diff --git a/nova/tests/functional/api_sample_tests/test_agents.py b/nova/tests/functional/api_sample_tests/test_agents.py index c89bb9975a39..fa86c3449d1b 100644 --- a/nova/tests/functional/api_sample_tests/test_agents.py +++ b/nova/tests/functional/api_sample_tests/test_agents.py @@ -13,24 +13,14 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.db.sqlalchemy import models from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class AgentsJsonTest(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-agents" - def _get_flags(self): - f = super(AgentsJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.agents.Agents') - return f - def setUp(self): super(AgentsJsonTest, self).setUp() diff --git a/nova/tests/functional/api_sample_tests/test_aggregates.py b/nova/tests/functional/api_sample_tests/test_aggregates.py index da3d0de563ce..43df18c575a5 100644 --- a/nova/tests/functional/api_sample_tests/test_aggregates.py +++ b/nova/tests/functional/api_sample_tests/test_aggregates.py @@ -13,23 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class AggregatesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-aggregates" - def _get_flags(self): - f = super(AggregatesSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.aggregates.Aggregates') - return f - def test_aggregate_create(self): subs = { "aggregate_id": '(?P\d+)' diff --git a/nova/tests/functional/api_sample_tests/test_assisted_volume_snapshots.py b/nova/tests/functional/api_sample_tests/test_assisted_volume_snapshots.py index 178432bc27cf..8e571e5f168c 100644 --- a/nova/tests/functional/api_sample_tests/test_assisted_volume_snapshots.py +++ b/nova/tests/functional/api_sample_tests/test_assisted_volume_snapshots.py @@ -12,24 +12,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers from nova.tests.unit.api.openstack import fakes -CONF = nova.conf.CONF - class AssistedVolumeSnapshotsJsonTests(test_servers.ServersSampleBase): extension_name = "os-assisted-volume-snapshots" - def _get_flags(self): - f = super(AssistedVolumeSnapshotsJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.' - 'assisted_volume_snapshots.Assisted_volume_snapshots') - return f - def test_create(self): """Create a volume snapshots.""" self.stub_out('nova.compute.api.API.volume_snapshot_create', diff --git a/nova/tests/functional/api_sample_tests/test_attach_interfaces.py b/nova/tests/functional/api_sample_tests/test_attach_interfaces.py index 969aac681ab8..4d6f374adc06 100644 --- a/nova/tests/functional/api_sample_tests/test_attach_interfaces.py +++ b/nova/tests/functional/api_sample_tests/test_attach_interfaces.py @@ -13,26 +13,15 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova import exception from nova.network import api as network_api from nova.tests.functional.api_sample_tests import test_servers from nova.tests.unit import fake_network_cache_model -CONF = nova.conf.CONF - class AttachInterfacesSampleJsonTest(test_servers.ServersSampleBase): extension_name = 'os-attach-interfaces' - def _get_flags(self): - f = super(AttachInterfacesSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.' - 'attach_interfaces.Attach_interfaces') - return f - def setUp(self): super(AttachInterfacesSampleJsonTest, self).setUp() diff --git a/nova/tests/functional/api_sample_tests/test_availability_zone.py b/nova/tests/functional/api_sample_tests/test_availability_zone.py index 6bee7e116544..db157b68955e 100644 --- a/nova/tests/functional/api_sample_tests/test_availability_zone.py +++ b/nova/tests/functional/api_sample_tests/test_availability_zone.py @@ -12,24 +12,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class AvailabilityZoneJsonTest(test_servers.ServersSampleBase): ADMIN_API = True extension_name = "os-availability-zone" - def _get_flags(self): - f = super(AvailabilityZoneJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.availability_zone.' - 'Availability_zone') - return f - def test_availability_zone_list(self): response = self._do_get('os-availability-zone') self._verify_response('availability-zone-list-resp', {}, response, 200) diff --git a/nova/tests/functional/api_sample_tests/test_baremetal_nodes.py b/nova/tests/functional/api_sample_tests/test_baremetal_nodes.py index 4ee6cd1e016e..fd8e1e3080b2 100644 --- a/nova/tests/functional/api_sample_tests/test_baremetal_nodes.py +++ b/nova/tests/functional/api_sample_tests/test_baremetal_nodes.py @@ -14,11 +14,8 @@ import mock -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class FakeNode(object): def __init__(self, uuid='058d27fa-241b-445a-a386-08c04f96db43'): @@ -49,13 +46,6 @@ class BareMetalNodesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-baremetal-nodes" - def _get_flags(self): - f = super(BareMetalNodesSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.baremetal_nodes.Baremetal_nodes') - return f - @mock.patch("nova.api.openstack.compute.baremetal_nodes" "._get_ironic_client") def test_baremetal_nodes_list(self, mock_get_irc): diff --git a/nova/tests/functional/api_sample_tests/test_block_device_mapping_boot.py b/nova/tests/functional/api_sample_tests/test_block_device_mapping_boot.py index a21169ae68c9..ab7cdc0255cd 100644 --- a/nova/tests/functional/api_sample_tests/test_block_device_mapping_boot.py +++ b/nova/tests/functional/api_sample_tests/test_block_device_mapping_boot.py @@ -13,12 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers from nova.tests.unit.api.openstack import fakes -CONF = nova.conf.CONF - class BlockDeviceMappingV1BootJsonTest(test_servers.ServersSampleBase): extension_name = "os-block-device-mapping-v1" @@ -32,8 +29,3 @@ class BlockDeviceMappingV1BootJsonTest(test_servers.ServersSampleBase): class BlockDeviceMappingV2BootJsonTest(BlockDeviceMappingV1BootJsonTest): extension_name = "os-block-device-mapping" - - def _get_flags(self): - f = super(BlockDeviceMappingV2BootJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - return f diff --git a/nova/tests/functional/api_sample_tests/test_cells.py b/nova/tests/functional/api_sample_tests/test_cells.py index e1a8e1ff693d..feb767e63ef1 100644 --- a/nova/tests/functional/api_sample_tests/test_cells.py +++ b/nova/tests/functional/api_sample_tests/test_cells.py @@ -28,15 +28,6 @@ CONF = nova.conf.CONF class CellsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): extension_name = "os-cells" - def _get_flags(self): - f = super(CellsSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.cells.Cells') - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.cell_capacities.Cell_capacities') - return f - def setUp(self): # db_check_interval < 0 makes cells manager always hit the DB self.flags(enable=True, db_check_interval=-1, group='cells') diff --git a/nova/tests/functional/api_sample_tests/test_certificates.py b/nova/tests/functional/api_sample_tests/test_certificates.py index 24d34b051bf7..1f2f6871598f 100644 --- a/nova/tests/functional/api_sample_tests/test_certificates.py +++ b/nova/tests/functional/api_sample_tests/test_certificates.py @@ -13,23 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.unit import fake_crypto -CONF = nova.conf.CONF - class CertificatesSamplesJsonTest(api_sample_base.ApiSampleTestBaseV21): extension_name = "os-certificates" - def _get_flags(self): - f = super(CertificatesSamplesJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.certificates.Certificates') - return f - def setUp(self): super(CertificatesSamplesJsonTest, self).setUp() self.stub_out('nova.crypto.ensure_ca_filesystem', diff --git a/nova/tests/functional/api_sample_tests/test_cloudpipe.py b/nova/tests/functional/api_sample_tests/test_cloudpipe.py index 17f55a4b020d..bc37b22eb843 100644 --- a/nova/tests/functional/api_sample_tests/test_cloudpipe.py +++ b/nova/tests/functional/api_sample_tests/test_cloudpipe.py @@ -26,15 +26,6 @@ class CloudPipeSampleTest(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-cloudpipe" - def _get_flags(self): - f = super(CloudPipeSampleTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.cloudpipe.Cloudpipe') - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.cloudpipe_update.Cloudpipe_update') - return f - def setUp(self): super(CloudPipeSampleTest, self).setUp() diff --git a/nova/tests/functional/api_sample_tests/test_config_drive.py b/nova/tests/functional/api_sample_tests/test_config_drive.py index bb6ff80ccc95..8daa28171552 100644 --- a/nova/tests/functional/api_sample_tests/test_config_drive.py +++ b/nova/tests/functional/api_sample_tests/test_config_drive.py @@ -13,31 +13,14 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers from nova.tests.unit.api.openstack import fakes from nova.tests.unit.image import fake -CONF = nova.conf.CONF - class ConfigDriveSampleJsonTest(test_servers.ServersSampleBase): extension_name = 'os-config-drive' - def _get_flags(self): - f = super(ConfigDriveSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.config_drive.Config_drive') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.keypairs.Keypairs') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips.Extended_ips') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips_mac.' - 'Extended_ips_mac') - return f - def setUp(self): super(ConfigDriveSampleJsonTest, self).setUp() fakes.stub_out_networking(self) diff --git a/nova/tests/functional/api_sample_tests/test_console_auth_tokens.py b/nova/tests/functional/api_sample_tests/test_console_auth_tokens.py index 35d9367960e8..c20343ba69e6 100644 --- a/nova/tests/functional/api_sample_tests/test_console_auth_tokens.py +++ b/nova/tests/functional/api_sample_tests/test_console_auth_tokens.py @@ -16,27 +16,14 @@ import re from oslo_serialization import jsonutils -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class ConsoleAuthTokensSampleJsonTests(test_servers.ServersSampleBase): ADMIN_API = True extension_name = "os-console-auth-tokens" extra_extensions_to_load = ["os-remote-consoles", "os-access-ips"] - def _get_flags(self): - f = super(ConsoleAuthTokensSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.consoles.Consoles') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.console_auth_tokens.' - 'Console_auth_tokens') - return f - def _get_console_url(self, data): return jsonutils.loads(data)["console"]["url"] diff --git a/nova/tests/functional/api_sample_tests/test_console_output.py b/nova/tests/functional/api_sample_tests/test_console_output.py index b10a942d70e5..92e97b4695d8 100644 --- a/nova/tests/functional/api_sample_tests/test_console_output.py +++ b/nova/tests/functional/api_sample_tests/test_console_output.py @@ -13,23 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class ConsoleOutputSampleJsonTest(test_servers.ServersSampleBase): extension_name = "os-console-output" - def _get_flags(self): - f = super(ConsoleOutputSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.console_output.' - 'Console_output') - return f - def test_get_console_output(self): uuid = self._post_server() response = self._do_post('servers/%s/action' % uuid, diff --git a/nova/tests/functional/api_sample_tests/test_create_backup.py b/nova/tests/functional/api_sample_tests/test_create_backup.py index 2ee00de40d96..07ec04d4813d 100644 --- a/nova/tests/functional/api_sample_tests/test_create_backup.py +++ b/nova/tests/functional/api_sample_tests/test_create_backup.py @@ -15,23 +15,13 @@ import mock -import nova.conf from nova.tests.functional.api_sample_tests import test_servers from nova.tests.unit.image import fake -CONF = nova.conf.CONF - class CreateBackupSamplesJsonTest(test_servers.ServersSampleBase): extension_name = "os-create-backup" - def _get_flags(self): - f = super(CreateBackupSamplesJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.admin_actions.Admin_actions') - return f - def setUp(self): """setUp Method for PauseServer api samples extension diff --git a/nova/tests/functional/api_sample_tests/test_deferred_delete.py b/nova/tests/functional/api_sample_tests/test_deferred_delete.py index ca12495293a1..41db0664130e 100644 --- a/nova/tests/functional/api_sample_tests/test_deferred_delete.py +++ b/nova/tests/functional/api_sample_tests/test_deferred_delete.py @@ -13,23 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class DeferredDeleteSampleJsonTests(test_servers.ServersSampleBase): extension_name = "os-deferred-delete" - def _get_flags(self): - f = super(DeferredDeleteSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.deferred_delete.' - 'Deferred_delete') - return f - def setUp(self): super(DeferredDeleteSampleJsonTests, self).setUp() self.flags(reclaim_instance_interval=1) diff --git a/nova/tests/functional/api_sample_tests/test_disk_config.py b/nova/tests/functional/api_sample_tests/test_disk_config.py index d48e2011178c..434dcb993add 100644 --- a/nova/tests/functional/api_sample_tests/test_disk_config.py +++ b/nova/tests/functional/api_sample_tests/test_disk_config.py @@ -13,32 +13,14 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers from nova.tests.unit.image import fake -CONF = nova.conf.CONF - class DiskConfigJsonTest(test_servers.ServersSampleBase): extension_name = 'os-disk-config' extra_extensions_to_load = ["os-access-ips"] - def _get_flags(self): - f = super(DiskConfigJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.keypairs.Keypairs') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips.Extended_ips') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips_mac.' - 'Extended_ips_mac') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.disk_config.' - 'Disk_config') - return f - def test_list_servers_detail(self): uuid = self._post_server(use_common_server_api_samples=False) response = self._do_get('servers/detail') diff --git a/nova/tests/functional/api_sample_tests/test_evacuate.py b/nova/tests/functional/api_sample_tests/test_evacuate.py index de8b616b26ea..5f2828e5eee6 100644 --- a/nova/tests/functional/api_sample_tests/test_evacuate.py +++ b/nova/tests/functional/api_sample_tests/test_evacuate.py @@ -15,27 +15,14 @@ import mock -import nova.conf from nova import objects from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class EvacuateJsonTest(test_servers.ServersSampleBase): ADMIN_API = True extension_name = "os-evacuate" - def _get_flags(self): - f = super(EvacuateJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.evacuate.Evacuate') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_evacuate_find_host.' - 'Extended_evacuate_find_host') - return f - def _test_evacuate(self, req_subs, server_req, server_resp, expected_resp_code): self.uuid = self._post_server() diff --git a/nova/tests/functional/api_sample_tests/test_extended_availability_zone.py b/nova/tests/functional/api_sample_tests/test_extended_availability_zone.py index 653dc49ab601..19432528a2f0 100644 --- a/nova/tests/functional/api_sample_tests/test_extended_availability_zone.py +++ b/nova/tests/functional/api_sample_tests/test_extended_availability_zone.py @@ -13,30 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class ExtendedAvailabilityZoneJsonTests(test_servers.ServersSampleBase): extension_name = "os-extended-availability-zone" - def _get_flags(self): - f = super(ExtendedAvailabilityZoneJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.keypairs.Keypairs') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_availability_zone.' - 'Extended_availability_zone') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips.Extended_ips') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips_mac.' - 'Extended_ips_mac') - return f - def test_show(self): uuid = self._post_server() response = self._do_get('servers/%s' % uuid) diff --git a/nova/tests/functional/api_sample_tests/test_extended_server_attributes.py b/nova/tests/functional/api_sample_tests/test_extended_server_attributes.py index a8c7f9177df7..164bf7260497 100644 --- a/nova/tests/functional/api_sample_tests/test_extended_server_attributes.py +++ b/nova/tests/functional/api_sample_tests/test_extended_server_attributes.py @@ -13,30 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class ExtendedServerAttributesJsonTest(test_servers.ServersSampleBase): extension_name = "os-extended-server-attributes" - def _get_flags(self): - f = super(ExtendedServerAttributesJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.keypairs.Keypairs') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips.Extended_ips') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips_mac.' - 'Extended_ips_mac') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_server_attributes.' - 'Extended_server_attributes') - return f - def test_show(self): uuid = self._post_server() diff --git a/nova/tests/functional/api_sample_tests/test_extended_status.py b/nova/tests/functional/api_sample_tests/test_extended_status.py index 1bcc0c9ec521..55999f11d87e 100644 --- a/nova/tests/functional/api_sample_tests/test_extended_status.py +++ b/nova/tests/functional/api_sample_tests/test_extended_status.py @@ -13,30 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class ExtendedStatusSampleJsonTests(test_servers.ServersSampleBase): extension_name = "os-extended-status" - def _get_flags(self): - f = super(ExtendedStatusSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.keypairs.Keypairs') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips.Extended_ips') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips_mac.' - 'Extended_ips_mac') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_status.' - 'Extended_status') - return f - def test_show(self): uuid = self._post_server() response = self._do_get('servers/%s' % uuid) diff --git a/nova/tests/functional/api_sample_tests/test_extended_volumes.py b/nova/tests/functional/api_sample_tests/test_extended_volumes.py index 1b130362ffb2..275e199859c4 100644 --- a/nova/tests/functional/api_sample_tests/test_extended_volumes.py +++ b/nova/tests/functional/api_sample_tests/test_extended_volumes.py @@ -13,33 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers from nova.tests.unit.api.openstack import fakes -CONF = nova.conf.CONF - class ExtendedVolumesSampleJsonTests(test_servers.ServersSampleBase): extension_name = "os-extended-volumes" - def _get_flags(self): - f = super(ExtendedVolumesSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_volumes.' - 'Extended_volumes') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.keypairs.' - 'Keypairs') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips_mac.' - 'Extended_ips_mac') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips.' - 'Extended_ips') - return f - def test_show(self): uuid = self._post_server() self.stub_out('nova.db.block_device_mapping_get_all_by_instance_uuids', diff --git a/nova/tests/functional/api_sample_tests/test_fixed_ips.py b/nova/tests/functional/api_sample_tests/test_fixed_ips.py index 32d46b4de32e..df15d1e6cc14 100644 --- a/nova/tests/functional/api_sample_tests/test_fixed_ips.py +++ b/nova/tests/functional/api_sample_tests/test_fixed_ips.py @@ -12,28 +12,18 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova import exception from nova.tests.functional.api_sample_tests import test_servers from nova.tests.unit.objects import test_network from nova.tests.unit import utils as test_utils from nova.tests import uuidsentinel as uuids -CONF = nova.conf.CONF - class FixedIpTest(test_servers.ServersSampleBase): extension_name = "os-fixed-ips" microversion = None - def _get_flags(self): - f = super(FixedIpTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.fixed_ips.Fixed_ips') - return f - def setUp(self): super(FixedIpTest, self).setUp() self.api.microversion = self.microversion diff --git a/nova/tests/functional/api_sample_tests/test_flavor_access.py b/nova/tests/functional/api_sample_tests/test_flavor_access.py index 6f8c56646166..dd7d731ef4d3 100644 --- a/nova/tests/functional/api_sample_tests/test_flavor_access.py +++ b/nova/tests/functional/api_sample_tests/test_flavor_access.py @@ -12,37 +12,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class FlavorAccessTestsBase(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = 'flavor-access' - def _get_flags(self): - f = super(FlavorAccessTestsBase, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.' - 'flavor_access.Flavor_access') - # FlavorAccess extension also needs Flavormanage to be loaded. - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.' - 'flavormanage.Flavormanage') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.' - 'flavor_disabled.Flavor_disabled') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.' - 'flavorextradata.Flavorextradata') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.' - 'flavor_swap.Flavor_swap') - return f - def _add_tenant(self): subs = { 'tenant_id': 'fake_tenant', diff --git a/nova/tests/functional/api_sample_tests/test_flavor_extraspecs.py b/nova/tests/functional/api_sample_tests/test_flavor_extraspecs.py index cab90497ceb0..b4896fc4cadd 100644 --- a/nova/tests/functional/api_sample_tests/test_flavor_extraspecs.py +++ b/nova/tests/functional/api_sample_tests/test_flavor_extraspecs.py @@ -13,24 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class FlavorExtraSpecsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = 'flavor-extra-specs' - def _get_flags(self): - f = super(FlavorExtraSpecsSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.flavorextraspecs.' - 'Flavorextraspecs') - return f - def _flavor_extra_specs_create(self): subs = {'value1': 'value1', 'value2': 'value2' diff --git a/nova/tests/functional/api_sample_tests/test_flavor_manage.py b/nova/tests/functional/api_sample_tests/test_flavor_manage.py index aee25d13fc3d..a4aa406308ec 100644 --- a/nova/tests/functional/api_sample_tests/test_flavor_manage.py +++ b/nova/tests/functional/api_sample_tests/test_flavor_manage.py @@ -13,36 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class FlavorManageSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = 'flavor-manage' - def _get_flags(self): - f = super(FlavorManageSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.flavormanage.' - 'Flavormanage') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.flavor_disabled.' - 'Flavor_disabled') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.flavor_access.' - 'Flavor_access') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.flavorextradata.' - 'Flavorextradata') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.flavor_swap.' - 'Flavor_swap') - return f - def _create_flavor(self): """Create a flavor.""" subs = { diff --git a/nova/tests/functional/api_sample_tests/test_flavor_rxtx.py b/nova/tests/functional/api_sample_tests/test_flavor_rxtx.py index e8f4d2c779e6..499945ada7ad 100644 --- a/nova/tests/functional/api_sample_tests/test_flavor_rxtx.py +++ b/nova/tests/functional/api_sample_tests/test_flavor_rxtx.py @@ -13,39 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class FlavorRxtxJsonTest(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = 'os-flavor-rxtx' - def _get_flags(self): - f = super(FlavorRxtxJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.flavor_rxtx.' - 'Flavor_rxtx') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.flavormanage.' - 'Flavormanage') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.flavor_disabled.' - 'Flavor_disabled') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.flavor_access.' - 'Flavor_access') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.flavorextradata.' - 'Flavorextradata') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.flavor_swap.' - 'Flavor_swap') - return f - def test_flavor_rxtx_get(self): flavor_id = '1' response = self._do_get('flavors/%s' % flavor_id) diff --git a/nova/tests/functional/api_sample_tests/test_flavors.py b/nova/tests/functional/api_sample_tests/test_flavors.py index 6c10dbe61c30..6f73d1aa5cd0 100644 --- a/nova/tests/functional/api_sample_tests/test_flavors.py +++ b/nova/tests/functional/api_sample_tests/test_flavors.py @@ -13,28 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class FlavorsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): sample_dir = 'flavors' - def _get_flags(self): - f = super(FlavorsSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.flavor_swap.Flavor_swap') - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.flavor_disabled.Flavor_disabled') - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.flavor_access.Flavor_access') - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.flavorextradata.Flavorextradata') - return f - def test_flavors_get(self): response = self._do_get('flavors/1') self._verify_response('flavor-get-resp', {}, response, 200) @@ -51,8 +35,3 @@ class FlavorsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): class FlavorsSampleAllExtensionJsonTest(FlavorsSampleJsonTest): all_extensions = True sample_dir = None - - def _get_flags(self): - f = super(FlavorsSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - return f diff --git a/nova/tests/functional/api_sample_tests/test_floating_ip_dns.py b/nova/tests/functional/api_sample_tests/test_floating_ip_dns.py index ea706bfc23ed..dc60fbfa4ae2 100644 --- a/nova/tests/functional/api_sample_tests/test_floating_ip_dns.py +++ b/nova/tests/functional/api_sample_tests/test_floating_ip_dns.py @@ -12,11 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class FloatingIpDNSTest(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True @@ -29,13 +26,6 @@ class FloatingIpDNSTest(api_sample_base.ApiSampleTestBaseV21): dns_type = 'A' ip = '192.168.1.1' - def _get_flags(self): - f = super(FloatingIpDNSTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.floating_ip_dns.Floating_ip_dns') - return f - def _create_or_update(self): subs = {'project': self.project, 'scope': self.scope} diff --git a/nova/tests/functional/api_sample_tests/test_floating_ip_pools.py b/nova/tests/functional/api_sample_tests/test_floating_ip_pools.py index fa278241fc43..ce46d86b8b57 100644 --- a/nova/tests/functional/api_sample_tests/test_floating_ip_pools.py +++ b/nova/tests/functional/api_sample_tests/test_floating_ip_pools.py @@ -12,22 +12,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class FloatingIPPoolsSampleTests(api_sample_base.ApiSampleTestBaseV21): extension_name = "os-floating-ip-pools" - def _get_flags(self): - f = super(FloatingIPPoolsSampleTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.floating_ip_pools.Floating_ip_pools') - return f - def test_list_floatingippools(self): pool_list = ["pool1", "pool2"] diff --git a/nova/tests/functional/api_sample_tests/test_floating_ips.py b/nova/tests/functional/api_sample_tests/test_floating_ips.py index 7aafccd2f5a4..b443d7b9b848 100644 --- a/nova/tests/functional/api_sample_tests/test_floating_ips.py +++ b/nova/tests/functional/api_sample_tests/test_floating_ips.py @@ -23,15 +23,6 @@ CONF = nova.conf.CONF class FloatingIpsTest(api_sample_base.ApiSampleTestBaseV21): extension_name = "os-floating-ips" - def _get_flags(self): - f = super(FloatingIpsTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.floating_ips.Floating_ips') - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.extended_floating_ips.Extended_floating_ips') - return f - def setUp(self): super(FloatingIpsTest, self).setUp() pool = CONF.default_floating_pool diff --git a/nova/tests/functional/api_sample_tests/test_floating_ips_bulk.py b/nova/tests/functional/api_sample_tests/test_floating_ips_bulk.py index 0af432e95f4c..7d146b965afc 100644 --- a/nova/tests/functional/api_sample_tests/test_floating_ips_bulk.py +++ b/nova/tests/functional/api_sample_tests/test_floating_ips_bulk.py @@ -24,13 +24,6 @@ class FloatingIpsBulkTest(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-floating-ips-bulk" - def _get_flags(self): - f = super(FloatingIpsBulkTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.floating_ips_bulk.Floating_ips_bulk') - return f - def setUp(self): super(FloatingIpsBulkTest, self).setUp() pool = CONF.default_floating_pool diff --git a/nova/tests/functional/api_sample_tests/test_fping.py b/nova/tests/functional/api_sample_tests/test_fping.py index 4e2194f257b3..0547a9d54049 100644 --- a/nova/tests/functional/api_sample_tests/test_fping.py +++ b/nova/tests/functional/api_sample_tests/test_fping.py @@ -13,23 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers from nova.tests.unit.api.openstack.compute import test_fping -CONF = nova.conf.CONF - class FpingSampleJsonTests(test_servers.ServersSampleBase): extension_name = "os-fping" - def _get_flags(self): - f = super(FpingSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.fping.Fping') - return f - def setUp(self): super(FpingSampleJsonTests, self).setUp() diff --git a/nova/tests/functional/api_sample_tests/test_hide_server_addresses.py b/nova/tests/functional/api_sample_tests/test_hide_server_addresses.py index 56ef0932d442..a1eedbb5315e 100644 --- a/nova/tests/functional/api_sample_tests/test_hide_server_addresses.py +++ b/nova/tests/functional/api_sample_tests/test_hide_server_addresses.py @@ -27,13 +27,6 @@ class ServersSampleHideAddressesJsonTest(test_servers.ServersSampleJsonTest): # to the extension name sample_dir = extension_name - def _get_flags(self): - f = super(ServersSampleHideAddressesJsonTest, self)._get_flags() - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.hide_server_addresses.' - 'Hide_server_addresses') - return f - def setUp(self): # We override osapi_hide_server_address_states in order # to have an example of in the json samples of the diff --git a/nova/tests/functional/api_sample_tests/test_hosts.py b/nova/tests/functional/api_sample_tests/test_hosts.py index 294b0c0b8acc..2391476c779c 100644 --- a/nova/tests/functional/api_sample_tests/test_hosts.py +++ b/nova/tests/functional/api_sample_tests/test_hosts.py @@ -13,23 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class HostsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-hosts" - def _get_flags(self): - f = super(HostsSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.hosts.Hosts') - return f - def test_host_startup(self): response = self._do_get('os-hosts/%s/startup' % self.compute.host) self._verify_response('host-get-startup', {}, response, 200) diff --git a/nova/tests/functional/api_sample_tests/test_hypervisors.py b/nova/tests/functional/api_sample_tests/test_hypervisors.py index 7a7d4554ee13..9626a69bde17 100644 --- a/nova/tests/functional/api_sample_tests/test_hypervisors.py +++ b/nova/tests/functional/api_sample_tests/test_hypervisors.py @@ -16,30 +16,14 @@ import mock from nova.cells import utils as cells_utils -import nova.conf from nova import objects from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class HypervisorsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-hypervisors" - def _get_flags(self): - f = super(HypervisorsSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.hypervisors.Hypervisors') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_hypervisors.' - 'Extended_hypervisors') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.hypervisor_status.' - 'Hypervisor_status') - return f - def test_hypervisors_list(self): response = self._do_get('os-hypervisors') self._verify_response('hypervisors-list-resp', {}, response, 200) @@ -112,16 +96,6 @@ class HypervisorsCellsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-hypervisors" - def _get_flags(self): - f = super(HypervisorsCellsSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.hypervisors.Hypervisors') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.hypervisor_status.' - 'Hypervisor_status') - return f - def setUp(self): self.flags(enable=True, cell_type='api', group='cells') super(HypervisorsCellsSampleJsonTests, self).setUp() diff --git a/nova/tests/functional/api_sample_tests/test_instance_actions.py b/nova/tests/functional/api_sample_tests/test_instance_actions.py index eda2dc5a98a6..4a59a15dc3ae 100644 --- a/nova/tests/functional/api_sample_tests/test_instance_actions.py +++ b/nova/tests/functional/api_sample_tests/test_instance_actions.py @@ -17,27 +17,17 @@ import copy import six -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.unit import fake_instance from nova.tests.unit import fake_server_actions from nova.tests.unit import utils as test_utils -CONF = nova.conf.CONF - class ServerActionsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): microversion = None ADMIN_API = True extension_name = 'os-instance-actions' - def _get_flags(self): - f = super(ServerActionsSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.instance_actions.Instance_actions') - return f - def setUp(self): super(ServerActionsSampleJsonTest, self).setUp() self.api.microversion = self.microversion diff --git a/nova/tests/functional/api_sample_tests/test_instance_usage_audit_log.py b/nova/tests/functional/api_sample_tests/test_instance_usage_audit_log.py index ef00558caaf6..08014b39565e 100644 --- a/nova/tests/functional/api_sample_tests/test_instance_usage_audit_log.py +++ b/nova/tests/functional/api_sample_tests/test_instance_usage_audit_log.py @@ -15,24 +15,13 @@ from six.moves import urllib -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class InstanceUsageAuditLogJsonTest(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-instance-usage-audit-log" - def _get_flags(self): - f = super(InstanceUsageAuditLogJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.instance_usage_audit_log.' - 'Instance_usage_audit_log') - return f - def test_show_instance_usage_audit_log(self): response = self._do_get('os-instance_usage_audit_log/%s' % urllib.parse.quote('2012-07-05 10:00:00')) diff --git a/nova/tests/functional/api_sample_tests/test_keypairs.py b/nova/tests/functional/api_sample_tests/test_keypairs.py index c2d549e4dad4..50bc9931abf7 100644 --- a/nova/tests/functional/api_sample_tests/test_keypairs.py +++ b/nova/tests/functional/api_sample_tests/test_keypairs.py @@ -15,13 +15,10 @@ import uuid -import nova.conf from nova.objects import keypair as keypair_obj from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.unit import fake_crypto -CONF = nova.conf.CONF - class KeyPairsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): microversion = None @@ -29,13 +26,6 @@ class KeyPairsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): expected_delete_status_code = 202 expected_post_status_code = 200 - def _get_flags(self): - f = super(KeyPairsSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.keypairs.Keypairs') - return f - def setUp(self): super(KeyPairsSampleJsonTest, self).setUp() self.api.microversion = self.microversion diff --git a/nova/tests/functional/api_sample_tests/test_limits.py b/nova/tests/functional/api_sample_tests/test_limits.py index 5d6064da78a2..5d92cf75d61f 100644 --- a/nova/tests/functional/api_sample_tests/test_limits.py +++ b/nova/tests/functional/api_sample_tests/test_limits.py @@ -13,11 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class LimitsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True @@ -29,11 +26,6 @@ class LimitsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): # and V2.1 as the response are different. self.template = 'limit-get-resp' - def _get_flags(self): - f = super(LimitsSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - return f - def test_limits_get(self): response = self._do_get('limits') self._verify_response(self.template, {}, response, 200) diff --git a/nova/tests/functional/api_sample_tests/test_lock_server.py b/nova/tests/functional/api_sample_tests/test_lock_server.py index bcfdf06b4f36..d555bed17abc 100644 --- a/nova/tests/functional/api_sample_tests/test_lock_server.py +++ b/nova/tests/functional/api_sample_tests/test_lock_server.py @@ -13,22 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class LockServerSamplesJsonTest(test_servers.ServersSampleBase): extension_name = "os-lock-server" - def _get_flags(self): - f = super(LockServerSamplesJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.admin_actions.Admin_actions') - return f - def setUp(self): """setUp Method for LockServer api samples extension diff --git a/nova/tests/functional/api_sample_tests/test_migrate_server.py b/nova/tests/functional/api_sample_tests/test_migrate_server.py index 512ad7061d2a..2da38bfe96b3 100644 --- a/nova/tests/functional/api_sample_tests/test_migrate_server.py +++ b/nova/tests/functional/api_sample_tests/test_migrate_server.py @@ -16,24 +16,13 @@ import mock from oslo_utils import versionutils -import nova.conf from nova import objects from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class MigrateServerSamplesJsonTest(test_servers.ServersSampleBase): extension_name = "os-migrate-server" - def _get_flags(self): - f = super(MigrateServerSamplesJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.admin_actions.' - 'Admin_actions') - return f - def setUp(self): """setUp Method for MigrateServer api samples extension diff --git a/nova/tests/functional/api_sample_tests/test_migrations.py b/nova/tests/functional/api_sample_tests/test_migrations.py index edaf31775c9e..5d111610d544 100644 --- a/nova/tests/functional/api_sample_tests/test_migrations.py +++ b/nova/tests/functional/api_sample_tests/test_migrations.py @@ -15,13 +15,10 @@ import datetime -import nova.conf from nova import context from nova import objects from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - # NOTE(ShaoHe Feng) here I can not use uuidsentinel, it generate a random # UUID. The uuid in doc/api_samples files is fixed. @@ -75,13 +72,6 @@ class MigrationsSamplesJsonTest(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-migrations" - def _get_flags(self): - f = super(MigrationsSamplesJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.migrations.Migrations') - return f - def setUp(self): super(MigrationsSamplesJsonTest, self).setUp() self.stub_out('nova.compute.api.API.get_migrations', diff --git a/nova/tests/functional/api_sample_tests/test_multinic.py b/nova/tests/functional/api_sample_tests/test_multinic.py index 6d9e1bc4827c..ec01ce1976a3 100644 --- a/nova/tests/functional/api_sample_tests/test_multinic.py +++ b/nova/tests/functional/api_sample_tests/test_multinic.py @@ -13,23 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class MultinicSampleJsonTest(test_servers.ServersSampleBase): ADMIN_API = True extension_name = "os-multinic" - def _get_flags(self): - f = super(MultinicSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.multinic.Multinic') - return f - def _disable_instance_dns_manager(self): # NOTE(markmc): it looks like multinic and instance_dns_manager are # incompatible. See: diff --git a/nova/tests/functional/api_sample_tests/test_multiple_create.py b/nova/tests/functional/api_sample_tests/test_multiple_create.py index 86aeef38fb9b..344914b04f70 100644 --- a/nova/tests/functional/api_sample_tests/test_multiple_create.py +++ b/nova/tests/functional/api_sample_tests/test_multiple_create.py @@ -13,24 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers from nova.tests.unit.image import fake -CONF = nova.conf.CONF - class MultipleCreateJsonTest(test_servers.ServersSampleBase): extension_name = "os-multiple-create" - def _get_flags(self): - f = super(MultipleCreateJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.multiple_create.' - 'Multiple_create') - return f - def test_multiple_create(self): subs = { 'image_id': fake.get_valid_image_id(), diff --git a/nova/tests/functional/api_sample_tests/test_networks.py b/nova/tests/functional/api_sample_tests/test_networks.py index aa87ac56d847..71d92bdc3d50 100644 --- a/nova/tests/functional/api_sample_tests/test_networks.py +++ b/nova/tests/functional/api_sample_tests/test_networks.py @@ -13,12 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.unit.api.openstack.compute import test_networks -CONF = nova.conf.CONF - def _fixtures_passthrough(method_name): # This compensates for how fixtures 3.x handles the signatures of @@ -43,15 +40,6 @@ class NetworksJsonTests(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-networks" - def _get_flags(self): - f = super(NetworksJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.os_networks.Os_networks') - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.extended_networks.Extended_networks') - return f - def setUp(self): super(NetworksJsonTests, self).setUp() self.stub_out("nova.network.api.API.get_all", diff --git a/nova/tests/functional/api_sample_tests/test_networks_associate.py b/nova/tests/functional/api_sample_tests/test_networks_associate.py index 7723203bd7b9..d34d13222b3f 100644 --- a/nova/tests/functional/api_sample_tests/test_networks_associate.py +++ b/nova/tests/functional/api_sample_tests/test_networks_associate.py @@ -13,11 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class NetworksAssociateJsonTests(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True @@ -26,17 +23,6 @@ class NetworksAssociateJsonTests(api_sample_base.ApiSampleTestBaseV21): _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') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.networks_associate.' - 'Networks_associate') - return f - def setUp(self): super(NetworksAssociateJsonTests, self).setUp() diff --git a/nova/tests/functional/api_sample_tests/test_pause_server.py b/nova/tests/functional/api_sample_tests/test_pause_server.py index dc973bc8898c..2fbe995dd7b2 100644 --- a/nova/tests/functional/api_sample_tests/test_pause_server.py +++ b/nova/tests/functional/api_sample_tests/test_pause_server.py @@ -13,22 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class PauseServerSamplesJsonTest(test_servers.ServersSampleBase): extension_name = "os-pause-server" - def _get_flags(self): - f = super(PauseServerSamplesJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.admin_actions.Admin_actions') - return f - def setUp(self): """setUp Method for PauseServer api samples extension diff --git a/nova/tests/functional/api_sample_tests/test_preserve_ephemeral_rebuild.py b/nova/tests/functional/api_sample_tests/test_preserve_ephemeral_rebuild.py index 9cbfc9ec9a09..5adb915470b1 100644 --- a/nova/tests/functional/api_sample_tests/test_preserve_ephemeral_rebuild.py +++ b/nova/tests/functional/api_sample_tests/test_preserve_ephemeral_rebuild.py @@ -13,24 +13,13 @@ # under the License. from nova.compute import api as compute_api -import nova.conf from nova.tests.functional.api_sample_tests import test_servers from nova.tests.unit.image import fake -CONF = nova.conf.CONF - class PreserveEphemeralOnRebuildJsonTest(test_servers.ServersSampleBase): extension_name = 'os-preserve-ephemeral-rebuild' - def _get_flags(self): - f = super(PreserveEphemeralOnRebuildJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.preserve_ephemeral_rebuild.' - 'Preserve_ephemeral_rebuild') - return f - def _test_server_rebuild_preserve_ephemeral(self, value, resp_tpl=None): uuid = self._post_server() image = fake.get_valid_image_id() diff --git a/nova/tests/functional/api_sample_tests/test_quota_classes.py b/nova/tests/functional/api_sample_tests/test_quota_classes.py index 0b33aac415a7..8b65839218b9 100644 --- a/nova/tests/functional/api_sample_tests/test_quota_classes.py +++ b/nova/tests/functional/api_sample_tests/test_quota_classes.py @@ -13,25 +13,14 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class QuotaClassesSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-quota-class-sets" set_id = 'test_class' - def _get_flags(self): - f = super(QuotaClassesSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.quota_classes.' - 'Quota_classes') - return f - def test_show_quota_classes(self): # Get api sample to show quota classes. response = self._do_get('os-quota-class-sets/%s' % self.set_id) diff --git a/nova/tests/functional/api_sample_tests/test_quota_sets.py b/nova/tests/functional/api_sample_tests/test_quota_sets.py index 3b6c5aa7c57e..5f274a264204 100644 --- a/nova/tests/functional/api_sample_tests/test_quota_sets.py +++ b/nova/tests/functional/api_sample_tests/test_quota_sets.py @@ -13,30 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class QuotaSetsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-quota-sets" - def _get_flags(self): - f = super(QuotaSetsSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.server_group_quotas.' - 'Server_group_quotas') - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.quotas.Quotas') - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.extended_quotas.Extended_quotas') - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.user_quotas.User_quotas') - return f - def test_show_quotas(self): # Get api sample to show quotas. response = self._do_get('os-quota-sets/fake_tenant') diff --git a/nova/tests/functional/api_sample_tests/test_remote_consoles.py b/nova/tests/functional/api_sample_tests/test_remote_consoles.py index 7def88f2e185..cfb206aad62a 100644 --- a/nova/tests/functional/api_sample_tests/test_remote_consoles.py +++ b/nova/tests/functional/api_sample_tests/test_remote_consoles.py @@ -13,23 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class ConsolesSampleJsonTests(test_servers.ServersSampleBase): microversion = None extension_name = "os-remote-consoles" - def _get_flags(self): - f = super(ConsolesSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.consoles.Consoles') - return f - def setUp(self): super(ConsolesSampleJsonTests, self).setUp() self.api.microversion = self.microversion diff --git a/nova/tests/functional/api_sample_tests/test_rescue.py b/nova/tests/functional/api_sample_tests/test_rescue.py index 1b422f808405..5e046626ac13 100644 --- a/nova/tests/functional/api_sample_tests/test_rescue.py +++ b/nova/tests/functional/api_sample_tests/test_rescue.py @@ -13,32 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class RescueJsonTest(test_servers.ServersSampleBase): extension_name = "os-rescue" - def _get_flags(self): - f = super(RescueJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.rescue.Rescue') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_rescue_with_image.' - 'Extended_rescue_with_image') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.keypairs.Keypairs') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips.Extended_ips') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips_mac.' - 'Extended_ips_mac') - return f - def _rescue(self, uuid): req_subs = { 'password': 'MySecretPass' diff --git a/nova/tests/functional/api_sample_tests/test_scheduler_hints.py b/nova/tests/functional/api_sample_tests/test_scheduler_hints.py index e41229b2a1e1..bdf731ccd6b0 100644 --- a/nova/tests/functional/api_sample_tests/test_scheduler_hints.py +++ b/nova/tests/functional/api_sample_tests/test_scheduler_hints.py @@ -15,24 +15,13 @@ import uuid -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.unit.image import fake -CONF = nova.conf.CONF - class SchedulerHintsJsonTest(api_sample_base.ApiSampleTestBaseV21): extension_name = "os-scheduler-hints" - def _get_flags(self): - f = super(SchedulerHintsJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - "nova.api.openstack.compute.contrib.scheduler_hints." - "Scheduler_hints") - return f - def test_scheduler_hints_post(self): # Get api sample of scheduler hint post request. subs = {'image_id': fake.get_valid_image_id(), diff --git a/nova/tests/functional/api_sample_tests/test_security_group_default_rules.py b/nova/tests/functional/api_sample_tests/test_security_group_default_rules.py index 413f30b806c3..bac663ac84b1 100644 --- a/nova/tests/functional/api_sample_tests/test_security_group_default_rules.py +++ b/nova/tests/functional/api_sample_tests/test_security_group_default_rules.py @@ -12,25 +12,14 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class SecurityGroupDefaultRulesSampleJsonTest( api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = 'os-security-group-default-rules' - def _get_flags(self): - f = super(SecurityGroupDefaultRulesSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.security_group_default_rules.' - 'Security_group_default_rules') - return f - def test_security_group_default_rules_create(self): response = self._do_post('os-security-group-default-rules', 'security-group-default-rules-create-req', diff --git a/nova/tests/functional/api_sample_tests/test_security_groups.py b/nova/tests/functional/api_sample_tests/test_security_groups.py index 614375ff3e3c..d5cd26927cda 100644 --- a/nova/tests/functional/api_sample_tests/test_security_groups.py +++ b/nova/tests/functional/api_sample_tests/test_security_groups.py @@ -13,12 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers import nova.tests.functional.api_samples_test_base as astb -CONF = nova.conf.CONF - def fake_get(*args, **kwargs): nova_group = {} @@ -63,21 +60,6 @@ def fake_create_security_group(self, context, name, description): class SecurityGroupsJsonTest(test_servers.ServersSampleBase): extension_name = 'os-security-groups' - def _get_flags(self): - f = super(SecurityGroupsJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.security_groups.' - 'Security_groups') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.keypairs.Keypairs') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips.Extended_ips') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips_mac.' - 'Extended_ips_mac') - return f - def setUp(self): self.flags(security_group_api=('neutron')) super(SecurityGroupsJsonTest, self).setUp() diff --git a/nova/tests/functional/api_sample_tests/test_server_diagnostics.py b/nova/tests/functional/api_sample_tests/test_server_diagnostics.py index ebf10c4ff1a3..16a211ad167b 100644 --- a/nova/tests/functional/api_sample_tests/test_server_diagnostics.py +++ b/nova/tests/functional/api_sample_tests/test_server_diagnostics.py @@ -13,23 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class ServerDiagnosticsSamplesJsonTest(test_servers.ServersSampleBase): extension_name = "os-server-diagnostics" - def _get_flags(self): - f = super(ServerDiagnosticsSamplesJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.server_diagnostics.' - 'Server_diagnostics') - return f - def test_server_diagnostics_get(self): uuid = self._post_server() response = self._do_get('servers/%s/diagnostics' % uuid) diff --git a/nova/tests/functional/api_sample_tests/test_server_external_events.py b/nova/tests/functional/api_sample_tests/test_server_external_events.py index 2c4a9a130879..af5dd5c52879 100644 --- a/nova/tests/functional/api_sample_tests/test_server_external_events.py +++ b/nova/tests/functional/api_sample_tests/test_server_external_events.py @@ -12,24 +12,13 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class ServerExternalEventsSamplesJsonTest(test_servers.ServersSampleBase): ADMIN_API = True extension_name = "os-server-external-events" - def _get_flags(self): - f = super(ServerExternalEventsSamplesJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.server_external_events.' - 'Server_external_events') - return f - def setUp(self): """setUp Method for AdminActions api samples extension diff --git a/nova/tests/functional/api_sample_tests/test_server_groups.py b/nova/tests/functional/api_sample_tests/test_server_groups.py index 50c668e2d802..fbbbec6e4005 100644 --- a/nova/tests/functional/api_sample_tests/test_server_groups.py +++ b/nova/tests/functional/api_sample_tests/test_server_groups.py @@ -13,22 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base -CONF = nova.conf.CONF - class ServerGroupsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): extension_name = "os-server-groups" - def _get_flags(self): - f = super(ServerGroupsSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.server_groups.Server_groups') - return f - def _get_create_subs(self): return {'name': 'test'} diff --git a/nova/tests/functional/api_sample_tests/test_server_password.py b/nova/tests/functional/api_sample_tests/test_server_password.py index 5dd201a87f0f..e21aacc0eca6 100644 --- a/nova/tests/functional/api_sample_tests/test_server_password.py +++ b/nova/tests/functional/api_sample_tests/test_server_password.py @@ -14,23 +14,12 @@ import mock -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class ServerPasswordSampleJsonTests(test_servers.ServersSampleBase): extension_name = "os-server-password" - def _get_flags(self): - f = super(ServerPasswordSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.server_password.' - 'Server_password') - return f - @mock.patch("nova.api.metadata.password.extract_password") def test_get_password(self, mock_extract_password): password = ("xlozO3wLCBRWAa2yDjCCVx8vwNPypxnypmRYDa/zErlQ+EzPe1S/" diff --git a/nova/tests/functional/api_sample_tests/test_server_usage.py b/nova/tests/functional/api_sample_tests/test_server_usage.py index a1d75170748b..daad7c501d45 100644 --- a/nova/tests/functional/api_sample_tests/test_server_usage.py +++ b/nova/tests/functional/api_sample_tests/test_server_usage.py @@ -13,29 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class ServerUsageSampleJsonTest(test_servers.ServersSampleBase): extension_name = 'os-server-usage' - def _get_flags(self): - f = super(ServerUsageSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.server_usage.Server_usage') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.keypairs.Keypairs') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips.Extended_ips') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips_mac.' - 'Extended_ips_mac') - return f - def setUp(self): """setUp method for server usage.""" super(ServerUsageSampleJsonTest, self).setUp() diff --git a/nova/tests/functional/api_sample_tests/test_servers.py b/nova/tests/functional/api_sample_tests/test_servers.py index 16f9fc1c78f8..fe07c4c353a3 100644 --- a/nova/tests/functional/api_sample_tests/test_servers.py +++ b/nova/tests/functional/api_sample_tests/test_servers.py @@ -13,12 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.unit.image import fake -CONF = nova.conf.CONF - class ServersSampleBase(api_sample_base.ApiSampleTestBaseV21): extra_extensions_to_load = ["os-access-ips"] @@ -71,18 +68,6 @@ class ServersSampleJsonTest(ServersSampleBase): sample_dir = 'servers' microversion = None - def _get_flags(self): - f = super(ServersSampleBase, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.keypairs.Keypairs') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips.Extended_ips') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.extended_ips_mac.' - 'Extended_ips_mac') - return f - def test_servers_post(self): return self._post_server() @@ -167,14 +152,6 @@ class ServersUpdateSampleJsonTest(ServersSampleBase): class ServerSortKeysJsonTests(ServersSampleBase): sample_dir = 'servers-sort' - def _get_flags(self): - f = super(ServerSortKeysJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.server_sort_keys.' - 'Server_sort_keys') - return f - def test_servers_list(self): self._post_server() response = self._do_get('servers?sort_key=display_name&sort_dir=asc') @@ -294,14 +271,6 @@ class ServersActionsAllJsonTest(ServersActionsJsonTest): class ServerStartStopJsonTest(ServersSampleBase): sample_dir = 'servers' - def _get_flags(self): - f = super(ServerStartStopJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.server_start_stop.' - 'Server_start_stop') - return f - def _test_server_action(self, uuid, action, req_tpl): response = self._do_post('servers/%s/action' % uuid, req_tpl, @@ -323,11 +292,6 @@ class ServersSampleMultiStatusJsonTest(ServersSampleBase): sample_dir = 'servers' extra_extensions_to_load = ["os-access-ips"] - def _get_flags(self): - f = super(ServersSampleMultiStatusJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - return f - def test_servers_list(self): uuid = self._post_server() response = self._do_get('servers?status=active&status=error') diff --git a/nova/tests/functional/api_sample_tests/test_services.py b/nova/tests/functional/api_sample_tests/test_services.py index 0603aca19fab..1d714b33d69a 100644 --- a/nova/tests/functional/api_sample_tests/test_services.py +++ b/nova/tests/functional/api_sample_tests/test_services.py @@ -15,31 +15,15 @@ from oslo_utils import fixture as utils_fixture -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.unit.api.openstack.compute import test_services -CONF = nova.conf.CONF - - class ServicesJsonTest(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-services" microversion = None - def _get_flags(self): - f = super(ServicesJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.services.Services') - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.extended_services_delete.' - 'Extended_services_delete') - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.extended_services.Extended_services') - return f - def setUp(self): super(ServicesJsonTest, self).setUp() self.api.microversion = self.microversion diff --git a/nova/tests/functional/api_sample_tests/test_shelve.py b/nova/tests/functional/api_sample_tests/test_shelve.py index 7ec20d9f891d..6a5ee1413ec2 100644 --- a/nova/tests/functional/api_sample_tests/test_shelve.py +++ b/nova/tests/functional/api_sample_tests/test_shelve.py @@ -23,13 +23,6 @@ CONF = nova.conf.CONF class ShelveJsonTest(test_servers.ServersSampleBase): extension_name = "os-shelve" - def _get_flags(self): - f = super(ShelveJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.shelve.Shelve') - return f - def setUp(self): super(ShelveJsonTest, self).setUp() # Don't offload instance, so we can test the offload call. diff --git a/nova/tests/functional/api_sample_tests/test_simple_tenant_usage.py b/nova/tests/functional/api_sample_tests/test_simple_tenant_usage.py index 93e109d556ca..521e172a1c08 100644 --- a/nova/tests/functional/api_sample_tests/test_simple_tenant_usage.py +++ b/nova/tests/functional/api_sample_tests/test_simple_tenant_usage.py @@ -17,24 +17,13 @@ import urllib from oslo_utils import timeutils -import nova.conf from nova.tests.functional.api_sample_tests import test_servers import nova.tests.functional.api_samples_test_base as astb -CONF = nova.conf.CONF - class SimpleTenantUsageSampleJsonTest(test_servers.ServersSampleBase): extension_name = "os-simple-tenant-usage" - def _get_flags(self): - f = super(SimpleTenantUsageSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.simple_tenant_usage.' - 'Simple_tenant_usage') - return f - def setUp(self): """setUp method for simple tenant usage.""" super(SimpleTenantUsageSampleJsonTest, self).setUp() diff --git a/nova/tests/functional/api_sample_tests/test_suspend_server.py b/nova/tests/functional/api_sample_tests/test_suspend_server.py index 587fea4600f7..e28066072b97 100644 --- a/nova/tests/functional/api_sample_tests/test_suspend_server.py +++ b/nova/tests/functional/api_sample_tests/test_suspend_server.py @@ -12,22 +12,12 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class SuspendServerSamplesJsonTest(test_servers.ServersSampleBase): extension_name = "os-suspend-server" - def _get_flags(self): - f = super(SuspendServerSamplesJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.admin_actions.Admin_actions') - return f - def setUp(self): """setUp Method for SuspendServer api samples extension diff --git a/nova/tests/functional/api_sample_tests/test_tenant_networks.py b/nova/tests/functional/api_sample_tests/test_tenant_networks.py index 7092f190fb0a..035fe3057c5e 100644 --- a/nova/tests/functional/api_sample_tests/test_tenant_networks.py +++ b/nova/tests/functional/api_sample_tests/test_tenant_networks.py @@ -26,13 +26,6 @@ class TenantNetworksJsonTests(api_sample_base.ApiSampleTestBaseV21): ADMIN_API = True extension_name = "os-tenant-networks" - def _get_flags(self): - f = super(TenantNetworksJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append('nova.api.openstack.compute.' - 'contrib.os_tenant_networks.Os_tenant_networks') - return f - def setUp(self): super(TenantNetworksJsonTests, self).setUp() CONF.set_override("enable_network_quota", True) diff --git a/nova/tests/functional/api_sample_tests/test_user_data.py b/nova/tests/functional/api_sample_tests/test_user_data.py index 7efed3c53b59..3f9728662561 100644 --- a/nova/tests/functional/api_sample_tests/test_user_data.py +++ b/nova/tests/functional/api_sample_tests/test_user_data.py @@ -15,23 +15,13 @@ import base64 -import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.unit.image import fake -CONF = nova.conf.CONF - class UserDataJsonTest(api_sample_base.ApiSampleTestBaseV21): extension_name = "os-user-data" - def _get_flags(self): - f = super(UserDataJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.user_data.User_data') - return f - 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) diff --git a/nova/tests/functional/api_sample_tests/test_virtual_interfaces.py b/nova/tests/functional/api_sample_tests/test_virtual_interfaces.py index d2de3450e624..a4b1858dd6e4 100644 --- a/nova/tests/functional/api_sample_tests/test_virtual_interfaces.py +++ b/nova/tests/functional/api_sample_tests/test_virtual_interfaces.py @@ -13,11 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import nova.conf from nova.tests.functional.api_sample_tests import test_servers -CONF = nova.conf.CONF - class VirtualInterfacesJsonTest(test_servers.ServersSampleBase): extension_name = "os-virtual-interfaces" @@ -28,11 +25,6 @@ class VirtualInterfacesJsonTest(test_servers.ServersSampleBase): if self.api_major_version == 'v2': self.template = 'vifs-list-resp-v2' - def _get_flags(self): - f = super(VirtualInterfacesJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - return f - def test_vifs_list(self): uuid = self._post_server() diff --git a/nova/tests/functional/api_sample_tests/test_volumes.py b/nova/tests/functional/api_sample_tests/test_volumes.py index 05fd6530c1d0..79bedca18ba9 100644 --- a/nova/tests/functional/api_sample_tests/test_volumes.py +++ b/nova/tests/functional/api_sample_tests/test_volumes.py @@ -15,7 +15,6 @@ import datetime -import nova.conf from nova import context from nova import objects from nova.tests.functional.api_sample_tests import api_sample_base @@ -24,8 +23,6 @@ from nova.tests.unit.api.openstack import fakes from nova.tests.unit import fake_block_device from nova.tests.unit import fake_instance -CONF = nova.conf.CONF - class SnapshotsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): extension_name = "os-volumes" @@ -36,13 +33,6 @@ class SnapshotsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): 'volume_id': '521752a6-acf6-4b2d-bc7a-119f9148cd8c' } - def _get_flags(self): - f = super(SnapshotsSampleJsonTests, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.volumes.Volumes') - return f - def setUp(self): super(SnapshotsSampleJsonTests, self).setUp() self.stub_out("nova.volume.cinder.API.get_all_snapshots", @@ -142,13 +132,6 @@ def _stub_volume_create(stub_self, context, size, name, description, class VolumesSampleJsonTest(test_servers.ServersSampleBase): extension_name = "os-volumes" - def _get_flags(self): - f = super(VolumesSampleJsonTest, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.volumes.Volumes') - return f - def setUp(self): super(VolumesSampleJsonTest, self).setUp() fakes.stub_out_networking(self) @@ -243,16 +226,6 @@ class VolumeAttachmentsSample(test_servers.ServersSampleBase): self.stub_out('nova.compute.api.API.get', fake_compute_api_get) - def _get_flags(self): - f = super(VolumeAttachmentsSample, self)._get_flags() - f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.volumes.Volumes') - f['osapi_compute_extension'].append( - 'nova.api.openstack.compute.contrib.' - 'volume_attachment_update.Volume_attachment_update') - return f - def test_attach_volume_to_server(self): self.stub_out('nova.volume.cinder.API.get', fakes.stub_volume_get) self.stub_out('nova.volume.cinder.API.check_attach',