python3: Adapt to new iterator names
This patch is generated by "2to3 -f dict" and irrevant parts were hand-removed. Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
c3c2112cb1
commit
c0590ea903
@ -145,7 +145,7 @@ class StatsController(ControllerBase):
|
||||
self.waiters = data['waiters']
|
||||
|
||||
def get_dpids(self, req, **_kwargs):
|
||||
dps = self.dpset.dps.keys()
|
||||
dps = list(self.dpset.dps.keys())
|
||||
body = json.dumps(dps)
|
||||
return Response(content_type='application/json', body=body)
|
||||
|
||||
|
@ -57,7 +57,7 @@ class QuantumController(ControllerBase):
|
||||
self.ifaces = data
|
||||
|
||||
def list_ifaces(self, _req, **_kwargs):
|
||||
body = json.dumps(self.ifaces.keys())
|
||||
body = json.dumps(list(self.ifaces.keys()))
|
||||
return Response(content_type='application/json', body=body)
|
||||
|
||||
def delete_iface(self, _req, iface_id, **_kwargs):
|
||||
|
@ -482,7 +482,7 @@ class Router(dict):
|
||||
vlan_routers = []
|
||||
|
||||
if vlan_id == REST_ALL:
|
||||
vlan_routers = self.values()
|
||||
vlan_routers = list(self.values())
|
||||
else:
|
||||
vlan_id = int(vlan_id)
|
||||
if (vlan_id != VLANID_NONE and
|
||||
|
@ -108,7 +108,7 @@ class SimpleIsolation(app_manager.RyuApp):
|
||||
self.logger.debug("dpid %s in_port %d src %s dst %s ports %s",
|
||||
datapath.id, msg.in_port,
|
||||
haddr_to_str(src), haddr_to_str(dst),
|
||||
self.nw.dpids.get(datapath.id, {}).items())
|
||||
list(self.nw.dpids.get(datapath.id, {}).items()))
|
||||
for port_no in self.nw.filter_ports(datapath.id, msg.in_port,
|
||||
nw_id, NW_ID_EXTERNAL):
|
||||
self.logger.debug("port_no %s", port_no)
|
||||
|
@ -147,7 +147,7 @@ class RyuApp(object):
|
||||
"""
|
||||
Return iterator over the (key, contxt class) of application context
|
||||
"""
|
||||
return cls._CONTEXTS.iteritems()
|
||||
return iter(cls._CONTEXTS.items())
|
||||
|
||||
def __init__(self, *_args, **_kwargs):
|
||||
super(RyuApp, self).__init__()
|
||||
@ -243,7 +243,7 @@ class RyuApp(object):
|
||||
|
||||
def get_observers(self, ev, state):
|
||||
observers = []
|
||||
for k, v in self.observers.get(ev.__class__, {}).iteritems():
|
||||
for k, v in self.observers.get(ev.__class__, {}).items():
|
||||
if not state or not v or state in v:
|
||||
observers.append(k)
|
||||
|
||||
@ -428,7 +428,7 @@ class AppManager(object):
|
||||
for _k, m in inspect.getmembers(i, inspect.ismethod):
|
||||
if not hasattr(m, 'callers'):
|
||||
continue
|
||||
for ev_cls, c in m.callers.iteritems():
|
||||
for ev_cls, c in m.callers.items():
|
||||
if not c.ev_source:
|
||||
continue
|
||||
|
||||
@ -438,7 +438,7 @@ class AppManager(object):
|
||||
c.dispatchers)
|
||||
|
||||
# allow RyuApp and Event class are in different module
|
||||
for brick in SERVICE_BRICKS.itervalues():
|
||||
for brick in SERVICE_BRICKS.values():
|
||||
if ev_cls in brick._EVENTS:
|
||||
brick.register_observer(ev_cls, i.name,
|
||||
c.dispatchers)
|
||||
|
@ -182,7 +182,7 @@ class Cmd(cmd.Cmd):
|
||||
self._peek_notification()
|
||||
|
||||
def _peek_notification(self):
|
||||
for k, p in peers.iteritems():
|
||||
for k, p in peers.items():
|
||||
if p.client:
|
||||
try:
|
||||
p.client.peek_notification()
|
||||
|
@ -43,7 +43,7 @@ base_conf = cfg.ConfigOpts()
|
||||
base_conf.register_cli_opt(cfg.StrOpt('subcommand', positional=True,
|
||||
required=True,
|
||||
help='[%s]' % '|'.join(
|
||||
subcommands.keys())))
|
||||
list(subcommands.keys()))))
|
||||
base_conf.register_cli_opt(RemainderOpt('subcommand_args', default=[],
|
||||
positional=True,
|
||||
help='subcommand specific arguments'))
|
||||
|
@ -62,14 +62,14 @@ class ConfSwitchSet(app_manager.RyuApp):
|
||||
self.confs = {}
|
||||
|
||||
def dpids(self):
|
||||
return self.confs.keys()
|
||||
return list(self.confs.keys())
|
||||
|
||||
def del_dpid(self, dpid):
|
||||
del self.confs[dpid]
|
||||
self.send_event_to_observers(EventConfSwitchDelDPID(dpid))
|
||||
|
||||
def keys(self, dpid):
|
||||
return self.confs[dpid].keys()
|
||||
return list(self.confs[dpid].keys())
|
||||
|
||||
def set_key(self, dpid, key, value):
|
||||
conf = self.confs.setdefault(dpid, {})
|
||||
|
@ -166,7 +166,7 @@ class DPSet(app_manager.RyuApp):
|
||||
|
||||
[ (dpid_A, Datapath_A), (dpid_B, Datapath_B), ... ]
|
||||
"""
|
||||
return self.dps.items()
|
||||
return list(self.dps.items())
|
||||
|
||||
def _port_added(self, datapath, port):
|
||||
self.port_state[datapath.id].add(port.port_no, port)
|
||||
@ -239,7 +239,7 @@ class DPSet(app_manager.RyuApp):
|
||||
instances for the given Datapath ID.
|
||||
Raises KeyError if no such a datapath connected to this controller.
|
||||
"""
|
||||
return self.port_state[dpid].values()
|
||||
return list(self.port_state[dpid].values())
|
||||
|
||||
|
||||
handler.register_service('ryu.controller.dpset')
|
||||
|
@ -82,7 +82,7 @@ def register_instance(i):
|
||||
for _k, m in inspect.getmembers(i, inspect.ismethod):
|
||||
# LOG.debug('instance %s k %s m %s', i, _k, m)
|
||||
if _has_caller(m):
|
||||
for ev_cls, c in m.callers.iteritems():
|
||||
for ev_cls, c in m.callers.items():
|
||||
i.register_handler(ev_cls, m)
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ def get_dependent_services(cls):
|
||||
services = []
|
||||
for _k, m in inspect.getmembers(cls, inspect.ismethod):
|
||||
if _has_caller(m):
|
||||
for ev_cls, c in m.callers.iteritems():
|
||||
for ev_cls, c in m.callers.items():
|
||||
service = getattr(sys.modules[ev_cls.__module__],
|
||||
'_SERVICE_NAME', None)
|
||||
if service:
|
||||
|
@ -62,7 +62,7 @@ class Networks(dict):
|
||||
self.send_event = f
|
||||
|
||||
def list_networks(self):
|
||||
return self.keys()
|
||||
return list(self.keys())
|
||||
|
||||
def has_network(self, network_id):
|
||||
return network_id in self
|
||||
@ -183,7 +183,7 @@ class DPIDs(dict):
|
||||
|
||||
def get_ports(self, dpid, network_id=None, mac_address=None):
|
||||
if network_id is None:
|
||||
return self.get(dpid, {}).values()
|
||||
return list(self.get(dpid, {}).values())
|
||||
if mac_address is None:
|
||||
return [p for p in self.get(dpid, {}).values()
|
||||
if p.network_id == network_id]
|
||||
|
@ -426,8 +426,8 @@ class BFDSession(object):
|
||||
# Authentication Section
|
||||
auth_cls = None
|
||||
if self._auth_type:
|
||||
auth_key_id = self._auth_keys.keys()[
|
||||
random.randint(0, len(self._auth_keys.keys()) - 1)]
|
||||
auth_key_id = list(self._auth_keys.keys())[
|
||||
random.randint(0, len(list(self._auth_keys.keys())) - 1)]
|
||||
auth_key = self._auth_keys[auth_key_id]
|
||||
|
||||
if self._auth_type == bfd.BFD_AUTH_SIMPLE_PASS:
|
||||
|
@ -716,7 +716,7 @@ class VSCtlContext(object):
|
||||
else:
|
||||
key = None
|
||||
if value is not None:
|
||||
LOG.debug("columns %s", table_schema.columns.keys())
|
||||
LOG.debug("columns %s", list(table_schema.columns.keys()))
|
||||
type_ = table_schema.columns[column].type
|
||||
value = datum_from_string(type_, value)
|
||||
LOG.debug("column %s value %s", column, value)
|
||||
@ -752,7 +752,7 @@ class VSCtlContext(object):
|
||||
if not vsctl_row_id.name_column:
|
||||
if record_id != '.':
|
||||
return None
|
||||
values = self.idl.tables[vsctl_row_id.table].rows.values()
|
||||
values = list(self.idl.tables[vsctl_row_id.table].rows.values())
|
||||
if not values or len(values) > 2:
|
||||
return None
|
||||
referrer = values[0]
|
||||
@ -940,7 +940,7 @@ class VSCtl(object):
|
||||
txn.add_comment('ovs-vsctl') # TODO:XXX add operation name. args
|
||||
ovs_rows = idl_.tables[vswitch_idl.OVSREC_TABLE_OPEN_VSWITCH].rows
|
||||
if ovs_rows:
|
||||
ovs_ = ovs_rows.values()[0]
|
||||
ovs_ = list(ovs_rows.values())[0]
|
||||
else:
|
||||
# XXX add verification that table is empty
|
||||
ovs_ = txn.insert(
|
||||
|
@ -218,7 +218,7 @@ class _TypeDisp(object):
|
||||
@classmethod
|
||||
def _rev_lookup_type(cls, targ_cls):
|
||||
if cls._REV_TYPES is None:
|
||||
rev = dict((v, k) for k, v in cls._TYPES.iteritems())
|
||||
rev = dict((v, k) for k, v in cls._TYPES.items())
|
||||
cls._REV_TYPES = rev
|
||||
return cls._REV_TYPES[targ_cls]
|
||||
|
||||
|
@ -96,7 +96,7 @@ class _TypeDisp(object):
|
||||
@classmethod
|
||||
def _rev_lookup_type(cls, targ_cls):
|
||||
if cls._REV_TYPES is None:
|
||||
rev = dict((v, k) for k, v in cls._TYPES.iteritems())
|
||||
rev = dict((v, k) for k, v in cls._TYPES.items())
|
||||
cls._REV_TYPES = rev
|
||||
return cls._REV_TYPES[targ_cls]
|
||||
|
||||
|
@ -119,7 +119,7 @@ class _TypeDisp(object):
|
||||
@classmethod
|
||||
def _rev_lookup_type(cls, targ_cls):
|
||||
if cls._REV_TYPES is None:
|
||||
rev = dict((v, k) for k, v in cls._TYPES.iteritems())
|
||||
rev = dict((v, k) for k, v in cls._TYPES.items())
|
||||
cls._REV_TYPES = rev
|
||||
return cls._REV_TYPES[targ_cls]
|
||||
|
||||
|
@ -61,7 +61,7 @@ class QuantumIfaces(app_manager.RyuApp, dict):
|
||||
return self[iface_id]
|
||||
|
||||
def list_keys(self, iface_id):
|
||||
return self[iface_id].keys()
|
||||
return list(self[iface_id].keys())
|
||||
|
||||
def get_key(self, iface_id, key):
|
||||
return self[iface_id][key]
|
||||
|
@ -387,7 +387,7 @@ class Bridge(object):
|
||||
values = self._DEFAULT_VALUE
|
||||
for key, value in bridge_conf.items():
|
||||
values[key] = value
|
||||
system_id = dp.ports.values()[0].hw_addr
|
||||
system_id = list(dp.ports.values())[0].hw_addr
|
||||
|
||||
self.bridge_id = BridgeId(values['priority'],
|
||||
values['sys_ext_id'],
|
||||
|
@ -153,7 +153,7 @@ class StringifyMixin(object):
|
||||
assert isinstance(dict_, dict)
|
||||
if len(dict_) != 1:
|
||||
return False
|
||||
k = dict_.keys()[0]
|
||||
k = list(dict_.keys())[0]
|
||||
if not isinstance(k, (bytes, unicode)):
|
||||
return False
|
||||
for p in cls._class_prefixes:
|
||||
@ -167,7 +167,7 @@ class StringifyMixin(object):
|
||||
@classmethod
|
||||
def _get_type(cls, k):
|
||||
if hasattr(cls, '_TYPE'):
|
||||
for t, attrs in cls._TYPE.iteritems():
|
||||
for t, attrs in cls._TYPE.items():
|
||||
if k in attrs:
|
||||
return _types[t]
|
||||
return None
|
||||
@ -249,7 +249,7 @@ class StringifyMixin(object):
|
||||
@classmethod
|
||||
def obj_from_jsondict(cls, jsondict, **additional_args):
|
||||
assert len(jsondict) == 1
|
||||
for k, v in jsondict.iteritems():
|
||||
for k, v in jsondict.items():
|
||||
obj_cls = cls.cls_from_jsondict_key(k)
|
||||
return obj_cls.from_jsondict(v, **additional_args)
|
||||
|
||||
|
@ -104,7 +104,7 @@ def ofp_msg_from_jsondict(dp, jsondict):
|
||||
"""
|
||||
parser = dp.ofproto_parser
|
||||
assert len(jsondict) == 1
|
||||
for k, v in jsondict.iteritems():
|
||||
for k, v in jsondict.items():
|
||||
cls = getattr(parser, k)
|
||||
assert issubclass(cls, MsgBase)
|
||||
return cls.from_jsondict(v, datapath=dp)
|
||||
|
@ -1479,7 +1479,7 @@ class OFPActionSetField(OFPAction):
|
||||
else:
|
||||
# new api
|
||||
assert len(kwargs) == 1
|
||||
key = kwargs.keys()[0]
|
||||
key = list(kwargs.keys())[0]
|
||||
value = kwargs[key]
|
||||
assert isinstance(key, (str, unicode))
|
||||
assert not isinstance(value, tuple) # no mask
|
||||
@ -3396,9 +3396,9 @@ class OFPMatch(StringifyMixin):
|
||||
# OFPMatch(eth_src=('ff:ff:ff:00:00:00'), eth_type=0x800,
|
||||
# ipv4_src='10.0.0.1')
|
||||
kwargs = dict(ofproto.oxm_normalize_user(k, v) for
|
||||
(k, v) in kwargs.iteritems())
|
||||
(k, v) in kwargs.items())
|
||||
fields = [ofproto.oxm_from_user(k, v) for (k, v)
|
||||
in kwargs.iteritems()]
|
||||
in kwargs.items()]
|
||||
# assumption: sorting by OXM type values makes fields
|
||||
# meet ordering requirements (eg. eth_type before ipv4_src)
|
||||
fields.sort()
|
||||
@ -3412,7 +3412,7 @@ class OFPMatch(StringifyMixin):
|
||||
return key in dict(self._fields2)
|
||||
|
||||
def iteritems(self):
|
||||
return dict(self._fields2).iteritems()
|
||||
return iter(dict(self._fields2).items())
|
||||
|
||||
def get(self, key, default=None):
|
||||
return dict(self._fields2).get(key, default)
|
||||
@ -4037,7 +4037,7 @@ class OFPMatchField(StringifyMixin):
|
||||
@classmethod
|
||||
def cls_to_header(cls, cls_, hasmask):
|
||||
# XXX efficiency
|
||||
inv = dict((v, k) for k, v in cls._FIELDS_HEADERS.iteritems()
|
||||
inv = dict((v, k) for k, v in cls._FIELDS_HEADERS.items()
|
||||
if (((k >> 8) & 1) != 0) == hasmask)
|
||||
return inv[cls_]
|
||||
|
||||
|
@ -845,7 +845,7 @@ class OFPMatch(StringifyMixin):
|
||||
return key in dict(self._fields2)
|
||||
|
||||
def iteritems(self):
|
||||
return dict(self._fields2).iteritems()
|
||||
return iter(dict(self._fields2).items())
|
||||
|
||||
def get(self, key, default=None):
|
||||
return dict(self._fields2).get(key, default)
|
||||
@ -1533,7 +1533,7 @@ class OFPMatchField(StringifyMixin):
|
||||
@classmethod
|
||||
def cls_to_header(cls, cls_, hasmask):
|
||||
# XXX efficiency
|
||||
inv = dict((v, k) for k, v in cls._FIELDS_HEADERS.iteritems()
|
||||
inv = dict((v, k) for k, v in cls._FIELDS_HEADERS.items()
|
||||
if (((k >> 8) & 1) != 0) == hasmask)
|
||||
return inv[cls_]
|
||||
|
||||
@ -3061,7 +3061,7 @@ class OFPActionSetField(OFPAction):
|
||||
else:
|
||||
# new api
|
||||
assert len(kwargs) == 1
|
||||
key = kwargs.keys()[0]
|
||||
key = list(kwargs.keys())[0]
|
||||
value = kwargs[key]
|
||||
assert isinstance(key, (str, unicode))
|
||||
assert not isinstance(value, tuple) # no mask
|
||||
|
@ -714,9 +714,9 @@ class OFPMatch(StringifyMixin):
|
||||
self._fields2 = _ordered_fields
|
||||
else:
|
||||
kwargs = dict(ofproto.oxm_normalize_user(k, v) for
|
||||
(k, v) in kwargs.iteritems())
|
||||
(k, v) in kwargs.items())
|
||||
fields = [ofproto.oxm_from_user(k, v) for (k, v)
|
||||
in kwargs.iteritems()]
|
||||
in kwargs.items()]
|
||||
# assumption: sorting by OXM type values makes fields
|
||||
# meet ordering requirements (eg. eth_type before ipv4_src)
|
||||
fields.sort()
|
||||
@ -780,7 +780,7 @@ class OFPMatch(StringifyMixin):
|
||||
return key in dict(self._fields2)
|
||||
|
||||
def iteritems(self):
|
||||
return dict(self._fields2).iteritems()
|
||||
return iter(dict(self._fields2).items())
|
||||
|
||||
def get(self, key, default=None):
|
||||
return dict(self._fields2).get(key, default)
|
||||
@ -1086,7 +1086,7 @@ class OFPMatchField(StringifyMixin):
|
||||
@classmethod
|
||||
def cls_to_header(cls, cls_, hasmask):
|
||||
# XXX efficiency
|
||||
inv = dict((v, k) for k, v in cls._FIELDS_HEADERS.iteritems()
|
||||
inv = dict((v, k) for k, v in cls._FIELDS_HEADERS.items()
|
||||
if (((k >> 8) & 1) != 0) == hasmask)
|
||||
return inv[cls_]
|
||||
|
||||
@ -5355,7 +5355,7 @@ class OFPActionSetField(OFPAction):
|
||||
def __init__(self, field=None, **kwargs):
|
||||
super(OFPActionSetField, self).__init__()
|
||||
assert len(kwargs) == 1
|
||||
key = kwargs.keys()[0]
|
||||
key = list(kwargs.keys())[0]
|
||||
value = kwargs[key]
|
||||
assert isinstance(key, (str, unicode))
|
||||
assert not isinstance(value, tuple) # no mask
|
||||
|
@ -715,9 +715,9 @@ class OFPMatch(StringifyMixin):
|
||||
self._fields2 = _ordered_fields
|
||||
else:
|
||||
kwargs = dict(ofproto.oxm_normalize_user(k, v) for
|
||||
(k, v) in kwargs.iteritems())
|
||||
(k, v) in kwargs.items())
|
||||
fields = [ofproto.oxm_from_user(k, v) for (k, v)
|
||||
in kwargs.iteritems()]
|
||||
in kwargs.items()]
|
||||
# assumption: sorting by OXM type values makes fields
|
||||
# meet ordering requirements (eg. eth_type before ipv4_src)
|
||||
fields.sort()
|
||||
@ -781,7 +781,7 @@ class OFPMatch(StringifyMixin):
|
||||
return key in dict(self._fields2)
|
||||
|
||||
def iteritems(self):
|
||||
return dict(self._fields2).iteritems()
|
||||
return iter(dict(self._fields2).items())
|
||||
|
||||
def get(self, key, default=None):
|
||||
return dict(self._fields2).get(key, default)
|
||||
@ -1227,7 +1227,7 @@ class OFPMatchField(StringifyMixin):
|
||||
@classmethod
|
||||
def cls_to_header(cls, cls_, hasmask):
|
||||
# XXX efficiency
|
||||
inv = dict((v, k) for k, v in cls._FIELDS_HEADERS.iteritems()
|
||||
inv = dict((v, k) for k, v in cls._FIELDS_HEADERS.items()
|
||||
if (((k >> 8) & 1) != 0) == hasmask)
|
||||
return inv[cls_]
|
||||
|
||||
@ -5465,7 +5465,7 @@ class OFPActionSetField(OFPAction):
|
||||
def __init__(self, field=None, **kwargs):
|
||||
super(OFPActionSetField, self).__init__()
|
||||
assert len(kwargs) == 1
|
||||
key = kwargs.keys()[0]
|
||||
key = list(kwargs.keys())[0]
|
||||
value = kwargs[key]
|
||||
assert isinstance(key, (str, unicode))
|
||||
assert not isinstance(value, tuple) # no mask
|
||||
|
@ -181,7 +181,7 @@ class RegisterWithArgChecks(object):
|
||||
|
||||
# Collect optional arguments.
|
||||
opt_items = {}
|
||||
for opt_arg, opt_value in kwargs.iteritems():
|
||||
for opt_arg, opt_value in kwargs.items():
|
||||
if opt_arg in self._opt_args:
|
||||
opt_items[opt_arg] = opt_value
|
||||
|
||||
|
@ -72,7 +72,7 @@ def update_neighbor_enabled(neigh_ip_address, enabled):
|
||||
req_args=[neighbors.IP_ADDRESS, neighbors.CHANGES])
|
||||
def update_neighbor(neigh_ip_address, changes):
|
||||
rets = []
|
||||
for k, v in changes.iteritems():
|
||||
for k, v in changes.items():
|
||||
if k == neighbors.MULTI_EXIT_DISC:
|
||||
rets.append(_update_med(neigh_ip_address, v))
|
||||
|
||||
|
@ -207,7 +207,7 @@ class RyuBGPSpeaker(RyuApp):
|
||||
All valid VRFs are loaded.
|
||||
"""
|
||||
vpns_conf = routing_settings.setdefault('vpns', {})
|
||||
for vrfname, vrf in vpns_conf.iteritems():
|
||||
for vrfname, vrf in vpns_conf.items():
|
||||
try:
|
||||
vrf[vrfs.VRF_NAME] = vrfname
|
||||
call('vrf.create', **vrf)
|
||||
|
@ -160,7 +160,7 @@ class BMPClient(Activity):
|
||||
|
||||
def _construct_update(self, path):
|
||||
# Get copy of path's path attributes.
|
||||
new_pathattr = [attr for attr in path.pathattr_map.itervalues()]
|
||||
new_pathattr = [attr for attr in path.pathattr_map.values()]
|
||||
|
||||
if path.is_withdraw:
|
||||
if isinstance(path, Ipv4Path):
|
||||
@ -220,7 +220,7 @@ class BMPClient(Activity):
|
||||
msg = self._construct_peer_up_notification(peer)
|
||||
self._send(msg)
|
||||
|
||||
for path in peer._adj_rib_in.itervalues():
|
||||
for path in peer._adj_rib_in.values():
|
||||
msg = self._construct_route_monitoring(peer, path)
|
||||
self._send(msg)
|
||||
|
||||
|
@ -282,7 +282,7 @@ class CoreService(Factory, Activity):
|
||||
- `new_rts`: (set) of new RTs that peer is interested in.
|
||||
- `old_rts`: (set) of RTs that peers is no longer interested in.
|
||||
"""
|
||||
for table in self._table_manager._global_tables.itervalues():
|
||||
for table in self._table_manager._global_tables.values():
|
||||
if table.route_family == RF_RTC_UC:
|
||||
continue
|
||||
self._spawn('rt_filter_chg_%s' % peer,
|
||||
@ -313,7 +313,7 @@ class CoreService(Factory, Activity):
|
||||
# Check if we have to use all paths or just best path
|
||||
if self._common_config.max_path_ext_rtfilter_all:
|
||||
# We have to look at all paths for a RtDest
|
||||
for rtcdest in self._table_manager.get_rtc_table().itervalues():
|
||||
for rtcdest in self._table_manager.get_rtc_table().values():
|
||||
known_path_list = rtcdest.known_path_list
|
||||
for path in known_path_list:
|
||||
neigh = path.source
|
||||
@ -328,7 +328,7 @@ class CoreService(Factory, Activity):
|
||||
# We iterate over all destination of the RTC table and for iBGP
|
||||
# peers we use all known paths' RTs for RT filter and for eBGP
|
||||
# peers we only consider best-paths' RTs for RT filter
|
||||
for rtcdest in self._table_manager.get_rtc_table().itervalues():
|
||||
for rtcdest in self._table_manager.get_rtc_table().values():
|
||||
path = rtcdest.best_path
|
||||
# If this destination does not have any path, we continue
|
||||
if not path:
|
||||
|
@ -36,7 +36,7 @@ class PeerManager(object):
|
||||
|
||||
@property
|
||||
def iterpeers(self):
|
||||
return self._peers.itervalues()
|
||||
return iter(self._peers.values())
|
||||
|
||||
def set_peer_to_rtfilter_map(self, new_map):
|
||||
self._peer_to_rtfilter_map = new_map
|
||||
@ -69,7 +69,7 @@ class PeerManager(object):
|
||||
|
||||
def _get_non_rtc_peers(self):
|
||||
non_rtc_peer_list = set()
|
||||
for peer in self._peers.itervalues():
|
||||
for peer in self._peers.values():
|
||||
if (peer.in_established() and
|
||||
not peer.is_mpbgp_cap_valid(RF_RTC_UC)):
|
||||
non_rtc_peer_list.add(peer)
|
||||
@ -81,7 +81,7 @@ class PeerManager(object):
|
||||
def get_peers_in_established(self):
|
||||
"""Returns list of peers in established state."""
|
||||
est_peers = []
|
||||
for peer in self._peers.itervalues():
|
||||
for peer in self._peers.values():
|
||||
if peer.in_established:
|
||||
est_peers.append(peer)
|
||||
return est_peers
|
||||
@ -107,7 +107,7 @@ class PeerManager(object):
|
||||
route_family
|
||||
)
|
||||
|
||||
for destination in table.itervalues():
|
||||
for destination in table.values():
|
||||
# Check if this destination's sent - routes include this peer.
|
||||
# i.e. check if this destinations was advertised and enqueue
|
||||
# the path only if it was. If the current best-path has not been
|
||||
@ -139,7 +139,7 @@ class PeerManager(object):
|
||||
Skips making request to peer that have valid RTC capability.
|
||||
"""
|
||||
assert route_family != RF_RTC_UC
|
||||
for peer in self._peers.itervalues():
|
||||
for peer in self._peers.values():
|
||||
# First check if peer is in established state
|
||||
if (peer.in_established and
|
||||
# Check if peer has valid capability for given address
|
||||
@ -199,7 +199,7 @@ class PeerManager(object):
|
||||
peer_rtc_as = neigh_conf.rtc_as
|
||||
# Iterate over all RT_NLRI destination communicate qualifying RT_NLRIs
|
||||
rtc_table = self._table_manager.get_rtc_table()
|
||||
for dest in rtc_table.itervalues():
|
||||
for dest in rtc_table.values():
|
||||
best_path = dest.best_path
|
||||
# Ignore a destination that currently does not have best path
|
||||
if not best_path:
|
||||
@ -231,7 +231,7 @@ class PeerManager(object):
|
||||
if route_family == RF_RTC_UC:
|
||||
continue
|
||||
if peer.is_mbgp_cap_valid(route_family):
|
||||
for dest in table.itervalues():
|
||||
for dest in table.values():
|
||||
if dest.best_path:
|
||||
peer.communicate_path(dest.best_path)
|
||||
|
||||
@ -290,7 +290,7 @@ class PeerManager(object):
|
||||
# Peers that have RTC capability and have common RT with the path
|
||||
# also qualify
|
||||
peer_to_rtfilter_map = self._peer_to_rtfilter_map
|
||||
for peer, rt_filter in peer_to_rtfilter_map.iteritems():
|
||||
for peer, rt_filter in peer_to_rtfilter_map.items():
|
||||
# Ignore Network Controller (its not a BGP peer)
|
||||
if peer is None:
|
||||
continue
|
||||
|
@ -85,7 +85,7 @@ class TableCoreManager(object):
|
||||
|
||||
# Withdraw the best-path whose source was NC since it may have been
|
||||
# exported to VPN table.
|
||||
for destination in vrf_table.itervalues():
|
||||
for destination in vrf_table.values():
|
||||
best_path = destination.best_path
|
||||
if best_path and best_path.source is None:
|
||||
vpn_clone = best_path.clone_to_vpn(vrf_conf.route_dist,
|
||||
@ -294,7 +294,7 @@ class TableCoreManager(object):
|
||||
adds new path with path attributes as per current VRF configuration.
|
||||
"""
|
||||
assert vrf_table
|
||||
for dest in vrf_table.itervalues():
|
||||
for dest in vrf_table.values():
|
||||
for path in dest.known_path_list:
|
||||
if path.source is None:
|
||||
vrf_table.insert_vrf_path(
|
||||
|
@ -81,7 +81,7 @@ class Table(object):
|
||||
raise NotImplementedError()
|
||||
|
||||
def itervalues(self):
|
||||
return self._destinations.itervalues()
|
||||
return iter(self._destinations.values())
|
||||
|
||||
def insert(self, path):
|
||||
self._validate_path(path)
|
||||
@ -124,7 +124,7 @@ class Table(object):
|
||||
version number. Also removes sent paths to this peer.
|
||||
"""
|
||||
LOG.debug('Cleaning paths from table %s for peer %s', self, peer)
|
||||
for dest in self.itervalues():
|
||||
for dest in self.values():
|
||||
# Remove paths learned from this source
|
||||
paths_deleted = dest.remove_old_paths_from_source(peer)
|
||||
# Remove sent paths to this peer
|
||||
@ -146,7 +146,7 @@ class Table(object):
|
||||
LOG.debug('Cleaning table %s for given interested RTs %s',
|
||||
self, interested_rts)
|
||||
uninteresting_dest_count = 0
|
||||
for dest in self.itervalues():
|
||||
for dest in self.values():
|
||||
added_withdraw = \
|
||||
dest.withdraw_unintresting_paths(interested_rts)
|
||||
if added_withdraw:
|
||||
@ -343,7 +343,7 @@ class Destination(object):
|
||||
|
||||
@property
|
||||
def sent_routes(self):
|
||||
return self._sent_routes.values()
|
||||
return list(self._sent_routes.values())
|
||||
|
||||
def add_new_path(self, new_path):
|
||||
self._validate_path(new_path)
|
||||
|
@ -102,7 +102,7 @@ class VrfTable(Table):
|
||||
|
||||
remote_route_count = 0
|
||||
local_route_count = 0
|
||||
for dest in self.itervalues():
|
||||
for dest in self.values():
|
||||
for path in dest.known_path_list:
|
||||
if (hasattr(path.source, 'version_num')
|
||||
or path.source == VPN_TABLE):
|
||||
@ -115,7 +115,7 @@ class VrfTable(Table):
|
||||
LOCAL_ROUTES: local_route_count}
|
||||
|
||||
def import_vpn_paths_from_table(self, vpn_table, import_rts=None):
|
||||
for vpn_dest in vpn_table.itervalues():
|
||||
for vpn_dest in vpn_table.values():
|
||||
vpn_path = vpn_dest.best_path
|
||||
if not vpn_path:
|
||||
continue
|
||||
@ -187,7 +187,7 @@ class VrfTable(Table):
|
||||
|
||||
def apply_import_maps(self):
|
||||
changed_dests = []
|
||||
for dest in self.itervalues():
|
||||
for dest in self.values():
|
||||
assert isinstance(dest, VrfDest)
|
||||
for import_map in self._import_maps:
|
||||
for path in dest.known_path_list:
|
||||
|
@ -117,7 +117,7 @@ class Command(object):
|
||||
if not isinstance(val, list):
|
||||
val = [val]
|
||||
for line in val:
|
||||
for k, v in line.iteritems():
|
||||
for k, v in line.items():
|
||||
if isinstance(v, dict):
|
||||
ret += cls.cli_resp_line_template.format(
|
||||
k, '\n' + pprint.pformat(v)
|
||||
@ -194,7 +194,7 @@ class Command(object):
|
||||
ret.append(self._quick_help())
|
||||
|
||||
if len(self.subcommands) > 0:
|
||||
for k, _ in sorted(self.subcommands.iteritems()):
|
||||
for k, _ in sorted(self.subcommands.items()):
|
||||
command_path, param_help, cmd_help = \
|
||||
self._instantiate_subcommand(k)._quick_help(nested=True)
|
||||
if command_path or param_help or cmd_help:
|
||||
@ -245,7 +245,7 @@ class TextFilter(object):
|
||||
iterator = enumerate(action_resp_value)
|
||||
else:
|
||||
resp = dict(action_resp_value)
|
||||
iterator = action_resp_value.iteritems()
|
||||
iterator = iter(action_resp_value.items())
|
||||
|
||||
remove = []
|
||||
|
||||
@ -258,7 +258,7 @@ class TextFilter(object):
|
||||
if key not in remove]
|
||||
else:
|
||||
resp = dict([(key, value)
|
||||
for key, value in resp.iteritems()
|
||||
for key, value in resp.items()
|
||||
if key not in remove])
|
||||
|
||||
return resp
|
||||
|
@ -166,7 +166,7 @@ class Neighbor(Command):
|
||||
[{'ip_addr': k,
|
||||
'as_num': str(v['remote_as']),
|
||||
'bgp_state': v['stats']['bgp_state']}
|
||||
for k, v in ret.iteritems()])
|
||||
for k, v in ret.items()])
|
||||
|
||||
@classmethod
|
||||
def cli_resp_formatter(cls, resp):
|
||||
|
@ -63,7 +63,7 @@ class Rib(RibBase):
|
||||
if resp.status == STATUS_ERROR:
|
||||
return RibBase.cli_resp_formatter(resp)
|
||||
ret = cls._format_family_header()
|
||||
for family, data in resp.value.iteritems():
|
||||
for family, data in resp.value.items():
|
||||
ret += 'Family: {0}\n'.format(family)
|
||||
ret += cls._format_family(data)
|
||||
return ret
|
||||
|
@ -70,7 +70,7 @@ class Routes(Command, RouteFormatterMixin):
|
||||
if resp.status == STATUS_ERROR:
|
||||
return Command.cli_resp_formatter(resp)
|
||||
ret = cls._format_family_header()
|
||||
for family, data in resp.value.iteritems():
|
||||
for family, data in resp.value.items():
|
||||
ret += 'VPN: {0}\n'.format(family)
|
||||
ret += cls._format_family(data)
|
||||
return ret
|
||||
@ -130,7 +130,7 @@ class Summary(Command, CountRoutesMixin):
|
||||
vrf_confs = self.api.get_vrfs_conf()
|
||||
view = ConfDictView(vrf_confs)
|
||||
encoded = view.encode()
|
||||
for vrf_key, conf in encoded.iteritems():
|
||||
for vrf_key, conf in encoded.items():
|
||||
vrf_name, vrf_rf = vrf_key
|
||||
conf['routes_count'] = self._count_routes(
|
||||
vrf_name,
|
||||
@ -138,7 +138,7 @@ class Summary(Command, CountRoutesMixin):
|
||||
)
|
||||
|
||||
encoded = dict([(str(k), v)
|
||||
for k, v in encoded.iteritems()])
|
||||
for k, v in encoded.items()])
|
||||
return CommandsResponse(
|
||||
STATUS_OK,
|
||||
encoded
|
||||
|
@ -47,7 +47,7 @@ class InternalApi(object):
|
||||
vrf_name = vrf_name.encode('ascii', 'ignore')
|
||||
|
||||
route_count = \
|
||||
len([d for d in vrf.itervalues() if d.best_path])
|
||||
len([d for d in vrf.values() if d.best_path])
|
||||
return {str((vrf_name, vrf_rf)): route_count}
|
||||
|
||||
def get_vrfs_conf(self):
|
||||
@ -56,7 +56,7 @@ class InternalApi(object):
|
||||
def get_all_vrf_routes(self):
|
||||
vrfs = self._get_vrf_tables()
|
||||
ret = {}
|
||||
for (vrf_id, vrf_rf), table in sorted(vrfs.iteritems()):
|
||||
for (vrf_id, vrf_rf), table in sorted(vrfs.items()):
|
||||
ret[str((vrf_id, vrf_rf))] = self._get_single_vrf_routes(table)
|
||||
return ret
|
||||
|
||||
@ -64,10 +64,10 @@ class InternalApi(object):
|
||||
vrf = self._get_vrf_table(vrf_id, vrf_rf)
|
||||
if not vrf:
|
||||
raise WrongParamError('wrong vpn name %s' % str((vrf_id, vrf_rf)))
|
||||
return [self._dst_to_dict(d) for d in vrf.itervalues()]
|
||||
return [self._dst_to_dict(d) for d in vrf.values()]
|
||||
|
||||
def _get_single_vrf_routes(self, vrf_table):
|
||||
return [self._dst_to_dict(d) for d in vrf_table.itervalues()]
|
||||
return [self._dst_to_dict(d) for d in vrf_table.values()]
|
||||
|
||||
def _get_vrf_table(self, vrf_name, vrf_rf):
|
||||
return CORE_MANAGER.get_core_service()\
|
||||
@ -92,7 +92,7 @@ class InternalApi(object):
|
||||
gtable = table_manager.get_global_table_by_route_family(rf)
|
||||
if gtable is not None:
|
||||
return [self._dst_to_dict(dst)
|
||||
for dst in sorted(gtable.itervalues())]
|
||||
for dst in sorted(gtable.values())]
|
||||
else:
|
||||
return []
|
||||
|
||||
|
@ -122,7 +122,7 @@ class OperatorDetailView(OperatorAbstractView):
|
||||
|
||||
def encode(self):
|
||||
return {field_name: field.get(self._obj)
|
||||
for field_name, field in self._fields.iteritems()
|
||||
for field_name, field in self._fields.items()
|
||||
if isinstance(field, fields.DataField)}
|
||||
|
||||
def rel(self, field_name):
|
||||
@ -153,7 +153,7 @@ class OperatorListView(OperatorAbstractView):
|
||||
def encode(self):
|
||||
return RdyToFlattenList(
|
||||
[{field_name: field.get(obj)
|
||||
for field_name, field in self._fields.iteritems()
|
||||
for field_name, field in self._fields.items()
|
||||
if isinstance(field, fields.DataField)}
|
||||
for obj in self.model]
|
||||
)
|
||||
@ -175,28 +175,28 @@ class OperatorDictView(OperatorAbstractView):
|
||||
def combine_related(self, field_name):
|
||||
f = self._fields[field_name]
|
||||
return CombinedViewsWrapper(RdyToFlattenList(
|
||||
map(lambda obj: f.retrieve_and_wrap(obj), self.model.itervalues()))
|
||||
map(lambda obj: f.retrieve_and_wrap(obj), self.model.values()))
|
||||
)
|
||||
|
||||
def get_field(self, field_name):
|
||||
f = self._fields[field_name]
|
||||
return RdyToFlattenDict(
|
||||
{key: f.get(obj) for key, obj in self.model.iteritems()}
|
||||
{key: f.get(obj) for key, obj in self.model.items()}
|
||||
)
|
||||
|
||||
def encode(self):
|
||||
return RdyToFlattenDict(
|
||||
{key: {field_name: field.get(obj)
|
||||
for field_name, field in self._fields.iteritems()
|
||||
for field_name, field in self._fields.items()
|
||||
if isinstance(field, fields.DataField)}
|
||||
for key, obj in self.model.iteritems()}
|
||||
for key, obj in self.model.items()}
|
||||
)
|
||||
|
||||
@property
|
||||
def model(self):
|
||||
if self._filter_func is not None:
|
||||
new_model = RdyToFlattenDict()
|
||||
for k, v in self._obj.iteritems():
|
||||
for k, v in self._obj.items():
|
||||
if self._filter_func(k, v):
|
||||
new_model[k] = v
|
||||
return new_model
|
||||
@ -282,7 +282,7 @@ def create_dict_view_class(detail_view_class, name):
|
||||
if 'encode' in dir(detail_view_class):
|
||||
def encode(self):
|
||||
return RdyToFlattenDict({key: detail_view_class(obj).encode()
|
||||
for key, obj in self.model.iteritems()})
|
||||
for key, obj in self.model.items()})
|
||||
|
||||
return _create_collection_view(
|
||||
detail_view_class, name, encode, OperatorDictView
|
||||
|
@ -175,7 +175,7 @@ class PeerState(object):
|
||||
|
||||
def _remember_last_bgp_error(self, identifier, data):
|
||||
self._last_bgp_error = dict([(k, v)
|
||||
for k, v in data.iteritems()
|
||||
for k, v in data.items()
|
||||
if k != 'peer'])
|
||||
|
||||
@property
|
||||
@ -584,7 +584,7 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
|
||||
|
||||
def on_update_in_filter(self):
|
||||
LOG.debug('on_update_in_filter fired')
|
||||
for received_path in self._adj_rib_in.itervalues():
|
||||
for received_path in self._adj_rib_in.values():
|
||||
LOG.debug('received_path: %s', received_path)
|
||||
path = received_path.path
|
||||
nlri_str = path.nlri.formatted_nlri_str
|
||||
@ -606,7 +606,7 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
|
||||
|
||||
def on_update_out_filter(self):
|
||||
LOG.debug('on_update_out_filter fired')
|
||||
for sent_path in self._adj_rib_out.itervalues():
|
||||
for sent_path in self._adj_rib_out.values():
|
||||
LOG.debug('sent_path: %s', sent_path)
|
||||
path = sent_path.path
|
||||
nlri_str = path.nlri.formatted_nlri_str
|
||||
@ -631,7 +631,7 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
|
||||
def on_update_attribute_maps(self):
|
||||
# resend sent_route in case of filter matching
|
||||
LOG.debug('on_update_attribute_maps fired')
|
||||
for sent_path in self._adj_rib_out.itervalues():
|
||||
for sent_path in self._adj_rib_out.values():
|
||||
LOG.debug('resend path: %s', sent_path)
|
||||
path = sent_path.path
|
||||
self.enque_outgoing_msg(OutgoingRoute(path))
|
||||
@ -837,7 +837,7 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
|
||||
new_pathattr.append(mpunreach_attr)
|
||||
elif self.is_route_server_client:
|
||||
nlri_list = [path.nlri]
|
||||
for pathattr in path.pathattr_map.itervalues():
|
||||
for pathattr in path.pathattr_map.values():
|
||||
new_pathattr.append(pathattr)
|
||||
else:
|
||||
# Supported and un-supported/unknown attributes.
|
||||
@ -1204,7 +1204,7 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
|
||||
else:
|
||||
yield L
|
||||
opts = list(flatten(
|
||||
self._neigh_conf.get_configured_capabilites().values()))
|
||||
list(self._neigh_conf.get_configured_capabilites().values())))
|
||||
open_msg = BGPOpen(
|
||||
my_as=asnum,
|
||||
bgp_identifier=bgpid,
|
||||
@ -1844,11 +1844,11 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
|
||||
LOG.debug('Communicating current best path for all afi/safi except'
|
||||
' 1/132')
|
||||
# We will enqueue best path from all global destination.
|
||||
for route_family, table in global_tables.iteritems():
|
||||
for route_family, table in global_tables.items():
|
||||
if route_family == RF_RTC_UC:
|
||||
continue
|
||||
if self.is_mbgp_cap_valid(route_family):
|
||||
for dest in table.itervalues():
|
||||
for dest in table.values():
|
||||
if dest.best_path:
|
||||
self.communicate_path(dest.best_path)
|
||||
|
||||
|
@ -121,7 +121,7 @@ def validate_enabled(enabled):
|
||||
|
||||
@validate(name=CHANGES)
|
||||
def validate_changes(changes):
|
||||
for k, v in changes.iteritems():
|
||||
for k, v in changes.items():
|
||||
if k not in (MULTI_EXIT_DISC, ENABLED, CONNECT_MODE):
|
||||
raise ConfigValueError(desc="Unknown field to change: %s" % k)
|
||||
|
||||
@ -219,7 +219,7 @@ def valid_filter(filter_):
|
||||
raise ConfigTypeError(desc='Invalid filter type: %s, supported filter'
|
||||
' types are %s'
|
||||
% (filter_['type'],
|
||||
SUPPORTED_FILTER_VALIDATORS.keys()))
|
||||
list(SUPPORTED_FILTER_VALIDATORS.keys())))
|
||||
|
||||
return SUPPORTED_FILTER_VALIDATORS[filter_['type']](filter_)
|
||||
|
||||
@ -627,7 +627,7 @@ class NeighborsConf(BaseConf):
|
||||
"""Returns current RTC AS configured for current neighbors.
|
||||
"""
|
||||
rtc_as_set = set()
|
||||
for neigh in self._neighbors.itervalues():
|
||||
for neigh in self._neighbors.values():
|
||||
rtc_as_set.add(neigh.rtc_as)
|
||||
return rtc_as_set
|
||||
|
||||
@ -670,7 +670,7 @@ class NeighborsConf(BaseConf):
|
||||
@property
|
||||
def settings(self):
|
||||
return [neighbor.settings for _, neighbor in
|
||||
self._neighbors.iteritems()]
|
||||
self._neighbors.items()]
|
||||
|
||||
|
||||
class NeighborConfListener(ConfWithIdListener, ConfWithStatsListener):
|
||||
|
@ -404,7 +404,7 @@ class VrfsConf(BaseConf):
|
||||
def vrf_confs(self):
|
||||
"""Returns a list of configured `VrfConf`s
|
||||
"""
|
||||
return self._vrfs_by_rd_rf.values()
|
||||
return list(self._vrfs_by_rd_rf.values())
|
||||
|
||||
@property
|
||||
def vrf_interested_rts(self):
|
||||
|
@ -110,7 +110,7 @@ def get_unknow_opttrans_attr(path):
|
||||
"""
|
||||
path_attrs = path.pathattr_map
|
||||
unknown_opt_tran_attrs = {}
|
||||
for _, attr in path_attrs.iteritems():
|
||||
for _, attr in path_attrs.items():
|
||||
if (isinstance(attr, BGPPathAttributeUnknown) and
|
||||
attr.is_optional_transitive()):
|
||||
unknown_opt_tran_attrs[attr.type_code] = attr
|
||||
|
@ -257,7 +257,7 @@ class BaseConfigurator(object):
|
||||
kwargs = dict([(k, config[k]) for k in config if valid_ident(k)])
|
||||
result = c(**kwargs)
|
||||
if props:
|
||||
for name, value in props.items():
|
||||
for name, value in list(props.items()):
|
||||
setattr(result, name, value)
|
||||
return result
|
||||
|
||||
@ -366,7 +366,7 @@ class DictConfigurator(BaseConfigurator):
|
||||
# which were in the previous configuration but
|
||||
# which are not in the new configuration.
|
||||
root = logging.root
|
||||
existing = root.manager.loggerDict.keys()
|
||||
existing = list(root.manager.loggerDict.keys())
|
||||
# The list needs to be sorted so that we can
|
||||
# avoid disabling child loggers of explicitly
|
||||
# named loggers. With a sorted list it is easier
|
||||
|
@ -140,7 +140,7 @@ class RouteTargetManager(object):
|
||||
def on_rt_filter_chg_sync_peer(self, peer, new_rts, old_rts, table):
|
||||
LOG.debug('RT Filter changed for peer %s, new_rts %s, old_rts %s ',
|
||||
peer, new_rts, old_rts)
|
||||
for dest in table.itervalues():
|
||||
for dest in table.values():
|
||||
# If this destination does not have best path, we ignore it
|
||||
if not dest.best_path:
|
||||
continue
|
||||
|
@ -30,7 +30,7 @@ from ryu import cfg
|
||||
|
||||
# import all packet libraries.
|
||||
PKT_LIB_PATH = 'ryu.lib.packet'
|
||||
for modname, moddef in sys.modules.iteritems():
|
||||
for modname, moddef in sys.modules.items():
|
||||
if not modname.startswith(PKT_LIB_PATH) or not moddef:
|
||||
continue
|
||||
for (clsname, clsdef, ) in inspect.getmembers(moddef):
|
||||
@ -882,7 +882,7 @@ class OfTester(app_manager.RyuApp):
|
||||
'ipv6_flabel': 20,
|
||||
'ipv6_exthdr': 9}
|
||||
match_fields = list()
|
||||
for key, united_value in match.iteritems():
|
||||
for key, united_value in match.items():
|
||||
if isinstance(united_value, tuple):
|
||||
(value, mask) = united_value
|
||||
# look up oxm_fields.TypeDescr to get mask length.
|
||||
@ -1308,7 +1308,7 @@ class TestFile(stringify.StringifyMixin):
|
||||
if v[k] == port_name:
|
||||
v[k] = CONF['test-switch'][port_name]
|
||||
if isinstance(val, dict):
|
||||
for k, v in val.iteritems():
|
||||
for k, v in val.items():
|
||||
if k == "OFPActionOutput":
|
||||
if 'port' in v:
|
||||
__replace_port_name("port", v)
|
||||
|
@ -35,7 +35,7 @@ from ryu import cfg
|
||||
|
||||
# import all packet libraries.
|
||||
PKT_LIB_PATH = 'ryu.lib.packet'
|
||||
for modname, moddef in sys.modules.iteritems():
|
||||
for modname, moddef in sys.modules.items():
|
||||
if not modname.startswith(PKT_LIB_PATH) or not moddef:
|
||||
continue
|
||||
for (clsname, clsdef, ) in inspect.getmembers(moddef):
|
||||
|
@ -206,7 +206,7 @@ class Test_Parser(unittest.TestCase):
|
||||
return map(f, d)
|
||||
if isinstance(d, dict):
|
||||
d2 = {}
|
||||
for k, v in d.iteritems():
|
||||
for k, v in d.items():
|
||||
if k in names:
|
||||
continue
|
||||
d2[k] = f(v)
|
||||
|
@ -131,7 +131,7 @@ class Test_Parser_Compat(unittest.TestCase):
|
||||
# a parsed object can be inspected by old and new api
|
||||
|
||||
check(ofpp.OFPMatch.parser(buffer(new_buf), 0))
|
||||
check(ofpp.OFPMatch.from_jsondict(new_jsondict.values()[0]))
|
||||
check(ofpp.OFPMatch.from_jsondict(list(new_jsondict.values())[0]))
|
||||
|
||||
|
||||
def _add_tests():
|
||||
|
@ -51,12 +51,12 @@ class Test_Parser_OFPMatch(unittest.TestCase):
|
||||
if domask:
|
||||
d = dict(self._ofp[ofpp].oxm_normalize_user(k, uv)
|
||||
for (k, uv)
|
||||
in d.iteritems())
|
||||
in d.items())
|
||||
match = ofpp.OFPMatch(**d)
|
||||
b = bytearray()
|
||||
match.serialize(b, 0)
|
||||
match2 = match.parser(buffer(b), 0)
|
||||
for k, v in d.iteritems():
|
||||
for k, v in d.items():
|
||||
ok_(k in match)
|
||||
ok_(k in match2)
|
||||
eq_(match[k], v)
|
||||
|
@ -288,7 +288,7 @@ class PortDataState(dict):
|
||||
curr = curr[self._NEXT]
|
||||
|
||||
def clear(self):
|
||||
for node in self._map.itervalues():
|
||||
for node in self._map.values():
|
||||
del node[:]
|
||||
root = self._root
|
||||
root[:] = [root, root, None]
|
||||
@ -486,7 +486,7 @@ class Switches(app_manager.RyuApp):
|
||||
def _get_switch(self, dpid):
|
||||
if dpid in self.dps:
|
||||
switch = Switch(self.dps[dpid])
|
||||
for ofpport in self.port_state[dpid].itervalues():
|
||||
for ofpport in self.port_state[dpid].values():
|
||||
switch.add_port(ofpport)
|
||||
return switch
|
||||
|
||||
@ -843,7 +843,7 @@ class Switches(app_manager.RyuApp):
|
||||
switches = []
|
||||
if dpid is None:
|
||||
# reply all list
|
||||
for dp in self.dps.itervalues():
|
||||
for dp in self.dps.values():
|
||||
switches.append(self._get_switch(dp.id))
|
||||
elif dpid in self.dps:
|
||||
switches.append(self._get_switch(dpid))
|
||||
|
@ -65,7 +65,7 @@ def _likely_same(a, b):
|
||||
|
||||
def _find_loaded_module(modpath):
|
||||
# copy() to avoid RuntimeError: dictionary changed size during iteration
|
||||
for k, m in sys.modules.copy().iteritems():
|
||||
for k, m in sys.modules.copy().items():
|
||||
if k == '__main__':
|
||||
continue
|
||||
if not hasattr(m, '__file__'):
|
||||
|
Loading…
Reference in New Issue
Block a user