mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-05 04:16:11 +02:00
of12: some "len" "type" attributes visible to user
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
a6b71f671e
commit
80533a0afb
@ -940,9 +940,7 @@ class OFPInstructionGotoTable(StringifyMixin):
|
||||
table_id Next table
|
||||
================ ======================================================
|
||||
"""
|
||||
_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_2.OFPIT_GOTO_TABLE
|
||||
self.len = ofproto_v1_2.OFP_INSTRUCTION_GOTO_TABLE_SIZE
|
||||
@ -974,9 +972,7 @@ class OFPInstructionWriteMetadata(StringifyMixin):
|
||||
metadata_mask Metadata write bitmask
|
||||
================ ======================================================
|
||||
"""
|
||||
_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_2.OFPIT_WRITE_METADATA
|
||||
self.len = ofproto_v1_2.OFP_INSTRUCTION_WRITE_METADATA_SIZE
|
||||
@ -1015,9 +1011,7 @@ class OFPInstructionActions(StringifyMixin):
|
||||
actions list of OpenFlow action class
|
||||
================ ======================================================
|
||||
"""
|
||||
_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
|
||||
@ -1059,8 +1053,6 @@ class OFPInstructionActions(StringifyMixin):
|
||||
|
||||
|
||||
class OFPActionHeader(StringifyMixin):
|
||||
_base_attributes = ['type', 'len']
|
||||
|
||||
def __init__(self, type_, len_):
|
||||
self.type = type_
|
||||
self.len = len_
|
||||
@ -1115,7 +1107,7 @@ class OFPActionOutput(OFPAction):
|
||||
max_len Max length to send to controller
|
||||
================ ======================================================
|
||||
"""
|
||||
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
|
||||
@ -1145,7 +1137,7 @@ class OFPActionGroup(OFPAction):
|
||||
group_id Group identifier
|
||||
================ ======================================================
|
||||
"""
|
||||
def __init__(self, group_id):
|
||||
def __init__(self, group_id, type_=None, len_=None):
|
||||
super(OFPActionGroup, self).__init__()
|
||||
self.group_id = group_id
|
||||
|
||||
@ -1175,7 +1167,7 @@ class OFPActionSetQueue(OFPAction):
|
||||
queue_id Queue ID for the packets
|
||||
================ ======================================================
|
||||
"""
|
||||
def __init__(self, queue_id):
|
||||
def __init__(self, queue_id, type_=None, len_=None):
|
||||
super(OFPActionSetQueue, self).__init__()
|
||||
self.queue_id = queue_id
|
||||
|
||||
@ -1204,7 +1196,7 @@ class OFPActionSetMplsTtl(OFPAction):
|
||||
mpls_ttl MPLS TTL
|
||||
================ ======================================================
|
||||
"""
|
||||
def __init__(self, mpls_ttl):
|
||||
def __init__(self, mpls_ttl, type_=None, len_=None):
|
||||
super(OFPActionSetMplsTtl, self).__init__()
|
||||
self.mpls_ttl = mpls_ttl
|
||||
|
||||
@ -1227,7 +1219,7 @@ class OFPActionDecMplsTtl(OFPAction):
|
||||
|
||||
This action decrements the MPLS TTL.
|
||||
"""
|
||||
def __init__(self):
|
||||
def __init__(self, type_=None, len_=None):
|
||||
super(OFPActionDecMplsTtl, self).__init__()
|
||||
|
||||
@classmethod
|
||||
@ -1251,7 +1243,7 @@ class OFPActionSetNwTtl(OFPAction):
|
||||
nw_ttl IP TTL
|
||||
================ ======================================================
|
||||
"""
|
||||
def __init__(self, nw_ttl):
|
||||
def __init__(self, nw_ttl, type_=None, len_=None):
|
||||
super(OFPActionSetNwTtl, self).__init__()
|
||||
self.nw_ttl = nw_ttl
|
||||
|
||||
@ -1274,7 +1266,7 @@ class OFPActionDecNwTtl(OFPAction):
|
||||
|
||||
This action decrements the IP TTL.
|
||||
"""
|
||||
def __init__(self):
|
||||
def __init__(self, type_=None, len_=None):
|
||||
super(OFPActionDecNwTtl, self).__init__()
|
||||
|
||||
@classmethod
|
||||
@ -1293,7 +1285,7 @@ class OFPActionCopyTtlOut(OFPAction):
|
||||
This action copies the TTL from the next-to-outermost header with TTL to
|
||||
the outermost header with TTL.
|
||||
"""
|
||||
def __init__(self):
|
||||
def __init__(self, type_=None, len_=None):
|
||||
super(OFPActionCopyTtlOut, self).__init__()
|
||||
|
||||
@classmethod
|
||||
@ -1312,7 +1304,7 @@ class OFPActionCopyTtlIn(OFPAction):
|
||||
This action copies the TTL from the outermost header with TTL to the
|
||||
next-to-outermost header with TTL.
|
||||
"""
|
||||
def __init__(self):
|
||||
def __init__(self, type_=None, len_=None):
|
||||
super(OFPActionCopyTtlIn, self).__init__()
|
||||
|
||||
@classmethod
|
||||
@ -1336,7 +1328,7 @@ class OFPActionPushVlan(OFPAction):
|
||||
ethertype Ether type
|
||||
================ ======================================================
|
||||
"""
|
||||
def __init__(self, ethertype):
|
||||
def __init__(self, ethertype, type_=None, len_=None):
|
||||
super(OFPActionPushVlan, self).__init__()
|
||||
self.ethertype = ethertype
|
||||
|
||||
@ -1365,7 +1357,7 @@ class OFPActionPushMpls(OFPAction):
|
||||
ethertype Ether type
|
||||
================ ======================================================
|
||||
"""
|
||||
def __init__(self, ethertype):
|
||||
def __init__(self, ethertype, type_=None, len_=None):
|
||||
super(OFPActionPushMpls, self).__init__()
|
||||
self.ethertype = ethertype
|
||||
|
||||
@ -1388,7 +1380,7 @@ class OFPActionPopVlan(OFPAction):
|
||||
|
||||
This action pops the outermost VLAN tag from the packet.
|
||||
"""
|
||||
def __init__(self):
|
||||
def __init__(self, type_=None, len_=None):
|
||||
super(OFPActionPopVlan, self).__init__()
|
||||
|
||||
@classmethod
|
||||
@ -1406,7 +1398,7 @@ class OFPActionPopMpls(OFPAction):
|
||||
|
||||
This action pops the MPLS header from the packet.
|
||||
"""
|
||||
def __init__(self, ethertype):
|
||||
def __init__(self, ethertype, type_=None, len_=None):
|
||||
super(OFPActionPopMpls, self).__init__()
|
||||
self.ethertype = ethertype
|
||||
|
||||
@ -1558,7 +1550,7 @@ class OFPActionExperimenter(OFPAction):
|
||||
experimenter Experimenter ID
|
||||
================ ======================================================
|
||||
"""
|
||||
def __init__(self, experimenter):
|
||||
def __init__(self, experimenter, type_=None, len_=None):
|
||||
super(OFPActionExperimenter, self).__init__()
|
||||
self.experimenter = experimenter
|
||||
|
||||
@ -1576,7 +1568,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
|
||||
@ -1598,7 +1590,7 @@ class OFPBucket(StringifyMixin):
|
||||
length += action.len
|
||||
|
||||
m = cls(weigth, watch_port, watch_group, actions)
|
||||
m._len = len_
|
||||
m.len = len_
|
||||
return m
|
||||
|
||||
def serialize(self, buf, offset):
|
||||
@ -1609,10 +1601,9 @@ class OFPBucket(StringifyMixin):
|
||||
action_offset += a.len
|
||||
action_len += a.len
|
||||
|
||||
self._len = utils.round_up(ofproto_v1_2.OFP_BUCKET_SIZE + action_len,
|
||||
8)
|
||||
self.len = utils.round_up(ofproto_v1_2.OFP_BUCKET_SIZE + action_len, 8)
|
||||
msg_pack_into(ofproto_v1_2.OFP_BUCKET_PACK_STR, buf, offset,
|
||||
self._len, self.weight, self.watch_port,
|
||||
self.len, self.weight, self.watch_port,
|
||||
self.watch_group)
|
||||
|
||||
|
||||
@ -1675,7 +1666,7 @@ class OFPGroupMod(MsgBase):
|
||||
offset = ofproto_v1_2.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_2.OFPT_PORT_MOD)
|
||||
@ -2727,8 +2718,8 @@ class OFPGroupDescStats(StringifyMixin):
|
||||
while bucket_len > 0:
|
||||
bucket = OFPBucket.parser(buf, offset)
|
||||
buckets.append(bucket)
|
||||
offset += bucket._len
|
||||
bucket_len -= bucket._len
|
||||
offset += bucket.len
|
||||
bucket_len -= bucket.len
|
||||
|
||||
o = cls(type_, group_id, buckets)
|
||||
o._length = length
|
||||
@ -2851,13 +2842,13 @@ class OFPQueueGetConfigRequest(MsgBase):
|
||||
|
||||
|
||||
class OFPQueuePropHeader(StringifyMixin):
|
||||
def __init__(self, property_, len_):
|
||||
def __init__(self, property_, len_=None):
|
||||
self._property = property_
|
||||
self._len = len_
|
||||
self.len = len_
|
||||
|
||||
def serialize(self, buf, offset):
|
||||
msg_pack_into(ofproto_v1_2.OFP_QUEUE_PROP_HEADER_PACK_STR,
|
||||
buf, offset, self._property, self._len)
|
||||
buf, offset, self._property, self.len)
|
||||
|
||||
|
||||
class OFPQueueProp(OFPQueuePropHeader):
|
||||
@ -2888,10 +2879,11 @@ class OFPQueueProp(OFPQueuePropHeader):
|
||||
|
||||
|
||||
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
|
||||
@ -2904,17 +2896,17 @@ 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
|
||||
|
||||
|
||||
@OFPQueueProp.register_property(ofproto_v1_2.OFPQT_MIN_RATE,
|
||||
ofproto_v1_2.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
|
||||
|
||||
@ -2928,7 +2920,7 @@ class OFPQueuePropMinRate(OFPQueueProp):
|
||||
@OFPQueueProp.register_property(ofproto_v1_2.OFPQT_MAX_RATE,
|
||||
ofproto_v1_2.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
|
||||
|
||||
@ -2985,8 +2977,8 @@ class OFPQueueGetConfigReply(MsgBase):
|
||||
queue = OFPPacketQueue.parser(msg.buf, offset)
|
||||
msg.queues.append(queue)
|
||||
|
||||
offset += queue._len
|
||||
length += queue._len
|
||||
offset += queue.len
|
||||
length += queue.len
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user