Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
ryu/ofproto/ofproto_v1_3_parser.py | 78 +++++++++++++++++---------------------
1 file changed, 35 insertions(+), 43 deletions(-)
diff --git a/ryu/ofproto/ofproto_v1_3_parser.py
b/ryu/ofproto/ofproto_v1_3_parser.py
index 1392604..fe366e0 100644
--- a/ryu/ofproto/ofproto_v1_3_parser.py
+++ b/ryu/ofproto/ofproto_v1_3_parser.py
@@ -1884,9 +1884,7 @@ class OFPInstruction(object):
@OFPInstruction.register_instruction_type([ofproto_v1_3.OFPIT_GOTO_TABLE])
class OFPInstructionGotoTable(StringifyMixin):
- _base_attributes = ['type', 'len']
-
- def __init__(self, table_id):
+ def __init__(self, table_id, type_=None, len_=None):
super(OFPInstructionGotoTable, self).__init__()
self.type = ofproto_v1_3.OFPIT_GOTO_TABLE
self.len = ofproto_v1_3.OFP_INSTRUCTION_GOTO_TABLE_SIZE
@@ -1906,9 +1904,7 @@ class OFPInstructionGotoTable(StringifyMixin):
@OFPInstruction.register_instruction_type([ofproto_v1_3.OFPIT_WRITE_METADATA])
class OFPInstructionWriteMetadata(StringifyMixin):
- _base_attributes = ['type', 'len']
-
- def __init__(self, metadata, metadata_mask):
+ def __init__(self, metadata, metadata_mask, len_=None):
super(OFPInstructionWriteMetadata, self).__init__()
self.type = ofproto_v1_3.OFPIT_WRITE_METADATA
self.len = ofproto_v1_3.OFP_INSTRUCTION_WRITE_METADATA_SIZE
@@ -1932,9 +1928,7 @@ class OFPInstructionWriteMetadata(StringifyMixin):
ofproto_v1_3.OFPIT_APPLY_ACTIONS,
ofproto_v1_3.OFPIT_CLEAR_ACTIONS])
class OFPInstructionActions(StringifyMixin):
- _base_attributes = ['len']
-
- def __init__(self, type_, actions=None):
+ def __init__(self, type_, actions=None, len_=None):
super(OFPInstructionActions, self).__init__()
self.type = type_
self.actions = actions
@@ -1997,8 +1991,6 @@ class OFPInstructionMeter(StringifyMixin):
class OFPActionHeader(StringifyMixin):
- _base_attributes = ['type', 'len']
-
def __init__(self, type_, len_):
self.type = type_
self.len = len_
@@ -2037,7 +2029,7 @@ class OFPAction(OFPActionHeader):
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_OUTPUT,
ofproto_v1_3.OFP_ACTION_OUTPUT_SIZE)
class OFPActionOutput(OFPAction):
- def __init__(self, port, max_len=0):
+ def __init__(self, port, max_len=0, type_=None, len_=None):
super(OFPActionOutput, self).__init__()
self.port = port
self.max_len = max_len
@@ -2056,7 +2048,7 @@ class OFPActionOutput(OFPAction):
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_GROUP,
ofproto_v1_3.OFP_ACTION_GROUP_SIZE)
class OFPActionGroup(OFPAction):
- def __init__(self, group_id):
+ def __init__(self, group_id, type_=None, len_=None):
super(OFPActionGroup, self).__init__()
self.group_id = group_id
@@ -2074,7 +2066,7 @@ class OFPActionGroup(OFPAction):
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_SET_QUEUE,
ofproto_v1_3.OFP_ACTION_SET_QUEUE_SIZE)
class OFPActionSetQueue(OFPAction):
- def __init__(self, queue_id):
+ def __init__(self, queue_id, type_=None, len_=None):
super(OFPActionSetQueue, self).__init__()
self.queue_id = queue_id
@@ -2092,7 +2084,7 @@ class OFPActionSetQueue(OFPAction):
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_SET_MPLS_TTL,
ofproto_v1_3.OFP_ACTION_MPLS_TTL_SIZE)
class OFPActionSetMplsTtl(OFPAction):
- def __init__(self, mpls_ttl):
+ def __init__(self, mpls_ttl, type_=None, len_=None):
super(OFPActionSetMplsTtl, self).__init__()
self.mpls_ttl = mpls_ttl
@@ -2110,14 +2102,14 @@ class OFPActionSetMplsTtl(OFPAction):
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_DEC_MPLS_TTL,
ofproto_v1_3.OFP_ACTION_HEADER_SIZE)
class OFPActionDecMplsTtl(OFPAction):
- def __init__(self):
+ def __init__(self, type_=None, len_=None):
super(OFPActionDecMplsTtl, self).__init__()
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_SET_NW_TTL,
ofproto_v1_3.OFP_ACTION_NW_TTL_SIZE)
class OFPActionSetNwTtl(OFPAction):
- def __init__(self, nw_ttl):
+ def __init__(self, nw_ttl, type_=None, len_=None):
super(OFPActionSetNwTtl, self).__init__()
self.nw_ttl = nw_ttl
@@ -2135,7 +2127,7 @@ class OFPActionSetNwTtl(OFPAction):
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_DEC_NW_TTL,
ofproto_v1_3.OFP_ACTION_HEADER_SIZE)
class OFPActionDecNwTtl(OFPAction):
- def __init__(self):
+ def __init__(self, type_=None, len_=None):
super(OFPActionDecNwTtl, self).__init__()
@classmethod
@@ -2147,7 +2139,7 @@ class OFPActionDecNwTtl(OFPAction):
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_COPY_TTL_OUT,
ofproto_v1_3.OFP_ACTION_HEADER_SIZE)
class OFPActionCopyTtlOut(OFPAction):
- def __init__(self):
+ def __init__(self, type_=None, len_=None):
super(OFPActionCopyTtlOut, self).__init__()
@classmethod
@@ -2159,7 +2151,7 @@ class OFPActionCopyTtlOut(OFPAction):
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_COPY_TTL_IN,
ofproto_v1_3.OFP_ACTION_HEADER_SIZE)
class OFPActionCopyTtlIn(OFPAction):
- def __init__(self):
+ def __init__(self, type_=None, len_=None):
super(OFPActionCopyTtlIn, self).__init__()
@classmethod
@@ -2171,7 +2163,7 @@ class OFPActionCopyTtlIn(OFPAction):
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_PUSH_VLAN,
ofproto_v1_3.OFP_ACTION_PUSH_SIZE)
class OFPActionPushVlan(OFPAction):
- def __init__(self, ethertype):
+ def __init__(self, ethertype, type_=None, len_=None):
super(OFPActionPushVlan, self).__init__()
self.ethertype = ethertype
@@ -2189,7 +2181,7 @@ class OFPActionPushVlan(OFPAction):
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_PUSH_MPLS,
ofproto_v1_3.OFP_ACTION_PUSH_SIZE)
class OFPActionPushMpls(OFPAction):
- def __init__(self, ethertype):
+ def __init__(self, ethertype, type_=None, len_=None):
super(OFPActionPushMpls, self).__init__()
self.ethertype = ethertype
@@ -2207,7 +2199,7 @@ class OFPActionPushMpls(OFPAction):
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_POP_VLAN,
ofproto_v1_3.OFP_ACTION_HEADER_SIZE)
class OFPActionPopVlan(OFPAction):
- def __init__(self):
+ def __init__(self, type_=None, len_=None):
super(OFPActionPopVlan, self).__init__()
@classmethod
@@ -2219,7 +2211,7 @@ class OFPActionPopVlan(OFPAction):
@OFPAction.register_action_type(ofproto_v1_3.OFPAT_POP_MPLS,
ofproto_v1_3.OFP_ACTION_POP_MPLS_SIZE)
class OFPActionPopMpls(OFPAction):
- def __init__(self, ethertype):
+ def __init__(self, ethertype, type_=None, len_=None):
super(OFPActionPopMpls, self).__init__()
self.ethertype = ethertype
@@ -2350,7 +2342,7 @@ class OFPActionSetField(OFPAction):
ofproto_v1_3.OFPAT_EXPERIMENTER,
ofproto_v1_3.OFP_ACTION_EXPERIMENTER_HEADER_SIZE)
class OFPActionExperimenter(OFPAction):
- def __init__(self, experimenter):
+ def __init__(self, experimenter, type_=None, len_=None):
super(OFPActionExperimenter, self).__init__()
self.experimenter = experimenter
@@ -2366,7 +2358,7 @@ class OFPActionExperimenter(OFPAction):
class OFPBucket(StringifyMixin):
- def __init__(self, weight, watch_port, watch_group, actions):
+ def __init__(self, weight, watch_port, watch_group, actions, len_=None):
super(OFPBucket, self).__init__()
self.weight = weight
self.watch_port = watch_port
@@ -2378,11 +2370,11 @@ class OFPBucket(StringifyMixin):
(len_, weight, watch_port, watch_group) = struct.unpack_from(
ofproto_v1_3.OFP_BUCKET_PACK_STR, buf, offset)
msg = cls(weight, watch_port, watch_group, [])
- msg._len = len_
+ msg.len = len_
length = ofproto_v1_3.OFP_BUCKET_SIZE
offset += ofproto_v1_3.OFP_BUCKET_SIZE
- while length < msg._len:
+ while length < msg.len:
action = OFPAction.parser(buf, offset)
msg.actions.append(action)
offset += action.len
@@ -2398,10 +2390,9 @@ class OFPBucket(StringifyMixin):
action_offset += a.len
action_len += a.len
- self._len = utils.round_up(ofproto_v1_3.OFP_BUCKET_SIZE + action_len,
- 8)
+ self.len = utils.round_up(ofproto_v1_3.OFP_BUCKET_SIZE + action_len, 8)
msg_pack_into(ofproto_v1_3.OFP_BUCKET_PACK_STR, buf, offset,
- self._len, self.weight, self.watch_port,
+ self.len, self.weight, self.watch_port,
self.watch_group)
@@ -2422,7 +2413,7 @@ class OFPGroupMod(MsgBase):
offset = ofproto_v1_3.OFP_GROUP_MOD_SIZE
for b in self.buckets:
b.serialize(self.buf, offset)
- offset += b._len
+ offset += b.len
@_set_msg_type(ofproto_v1_3.OFPT_PORT_MOD)
@@ -2892,8 +2883,8 @@ class OFPGroupDescStats(StringifyMixin):
bucket = OFPBucket.parser(buf, offset)
stats.buckets.append(bucket)
- offset += bucket._len
- length += bucket._len
+ offset += bucket.len
+ length += bucket.len
return stats
@@ -3298,11 +3289,11 @@ class OFPQueueGetConfigRequest(MsgBase):
class OFPQueuePropHeader(StringifyMixin):
def __init__(self, property_, len_):
self._property = property_
- self._len = len_
+ self.len = len_
def serialize(self, buf, offset):
msg_pack_into(ofproto_v1_3.OFP_QUEUE_PROP_HEADER_PACK_STR,
- buf, offset, self._property, self._len)
+ buf, offset, self._property, self.len)
class OFPQueueProp(OFPQueuePropHeader):
@@ -3336,7 +3327,7 @@ class OFPQueueProp(OFPQueuePropHeader):
ofproto_v1_3.OFPQT_MIN_RATE,
ofproto_v1_3.OFP_QUEUE_PROP_MIN_RATE_SIZE)
class OFPQueuePropMinRate(OFPQueueProp):
- def __init__(self, rate):
+ def __init__(self, rate, len_=None):
super(OFPQueuePropMinRate, self).__init__()
self.rate = rate
@@ -3351,7 +3342,7 @@ class OFPQueuePropMinRate(OFPQueueProp):
ofproto_v1_3.OFPQT_MAX_RATE,
ofproto_v1_3.OFP_QUEUE_PROP_MAX_RATE_SIZE)
class OFPQueuePropMaxRate(OFPQueueProp):
- def __init__(self, rate):
+ def __init__(self, rate, len_=None):
super(OFPQueuePropMaxRate, self).__init__()
self.rate = rate
@@ -3366,10 +3357,11 @@ class OFPQueuePropMaxRate(OFPQueueProp):
class OFPPacketQueue(StringifyMixin):
- def __init__(self, queue_id, port, properties):
+ def __init__(self, queue_id, port, properties, len_=None):
super(OFPPacketQueue, self).__init__()
self.queue_id = queue_id
self.port = port
+ self.len = len_
self.properties = properties
@classmethod
@@ -3382,10 +3374,10 @@ class OFPPacketQueue(StringifyMixin):
while length < len_:
queue_prop = OFPQueueProp.parser(buf, offset)
properties.append(queue_prop)
- offset += queue_prop._len
- length += queue_prop._len
+ offset += queue_prop.len
+ length += queue_prop.len
o = cls(queue_id, port, properties)
- o._len = len_
+ o.len = len_
return o
@@ -3411,7 +3403,7 @@ class OFPQueueGetConfigReply(MsgBase):
while offset < msg_len:
queue = OFPPacketQueue.parser(msg.buf, offset)
msg.queues.append(queue)
- offset += queue._len
+ offset += queue.len
return msg
--
1.8.3.1
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel