of13: correct parser() in several OFPActions

before applying this patch:
  - parser() of OFPActionDecMplsTtl calls itself recursively.
  - parser() of OFPActionDecNwTtl, OFPActionCopyTtlOut, OFPActionCopyTtlIn and OFPActionPopVlan fail by shortage of arguments.

after applying this patch:
  - all parser() of OFPActions work nicely.

Signed-off-by: itoyuichi <ito.yuichi0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Yuichi Ito 2013-10-09 17:02:43 +09:00 committed by FUJITA Tomonori
parent 05011f5116
commit 3b29d45ebe

View File

@ -2702,6 +2702,12 @@ class OFPActionDecMplsTtl(OFPAction):
def __init__(self, type_=None, len_=None):
super(OFPActionDecMplsTtl, self).__init__()
@classmethod
def parser(cls, buf, offset):
(type_, len_) = struct.unpack_from(
ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
return cls()
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_SET_NW_TTL,
ofproto_v1_3.OFP_ACTION_NW_TTL_SIZE)
@ -2745,7 +2751,8 @@ class OFPActionDecNwTtl(OFPAction):
@classmethod
def parser(cls, buf, offset):
msg_pack_into(ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
(type_, len_) = struct.unpack_from(
ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
return cls()
@ -2763,7 +2770,8 @@ class OFPActionCopyTtlOut(OFPAction):
@classmethod
def parser(cls, buf, offset):
msg_pack_into(ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
(type_, len_) = struct.unpack_from(
ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
return cls()
@ -2781,7 +2789,8 @@ class OFPActionCopyTtlIn(OFPAction):
@classmethod
def parser(cls, buf, offset):
msg_pack_into(ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
(type_, len_) = struct.unpack_from(
ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
return cls()
@ -2856,7 +2865,8 @@ class OFPActionPopVlan(OFPAction):
@classmethod
def parser(cls, buf, offset):
msg_pack_into(ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
(type_, len_) = struct.unpack_from(
ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
return cls()