mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-01-23 09:32:07 +01:00
bgp: move _TYPE declaration of IPAddrPrefix to the appropriate place.
_IPAddrPrefix can be inherited by labeled addr prefix.
In that case, variable 'addr' is tuple and not string. so declare to
parse 'addr' in 'ascii' format in _IPAddrPrefix cause following error.
this patch fix this bug.
p = LabelledIPAddrPrefix(28, ([1], '192.168.0.0'))
p.to_jsondict()
Traceback (most recent call last):
File "./parse_labeled_addr_prefix.py", line 11, in <module>
p.to_jsondict()
File "/home/wataru/ryu/ryu/lib/stringify.py", line 210, in to_jsondict
dict_[k] = encode(k, v)
File "/home/wataru/ryu/ryu/lib/stringify.py", line 208, in <lambda>
encode = lambda k, x: self._encode_value(k, x, encode_string)
File "/home/wataru/ryu/ryu/lib/stringify.py", line 155, in
_encode_value
return cls._get_encoder(k, encode_string)(v)
File "/home/wataru/ryu/ryu/lib/stringify.py", line 56, in encode
return unicode(v, 'ascii')
TypeError: coercing to Unicode: need string or buffer, tuple found
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
f92b674def
commit
7a5b83daa6
@ -852,12 +852,6 @@ class _UnlabelledAddrPrefix(_AddrPrefix):
|
||||
|
||||
|
||||
class _IPAddrPrefix(_AddrPrefix):
|
||||
_TYPE = {
|
||||
'ascii': [
|
||||
'addr'
|
||||
]
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def _prefix_to_bin(addr):
|
||||
(addr,) = addr
|
||||
@ -869,12 +863,6 @@ class _IPAddrPrefix(_AddrPrefix):
|
||||
|
||||
|
||||
class _IP6AddrPrefix(_AddrPrefix):
|
||||
_TYPE = {
|
||||
'ascii': [
|
||||
'addr'
|
||||
]
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def _prefix_to_bin(addr):
|
||||
(addr,) = addr
|
||||
@ -923,6 +911,11 @@ class _VPNAddrPrefix(_AddrPrefix):
|
||||
|
||||
class IPAddrPrefix(_UnlabelledAddrPrefix, _IPAddrPrefix):
|
||||
ROUTE_FAMILY = RF_IPv4_UC
|
||||
_TYPE = {
|
||||
'ascii': [
|
||||
'addr'
|
||||
]
|
||||
}
|
||||
|
||||
@property
|
||||
def prefix(self):
|
||||
@ -935,6 +928,11 @@ class IPAddrPrefix(_UnlabelledAddrPrefix, _IPAddrPrefix):
|
||||
|
||||
class IP6AddrPrefix(_UnlabelledAddrPrefix, _IP6AddrPrefix):
|
||||
ROUTE_FAMILY = RF_IPv6_UC
|
||||
_TYPE = {
|
||||
'ascii': [
|
||||
'addr'
|
||||
]
|
||||
}
|
||||
|
||||
@property
|
||||
def prefix(self):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user