def test_update_network_quota_enabled(self): self.flags(enable_network_quota=True) self.useFixture(nova_fixtures.RegisterNetworkQuota()) self.controller.update(self._get_http_request(), 1234, body={'quota_set': { 'networks': 1 }})
def setUp(self): self.flags(use_ipv6=False) self.flags(glance_link_prefix=self._get_glance_host(), compute_link_prefix=self._get_host(), group='api') # load any additional fixtures specified by the scenario for fix in self._additional_fixtures: self.useFixture(fix()) if not self.SUPPORTS_CELLS: # NOTE(danms): Disable base automatic DB (and cells) config self.USES_DB = False self.USES_DB_SELF = True # This is to enable the network quota which is being registered # based on CONF.enable_network_quota. Need this to test the # network quota in quota sample tests. self.flags(enable_network_quota=True) self.useFixture(fixtures.RegisterNetworkQuota()) # super class call is delayed here so that we have the right # paste and conf before loading all the services, as we can't # change these later. super(ApiSampleTestBaseV21, self).setUp() if not self.SUPPORTS_CELLS: self.useFixture(fixtures.Database()) self.useFixture(fixtures.Database(database='api')) self.useFixture(fixtures.DefaultFlavorsFixture()) self.useFixture(fixtures.SingleCellSimple()) super(ApiSampleTestBaseV21, self)._setup_services() if not self.USE_NEUTRON: # self.network is only setup if USE_NEUTRON=False self.useFixture(test.SampleNetworks(host=self.network.host)) fake_network.stub_compute_with_ips(self) self.useFixture(fixtures.SpawnIsSynchronousFixture()) # this is used to generate sample docs self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None # NOTE(mikal): this is used to stub away privsep helpers def fake_noop(*args, **kwargs): return '', '' self.stub_out('nova.privsep.linux_net.add_bridge', fake_noop) self.stub_out('nova.privsep.linux_net.set_device_mtu', fake_noop) self.stub_out('nova.privsep.linux_net.set_device_enabled', fake_noop) self.stub_out('nova.privsep.linux_net.set_device_macaddr', fake_noop) self.stub_out('nova.privsep.linux_net.routes_show', fake_noop) self.stub_out('nova.privsep.linux_net.lookup_ip', fake_noop) self.stub_out('nova.privsep.linux_net.change_ip', fake_noop) self.stub_out('nova.privsep.linux_net.address_command_deprecated', fake_noop) if self.availability_zones: self.useFixture( fixtures.AvailabilityZoneFixture(self.availability_zones))
def setUp(self): super(TenantNetworksTestV21, self).setUp() # os-tenant-networks only supports Neutron when listing networks or # showing details about a network, create and delete operations # result in a 503 and 500 response, respectively. self.flags(enable_network_quota=True, use_neutron=self.use_neutron) self.useFixture(nova_fixtures.RegisterNetworkQuota()) self.controller = self.ctrlr() self.req = fakes.HTTPRequest.blank('') self.original_value = CONF.api.use_neutron_default_nets
def setUp(self): super(TenantNetworksJsonTests, self).setUp() CONF.set_override("enable_network_quota", True) self.useFixture(nova_fixtures.RegisterNetworkQuota()) def fake(*args, **kwargs): pass self.stub_out("nova.quota.QUOTAS.reserve", fake) self.stub_out("nova.quota.QUOTAS.commit", fake) self.stub_out("nova.quota.QUOTAS.rollback", fake) self.stub_out("nova.quota.QuotaEngine.reserve", fake) self.stub_out("nova.quota.QuotaEngine.commit", fake) self.stub_out("nova.quota.QuotaEngine.rollback", fake)
def setUp(self): super(QuotaSetsTestV236, self).setUp() # We need to stub out verify_project_id so that it doesn't # generate an EndpointNotFound exception and result in a # server error. self.stub_out('nova.api.openstack.identity.verify_project_id', lambda ctx, project_id: True) self.flags(enable_network_quota=True) self.useFixture(nova_fixtures.RegisterNetworkQuota()) self.old_req = fakes.HTTPRequest.blank('', version='2.1') self.filtered_quotas = ['fixed_ips', 'floating_ips', 'networks', 'security_group_rules', 'security_groups'] self.quotas = { 'cores': {'limit': 20}, 'fixed_ips': {'limit': -1}, 'floating_ips': {'limit': 10}, 'injected_file_content_bytes': {'limit': 10240}, 'injected_file_path_bytes': {'limit': 255}, 'injected_files': {'limit': 5}, 'instances': {'limit': 10}, 'key_pairs': {'limit': 100}, 'metadata_items': {'limit': 128}, 'networks': {'limit': 3}, 'ram': {'limit': 51200}, 'security_group_rules': {'limit': 20}, 'security_groups': {'limit': 10}, 'server_group_members': {'limit': 10}, 'server_groups': {'limit': 10} } self.defaults = { 'cores': 20, 'fixed_ips': -1, 'floating_ips': 10, 'injected_file_content_bytes': 10240, 'injected_file_path_bytes': 255, 'injected_files': 5, 'instances': 10, 'key_pairs': 100, 'metadata_items': 128, 'networks': 3, 'ram': 51200, 'security_group_rules': 20, 'security_groups': 10, 'server_group_members': 10, 'server_groups': 10 } self.controller = quotas_v21.QuotaSetsController() self.req = fakes.HTTPRequest.blank('', version=self.microversion)
def setUp(self): self.flags(use_ipv6=False) self.flags(glance_link_prefix=self._get_glance_host(), compute_link_prefix=self._get_host(), group='api') # load any additional fixtures specified by the scenario for fix in self._additional_fixtures: self.useFixture(fix()) if not self.SUPPORTS_CELLS: # NOTE(danms): Disable base automatic DB (and cells) config self.USES_DB = False self.USES_DB_SELF = True # This is to enable the network quota which is being registered # based on CONF.enable_network_quota. Need this to test the # network quota in quota sample tests. self.flags(enable_network_quota=True) self.useFixture(fixtures.RegisterNetworkQuota()) # super class call is delayed here so that we have the right # paste and conf before loading all the services, as we can't # change these later. super(ApiSampleTestBaseV21, self).setUp() if not self.SUPPORTS_CELLS: self.useFixture(fixtures.Database()) self.useFixture(fixtures.Database(database='api')) # FIXME(cdent): Placement db already provided by IntegratedHelpers self.useFixture(fixtures.Database(database='placement')) self.useFixture(fixtures.DefaultFlavorsFixture()) self.useFixture(fixtures.SingleCellSimple()) super(ApiSampleTestBaseV21, self)._setup_services() if not self.USE_NEUTRON: # self.network is only setup if USE_NEUTRON=False self.useFixture(test.SampleNetworks(host=self.network.host)) fake_network.stub_compute_with_ips(self) self.useFixture(fixtures.SpawnIsSynchronousFixture()) # this is used to generate sample docs self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None