This class is parser class for OFPPDPT_RECIRCULATE type in Port Description Properties.
Signed-off-by: IWASE Yusuke <[email protected]> --- ryu/ofproto/ofproto_v1_5_parser.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ryu/ofproto/ofproto_v1_5_parser.py b/ryu/ofproto/ofproto_v1_5_parser.py index bc83a30..cdc87d8 100644 --- a/ryu/ofproto/ofproto_v1_5_parser.py +++ b/ryu/ofproto/ofproto_v1_5_parser.py @@ -992,6 +992,33 @@ class OFPPortDescPropOxm(OFPPortDescProp): return bin_ids [email protected]_type(ofproto.OFPPDPT_RECIRCULATE) +class OFPPortDescPropRecirculate(OFPPortDescProp): + _PORT_NO_PACK_STR = '!I' + + def __init__(self, type_=None, length=None, port_nos=[]): + super(OFPPortDescPropRecirculate, self).__init__(type_, length) + self.port_nos = port_nos + + @classmethod + def parser(cls, buf): + rest = cls.get_rest(buf) + nos = [] + while rest: + (n,) = struct.unpack_from(cls._PORT_NO_PACK_STR, buffer(rest), 0) + rest = rest[struct.calcsize(cls._PORT_NO_PACK_STR):] + nos.append(n) + return cls(port_nos=nos) + + def serialize_body(self): + bin_nos = bytearray() + for n in self.port_nos: + bin_no = bytearray() + msg_pack_into(self._PORT_NO_PACK_STR, bin_no, 0, n) + bin_nos += bin_no + return bin_nos + + @OFPPortDescProp.register_type(ofproto.OFPPDPT_EXPERIMENTER) class OFPPortDescPropExperimenter(OFPPropCommonExperimenter4ByteData): pass -- 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
