Merge "Remove start index 0 in range()"

This commit is contained in:
Jenkins 2013-12-19 22:46:27 +00:00 committed by Gerrit Code Review
commit 37a00518c1
8 changed files with 18 additions and 18 deletions

View File

@ -476,7 +476,7 @@ class NvpSynchronizer():
results, cursor, total_size = nvplib.get_single_query_page(
uri, self._cluster, cursor,
min(page_size, nvplib.MAX_PAGE_SIZE))
for _req in range(0, num_requests - 1):
for _req in range(num_requests - 1):
# If no cursor is returned break the cycle as there is no
# actual need to perform multiple requests (all fetched)
# This happens when the overall size of resources exceeds

View File

@ -350,14 +350,14 @@ class NvpSyncTestCase(base.BaseTestCase):
networks = []
ports = []
routers = []
for i in range(0, net_size):
for i in range(net_size):
net = self._plugin.create_network(ctx, network(i))
networks.append(net)
self._plugin.create_subnet(ctx, subnet(i, net['id']))
for j in range(0, port_size):
for j in range(port_size):
ports.append(self._plugin.create_port(
ctx, port("%s-%s" % (i, j), net['id'])))
for i in range(0, router_size):
for i in range(router_size):
routers.append(self._plugin.create_router(ctx, router(i)))
# Do not return anything as the user does need the actual
# data created
@ -627,7 +627,7 @@ class NvpSyncTestCase(base.BaseTestCase):
NvpApiClient.RequestTimeout)
# chunk size won't matter here
sp = sync.SyncParameters(999)
for i in range(0, 10):
for i in range(10):
self.assertEqual(
min(64, 2 ** i),
self._plugin._synchronizer._synchronize_state(sp))

View File

@ -595,7 +595,7 @@ class TestNvplibLogicalRouters(NvplibTestCase):
def test_get_lrouters(self):
lrouter_uuids = [nvplib.create_lrouter(
self.fake_cluster, 'pippo', 'fake-lrouter-%s' % k,
'10.0.0.1')['uuid'] for k in range(0, 3)]
'10.0.0.1')['uuid'] for k in range(3)]
routers = nvplib.get_lrouters(self.fake_cluster, 'pippo')
for router in routers:
self.assertIn(router['uuid'], lrouter_uuids)
@ -692,7 +692,7 @@ class TestNvplibLogicalRouters(NvplibTestCase):
self.fake_cluster, lrouter['uuid'], 'pippo',
'qp_id_%s' % k, 'port-%s' % k, True,
['192.168.0.%s' % k], '00:11:22:33:44:55')['uuid']
for k in range(0, 3)]
for k in range(3)]
ports = nvplib.query_lrouter_lports(self.fake_cluster, lrouter['uuid'])
self.assertEqual(len(ports), 3)
for res_port in ports:
@ -1403,7 +1403,7 @@ class TestNvplibLogicalPorts(NvplibTestCase):
nvplib.create_lport(
self.fake_cluster, lswitch['uuid'], 'pippo', 'qportid-%s' % k,
'port-%s' % k, 'deviceid-%s' % k, True)['uuid']
for k in range(0, 2)]
for k in range(2)]
switch_port_uuids.append(lport['uuid'])
ports = nvplib.query_lswitch_lports(self.fake_cluster, lswitch['uuid'])
self.assertEqual(len(ports), 3)

View File

@ -95,7 +95,7 @@ class TestVarmourRouter(base.BaseTestCase):
def _add_internal_ports(self, router, port_count=1):
self._del_all_internal_ports(router)
for i in range(0, port_count):
for i in range(port_count):
port = {'id': _uuid(),
'network_id': _uuid(),
'admin_state_up': True,
@ -114,7 +114,7 @@ class TestVarmourRouter(base.BaseTestCase):
def _add_floating_ips(self, router, port_count=1):
self._del_all_floating_ips(router)
for i in range(0, port_count):
for i in range(port_count):
fip = {'id': _uuid(),
'port_id': router['gw_port']['id'],
'floating_ip_address': '172.24.4.%s' % (100 + i),

View File

@ -103,7 +103,7 @@ class TestBasicRouterOperations(base.BaseTestCase):
def _add_internal_ports(self, router, port_count=1):
self._del_all_internal_ports(router)
for i in range(0, port_count):
for i in range(port_count):
port = {'id': _uuid(),
'network_id': _uuid(),
'admin_state_up': True,
@ -122,7 +122,7 @@ class TestBasicRouterOperations(base.BaseTestCase):
def _add_floating_ips(self, router, port_count=1):
self._del_all_floating_ips(router)
for i in range(0, port_count):
for i in range(port_count):
fip = {'id': _uuid(),
'port_id': router['gw_port']['id'],
'floating_ip_address': '172.24.4.%s' % (100 + i),
@ -154,7 +154,7 @@ class TestBasicRouterOperations(base.BaseTestCase):
def _add_firewall_rules(self, fw, rule_count=1):
rules = []
for i in range(0, rule_count):
for i in range(rule_count):
rule = {'id': _uuid(),
'enabled': True,
'action': 'deny' if (i % 2 == 0) else 'allow',

View File

@ -95,7 +95,7 @@ class TestLoadBalancerCallbacks(TestLoadBalancerPluginBase):
# add 3 pools and 2 vips directly to DB
# to create 2 "ready" devices and one pool without vip
pools = []
for i in xrange(0, 3):
for i in xrange(3):
pools.append(ldb.Pool(id=uuidutils.generate_uuid(),
subnet_id=self._subnet_id,
protocol="HTTP",

View File

@ -266,7 +266,7 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
"""Creates a bulk request for any kind of resource."""
objects = []
collection = "%ss" % resource
for i in range(0, number):
for i in range(number):
obj = copy.deepcopy(data)
obj[resource]['name'] = "%s_%s" % (name, i)
if 'override' in kwargs and i in kwargs['override']:
@ -344,9 +344,9 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
'tenant_id': self._tenant_id}}
# auto-generate cidrs as they should not overlap
overrides = dict((k, v)
for (k, v) in zip(range(0, number),
for (k, v) in zip(range(number),
[{'cidr': "10.0.%s.0/24" % num}
for num in range(0, number)]))
for num in range(number)]))
kwargs.update({'override': overrides})
return self._create_bulk(fmt, number, 'subnet', base_data, **kwargs)

View File

@ -360,7 +360,7 @@ class TestBasicRouterOperations(base.BaseTestCase):
'subnet': {'cidr': '19.4.4.0/24',
'gateway_ip': '19.4.4.1'}}
int_ports = []
for i in range(0, num_internal_ports):
for i in range(num_internal_ports):
int_ports.append({'id': _uuid(),
'network_id': _uuid(),
'admin_state_up': True,