Signed-off-by: FUJITA Tomonori <[email protected]>
---
 ryu/ofproto/ofproto_v1_0.py        |    5 +++++
 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 f2ad6ac..a42c075 100644
--- a/ryu/ofproto/ofproto_v1_0.py
+++ b/ryu/ofproto/ofproto_v1_0.py
@@ -246,6 +246,7 @@ NXAST_BUNDLE_LOAD = 13
 NXAST_RESUBMIT_TABLE = 14
 NXAST_OUTPUT_REG = 15
 NXAST_EXIT = 17
+NXAST_CONTROLLER = 20
 
 NX_ACTION_RESUBMIT_PACK_STR = '!HHIHHB3x'
 NX_ACTION_RESUBMIT_SIZE = 16
@@ -291,6 +292,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_CONTROLLER_PACK_STR = '!HHIHHHBB'
+NX_ACTION_CONTROLLER_SIZE = 16
+assert calcsize(NX_ACTION_CONTROLLER_PACK_STR) == NX_ACTION_CONTROLLER_SIZE
+
 NX_ACTION_HEADER_PACK_STR = '!HHIH6x'
 NX_ACTION_HEADER_SIZE = 16
 assert calcsize(NX_ACTION_HEADER_PACK_STR) == NX_ACTION_HEADER_SIZE
diff --git a/ryu/ofproto/ofproto_v1_0_parser.py 
b/ryu/ofproto/ofproto_v1_0_parser.py
index 49e645a..89a7f6e 100644
--- a/ryu/ofproto/ofproto_v1_0_parser.py
+++ b/ryu/ofproto/ofproto_v1_0_parser.py
@@ -764,6 +764,29 @@ class NXActionExit(NXActionHeader):
         return cls()
 
 
[email protected]_nx_action_subtype(ofproto_v1_0.NXAST_CONTROLLER)
+class NXActionController(NXActionHeader):
+    def __init__(self, max_len, controller_id, reason):
+        super(NXActionController, self).__init__(
+            ofproto_v1_0.NXAST_CONTROLLER,
+            ofproto_v1_0.NX_ACTION_CONTROLLER_SIZE)
+        self.max_len = max_len
+        self.controller_id = controller_id
+        self.reason = reason
+
+    def serialize(self, buf, offset):
+        msg_pack_into(ofproto_v1_0.NX_ACTION_CONTROLLER_PACK_STR, buf, offset,
+                      self.type, self.len, self.vendor, self.subtype,
+                      self.max_len, self.controller_id, self.reason, 0)
+
+    @classmethod
+    def parser(cls, buf, offset):
+        (type_, len_, vendor, subtype, max_len, controller_id, reason,
+         _zero) = struct.unpack_from(
+            ofproto_v1_0.NX_ACTION_CONTROLLER_PACK_STR, buf, offset)
+        return cls(max_len, controller_id, reason)
+
+
 class OFPDescStats(collections.namedtuple('OFPDescStats',
         ('mfr_desc', 'hw_desc', 'sw_desc', 'serial_num', 'dp_desc'))):
     @classmethod
-- 
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

Reply via email to