On Mon, 14 May 2012 13:45:54 +0900 Isaku Yamahata <[email protected]> wrote:
> On Mon, May 14, 2012 at 01:09:46PM +0900, FUJITA Tomonori wrote: >> Signed-off-by: FUJITA Tomonori <[email protected]> >> --- >> ryu/ofproto/ofproto_v1_0.py | 6 ++++++ >> ryu/ofproto/ofproto_v1_0_parser.py | 23 +++++++++++++++++++++++ >> 2 files changed, 29 insertions(+), 0 deletions(-) >> >> diff --git a/ryu/ofproto/ofproto_v1_0.py b/ryu/ofproto/ofproto_v1_0.py >> index b7acd5f..a757e13 100644 >> --- a/ryu/ofproto/ofproto_v1_0.py >> +++ b/ryu/ofproto/ofproto_v1_0.py >> @@ -241,6 +241,8 @@ NXAST_MULTIPATH = 10 >> NXAST_BUNDLE = 12 >> NXAST_BUNDLE_LOAD = 13 >> NXAST_RESUBMIT_TABLE = 14 >> +NXAST_OUTPUT_REG = 15 >> + >> >> NX_ACTION_RESUBMIT_PACK_STR = '!HHIHHB3x' >> NX_ACTION_RESUBMIT_SIZE = 16 >> @@ -270,6 +272,10 @@ NX_ACTION_BUNDLE_PACK_STR = '!HHIHHHHIHHI4x' >> NX_ACTION_BUNDLE_SIZE = 32 >> assert calcsize(NX_ACTION_BUNDLE_PACK_STR) == NX_ACTION_BUNDLE_SIZE >> >> +NX_ACTION_OUTPUT_REG_PACK_STR = '!HHIHHIH6x' >> +NX_ACTION_OUTPUT_REG_SIZE = 24 >> +assert calcsize(NX_ACTION_OUTPUT_REG_PACK_STR) == NX_ACTION_OUTPUT_REG_SIZE >> + >> NX_ACTION_HEADER_PACK_STR = '!HHIH' >> NX_ACTION_HEADER_SIZE = 10 >> assert calcsize(NX_ACTION_HEADER_PACK_STR) == NX_ACTION_HEADER_SIZE >> diff --git a/ryu/ofproto/ofproto_v1_0_parser.py >> b/ryu/ofproto/ofproto_v1_0_parser.py >> index d2f8cd1..a928dd5 100644 >> --- a/ryu/ofproto/ofproto_v1_0_parser.py >> +++ b/ryu/ofproto/ofproto_v1_0_parser.py >> @@ -661,6 +661,29 @@ class NXActionBundleLoad(NXActionBundleBase): >> return NXActionBundleBase.parser(NXActionBundleLoad, buf, offset) >> >> >> [email protected]_nx_action_subtype(ofproto_v1_0.NXAST_OUTPUT_REG) >> +class NXActionOutputReg(NXActionHeader): >> + def __init__(self, ofs_nbits, src, max_len): >> + super(NXActionOutputReg, self).__init__( >> + ofproto_v1_0.NXAST_OUTPUT_REG, >> + ofproto_v1_0.NX_ACTION_OUTPUT_REG_SIZE) >> + self.ofs_nbits = ofs_nbits >> + self.src = src >> + self.max_len = max_len >> + >> + def serialize(self, buf, offset): >> + msg_pack_into(ofproto_v1_0.NX_ACTION_OUTPUT_REG_PACK_STR, buf, >> offset, >> + self.type, self.len, self.vendor, self.subtype, >> + self.ofs_nbits, self.src, self.max_len) >> + >> + @classmethod >> + def parser(cls, buf, offset): >> + type_, len_, vendor, subtype, ofs_nbits, src,\ >> + max_len = struct.unpack_from( >> + ofproto_v1_0.NX_ACTION_OUTPUT_REG_PACK_STR, buf, offset) >> + return cls(subtype, ofs_nbits, src) >> + >> + > > Minor nitpick. > '\' can be avoided with parens like > (type_, len_, ... > max_len) = struct.unpack_from(...) Ah, looks prettier. I've fixed and merged the patch. Thanks, ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
