Signed-off-by: FUJITA Tomonori <[email protected]>
---
ryu/ofproto/ofproto_v1_0.py | 5 ++++
ryu/ofproto/ofproto_v1_0_parser.py | 39 ++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/ryu/ofproto/ofproto_v1_0.py b/ryu/ofproto/ofproto_v1_0.py
index 9892c2c..c8db6e7 100644
--- a/ryu/ofproto/ofproto_v1_0.py
+++ b/ryu/ofproto/ofproto_v1_0.py
@@ -246,6 +246,7 @@ NXAST_BUNDLE = 12
NXAST_BUNDLE_LOAD = 13
NXAST_RESUBMIT_TABLE = 14
NXAST_OUTPUT_REG = 15
+NXAST_LEARN = 16
NXAST_EXIT = 17
NXAST_DEC_TTL = 18
NXAST_FIN_TIMEOUT = 19
@@ -299,6 +300,10 @@ 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
+NX_ACTION_LEARN_PACK_STR = '!HHIHHHHQHBxHH'
+NX_ACTION_LEARN_SIZE = 32
+assert calcsize(NX_ACTION_LEARN_PACK_STR) == NX_ACTION_LEARN_SIZE
+
NX_ACTION_CONTROLLER_PACK_STR = '!HHIHHHBB'
NX_ACTION_CONTROLLER_SIZE = 16
assert calcsize(NX_ACTION_CONTROLLER_PACK_STR) == NX_ACTION_CONTROLLER_SIZE
diff --git a/ryu/ofproto/ofproto_v1_0_parser.py
b/ryu/ofproto/ofproto_v1_0_parser.py
index fdf7c36..2b1881f 100644
--- a/ryu/ofproto/ofproto_v1_0_parser.py
+++ b/ryu/ofproto/ofproto_v1_0_parser.py
@@ -824,6 +824,45 @@ class NXActionDecTtl(NXActionHeader):
return cls()
[email protected]_nx_action_subtype(ofproto_v1_0.NXAST_LEARN)
+class NXActionLearn(NXActionHeader):
+ def __init__(self, idle_timeout, hard_timeout, priority, cookie, flags,
+ table_id, fin_idle_timeout, fin_hard_timeout, spec):
+ len_ = len(spec) + ofproto_v1_0.NX_ACTION_LEARN_SIZE
+ pad_len = 8 - (len_ % 8)
+
+ super(NXActionLearn, self).__init__(
+ ofproto_v1_0.NXAST_LEARN, len_ + pad_len)
+ self.idle_timeout = idle_timeout
+ self.hard_timeout = hard_timeout
+ self.priority = priority
+ self.cookie = cookie
+ self.flags = flags
+ self.table_id = table_id
+ self.fin_idle_timeout = fin_idle_timeout
+ self.fin_hard_timeout = fin_hard_timeout
+ self.spec = spec + bytearray('\x00' * pad_len)
+
+ def serialize(self, buf, offset):
+ msg_pack_into(ofproto_v1_0.NX_ACTION_LEARN_PACK_STR, buf, offset,
+ self.type, self.len, self.vendor, self.subtype,
+ self.idle_timeout, self.hard_timeout, self.priority,
+ self.cookie, self.flags, self.table_id,
+ self.fin_idle_timeout, self.fin_hard_timeout)
+ buf += self.spec
+
+ @classmethod
+ def parser(cls, buf, offset):
+ (type_, len_, vendor, subtype, idle_timeout, hard_timeout, priority,
+ cookie, flags, table_id, fin_idle_timeout,
+ find_hard_timeout) = struct.unpack_from(
+ ofproto_v1_0.NX_ACTION_LEARN_PACK_STR, buf, offset)
+ spec = buf[offset + ofproto_v1_0.NX_ACTION_LEARN_SIZE:]
+ return cls(idle_timeout, hard_timeout, priority,
+ cookie, flags, table_id, fin_idle_timeout,
+ find_hard_timeout, spec)
+
+
@NXActionHeader.register_nx_action_subtype(ofproto_v1_0.NXAST_CONTROLLER)
class NXActionController(NXActionHeader):
def __init__(self, max_len, controller_id, reason):
--
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