diff options
author | Yuichi Ito <ito.yuichi0@gmail.com> | 2013-12-12 15:31:21 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2013-12-12 18:21:50 +0900 |
commit | 9b0c24c6dffaeae9f49df999900a91964943b0ed (patch) | |
tree | 25c9ae3426727eb676b545468118da4ad55b87a9 /.travis.yml | |
parent | 3f9a902198dce92f9044f22f34a1b89ab618e29e (diff) |
packet lib: bgp: fix reversibility about json
although BGP is using internal classes, no class is registered into '_class_prefixes'.
therefore, from_jsondict() does not work correctly.
this patch makes from_jsondict() to work correctly by registering internal classes into '_class_prefixes'.
examination code:
from ryu.lib.packet import bgp
msg1 = bgp.BGPUpdate(withdrawn_routes=[bgp.BGPWithdrawnRoute(length=0, addr='192.168.0.1')])
print msg1
jsondict = msg1.to_jsondict()
msg2 = bgp.BGPUpdate.from_jsondict(jsondict['BGPUpdate'])
print msg2
print str(msg1) == str(msg2)
before applying this patch:
BGPUpdate(len=None,marker='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff',nlri=[],path_attributes=[],total_path_attribute_len=None,type=2,withdrawn_routes=[BGPWithdrawnRoute(addr='192.168.0.1',length=0)],withdrawn_routes_len=None)
BGPUpdate(len=None,marker='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff',nlri=[],path_attributes=[],total_path_attribute_len=None,type=2,withdrawn_routes=[{'BGPWithdrawnRoute': {'length': 0, 'addr': '192.168.0.1'}}],withdrawn_routes_len=None)
False
after applying this patch:
BGPUpdate(len=None,marker='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff',nlri=[],path_attributes=[],total_path_attribute_len=None,type=2,withdrawn_routes=[BGPWithdrawnRoute(addr='192.168.0.1',length=0)],withdrawn_routes_len=None)
BGPUpdate(len=None,marker='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff',nlri=[],path_attributes=[],total_path_attribute_len=None,type=2,withdrawn_routes=[BGPWithdrawnRoute(addr='192.168.0.1',length=0)],withdrawn_routes_len=None)
True
Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to '.travis.yml')
0 files changed, 0 insertions, 0 deletions