Signed-off-by: FUJITA Tomonori <[email protected]>
---
ryu/ofproto/ofproto_v1_0_parser.py | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/ryu/ofproto/ofproto_v1_0_parser.py
b/ryu/ofproto/ofproto_v1_0_parser.py
index eb291b2..859cfd5 100644
--- a/ryu/ofproto/ofproto_v1_0_parser.py
+++ b/ryu/ofproto/ofproto_v1_0_parser.py
@@ -1007,6 +1007,16 @@ class OFPVendor(MsgBase):
class NiciraHeader(OFPVendor):
+ _NX_SUBTYPES = {}
+
+ @staticmethod
+ def register_nx_subtype(subtype):
+ def _register_nx_subtype(cls):
+ cls.cls_subtype = subtype
+ NiciraHeader._NX_SUBTYPES[cls.cls_subtype] = cls
+ return cls
+ return _register_nx_subtype
+
def __init__(self, datapath, subtype):
super(NiciraHeader, self).__init__(datapath)
self.vendor = ofproto_v1_0.NX_VENDOR_ID
@@ -1018,6 +1028,15 @@ class NiciraHeader(OFPVendor):
self.buf, ofproto_v1_0.OFP_HEADER_SIZE,
self.vendor, self.subtype)
+ @classmethod
+ def parser(cls, datapath, buf, offset):
+ vendor, subtype = struct.unpack_from(
+ ofproto_v1_0.NICIRA_HEADER_PACK_STR, buf,
+ offset + ofproto_v1_0.OFP_HEADER_SIZE)
+ cls_ = cls._NX_SUBTYPES.get(subtype)
+ return cls_.parser(datapath, buf,
+ offset + ofproto_v1_0.NICIRA_HEADER_SIZE)
+
class NXTSetFlowFormat(NiciraHeader):
def __init__(self, datapath, flow_format):
--
1.7.4.4
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel