Signed-off-by: Simon Horman <[email protected]>
---
v3
* Update changelog: s/of1.4/of14/
v2
* First post
---
ryu/ofproto/ofproto_v1_4.py | 6 ++++-
ryu/ofproto/ofproto_v1_4_parser.py | 55 ++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/ryu/ofproto/ofproto_v1_4.py b/ryu/ofproto/ofproto_v1_4.py
index 5f83e07..200e9b0 100644
--- a/ryu/ofproto/ofproto_v1_4.py
+++ b/ryu/ofproto/ofproto_v1_4.py
@@ -1414,7 +1414,11 @@ OFPTR_VACANCY_DOWN = 3 # Vacancy down threshold event.
OFPTR_VACANCY_UP = 4 # Vacancy up threshold event.
# struct ofp_table_status
-OFP_TABLE_STATUS_PACK_STR = '!B7x' + _OFP_TABLE_DESC_PACK_STR
+_OFP_TABLE_STATUS_0_PACK_STR = 'B7x'
+OFP_TABLE_STATUS_0_PACK_STR = '!' + _OFP_TABLE_STATUS_0_PACK_STR
+OFP_TABLE_STATUS_0_SIZE = 16
+OFP_TABLE_STATUS_PACK_STR = (OFP_TABLE_STATUS_0_PACK_STR +
+ _OFP_TABLE_DESC_PACK_STR)
OFP_TABLE_STATUS_SIZE = 24
assert (calcsize(OFP_TABLE_STATUS_PACK_STR) + OFP_HEADER_SIZE ==
OFP_TABLE_STATUS_SIZE)
diff --git a/ryu/ofproto/ofproto_v1_4_parser.py
b/ryu/ofproto/ofproto_v1_4_parser.py
index f3b0aee..74a6e33 100644
--- a/ryu/ofproto/ofproto_v1_4_parser.py
+++ b/ryu/ofproto/ofproto_v1_4_parser.py
@@ -4416,6 +4416,61 @@ class OFPRoleStatus(MsgBase):
return msg
+@_register_parser
+@_set_msg_type(ofproto.OFPT_TABLE_STATUS)
+class OFPTableStatus(MsgBase):
+ """
+ Table status message
+
+ The switch notifies controller of change of table status.
+
+ ================ ======================================================
+ Attribute Description
+ ================ ======================================================
+ reason One of the following values.
+ OFPTR_VACANCY_DOWN
+ OFPTR_VACANCY_UP
+ table ``OFPTableDesc`` instance
+ ================ ======================================================
+
+ Example::
+
+ @set_ev_cls(ofp_event.EventOFPTableStatus, MAIN_DISPATCHER)
+ def table(self, ev):
+ msg = ev.msg
+ dp = msg.datapath
+ ofp = dp.ofproto
+
+ if msg.reason == ofp.OFPTR_VACANCY_DOWN:
+ reason = 'VACANCY_DOWN'
+ elif msg.reason == ofp.OFPTR_VACANCY_UP:
+ reason = 'VACANCY_UP'
+ else:
+ reason = 'unknown'
+
+ self.logger.debug('OFPTableStatus received: reason=%s '
+ 'table_id=%d config=0x%08x properties=%s',
+ reason, msg.table.table_id, msg.table.config,
+ repr(msg.table.properties))
+ """
+ def __init__(self, datapath, reason=None, table=None):
+ super(OFPTableStatus, self).__init__(datapath)
+ self.reason = reason
+ self.table = table
+
+ @classmethod
+ def parser(cls, datapath, version, msg_type, msg_len, xid, buf):
+ msg = super(OFPTableStatus, cls).parser(datapath, version, msg_type,
+ msg_len, xid, buf)
+ (msg.reason,) = struct.unpack_from(ofproto.OFP_TABLE_STATUS_0_PACK_STR,
+ msg.buf, ofproto.OFP_HEADER_SIZE)
+
+ msg.table = OFPTableDesc.parser(msg.buf,
+ ofproto.OFP_TABLE_STATUS_0_SIZE)
+
+ return msg
+
+
@_set_msg_type(ofproto.OFPT_PACKET_OUT)
class OFPPacketOut(MsgBase):
"""
--
1.8.5.2
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel