mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-05 20:36:10 +02:00
bgp: should not use dict comprehension
Dict Comprehension is available in Python 2.7+ but Ryu should work with Python2.6. Currently, It will become syntax error when we try to operate BGP of Ryu on the platform of Python2.6. Signed-off-by: Satoshi Kobayashi <satoshi-k@stratosphere.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
bbb7724423
commit
4cfc239b30
@ -257,8 +257,9 @@ class TextFilter(object):
|
||||
resp = [resp[key] for key, value in enumerate(resp)
|
||||
if key not in remove]
|
||||
else:
|
||||
resp = {key: value for key, value in resp.iteritems()
|
||||
if key not in remove}
|
||||
resp = dict([(key, value)
|
||||
for key, value in resp.iteritems()
|
||||
if key not in remove])
|
||||
|
||||
return resp
|
||||
else:
|
||||
|
||||
@ -61,10 +61,10 @@ class SentRoutes(Command):
|
||||
return WrongParamResp('wrong addr_family name')
|
||||
|
||||
ret = self._retrieve_paths(addr_family, rf, ip_addr).encode()
|
||||
ret = {
|
||||
path['nlri']['formatted_nlri']: path
|
||||
ret = dict([
|
||||
(path['nlri']['formatted_nlri'], path)
|
||||
for path in ret
|
||||
}
|
||||
])
|
||||
|
||||
return CommandsResponse(STATUS_OK, ret)
|
||||
|
||||
|
||||
@ -137,7 +137,8 @@ class Summary(Command, CountRoutesMixin):
|
||||
vrf_rf
|
||||
)
|
||||
|
||||
encoded = {str(k): v for k, v in encoded.iteritems()}
|
||||
encoded = dict([(str(k), v)
|
||||
for k, v in encoded.iteritems()])
|
||||
return CommandsResponse(
|
||||
STATUS_OK,
|
||||
encoded
|
||||
|
||||
@ -49,7 +49,7 @@ class OperatorAbstractView(object):
|
||||
def _collect_fields(cls):
|
||||
names = [attr for attr in dir(cls)
|
||||
if isinstance(getattr(cls, attr), fields.Field)]
|
||||
return {name: getattr(cls, name) for name in names}
|
||||
return dict([(name, getattr(cls, name)) for name in names])
|
||||
|
||||
def combine_related(self, field_name):
|
||||
"""Combines related views. In case of DetailView it just returns
|
||||
|
||||
@ -167,8 +167,9 @@ class PeerState(object):
|
||||
)
|
||||
|
||||
def _remember_last_bgp_error(self, identifier, data):
|
||||
self._last_bgp_error = {k: v for k, v in data.iteritems()
|
||||
if k != 'peer'}
|
||||
self._last_bgp_error = dict([(k, v)
|
||||
for k, v in data.iteritems()
|
||||
if k != 'peer'])
|
||||
|
||||
@property
|
||||
def recv_prefix(self):
|
||||
|
||||
@ -233,14 +233,14 @@ class BgpProtocol(Protocol, Activity):
|
||||
|
||||
# Check MP_BGP capabilities were advertised.
|
||||
if local_mbgp_cap and remote_mbgp_cap:
|
||||
local_families = {
|
||||
local_families = set([
|
||||
(peer_cap.afi, peer_cap.safi)
|
||||
for peer_cap in local_mbgp_cap
|
||||
}
|
||||
remote_families = {
|
||||
])
|
||||
remote_families = set([
|
||||
(peer_cap.afi, peer_cap.safi)
|
||||
for peer_cap in remote_mbgp_cap
|
||||
}
|
||||
])
|
||||
afi_safi = local_families.intersection(remote_families)
|
||||
else:
|
||||
afi_safi = set()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user