Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
 ryu/ofproto/ofproto_v1_2_parser.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/ryu/ofproto/ofproto_v1_2_parser.py 
b/ryu/ofproto/ofproto_v1_2_parser.py
index 37433bc..27fbb6f 100644
--- a/ryu/ofproto/ofproto_v1_2_parser.py
+++ b/ryu/ofproto/ofproto_v1_2_parser.py
@@ -284,7 +284,7 @@ class OFPPacketIn(MsgBase):
         msg.match = OFPMatch.parser(msg.buf, ofproto_v1_2.OFP_PACKET_IN_SIZE -
                                     ofproto_v1_2.OFP_MATCH_SIZE)
 
-        match_len = utils.round_up(msg.match._length, 8)
+        match_len = utils.round_up(msg.match.length, 8)
         msg.data = msg.buf[(ofproto_v1_2.OFP_PACKET_IN_SIZE -
                             ofproto_v1_2.OFP_MATCH_SIZE + match_len + 2):]
 
@@ -1157,7 +1157,7 @@ class OFPFlowStats(StringifyMixin):
                    ofproto_v1_2.OFP_MATCH_SIZE)
         match = OFPMatch.parser(buf, offset)
 
-        match_length = utils.round_up(match._length, 8)
+        match_length = utils.round_up(match.length, 8)
         inst_length = (length - (ofproto_v1_2.OFP_FLOW_STATS_SIZE -
                                  ofproto_v1_2.OFP_MATCH_SIZE + match_length))
         offset += match_length
@@ -1682,11 +1682,13 @@ class FlowWildcards(object):
 
 
 class OFPMatch(StringifyMixin):
-    def __init__(self, _ordered_fields=None, **kwargs):
+    def __init__(self, type=None, length=None, _ordered_fields=None, **kwargs):
         super(OFPMatch, self).__init__()
         self._wc = FlowWildcards()
         self._flow = Flow()
         self.fields = []
+        self.type = ofproto_v1_2.OFPMT_OXM
+        self.length = length
 
         if not _ordered_fields is None:
             assert not kwargs
@@ -1734,7 +1736,9 @@ class OFPMatch(StringifyMixin):
             o = self
 
         body = {"oxm_fields": [ofproto_v1_2.oxm_to_jsondict(k, uv) for k, uv
-                               in o._fields2]}
+                               in o._fields2],
+                "length": o.length,
+                "type": o.type}
         return {self.__class__.__name__: body}
 
     @classmethod
@@ -1788,6 +1792,7 @@ class OFPMatch(StringifyMixin):
         length = field_offset - offset
         msg_pack_into(hdr_pack_str, buf, offset,
                       ofproto_v1_2.OFPMT_OXM, length)
+        self.length = length
 
         pad_len = utils.round_up(length, 8) - length
         ofproto_parser.msg_pack_into("%dx" % pad_len, buf, field_offset)
@@ -2000,7 +2005,7 @@ class OFPMatch(StringifyMixin):
         type_, length = struct.unpack_from('!HH', buf, offset)
 
         match.type = type_
-        match._length = length
+        match.length = length
 
         # ofp_match adjustment
         offset += 4
-- 
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