Signed-off-by: OHMURA Kei <[email protected]>
---
ryu/ofproto/ofproto_v1_0.py | 10 +++++++++
ryu/ofproto/ofproto_v1_0_parser.py | 41 ++++++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+)
diff --git a/ryu/ofproto/ofproto_v1_0.py b/ryu/ofproto/ofproto_v1_0.py
index ca6e384..1b4c414 100644
--- a/ryu/ofproto/ofproto_v1_0.py
+++ b/ryu/ofproto/ofproto_v1_0.py
@@ -669,6 +669,16 @@ NX_FLOW_STATS_PACK_STR = '!HBxIIHHHHHHQQQ'
NX_FLOW_STATS_SIZE = 48
assert calcsize(NX_FLOW_STATS_PACK_STR) == NX_FLOW_STATS_SIZE
+NX_AGGREGATE_STATS_REQUEST_PACK_STR = '!2HB3x'
+NX_AGGREGATE_STATS_REQUEST_SIZE = 8
+assert (calcsize(NX_AGGREGATE_STATS_REQUEST_PACK_STR) ==
+ NX_AGGREGATE_STATS_REQUEST_SIZE)
+
+NX_AGGREGATE_STATS_REPLY_PACK_STR = '!QQI4x'
+NX_AGGREGATE_STATS_REPLY_SIZE = 24
+assert (calcsize(NX_AGGREGATE_STATS_REPLY_PACK_STR) ==
+ NX_AGGREGATE_STATS_REPLY_SIZE)
+
def nxm_header__(vendor, field, hasmask, length):
return (vendor << 16) | (field << 9) | (hasmask << 8) | length
diff --git a/ryu/ofproto/ofproto_v1_0_parser.py
b/ryu/ofproto/ofproto_v1_0_parser.py
index 7945888..8df1dd4 100644
--- a/ryu/ofproto/ofproto_v1_0_parser.py
+++ b/ryu/ofproto/ofproto_v1_0_parser.py
@@ -1080,6 +1080,18 @@ class NXFlowStats(object):
return nxflow_stats
+class NXAggregateStats(collections.namedtuple('NXAggregateStats', (
+ 'packet_count', 'byte_count', 'flow_count'))):
+ @classmethod
+ def parser(cls, buf, offset):
+ agg = struct.unpack_from(
+ ofproto_v1_0.NX_AGGREGATE_STATS_REPLY_PACK_STR, buf, offset)
+ stats = cls(*agg)
+ stats.length = ofproto_v1_0.NX_AGGREGATE_STATS_REPLY_SIZE
+
+ return stats
+
+
class OFPQueuePropHeader(object):
_QUEUE_PROPERTIES = {}
@@ -1920,6 +1932,13 @@ class NXFlowStatsReply(NXStatsReply):
super(NXFlowStatsReply, self).__init__(datapath)
[email protected]_nx_stats_type()
+@_set_stats_type(ofproto_v1_0.NXST_AGGREGATE, NXAggregateStats)
+class NXAggregateStatsReply(NXStatsReply):
+ def __init__(self, datapath):
+ super(NXAggregateStatsReply, self).__init__(datapath)
+
+
#
# controller-to-switch message
# serializer only
@@ -2213,3 +2232,25 @@ class NXFlowStatsRequest(NXStatsRequest):
ofproto_v1_0.NX_FLOW_STATS_REQUEST_PACK_STR,
self.buf, ofproto_v1_0.NX_STATS_MSG_SIZE, self.out_port,
self.match_len, self.table_id)
+
+
+class NXAggregateStatsRequest(NXStatsRequest):
+ def __init__(self, datapath, flags, out_port, table_id, rule=None):
+ super(NXAggregateStatsRequest, self).__init__(
+ datapath, flags, ofproto_v1_0.NXST_AGGREGATE)
+ self.out_port = out_port
+ self.table_id = table_id
+ self.rule = rule
+ self.match_len = 0
+
+ def _serialize_vendor_stats_body(self):
+ if self.rule is not None:
+ offset = ofproto_v1_0.NX_STATS_MSG_SIZE + \
+ ofproto_v1_0.NX_AGGREGATE_STATS_REQUEST_SIZE
+ self.match_len = nx_match.serialize_nxm_match(
+ self.rule, self.buf, offset)
+
+ msg_pack_into(
+ ofproto_v1_0.NX_AGGREGATE_STATS_REQUEST_PACK_STR,
+ self.buf, ofproto_v1_0.NX_STATS_MSG_SIZE, self.out_port,
+ self.match_len, self.table_id)
--
1.7.9.5
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel