Remove start index 0 in range()
Remove the useless arg ("start index" = 0) in files, since its default value is 0, to make code cleaner. Fixes bug #1259560 Change-Id: Id595630f97b21cc84aefc39b31e7f09f5fb8deb9
This commit is contained in:
parent
028d71fe1c
commit
ffa87b47e9
@ -475,7 +475,7 @@ class NvpSynchronizer():
|
|||||||
results, cursor, total_size = nvplib.get_single_query_page(
|
results, cursor, total_size = nvplib.get_single_query_page(
|
||||||
uri, self._cluster, cursor,
|
uri, self._cluster, cursor,
|
||||||
min(page_size, nvplib.MAX_PAGE_SIZE))
|
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
|
# If no cursor is returned break the cycle as there is no
|
||||||
# actual need to perform multiple requests (all fetched)
|
# actual need to perform multiple requests (all fetched)
|
||||||
# This happens when the overall size of resources exceeds
|
# This happens when the overall size of resources exceeds
|
||||||
|
@ -350,14 +350,14 @@ class NvpSyncTestCase(base.BaseTestCase):
|
|||||||
networks = []
|
networks = []
|
||||||
ports = []
|
ports = []
|
||||||
routers = []
|
routers = []
|
||||||
for i in range(0, net_size):
|
for i in range(net_size):
|
||||||
net = self._plugin.create_network(ctx, network(i))
|
net = self._plugin.create_network(ctx, network(i))
|
||||||
networks.append(net)
|
networks.append(net)
|
||||||
self._plugin.create_subnet(ctx, subnet(i, net['id']))
|
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(
|
ports.append(self._plugin.create_port(
|
||||||
ctx, port("%s-%s" % (i, j), net['id'])))
|
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)))
|
routers.append(self._plugin.create_router(ctx, router(i)))
|
||||||
# Do not return anything as the user does need the actual
|
# Do not return anything as the user does need the actual
|
||||||
# data created
|
# data created
|
||||||
@ -627,7 +627,7 @@ class NvpSyncTestCase(base.BaseTestCase):
|
|||||||
NvpApiClient.RequestTimeout)
|
NvpApiClient.RequestTimeout)
|
||||||
# chunk size won't matter here
|
# chunk size won't matter here
|
||||||
sp = sync.SyncParameters(999)
|
sp = sync.SyncParameters(999)
|
||||||
for i in range(0, 10):
|
for i in range(10):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
min(64, 2 ** i),
|
min(64, 2 ** i),
|
||||||
self._plugin._synchronizer._synchronize_state(sp))
|
self._plugin._synchronizer._synchronize_state(sp))
|
||||||
|
@ -594,7 +594,7 @@ class TestNvplibLogicalRouters(NvplibTestCase):
|
|||||||
def test_get_lrouters(self):
|
def test_get_lrouters(self):
|
||||||
lrouter_uuids = [nvplib.create_lrouter(
|
lrouter_uuids = [nvplib.create_lrouter(
|
||||||
self.fake_cluster, 'pippo', 'fake-lrouter-%s' % k,
|
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')
|
routers = nvplib.get_lrouters(self.fake_cluster, 'pippo')
|
||||||
for router in routers:
|
for router in routers:
|
||||||
self.assertIn(router['uuid'], lrouter_uuids)
|
self.assertIn(router['uuid'], lrouter_uuids)
|
||||||
@ -691,7 +691,7 @@ class TestNvplibLogicalRouters(NvplibTestCase):
|
|||||||
self.fake_cluster, lrouter['uuid'], 'pippo',
|
self.fake_cluster, lrouter['uuid'], 'pippo',
|
||||||
'qp_id_%s' % k, 'port-%s' % k, True,
|
'qp_id_%s' % k, 'port-%s' % k, True,
|
||||||
['192.168.0.%s' % k], '00:11:22:33:44:55')['uuid']
|
['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'])
|
ports = nvplib.query_lrouter_lports(self.fake_cluster, lrouter['uuid'])
|
||||||
self.assertEqual(len(ports), 3)
|
self.assertEqual(len(ports), 3)
|
||||||
for res_port in ports:
|
for res_port in ports:
|
||||||
@ -1402,7 +1402,7 @@ class TestNvplibLogicalPorts(NvplibTestCase):
|
|||||||
nvplib.create_lport(
|
nvplib.create_lport(
|
||||||
self.fake_cluster, lswitch['uuid'], 'pippo', 'qportid-%s' % k,
|
self.fake_cluster, lswitch['uuid'], 'pippo', 'qportid-%s' % k,
|
||||||
'port-%s' % k, 'deviceid-%s' % k, True)['uuid']
|
'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'])
|
switch_port_uuids.append(lport['uuid'])
|
||||||
ports = nvplib.query_lswitch_lports(self.fake_cluster, lswitch['uuid'])
|
ports = nvplib.query_lswitch_lports(self.fake_cluster, lswitch['uuid'])
|
||||||
self.assertEqual(len(ports), 3)
|
self.assertEqual(len(ports), 3)
|
||||||
|
@ -95,7 +95,7 @@ class TestVarmourRouter(base.BaseTestCase):
|
|||||||
|
|
||||||
def _add_internal_ports(self, router, port_count=1):
|
def _add_internal_ports(self, router, port_count=1):
|
||||||
self._del_all_internal_ports(router)
|
self._del_all_internal_ports(router)
|
||||||
for i in range(0, port_count):
|
for i in range(port_count):
|
||||||
port = {'id': _uuid(),
|
port = {'id': _uuid(),
|
||||||
'network_id': _uuid(),
|
'network_id': _uuid(),
|
||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
@ -114,7 +114,7 @@ class TestVarmourRouter(base.BaseTestCase):
|
|||||||
|
|
||||||
def _add_floating_ips(self, router, port_count=1):
|
def _add_floating_ips(self, router, port_count=1):
|
||||||
self._del_all_floating_ips(router)
|
self._del_all_floating_ips(router)
|
||||||
for i in range(0, port_count):
|
for i in range(port_count):
|
||||||
fip = {'id': _uuid(),
|
fip = {'id': _uuid(),
|
||||||
'port_id': router['gw_port']['id'],
|
'port_id': router['gw_port']['id'],
|
||||||
'floating_ip_address': '172.24.4.%s' % (100 + i),
|
'floating_ip_address': '172.24.4.%s' % (100 + i),
|
||||||
|
@ -103,7 +103,7 @@ class TestBasicRouterOperations(base.BaseTestCase):
|
|||||||
|
|
||||||
def _add_internal_ports(self, router, port_count=1):
|
def _add_internal_ports(self, router, port_count=1):
|
||||||
self._del_all_internal_ports(router)
|
self._del_all_internal_ports(router)
|
||||||
for i in range(0, port_count):
|
for i in range(port_count):
|
||||||
port = {'id': _uuid(),
|
port = {'id': _uuid(),
|
||||||
'network_id': _uuid(),
|
'network_id': _uuid(),
|
||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
@ -122,7 +122,7 @@ class TestBasicRouterOperations(base.BaseTestCase):
|
|||||||
|
|
||||||
def _add_floating_ips(self, router, port_count=1):
|
def _add_floating_ips(self, router, port_count=1):
|
||||||
self._del_all_floating_ips(router)
|
self._del_all_floating_ips(router)
|
||||||
for i in range(0, port_count):
|
for i in range(port_count):
|
||||||
fip = {'id': _uuid(),
|
fip = {'id': _uuid(),
|
||||||
'port_id': router['gw_port']['id'],
|
'port_id': router['gw_port']['id'],
|
||||||
'floating_ip_address': '172.24.4.%s' % (100 + i),
|
'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):
|
def _add_firewall_rules(self, fw, rule_count=1):
|
||||||
rules = []
|
rules = []
|
||||||
for i in range(0, rule_count):
|
for i in range(rule_count):
|
||||||
rule = {'id': _uuid(),
|
rule = {'id': _uuid(),
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
'action': 'deny' if (i % 2 == 0) else 'allow',
|
'action': 'deny' if (i % 2 == 0) else 'allow',
|
||||||
|
@ -92,7 +92,7 @@ class TestLoadBalancerCallbacks(TestLoadBalancerPluginBase):
|
|||||||
# add 3 pools and 2 vips directly to DB
|
# add 3 pools and 2 vips directly to DB
|
||||||
# to create 2 "ready" devices and one pool without vip
|
# to create 2 "ready" devices and one pool without vip
|
||||||
pools = []
|
pools = []
|
||||||
for i in xrange(0, 3):
|
for i in xrange(3):
|
||||||
pools.append(ldb.Pool(id=uuidutils.generate_uuid(),
|
pools.append(ldb.Pool(id=uuidutils.generate_uuid(),
|
||||||
subnet_id=self._subnet_id,
|
subnet_id=self._subnet_id,
|
||||||
protocol="HTTP",
|
protocol="HTTP",
|
||||||
|
@ -266,7 +266,7 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
|
|||||||
"""Creates a bulk request for any kind of resource."""
|
"""Creates a bulk request for any kind of resource."""
|
||||||
objects = []
|
objects = []
|
||||||
collection = "%ss" % resource
|
collection = "%ss" % resource
|
||||||
for i in range(0, number):
|
for i in range(number):
|
||||||
obj = copy.deepcopy(data)
|
obj = copy.deepcopy(data)
|
||||||
obj[resource]['name'] = "%s_%s" % (name, i)
|
obj[resource]['name'] = "%s_%s" % (name, i)
|
||||||
if 'override' in kwargs and i in kwargs['override']:
|
if 'override' in kwargs and i in kwargs['override']:
|
||||||
@ -344,9 +344,9 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
|
|||||||
'tenant_id': self._tenant_id}}
|
'tenant_id': self._tenant_id}}
|
||||||
# auto-generate cidrs as they should not overlap
|
# auto-generate cidrs as they should not overlap
|
||||||
overrides = dict((k, v)
|
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}
|
[{'cidr': "10.0.%s.0/24" % num}
|
||||||
for num in range(0, number)]))
|
for num in range(number)]))
|
||||||
kwargs.update({'override': overrides})
|
kwargs.update({'override': overrides})
|
||||||
return self._create_bulk(fmt, number, 'subnet', base_data, **kwargs)
|
return self._create_bulk(fmt, number, 'subnet', base_data, **kwargs)
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ class TestBasicRouterOperations(base.BaseTestCase):
|
|||||||
'subnet': {'cidr': '19.4.4.0/24',
|
'subnet': {'cidr': '19.4.4.0/24',
|
||||||
'gateway_ip': '19.4.4.1'}}
|
'gateway_ip': '19.4.4.1'}}
|
||||||
int_ports = []
|
int_ports = []
|
||||||
for i in range(0, num_internal_ports):
|
for i in range(num_internal_ports):
|
||||||
int_ports.append({'id': _uuid(),
|
int_ports.append({'id': _uuid(),
|
||||||
'network_id': _uuid(),
|
'network_id': _uuid(),
|
||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
|
Loading…
Reference in New Issue
Block a user