Signed-off-by: Simon Horman <[email protected]>
---
ryu/ofproto/ofproto_v1_4_parser.py | 97 ++++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
diff --git a/ryu/ofproto/ofproto_v1_4_parser.py
b/ryu/ofproto/ofproto_v1_4_parser.py
index 4b35a30..17ae43a 100644
--- a/ryu/ofproto/ofproto_v1_4_parser.py
+++ b/ryu/ofproto/ofproto_v1_4_parser.py
@@ -2127,6 +2127,103 @@ class OFPGroupFeaturesStatsReply(OFPMultipartReply):
super(OFPGroupFeaturesStatsReply, self).__init__(datapath, **kwargs)
+class OFPMeterConfigStats(StringifyMixin):
+ def __init__(self, flags=None, meter_id=None, bands=None, length=None):
+ super(OFPMeterConfigStats, self).__init__()
+ self.length = None
+ self.flags = flags
+ self.meter_id = meter_id
+ self.bands = bands
+
+ @classmethod
+ def parser(cls, buf, offset):
+ meter_config = cls()
+
+ (meter_config.length, meter_config.flags,
+ meter_config.meter_id) = struct.unpack_from(
+ ofproto.OFP_METER_CONFIG_PACK_STR, buf, offset)
+ offset += ofproto.OFP_METER_CONFIG_SIZE
+
+ meter_config.bands = []
+ length = ofproto.OFP_METER_CONFIG_SIZE
+ while length < meter_config.length:
+ band = OFPMeterBandHeader.parser(buf, offset)
+ meter_config.bands.append(band)
+ offset += band.len
+ length += band.len
+
+ return meter_config
+
+
+@_set_stats_type(ofproto.OFPMP_METER_CONFIG, OFPMeterConfigStats)
+@_set_msg_type(ofproto.OFPT_MULTIPART_REQUEST)
+class OFPMeterConfigStatsRequest(OFPMultipartRequest):
+ """
+ Meter configuration statistics request message
+
+ The controller uses this message to query configuration for one or more
+ meters.
+
+ ================ ======================================================
+ Attribute Description
+ ================ ======================================================
+ flags Zero or ``OFPMPF_REQ_MORE``
+ meter_id ID of meter to read (OFPM_ALL to all meters)
+ ================ ======================================================
+
+ Example::
+
+ def send_meter_config_stats_request(self, datapath):
+ ofp = datapath.ofproto
+ ofp_parser = datapath.ofproto_parser
+
+ req = ofp_parser.OFPMeterConfigStatsRequest(datapath, 0,
+ ofp.OFPM_ALL)
+ datapath.send_msg(req)
+ """
+ def __init__(self, datapath, flags, meter_id, type_=None):
+ super(OFPMeterConfigStatsRequest, self).__init__(datapath, flags)
+ self.meter_id = meter_id
+
+ def _serialize_stats_body(self):
+ msg_pack_into(ofproto.OFP_METER_MULTIPART_REQUEST_PACK_STR,
+ self.buf,
+ ofproto.OFP_MULTIPART_REQUEST_SIZE,
+ self.meter_id)
+
+
[email protected]_stats_type()
+@_set_stats_type(ofproto.OFPMP_METER_CONFIG, OFPMeterConfigStats)
+@_set_msg_type(ofproto.OFPT_MULTIPART_REPLY)
+class OFPMeterConfigStatsReply(OFPMultipartReply):
+ """
+ Meter configuration statistics reply message
+
+ The switch responds with this message to a meter configuration
+ statistics request.
+
+ ================ ======================================================
+ Attribute Description
+ ================ ======================================================
+ body List of ``OFPMeterConfigStats`` instance
+ ================ ======================================================
+
+ Example::
+
+ @set_ev_cls(ofp_event.EventOFPMeterConfigStatsReply, MAIN_DISPATCHER)
+ def meter_config_stats_reply_handler(self, ev):
+ configs = []
+ for stat in ev.msg.body:
+ configs.append('length=%d flags=0x%04x meter_id=0x%08x '
+ 'bands=%s' %
+ (stat.length, stat.flags, stat.meter_id,
+ stat.bands))
+ self.logger.debug('MeterConfigStats: %s', configs)
+ """
+ def __init__(self, datapath, type_=None, **kwargs):
+ super(OFPMeterConfigStatsReply, self).__init__(datapath, **kwargs)
+
+
class OFPMeterBand(StringifyMixin):
def __init__(self, type_, len_):
super(OFPMeterBand, self).__init__()
--
1.8.5.2
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends. Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel