diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-05-20 10:42:14 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-05-28 17:12:34 +0900 |
commit | be9fc3dc6d8c579f43016ce27e0ec67f9695e9fc (patch) | |
tree | 7a7d816cf6039999de64b61619f5e8b89a5827e1 | |
parent | 0c74a7755cdfe37c7ed0d3bbcc64c8d393301ac9 (diff) |
Add Switch to Controller Nicira extension message support
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | 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 9517e4f5..9270ce4a 100644 --- a/ryu/ofproto/ofproto_v1_0_parser.py +++ b/ryu/ofproto/ofproto_v1_0_parser.py @@ -1089,6 +1089,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 @@ -1100,6 +1110,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): |