- when parsing, remove zero padding.
- stop base64 encoding for json representation because these fields
  are ASCII strings per OF spec.

Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
 ryu/ofproto/ofproto_v1_3_parser.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/ryu/ofproto/ofproto_v1_3_parser.py 
b/ryu/ofproto/ofproto_v1_3_parser.py
index b3792ad..7c73a74 100644
--- a/ryu/ofproto/ofproto_v1_3_parser.py
+++ b/ryu/ofproto/ofproto_v1_3_parser.py
@@ -2567,10 +2567,23 @@ class OFPMultipartReply(MsgBase):
 
 class OFPDescStats(ofproto_parser.namedtuple('OFPDescStats', (
         'mfr_desc', 'hw_desc', 'sw_desc', 'serial_num', 'dp_desc'))):
+
+    _TYPE = {
+        'ascii': [
+            'mfr_desc',
+            'hw_desc',
+            'sw_desc',
+            'serial_num',
+            'dp_desc',
+        ]
+    }
+
     @classmethod
     def parser(cls, buf, offset):
         desc = struct.unpack_from(ofproto_v1_3.OFP_DESC_PACK_STR,
                                   buf, offset)
+        desc = list(desc)
+        desc = map(lambda x: x.rstrip('\0'), desc)
         stats = cls(*desc)
         stats._length = ofproto_v1_3.OFP_DESC_SIZE
         return stats
-- 
1.8.3.1


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to