The latter only works in Python 2.
Also define a __next__ method in the classes that define a next method.
Change-Id: Iaa1a1e500facab50d8bcdffda39ccad3f2e4e9bb
Blueprint: neutron-python3
).split('\n')
for subnet_route_line in subnet_route_list_lines:
i = iter(subnet_route_line.split())
- while(i.next() != 'dev'):
+ while(next(i) != 'dev'):
pass
- device = i.next()
+ device = next(i)
try:
- while(i.next() != 'src'):
+ while(next(i) != 'src'):
pass
- src = i.next()
+ src = next(i)
except Exception:
src = ''
if device != interface_name:
return self
def next(self):
- n = self._i.next().name
+ n = next(self._i).name
return n, getattr(self, n)
+ __next__ = next
+
def __repr__(self):
"""sqlalchemy based automatic __repr__ method."""
items = ['%s=%r' % (col.name, getattr(self, col.name))
prefix_pool = self._get_available_prefix_list()
for prefix in prefix_pool:
if request.prefixlen >= prefix.prefixlen:
- subnet = prefix.subnet(request.prefixlen).next()
+ subnet = next(prefix.subnet(request.prefixlen))
gateway_ip = request.gateway_ip
if not gateway_ip:
gateway_ip = subnet.network + 1
def __init__(self, model):
super(TunnelTypeDriver, self).__init__(model)
- self.segmentation_key = iter(self.primary_keys).next()
+ self.segmentation_key = next(iter(self.primary_keys))
@abc.abstractmethod
def sync_allocations(self):
def __init__(self, segment_model, endpoint_model):
super(EndpointTunnelTypeDriver, self).__init__(segment_model)
self.endpoint_model = endpoint_model
- self.segmentation_key = iter(self.primary_keys).next()
+ self.segmentation_key = next(iter(self.primary_keys))
def get_endpoint_by_host(self, host):
LOG.debug("get_endpoint_by_host() called for host %s", host)
def __iter__(self):
while True:
- yield self.next()
+ yield next(self)
def next(self):
chunk = self.resp.read(CHUNKSIZE)
return chunk
else:
raise StopIteration()
+
+ __next__ = next
interfaces = copy.deepcopy(router.get(l3_constants.INTERFACE_KEY, []))
if interface_id:
try:
- interface = (i for i in interfaces
- if i['id'] == interface_id).next()
+ interface = next(i for i in interfaces
+ if i['id'] == interface_id)
except StopIteration:
raise ValueError("interface_id not found")
neutron.tests.unit.plugins.ml2.drivers.ext_test \
neutron.tests.unit.plugins.ml2.drivers.mech_sriov.test_mech_sriov_nic_switch \
neutron.tests.unit.plugins.ml2.drivers.mech_fake_agent \
+ neutron.tests.unit.plugins.ml2.drivers.test_type_vxlan \
+ neutron.tests.unit.plugins.ml2.drivers.test_type_gre \
neutron.tests.unit.plugins.ml2.drivers.arista.test_mechanism_arista \
neutron.tests.unit.plugins.ml2.drivers.test_type_local \
neutron.tests.unit.plugins.ml2.drivers.mechanism_logger \
neutron.tests.unit.agent.l3.test_dvr_fip_ns \
neutron.tests.unit.agent.common.test_config \
neutron.tests.unit.agent.common.test_polling \
+ neutron.tests.unit.agent.linux.test_ip_lib \
neutron.tests.unit.agent.linux.test_keepalived \
neutron.tests.unit.agent.linux.test_ipset_manager \
neutron.tests.unit.agent.linux.test_ebtables_manager \
neutron.tests.unit.cmd.test_netns_cleanup \
neutron.tests.unit.ipam.drivers.neutrondb_ipam.test_db_api \
neutron.tests.unit.ipam.drivers.neutrondb_ipam.test_driver \
+ neutron.tests.unit.ipam.test_subnet_alloc \
neutron.tests.unit.notifiers.test_nova \
neutron.tests.unit.notifiers.test_batch_notifier