OpenFlow Spec 1.5 introduces new instruction OFPIT_STAT_TRIGGER to define a set of statistics thresholds using OXS (EXT-335).
This patch adds OFPIT_STAT_TRIGGER instruction support. Signed-off-by: IWASE Yusuke <[email protected]> --- ryu/ofproto/ofproto_v1_5_parser.py | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/ryu/ofproto/ofproto_v1_5_parser.py b/ryu/ofproto/ofproto_v1_5_parser.py index b8aaa2a..860e8d8 100644 --- a/ryu/ofproto/ofproto_v1_5_parser.py +++ b/ryu/ofproto/ofproto_v1_5_parser.py @@ -5090,6 +5090,51 @@ class OFPInstructionActions(OFPInstruction): buf, offset, self.type, self.len) [email protected]_instruction_type([ofproto.OFPIT_STAT_TRIGGER]) +class OFPInstructionStatTrigger(OFPInstruction): + """ + Statistics triggers instruction + + This instruction defines a set of statistics thresholds using OXS. + + ================ ====================================================== + Attribute Description + ================ ====================================================== + flags Bitmap of the following flags. + + | OFPSTF_PERIODIC + | OFPSTF_ONLY_FIRST + thresholds Instance of ``OFPStats`` + ================ ====================================================== + """ + def __init__(self, flags, thresholds, type_=None, len_=None): + super(OFPInstructionStatTrigger, self).__init__() + self.type = ofproto.OFPIT_STAT_TRIGGER + self.len = len_ + self.flags = flags + self.thresholds = thresholds + + @classmethod + def parser(cls, buf, offset): + (type_, len_, flags) = struct.unpack_from( + ofproto.OFP_INSTRUCTION_STAT_TRIGGER_PACK_STR0, buf, offset) + + # adjustment + offset += 8 + thresholds = OFPStats.parser(buf, offset) + + inst = cls(flags, thresholds) + inst.len = len_ + return inst + + def serialize(self, buf, offset): + stats_len = self.thresholds.serialize(buf, offset + 8) + + self.len = 8 + stats_len + msg_pack_into(ofproto.OFP_INSTRUCTION_STAT_TRIGGER_PACK_STR0, + buf, offset, self.type, self.len, self.flags) + + class OFPActionHeader(StringifyMixin): def __init__(self, type_, len_): self.type = type_ -- 1.9.1 ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
