Signed-off-by: Simon Horman <[email protected]>
---
 ryu/ofproto/ofproto_v1_3_parser.py | 55 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 53 insertions(+), 2 deletions(-)

diff --git a/ryu/ofproto/ofproto_v1_3_parser.py 
b/ryu/ofproto/ofproto_v1_3_parser.py
index 06addda..0ca4769 100644
--- a/ryu/ofproto/ofproto_v1_3_parser.py
+++ b/ryu/ofproto/ofproto_v1_3_parser.py
@@ -5122,8 +5122,59 @@ class OFPTableFeaturePropOxm(OFPTableFeatureProp):
         return bin_ids
 
 
-# XXX ofproto.OFPTFPT_EXPERIMENTER
-# XXX ofproto.OFPTFPT_EXPERIMENTER_MISS
[email protected]_type(ofproto.OFPTFPT_EXPERIMENTER)
[email protected]_type(ofproto.OFPTFPT_EXPERIMENTER_MISS)
+class OFPTableFeaturePropExperimenter(OFPTableFeatureProp):
+    _DATA_ELEMENT_PACK_STR = '!I'
+    _PACK_STR = '!II'
+
+    def __init__(self, type_, experimenter=None, exp_type=None,
+                 data=None, length=None):
+        self.type = type_
+        self.length = length
+        self.experimenter = experimenter
+        self.exp_type = exp_type
+        self.data = data
+
+    @classmethod
+    def _parse_prop(cls, buf):
+        (experimenter, exp_type) = struct.unpack_from(cls._PACK_STR, buf, 0)
+
+        # Parse trailing data, a list of 4-byte words
+        length = len(buf)
+        data = []
+        pack_size = struct.calcsize(cls._DATA_ELEMENT_PACK_STR)
+        offset = struct.calcsize(cls._PACK_STR)
+        while offset < length:
+            (word,) = struct.unpack_from(cls._DATA_ELEMENT_PACK_STR,
+                                         buf, offset)
+            exp.data.append(word)
+            offset += pack_size
+
+        return {
+            'experimenter': experimenter,
+            'exp_type': exp_type,
+            'data': data,
+        }
+
+    def _serialize_prop(self):
+        # experimenter, exp_type
+        buf = bytearray()
+        msg_pack_into(self._PACK_STR, buf, 0, self.experimenter,
+                      self.exp_type)
+
+        # data
+        if len(self.data):
+            ofproto_parser.msg_pack_into('!%dI' % len(self.data),
+                                         data_buf, len(buf), *self.data)
+
+        # pad
+        length = super(OFPTableFeaturePropExperimenter, self)._PACK_STR
+        length += len(buf)
+        pad_len = utils.round_up(length, 8) - length
+        ofproto_parser.msg_pack_into("%dx" % pad_len, buf, len(buf))
+
+        return buf
 
 
 @_set_stats_type(ofproto.OFPMP_TABLE_FEATURES, OFPTableFeaturesStats)
-- 
1.8.5.2


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to