although ICMP 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 icmp
msg1 = icmp.icmp(data=icmp.echo())
print msg1
jsondict = msg1.to_jsondict()
msg2 = icmp.icmp.from_jsondict(jsondict['icmp'])
print msg2
print str(msg1) == str(msg2)
before applying this patch:
icmp(code=0,csum=0,data=echo(data=None,id=0,seq=0),type=8)
icmp(code=0,csum=0,data={'echo': {'data': None, 'id': 0, 'seq': 0}},type=8)
False
after applying this patch:
icmp(code=0,csum=0,data=echo(data=None,id=0,seq=0),type=8)
icmp(code=0,csum=0,data=echo(data=None,id=0,seq=0),type=8)
True
Signed-off-by: Yuichi Ito <[email protected]>
---
ryu/lib/packet/icmp.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ryu/lib/packet/icmp.py b/ryu/lib/packet/icmp.py
index a0ac118..57b153c 100644
--- a/ryu/lib/packet/icmp.py
+++ b/ryu/lib/packet/icmp.py
@@ -300,3 +300,6 @@ class TimeExceeded(stringify.StringifyMixin):
if self.data is not None:
length += len(self.data)
return length
+
+
+icmp.set_classes(icmp._ICMP_TYPES)
--
1.7.10.4
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel