diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-05-21 21:20:51 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-05-22 08:50:21 +0900 |
commit | 8082e3f1745597f4366153ca067912fd4fc9a56e (patch) | |
tree | a79fe8b3cee74ffae3e63bd3ccdc9bf4c80e1bf7 | |
parent | 79189bd1f8ae488515f19727b0ded9f481cd3371 (diff) |
add Nicira Extension NXAST_AUTOPATH support
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/ofproto/ofproto_v1_0.py | 5 | ||||
-rw-r--r-- | ryu/ofproto/ofproto_v1_0_parser.py | 23 |
2 files changed, 28 insertions, 0 deletions
diff --git a/ryu/ofproto/ofproto_v1_0.py b/ryu/ofproto/ofproto_v1_0.py index af34a4a6..08ae0f87 100644 --- a/ryu/ofproto/ofproto_v1_0.py +++ b/ryu/ofproto/ofproto_v1_0.py @@ -238,6 +238,7 @@ NXAST_REG_MOVE = 6 NXAST_REG_LOAD = 7 NXAST_SET_TUNNEL64 = 9 NXAST_MULTIPATH = 10 +NXAST_AUTOPATH = 11 NXAST_BUNDLE = 12 NXAST_BUNDLE_LOAD = 13 NXAST_RESUBMIT_TABLE = 14 @@ -272,6 +273,10 @@ NX_ACTION_BUNDLE_PACK_STR = '!HHIHHHHIHHI4x' NX_ACTION_BUNDLE_SIZE = 32 assert calcsize(NX_ACTION_BUNDLE_PACK_STR) == NX_ACTION_BUNDLE_SIZE +NX_ACTION_AUTOPATH_PACK_STR = '!HHIHHII4x' +NX_ACTION_AUTOPATH_SIZE = 24 +assert calcsize(NX_ACTION_AUTOPATH_PACK_STR) == NX_ACTION_AUTOPATH_SIZE + NX_ACTION_OUTPUT_REG_PACK_STR = '!HHIHHIH6x' NX_ACTION_OUTPUT_REG_SIZE = 24 assert calcsize(NX_ACTION_OUTPUT_REG_PACK_STR) == NX_ACTION_OUTPUT_REG_SIZE diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto/ofproto_v1_0_parser.py index 8820e3be..e8db6098 100644 --- a/ryu/ofproto/ofproto_v1_0_parser.py +++ b/ryu/ofproto/ofproto_v1_0_parser.py @@ -661,6 +661,29 @@ class NXActionBundleLoad(NXActionBundleBase): return NXActionBundleBase.parser(NXActionBundleLoad, buf, offset) +@NXActionHeader.register_nx_action_subtype(ofproto_v1_0.NXAST_AUTOPATH) +class NXActionAutopath(NXActionHeader): + def __init__(self, ofs_nbits, dst, _id): + super(NXActionAutopath, self).__init__( + ofproto_v1_0.NXAST_AUTOPATH, + ofproto_v1_0.NX_ACTION_AUTOPATH_SIZE) + self.ofs_nbits = ofs_nbits + self.dst = dst + self.id = _id + + def serialize(self, buf, offset): + msg_pack_into(ofproto_v1_0.NX_ACTION_OUTPUT_REG_PACK_STR, buf, offset, + self.type, self.len, self.vendor, self.subtype, + self.ofs_nbits, self.dst, self.id) + + @classmethod + def parser(cls, buf, offset): + (type_, len_, vendor, subtype, ofs_nbits, dst, + _id) = struct.unpack_from( + ofproto_v1_0.NX_ACTION_AUTOPATH_PACK_STR, buf, offset) + return cls(ofs_nbits, dst, _id) + + @NXActionHeader.register_nx_action_subtype(ofproto_v1_0.NXAST_OUTPUT_REG) class NXActionOutputReg(NXActionHeader): def __init__(self, ofs_nbits, src, max_len): |