fix pep8 1.3.3 warnings

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
FUJITA Tomonori 2012-08-22 06:27:12 +09:00
parent 1dcf8f76d9
commit c8cd4226d7
16 changed files with 136 additions and 131 deletions

View File

@ -43,7 +43,7 @@ def client_test():
'create_port': lambda a: client.create_port(a[1], a[2], a[3]), 'create_port': lambda a: client.create_port(a[1], a[2], a[3]),
'update_port': lambda a: client.update_port(a[1], a[2], a[3]), 'update_port': lambda a: client.update_port(a[1], a[2], a[3]),
'delete_port': lambda a: client.delete_port(a[1], a[2], a[3]) 'delete_port': lambda a: client.delete_port(a[1], a[2], a[3])
} }
# allow '-', instead of '_' # allow '-', instead of '_'
commands.update(dict([(k.replace('_', '-'), v) commands.update(dict([(k.replace('_', '-'), v)

View File

@ -49,7 +49,7 @@ class EventDumper(app_manager.RyuApp):
def _register_dump_handler(self, ev_q, dispatcher): def _register_dump_handler(self, ev_q, dispatcher):
if (self._need_dump(ev_q.name, FLAGS.dump_queue) or if (self._need_dump(ev_q.name, FLAGS.dump_queue) or
self._need_dump(dispatcher.name, FLAGS.dump_dispatcher)): self._need_dump(dispatcher.name, FLAGS.dump_dispatcher)):
dispatcher.register_all_handler(self._dump_event) dispatcher.register_all_handler(self._dump_event)
@set_ev_cls(dispatcher.EventQueueCreate, dispatcher.QUEUE_EV_DISPATCHER) @set_ev_cls(dispatcher.EventQueueCreate, dispatcher.QUEUE_EV_DISPATCHER)

View File

@ -138,7 +138,7 @@ class restapi(app_manager.RyuApp):
_CONTEXTS = { _CONTEXTS = {
'network': network.Network, 'network': network.Network,
'wsgi': WSGIApplication 'wsgi': WSGIApplication
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(restapi, self).__init__(*args, **kwargs) super(restapi, self).__init__(*args, **kwargs)

View File

@ -41,7 +41,7 @@ class SimpleIsolation(app_manager.RyuApp):
_CONTEXTS = { _CONTEXTS = {
'network': network.Network, 'network': network.Network,
'dpset': dpset.DPSet, 'dpset': dpset.DPSet,
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(SimpleIsolation, self).__init__(*args, **kwargs) super(SimpleIsolation, self).__init__(*args, **kwargs)
@ -136,6 +136,7 @@ class SimpleIsolation(app_manager.RyuApp):
# LOG.debug('packet in ev %s msg %s', ev, ev.msg) # LOG.debug('packet in ev %s msg %s', ev, ev.msg)
msg = ev.msg msg = ev.msg
datapath = msg.datapath datapath = msg.datapath
ofproto = datapath.ofproto
dst, src, _eth_type = struct.unpack_from('!6s6sH', buffer(msg.data), 0) dst, src, _eth_type = struct.unpack_from('!6s6sH', buffer(msg.data), 0)
@ -170,10 +171,13 @@ class SimpleIsolation(app_manager.RyuApp):
# new port. # new port.
rule = nx_match.ClsRule() rule = nx_match.ClsRule()
rule.set_dl_dst(src) rule.set_dl_dst(src)
datapath.send_flow_mod(rule=rule, cookie=0, datapath.send_flow_mod(rule=rule,
command=datapath.ofproto.OFPFC_DELETE, idle_timeout=0, cookie=0,
hard_timeout=0, priority=datapath.ofproto.OFP_DEFAULT_PRIORITY, command=ofproto.OFPFC_DELETE,
out_port=old_port) idle_timeout=0,
hard_timeout=0,
priority=ofproto.OFP_DEFAULT_PRIORITY,
out_port=old_port)
# to make sure the old flow entries are purged. # to make sure the old flow entries are purged.
datapath.send_barrier() datapath.send_barrier()

View File

@ -81,7 +81,7 @@ class Datapath(object):
ofproto_v1_0_parser), ofproto_v1_0_parser),
ofproto_v1_2.OFP_VERSION: (ofproto_v1_2, ofproto_v1_2.OFP_VERSION: (ofproto_v1_2,
ofproto_v1_2_parser), ofproto_v1_2_parser),
} }
def __init__(self, socket, address): def __init__(self, socket, address):
super(Datapath, self).__init__() super(Datapath, self).__init__()

View File

@ -56,7 +56,7 @@ class EventQueue(TrackInstances):
# This can be called when python interpreter exiting. # This can be called when python interpreter exiting.
# At that time, other object like EventQueueCreate can be # At that time, other object like EventQueueCreate can be
# already destructed. So we can't call it blindly. # already destructed. So we can't call it blindly.
assert self.aux == None assert self.aux is None
ev_q = self._get_ev_q() ev_q = self._get_ev_q()
if ev_q is not None and self != ev_q: if ev_q is not None and self != ev_q:
self._queue_q_ev(EventQueueCreate(self, False)) self._queue_q_ev(EventQueueCreate(self, False))

View File

@ -188,7 +188,7 @@ class ConfigHandler(object):
set_config = ofproto_parser.OFPSetConfig( set_config = ofproto_parser.OFPSetConfig(
datapath, ofproto.OFPC_FRAG_NORMAL, datapath, ofproto.OFPC_FRAG_NORMAL,
128 # TODO:XXX 128 # TODO:XXX
) )
datapath.send_msg(set_config) datapath.send_msg(set_config)
LOG.debug('move onto main mode') LOG.debug('move onto main mode')

View File

@ -72,7 +72,7 @@ class Network(object):
try: try:
old_network_id = self.dpids.get(dpid, {}).get(port, None) old_network_id = self.dpids.get(dpid, {}).get(port, None)
if ((dpid, port) in self.networks[network_id] or if ((dpid, port) in self.networks[network_id] or
_known_nw_id(old_network_id)): _known_nw_id(old_network_id)):
if not port_may_exist: if not port_may_exist:
raise PortAlreadyExist(network_id=network_id, raise PortAlreadyExist(network_id=network_id,
dpid=dpid, port=port) dpid=dpid, port=port)
@ -117,7 +117,8 @@ class Network(object):
return True return True
if (allow_nw_id_external is not None and if (allow_nw_id_external is not None and
(allow_nw_id_external == nw_id or allow_nw_id_external == out_nw)): (allow_nw_id_external == nw_id or
allow_nw_id_external == out_nw)):
# allow external network -> known network id # allow external network -> known network id
return True return True

View File

@ -19,6 +19,7 @@ from . import udp
from ryu.ofproto.ofproto_parser import msg_pack_into from ryu.ofproto.ofproto_parser import msg_pack_into
from ryu.ofproto import inet from ryu.ofproto import inet
class ipv4(packet_base.PacketBase): class ipv4(packet_base.PacketBase):
_PACK_STR = '!BBHHHBBHII' _PACK_STR = '!BBHHHBBHII'
@ -64,7 +65,7 @@ class ipv4(packet_base.PacketBase):
def checksum(self, data): def checksum(self, data):
s = 0 s = 0
for i in range(0, len(data), 2): for i in range(0, len(data), 2):
w = data[i] + (data[i+1] << 8) w = data[i] + (data[i + 1] << 8)
s = self.carry_around_add(s, w) s = self.carry_around_add(s, w)
return ~s & 0xffff return ~s & 0xffff
@ -74,7 +75,7 @@ class ipv4(packet_base.PacketBase):
msg_pack_into(ipv4._PACK_STR, buf, offset, version, self.tos, msg_pack_into(ipv4._PACK_STR, buf, offset, version, self.tos,
self.total_length, self.identification, flags, self.total_length, self.identification, flags,
self.ttl, self.proto, 0, self.src, self.dst) self.ttl, self.proto, 0, self.src, self.dst)
self.csum = self.checksum(buf[offset:offset+self.length]) self.csum = self.checksum(buf[offset:offset + self.length])
msg_pack_into('H', buf, offset + 10, self.csum) msg_pack_into('H', buf, offset + 10, self.csum)
ipv4.register_packet_type(udp.udp, inet.IPPROTO_UDP) ipv4.register_packet_type(udp.udp, inet.IPPROTO_UDP)

View File

@ -709,7 +709,7 @@ class MFRegister(MFField):
def put(self, buf, offset, rule): def put(self, buf, offset, rule):
for i in range(FLOW_N_REGS): for i in range(FLOW_N_REGS):
if (ofproto_v1_0.nxm_nx_reg(i) == self.nxm_header or if (ofproto_v1_0.nxm_nx_reg(i) == self.nxm_header or
ofproto_v1_0.nxm_nx_reg_w(i) == self.nxm_header): ofproto_v1_0.nxm_nx_reg_w(i) == self.nxm_header):
if rule.wc.regs_mask[i]: if rule.wc.regs_mask[i]:
return self.putm(buf, offset, rule.flow.regs[i], return self.putm(buf, offset, rule.flow.regs[i],
rule.wc.regs_mask[i]) rule.wc.regs_mask[i])

View File

@ -611,17 +611,17 @@ assert (calcsize(NX_ROLE_PACK_STR) +
NX_FLOW_MOD_PACK_STR = '!Q4HI3H6x' NX_FLOW_MOD_PACK_STR = '!Q4HI3H6x'
NX_FLOW_MOD_SIZE = 48 NX_FLOW_MOD_SIZE = 48
assert (calcsize(NX_FLOW_MOD_PACK_STR) + assert (calcsize(NX_FLOW_MOD_PACK_STR) +
NICIRA_HEADER_SIZE == NX_FLOW_MOD_SIZE) NICIRA_HEADER_SIZE == NX_FLOW_MOD_SIZE)
NX_SET_FLOW_FORMAT_PACK_STR = '!I' NX_SET_FLOW_FORMAT_PACK_STR = '!I'
NX_SET_FLOW_FORMAT_SIZE = 20 NX_SET_FLOW_FORMAT_SIZE = 20
assert (calcsize(NX_SET_FLOW_FORMAT_PACK_STR) + assert (calcsize(NX_SET_FLOW_FORMAT_PACK_STR) +
NICIRA_HEADER_SIZE == NX_SET_FLOW_FORMAT_SIZE) NICIRA_HEADER_SIZE == NX_SET_FLOW_FORMAT_SIZE)
NX_FLOW_REMOVED_PACK_STR = '!QHBxIIHHQQ' NX_FLOW_REMOVED_PACK_STR = '!QHBxIIHHQQ'
NX_FLOW_REMOVED_SIZE = 56 NX_FLOW_REMOVED_SIZE = 56
assert (calcsize(NX_FLOW_REMOVED_PACK_STR) + assert (calcsize(NX_FLOW_REMOVED_PACK_STR) +
NICIRA_HEADER_SIZE == NX_FLOW_REMOVED_SIZE) NICIRA_HEADER_SIZE == NX_FLOW_REMOVED_SIZE)
NX_FLOW_MOD_TABLE_ID_PACK_STR = '!B7x' NX_FLOW_MOD_TABLE_ID_PACK_STR = '!B7x'
NX_FLOW_MOD_TABLE_ID_SIZE = 24 NX_FLOW_MOD_TABLE_ID_SIZE = 24

View File

@ -79,8 +79,8 @@ def _set_msg_reply(msg_reply):
# #
class OFPPhyPort(collections.namedtuple('OFPPhyPort', ( class OFPPhyPort(collections.namedtuple('OFPPhyPort', (
'port_no', 'hw_addr', 'name', 'config', 'state', 'curr', 'advertised', 'port_no', 'hw_addr', 'name', 'config', 'state', 'curr', 'advertised',
'supported', 'peer'))): 'supported', 'peer'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
@ -90,9 +90,9 @@ class OFPPhyPort(collections.namedtuple('OFPPhyPort', (
class OFPMatch(collections.namedtuple('OFPMatchBase', ( class OFPMatch(collections.namedtuple('OFPMatchBase', (
'wildcards', 'in_port', 'dl_src', 'dl_dst', 'dl_vlan', 'wildcards', 'in_port', 'dl_src', 'dl_dst', 'dl_vlan',
'dl_vlan_pcp', 'dl_type', 'nw_tos', 'nw_proto', 'dl_vlan_pcp', 'dl_type', 'nw_tos', 'nw_proto',
'nw_src', 'nw_dst', 'tp_src', 'tp_dst'))): 'nw_src', 'nw_dst', 'tp_src', 'tp_dst'))):
def __new__(cls, *args): def __new__(cls, *args):
# for convenience when dl_src/dl_dst are wildcard # for convenience when dl_src/dl_dst are wildcard
@ -543,8 +543,8 @@ class NXActionRegMove(NXActionHeader):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
(type_, len_, vendor, subtype, n_bits, src_ofs, dst_ofs, (type_, len_, vendor, subtype, n_bits, src_ofs, dst_ofs,
src, dst) = struct.unpack_from( src, dst) = struct.unpack_from(
ofproto_v1_0.NX_ACTION_REG_MOVE_PACK_STR, buf, offset) ofproto_v1_0.NX_ACTION_REG_MOVE_PACK_STR, buf, offset)
return cls(n_bits, src_ofs, dst_ofs, src, dst) return cls(n_bits, src_ofs, dst_ofs, src, dst)
@ -566,8 +566,8 @@ class NXActionRegLoad(NXActionHeader):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
(type_, len_, vendor, subtype, ofs_nbits, dst, (type_, len_, vendor, subtype, ofs_nbits, dst,
value) = struct.unpack_from( value) = struct.unpack_from(
ofproto_v1_0.NX_ACTION_REG_LOAD_PACK_STR, buf, offset) ofproto_v1_0.NX_ACTION_REG_LOAD_PACK_STR, buf, offset)
return cls(ofs_nbits, dst, value) return cls(ofs_nbits, dst, value)
@ -615,8 +615,8 @@ class NXActionMultipath(NXActionHeader):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
(type_, len_, vendor, subtype, fields, basis, algorithm, (type_, len_, vendor, subtype, fields, basis, algorithm,
max_link, arg, ofs_nbits, dst) = struct.unpack_from( max_link, arg, ofs_nbits, dst) = struct.unpack_from(
ofproto_v1_0.NX_ACTION_MULTIPATH_PACK_STR, buf, offset) ofproto_v1_0.NX_ACTION_MULTIPATH_PACK_STR, buf, offset)
return cls(fields, basis, algorithm, max_link, arg, ofs_nbits, return cls(fields, basis, algorithm, max_link, arg, ofs_nbits,
dst) dst)
@ -700,8 +700,8 @@ class NXActionBundleBase(NXActionHeader):
@classmethod @classmethod
def parser(cls, action_cls, buf, offset): def parser(cls, action_cls, buf, offset):
(type_, len_, vendor, subtype, algorithm, fields, basis, (type_, len_, vendor, subtype, algorithm, fields, basis,
slave_type, n_slaves, ofs_nbits, dst) = struct.unpack_from( slave_type, n_slaves, ofs_nbits, dst) = struct.unpack_from(
ofproto_v1_0.NX_ACTION_BUNDLE_PACK_STR, buf, offset) ofproto_v1_0.NX_ACTION_BUNDLE_PACK_STR, buf, offset)
slave_offset = offset + ofproto_v1_0.NX_ACTION_BUNDLE_SIZE slave_offset = offset + ofproto_v1_0.NX_ACTION_BUNDLE_SIZE
slaves = [] slaves = []
@ -760,8 +760,8 @@ class NXActionAutopath(NXActionHeader):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
(type_, len_, vendor, subtype, ofs_nbits, dst, (type_, len_, vendor, subtype, ofs_nbits, dst,
id_) = struct.unpack_from( id_) = struct.unpack_from(
ofproto_v1_0.NX_ACTION_AUTOPATH_PACK_STR, buf, offset) ofproto_v1_0.NX_ACTION_AUTOPATH_PACK_STR, buf, offset)
return cls(ofs_nbits, dst, id_) return cls(ofs_nbits, dst, id_)
@ -783,8 +783,8 @@ class NXActionOutputReg(NXActionHeader):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
(type_, len_, vendor, subtype, ofs_nbits, src, (type_, len_, vendor, subtype, ofs_nbits, src,
max_len) = struct.unpack_from( max_len) = struct.unpack_from(
ofproto_v1_0.NX_ACTION_OUTPUT_REG_PACK_STR, buf, offset) ofproto_v1_0.NX_ACTION_OUTPUT_REG_PACK_STR, buf, offset)
return cls(ofs_nbits, src, max_len) return cls(ofs_nbits, src, max_len)
@ -854,9 +854,9 @@ class NXActionLearn(NXActionHeader):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
(type_, len_, vendor, subtype, idle_timeout, hard_timeout, priority, (type_, len_, vendor, subtype, idle_timeout, hard_timeout, priority,
cookie, flags, table_id, fin_idle_timeout, cookie, flags, table_id, fin_idle_timeout,
fin_hard_timeout) = struct.unpack_from( fin_hard_timeout) = struct.unpack_from(
ofproto_v1_0.NX_ACTION_LEARN_PACK_STR, buf, offset) ofproto_v1_0.NX_ACTION_LEARN_PACK_STR, buf, offset)
spec = buf[offset + ofproto_v1_0.NX_ACTION_LEARN_SIZE:] spec = buf[offset + ofproto_v1_0.NX_ACTION_LEARN_SIZE:]
return cls(idle_timeout, hard_timeout, priority, return cls(idle_timeout, hard_timeout, priority,
cookie, flags, table_id, fin_idle_timeout, cookie, flags, table_id, fin_idle_timeout,
@ -881,8 +881,8 @@ class NXActionController(NXActionHeader):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
(type_, len_, vendor, subtype, max_len, controller_id, reason, (type_, len_, vendor, subtype, max_len, controller_id, reason,
_zero) = struct.unpack_from( _zero) = struct.unpack_from(
ofproto_v1_0.NX_ACTION_CONTROLLER_PACK_STR, buf, offset) ofproto_v1_0.NX_ACTION_CONTROLLER_PACK_STR, buf, offset)
return cls(max_len, controller_id, reason) return cls(max_len, controller_id, reason)
@ -903,13 +903,13 @@ class NXActionFinTimeout(NXActionHeader):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
(type_, len_, vendor, subtype, fin_idle_timeout, (type_, len_, vendor, subtype, fin_idle_timeout,
fin_hard_timeout) = struct.unpack_from( fin_hard_timeout) = struct.unpack_from(
ofproto_v1_0.NX_ACTION_FIN_TIMEOUT_PACK_STR, buf, offset) ofproto_v1_0.NX_ACTION_FIN_TIMEOUT_PACK_STR, buf, offset)
return cls(fin_idle_timeout, fin_hard_timeout) return cls(fin_idle_timeout, fin_hard_timeout)
class OFPDescStats(collections.namedtuple('OFPDescStats', class OFPDescStats(collections.namedtuple('OFPDescStats', (
('mfr_desc', 'hw_desc', 'sw_desc', 'serial_num', 'dp_desc'))): 'mfr_desc', 'hw_desc', 'sw_desc', 'serial_num', 'dp_desc'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
desc = struct.unpack_from(ofproto_v1_0.OFP_DESC_STATS_PACK_STR, desc = struct.unpack_from(ofproto_v1_0.OFP_DESC_STATS_PACK_STR,
@ -954,7 +954,7 @@ class OFPFlowStats(object):
flow_stats.cookie, flow_stats.cookie,
flow_stats.packet_count, flow_stats.packet_count,
flow_stats.byte_count) = struct.unpack_from( flow_stats.byte_count) = struct.unpack_from(
ofproto_v1_0.OFP_FLOW_STATS_1_PACK_STR, buf, offset) ofproto_v1_0.OFP_FLOW_STATS_1_PACK_STR, buf, offset)
offset += ofproto_v1_0.OFP_FLOW_STATS_1_SIZE offset += ofproto_v1_0.OFP_FLOW_STATS_1_SIZE
flow_stats.actions = [] flow_stats.actions = []
@ -969,8 +969,8 @@ class OFPFlowStats(object):
return flow_stats return flow_stats
class OFPAggregateStats(collections.namedtuple('OFPAggregateStats', class OFPAggregateStats(collections.namedtuple('OFPAggregateStats', (
('packet_count', 'byte_count', 'flow_count'))): 'packet_count', 'byte_count', 'flow_count'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
agg = struct.unpack_from( agg = struct.unpack_from(
@ -980,9 +980,9 @@ class OFPAggregateStats(collections.namedtuple('OFPAggregateStats',
return stats return stats
class OFPTableStats(collections.namedtuple('OFPTableStats', class OFPTableStats(collections.namedtuple('OFPTableStats', (
('table_id', 'name', 'wildcards', 'max_entries', 'active_count', 'table_id', 'name', 'wildcards', 'max_entries', 'active_count',
'lookup_count', 'matched_count'))): 'lookup_count', 'matched_count'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
tbl = struct.unpack_from(ofproto_v1_0.OFP_TABLE_STATS_PACK_STR, tbl = struct.unpack_from(ofproto_v1_0.OFP_TABLE_STATS_PACK_STR,
@ -992,10 +992,10 @@ class OFPTableStats(collections.namedtuple('OFPTableStats',
return stats return stats
class OFPPortStats(collections.namedtuple('OFPPortStats', class OFPPortStats(collections.namedtuple('OFPPortStats', (
('port_no', 'rx_packets', 'tx_packets', 'rx_bytes', 'tx_bytes', 'port_no', 'rx_packets', 'tx_packets', 'rx_bytes', 'tx_bytes',
'rx_dropped', 'tx_dropped', 'rx_errors', 'tx_errors', 'rx_dropped', 'tx_dropped', 'rx_errors', 'tx_errors',
'rx_frame_err', 'rx_over_err', 'rx_crc_err', 'collisions'))): 'rx_frame_err', 'rx_over_err', 'rx_crc_err', 'collisions'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
port = struct.unpack_from(ofproto_v1_0.OFP_PORT_STATS_PACK_STR, port = struct.unpack_from(ofproto_v1_0.OFP_PORT_STATS_PACK_STR,
@ -1005,8 +1005,8 @@ class OFPPortStats(collections.namedtuple('OFPPortStats',
return stats return stats
class OFPQueueStats(collections.namedtuple('OFPQueueStats', class OFPQueueStats(collections.namedtuple('OFPQueueStats', (
('port_no', 'queue_id', 'tx_bytes', 'tx_packets', 'tx_errors'))): 'port_no', 'queue_id', 'tx_bytes', 'tx_packets', 'tx_errors'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
queue = struct.unpack_from(ofproto_v1_0.OFP_QUEUE_STATS_PACK_STR, queue = struct.unpack_from(ofproto_v1_0.OFP_QUEUE_STATS_PACK_STR,
@ -1385,7 +1385,7 @@ class NXTFlowRemoved(NiciraHeader):
(cookie, priority, reason, duration_sec, duration_nsec, (cookie, priority, reason, duration_sec, duration_nsec,
idle_timeout, match_len, idle_timeout, match_len,
packet_count, byte_count) = struct.unpack_from( packet_count, byte_count) = struct.unpack_from(
ofproto_v1_0.NX_FLOW_REMOVED_PACK_STR, buf, offset) ofproto_v1_0.NX_FLOW_REMOVED_PACK_STR, buf, offset)
offset += (ofproto_v1_0.NX_FLOW_REMOVED_SIZE offset += (ofproto_v1_0.NX_FLOW_REMOVED_SIZE
- ofproto_v1_0.NICIRA_HEADER_SIZE) - ofproto_v1_0.NICIRA_HEADER_SIZE)
match = nx_match.NXMatch.parser(buf, offset, match_len) match = nx_match.NXMatch.parser(buf, offset, match_len)
@ -1425,8 +1425,8 @@ class NXTPacketIn(NiciraHeader):
@classmethod @classmethod
def parser(cls, datapath, buf, offset): def parser(cls, datapath, buf, offset):
(buffer_id, total_len, reason, table_id, (buffer_id, total_len, reason, table_id,
cookie, match_len) = struct.unpack_from( cookie, match_len) = struct.unpack_from(
ofproto_v1_0.NX_PACKET_IN_PACK_STR, buf, offset) ofproto_v1_0.NX_PACKET_IN_PACK_STR, buf, offset)
offset += (ofproto_v1_0.NX_PACKET_IN_SIZE offset += (ofproto_v1_0.NX_PACKET_IN_SIZE
- ofproto_v1_0.NICIRA_HEADER_SIZE) - ofproto_v1_0.NICIRA_HEADER_SIZE)
@ -1507,8 +1507,8 @@ class OFPSwitchFeatures(MsgBase):
msg.n_tables, msg.n_tables,
msg.capabilities, msg.capabilities,
msg.actions) = struct.unpack_from( msg.actions) = struct.unpack_from(
ofproto_v1_0.OFP_SWITCH_FEATURES_PACK_STR, msg.buf, ofproto_v1_0.OFP_SWITCH_FEATURES_PACK_STR, msg.buf,
ofproto_v1_0.OFP_HEADER_SIZE) ofproto_v1_0.OFP_HEADER_SIZE)
msg.ports = {} msg.ports = {}
n_ports = ((msg_len - ofproto_v1_0.OFP_SWITCH_FEATURES_SIZE) / n_ports = ((msg_len - ofproto_v1_0.OFP_SWITCH_FEATURES_SIZE) /
@ -1532,7 +1532,7 @@ class OFPPortStatus(MsgBase):
@classmethod @classmethod
def parser(cls, datapath, version, msg_type, msg_len, xid, buf): def parser(cls, datapath, version, msg_type, msg_len, xid, buf):
msg = super(OFPPortStatus, cls).parser(datapath, version, msg_type, msg = super(OFPPortStatus, cls).parser(datapath, version, msg_type,
msg_len, xid, buf) msg_len, xid, buf)
msg.reason = struct.unpack_from( msg.reason = struct.unpack_from(
ofproto_v1_0.OFP_PORT_STATUS_PACK_STR, ofproto_v1_0.OFP_PORT_STATUS_PACK_STR,
msg.buf, ofproto_v1_0.OFP_HEADER_SIZE)[0] msg.buf, ofproto_v1_0.OFP_HEADER_SIZE)[0]
@ -1560,8 +1560,8 @@ class OFPPacketIn(MsgBase):
msg.total_len, msg.total_len,
msg.in_port, msg.in_port,
msg.reason) = struct.unpack_from( msg.reason) = struct.unpack_from(
ofproto_v1_0.OFP_PACKET_IN_PACK_STR, ofproto_v1_0.OFP_PACKET_IN_PACK_STR,
msg.buf, ofproto_v1_0.OFP_HEADER_SIZE) msg.buf, ofproto_v1_0.OFP_HEADER_SIZE)
msg.data = msg.buf[ofproto_v1_0.OFP_PACKET_IN_DATA_OFFSET:] msg.data = msg.buf[ofproto_v1_0.OFP_PACKET_IN_DATA_OFFSET:]
if msg.total_len < len(msg.data): if msg.total_len < len(msg.data):
# discard padding for 8-byte alignment of OFP packet # discard padding for 8-byte alignment of OFP packet
@ -1620,8 +1620,8 @@ class OFPFlowRemoved(MsgBase):
msg.idle_timeout, msg.idle_timeout,
msg.packet_count, msg.packet_count,
msg.byte_count) = struct.unpack_from( msg.byte_count) = struct.unpack_from(
ofproto_v1_0.OFP_FLOW_REMOVED_PACK_STR0, msg.buf, ofproto_v1_0.OFP_FLOW_REMOVED_PACK_STR0, msg.buf,
ofproto_v1_0.OFP_HEADER_SIZE + ofproto_v1_0.OFP_MATCH_SIZE) ofproto_v1_0.OFP_HEADER_SIZE + ofproto_v1_0.OFP_MATCH_SIZE)
return msg return msg

View File

@ -140,8 +140,8 @@ class OFPExperimenter(MsgBase):
class OFPPort(collections.namedtuple('OFPPort', ( class OFPPort(collections.namedtuple('OFPPort', (
'port_no', 'hw_addr', 'name', 'config', 'state', 'curr', 'port_no', 'hw_addr', 'name', 'config', 'state', 'curr',
'advertised', 'supported', 'peer', 'curr_speed', 'max_speed'))): 'advertised', 'supported', 'peer', 'curr_speed', 'max_speed'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
@ -170,8 +170,8 @@ class OFPSwitchFeatures(MsgBase):
msg.n_tables, msg.n_tables,
msg.capabilities, msg.capabilities,
msg.reserved) = struct.unpack_from( msg.reserved) = struct.unpack_from(
ofproto_v1_2.OFP_SWITCH_FEATURES_PACK_STR, msg.buf, ofproto_v1_2.OFP_SWITCH_FEATURES_PACK_STR, msg.buf,
ofproto_v1_2.OFP_HEADER_SIZE) ofproto_v1_2.OFP_HEADER_SIZE)
msg.ports = {} msg.ports = {}
n_ports = ((msg_len - ofproto_v1_2.OFP_SWITCH_FEATURES_SIZE) / n_ports = ((msg_len - ofproto_v1_2.OFP_SWITCH_FEATURES_SIZE) /
@ -234,8 +234,8 @@ class OFPPacketIn(MsgBase):
msg_len, xid, buf) msg_len, xid, buf)
(msg.buffer_id, msg.total_len, msg.reason, (msg.buffer_id, msg.total_len, msg.reason,
msg.table_id) = struct.unpack_from( msg.table_id) = struct.unpack_from(
ofproto_v1_2.OFP_PACKET_IN_PACK_STR, ofproto_v1_2.OFP_PACKET_IN_PACK_STR,
msg.buf, ofproto_v1_2.OFP_HEADER_SIZE) msg.buf, ofproto_v1_2.OFP_HEADER_SIZE)
msg.match = OFPMatch.parser(msg.buf, ofproto_v1_2.OFP_PACKET_IN_SIZE - msg.match = OFPMatch.parser(msg.buf, ofproto_v1_2.OFP_PACKET_IN_SIZE -
ofproto_v1_2.OFP_MATCH_SIZE) ofproto_v1_2.OFP_MATCH_SIZE)
@ -266,9 +266,9 @@ class OFPFlowRemoved(MsgBase):
msg.table_id, msg.duration_sec, msg.duration_nsec, msg.table_id, msg.duration_sec, msg.duration_nsec,
msg.idle_timeout, msg.hard_timeout, msg.packet_count, msg.idle_timeout, msg.hard_timeout, msg.packet_count,
msg.byte_count) = struct.unpack_from( msg.byte_count) = struct.unpack_from(
ofproto_v1_2.OFP_FLOW_REMOVED_PACK_STR0, ofproto_v1_2.OFP_FLOW_REMOVED_PACK_STR0,
msg.buf, msg.buf,
ofproto_v1_2.OFP_HEADER_SIZE) ofproto_v1_2.OFP_HEADER_SIZE)
offset = (ofproto_v1_2.OFP_FLOW_REMOVED_SIZE - offset = (ofproto_v1_2.OFP_FLOW_REMOVED_SIZE -
ofproto_v1_2.OFP_MATCH_SIZE) ofproto_v1_2.OFP_MATCH_SIZE)
@ -922,8 +922,8 @@ class OFPDescStatsRequest(OFPStatsRequest):
@OFPStatsReply.register_stats_reply_type(ofproto_v1_2.OFPST_DESC, @OFPStatsReply.register_stats_reply_type(ofproto_v1_2.OFPST_DESC,
body_single_struct=True) body_single_struct=True)
class OFPDescStats(collections.namedtuple('OFPDescStats', class OFPDescStats(collections.namedtuple('OFPDescStats', (
('mfr_desc', 'hw_desc', 'sw_desc', 'serial_num', 'dp_desc'))): 'mfr_desc', 'hw_desc', 'sw_desc', 'serial_num', 'dp_desc'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
desc = struct.unpack_from(ofproto_v1_2.OFP_DESC_STATS_PACK_STR, desc = struct.unpack_from(ofproto_v1_2.OFP_DESC_STATS_PACK_STR,
@ -984,8 +984,8 @@ class OFPFlowStats(object):
duration_nsec, priority, duration_nsec, priority,
idle_timeout, hard_timeout, idle_timeout, hard_timeout,
cookie, packet_count, byte_count) = struct.unpack_from( cookie, packet_count, byte_count) = struct.unpack_from(
ofproto_v1_2.OFP_FLOW_STATS_PACK_STR, ofproto_v1_2.OFP_FLOW_STATS_PACK_STR,
buf, offset) buf, offset)
offset += (ofproto_v1_2.OFP_FLOW_STATS_SIZE - offset += (ofproto_v1_2.OFP_FLOW_STATS_SIZE -
ofproto_v1_2.OFP_MATCH_SIZE) ofproto_v1_2.OFP_MATCH_SIZE)
match = OFPMatch.parser(buf, offset) match = OFPMatch.parser(buf, offset)
@ -1036,8 +1036,8 @@ class OFPAggregateStatsRequest(OFPStatsRequest):
@OFPStatsReply.register_stats_reply_type(ofproto_v1_2.OFPST_AGGREGATE, @OFPStatsReply.register_stats_reply_type(ofproto_v1_2.OFPST_AGGREGATE,
body_single_struct=True) body_single_struct=True)
class OFPAggregateStatsReply(collections.namedtuple('OFPAggregateStats', class OFPAggregateStatsReply(collections.namedtuple('OFPAggregateStats', (
('packet_count', 'byte_count', 'flow_count'))): 'packet_count', 'byte_count', 'flow_count'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
desc = struct.unpack_from( desc = struct.unpack_from(
@ -1176,9 +1176,9 @@ class OFPGroupStats(object):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
(length, group_id, ref_count, packet_count, (length, group_id, ref_count, packet_count,
byte_count) = struct.unpack_from( byte_count) = struct.unpack_from(
ofproto_v1_2.OFP_GROUP_STATS_PACK_STR, ofproto_v1_2.OFP_GROUP_STATS_PACK_STR,
buf, offset) buf, offset)
bucket_len = length - ofproto_v1_2.OFP_GROUP_STATS_SIZE bucket_len = length - ofproto_v1_2.OFP_GROUP_STATS_SIZE
offset += ofproto_v1_2.OFP_GROUP_STATS_SIZE offset += ofproto_v1_2.OFP_GROUP_STATS_SIZE

View File

@ -767,7 +767,7 @@ OFP_PACKET_IN_PACK_STR = '!IHBBQ' + _OFP_MATCH_PACK_STR
OFP_PACKET_IN_SIZE = 32 OFP_PACKET_IN_SIZE = 32
OFP_PACKET_IN_DATA_OFFSET = 18 OFP_PACKET_IN_DATA_OFFSET = 18
assert (calcsize(OFP_PACKET_IN_PACK_STR) + OFP_HEADER_SIZE == assert (calcsize(OFP_PACKET_IN_PACK_STR) + OFP_HEADER_SIZE ==
OFP_PACKET_IN_SIZE) OFP_PACKET_IN_SIZE)
# enum ofp_packet_in_reason # enum ofp_packet_in_reason
OFPR_NO_MATCH = 0 # No matching flow. OFPR_NO_MATCH = 0 # No matching flow.

View File

@ -165,8 +165,8 @@ class OFPSwitchFeatures(MsgBase):
msg.auxiliary_id, msg.auxiliary_id,
msg.capabilities, msg.capabilities,
msg.reserved) = struct.unpack_from( msg.reserved) = struct.unpack_from(
ofproto_v1_3.OFP_SWITCH_FEATURES_PACK_STR, msg.buf, ofproto_v1_3.OFP_SWITCH_FEATURES_PACK_STR, msg.buf,
ofproto_v1_3.OFP_HEADER_SIZE) ofproto_v1_3.OFP_HEADER_SIZE)
return msg return msg
@ -228,8 +228,8 @@ class OFPPacketIn(MsgBase):
msg_len, xid, buf) msg_len, xid, buf)
(msg.buffer_id, msg.total_len, msg.reason, (msg.buffer_id, msg.total_len, msg.reason,
msg.table_id, msg.cookie) = struct.unpack_from( msg.table_id, msg.cookie) = struct.unpack_from(
ofproto_v1_3.OFP_PACKET_IN_PACK_STR, ofproto_v1_3.OFP_PACKET_IN_PACK_STR,
msg.buf, ofproto_v1_3.OFP_HEADER_SIZE) msg.buf, ofproto_v1_3.OFP_HEADER_SIZE)
offset = ofproto_v1_3.OFP_HEADER_SIZE + ofproto_v1_3.OFP_PACKET_IN_SIZE offset = ofproto_v1_3.OFP_HEADER_SIZE + ofproto_v1_3.OFP_PACKET_IN_SIZE
msg.match = OFPMatch.parser(buf, offset - ofproto_v1_3.OFP_MATCH_SIZE) msg.match = OFPMatch.parser(buf, offset - ofproto_v1_3.OFP_MATCH_SIZE)
@ -251,8 +251,8 @@ class OFPFlowRemoved(MsgBase):
msg.table_id, msg.duration_sec, msg.duration_nsec, msg.table_id, msg.duration_sec, msg.duration_nsec,
msg.idle_timeout, msg.hard_timeout, msg.packet_count, msg.idle_timeout, msg.hard_timeout, msg.packet_count,
msg.byte_count) = struct.unpack_from( msg.byte_count) = struct.unpack_from(
ofproto_v1_3.OFP_FLOW_REMOVED_PACK_STR0, ofproto_v1_3.OFP_FLOW_REMOVED_PACK_STR0,
msg.buf, ofproto_v1_3.OFP_HEADER_SIZE) msg.buf, ofproto_v1_3.OFP_HEADER_SIZE)
offset = (ofproto_v1_3.OFP_FLOW_REMOVED_SIZE - offset = (ofproto_v1_3.OFP_FLOW_REMOVED_SIZE -
ofproto_v1_3.OFP_MATCH_SIZE) ofproto_v1_3.OFP_MATCH_SIZE)
@ -263,8 +263,8 @@ class OFPFlowRemoved(MsgBase):
class OFPPort(collections.namedtuple('OFPPort', ( class OFPPort(collections.namedtuple('OFPPort', (
'port_no', 'hw_addr', 'name', 'config', 'state', 'curr', 'port_no', 'hw_addr', 'name', 'config', 'state', 'curr',
'advertised', 'supported', 'peer', 'curr_speed', 'max_speed'))): 'advertised', 'supported', 'peer', 'curr_speed', 'max_speed'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
@ -639,7 +639,7 @@ class OFPBucket(object):
def parser(cls, buf, offset): def parser(cls, buf, offset):
(msg.len, msg.weigth, msg.watch_port, (msg.len, msg.weigth, msg.watch_port,
msg.watch_group) = struct.unpack_from( msg.watch_group) = struct.unpack_from(
ofproto_v1_3.OFP_BUCKET_PACK_STR, buf, offset) ofproto_v1_3.OFP_BUCKET_PACK_STR, buf, offset)
length = ofproto_v1_3.OFP_BUCKET_SIZE length = ofproto_v1_3.OFP_BUCKET_SIZE
offset += ofproto_v1_3.OFP_BUCKET_SIZE offset += ofproto_v1_3.OFP_BUCKET_SIZE
@ -786,8 +786,8 @@ class OFPMultipartReply(MsgBase):
return msg return msg
class OFPDescStats(collections.namedtuple('OFPDescStats', class OFPDescStats(collections.namedtuple('OFPDescStats', (
('mfr_desc', 'hw_desc', 'sw_desc', 'serial_num', 'dp_desc'))): 'mfr_desc', 'hw_desc', 'sw_desc', 'serial_num', 'dp_desc'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
desc = struct.unpack_from(ofproto_v1_3.OFP_DESC_PACK_STR, desc = struct.unpack_from(ofproto_v1_3.OFP_DESC_PACK_STR,
@ -837,7 +837,7 @@ class OFPFlowStats(object):
flow_stats.priority, flow_stats.idle_timeout, flow_stats.priority, flow_stats.idle_timeout,
flow_stats.cookie, flow_stats.packet_count, flow_stats.cookie, flow_stats.packet_count,
flow_stats.byte_count) = struct.unpack_from( flow_stats.byte_count) = struct.unpack_from(
ofproto_v1_3.OFP_FLOW_STATS_0_PACK_STR, buf, offset) ofproto_v1_3.OFP_FLOW_STATS_0_PACK_STR, buf, offset)
offset += ofproto_v1_3.OFP_FLOW_STATS_0_SIZE offset += ofproto_v1_3.OFP_FLOW_STATS_0_SIZE
flow_stats.match = OFPMatch.parse(buf, offset) flow_stats.match = OFPMatch.parse(buf, offset)
@ -884,8 +884,8 @@ class OFPFlowStatsReply(OFPMultipartReply):
super(OFPFlowStatsReply, self).__init__(datapath) super(OFPFlowStatsReply, self).__init__(datapath)
class OFPAggregateStats(collections.namedtuple('OFPAggregateStats', class OFPAggregateStats(collections.namedtuple('OFPAggregateStats', (
('packet_count', 'byte_count', 'flow_count'))): 'packet_count', 'byte_count', 'flow_count'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
agg = struct.unpack_from( agg = struct.unpack_from(
@ -916,9 +916,9 @@ class OFPAggregateStatsReply(OFPMultipartReply):
super(OFPAggregateStatsReply, self).__init__(datapath) super(OFPAggregateStatsReply, self).__init__(datapath)
class OFPTableStats(collections.namedtuple('OFPTableStats', class OFPTableStats(collections.namedtuple('OFPTableStats', (
('table_id', 'active_count', 'lookup_count', 'table_id', 'active_count', 'lookup_count',
'matched_count'))): 'matched_count'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
tbl = struct.unpack_from(ofproto_v1_3.OFP_TABLE_STATS_PACK_STR, tbl = struct.unpack_from(ofproto_v1_3.OFP_TABLE_STATS_PACK_STR,
@ -943,11 +943,11 @@ class OFPTableStatsReply(OFPMultipartReply):
super(OFPTableStatsReply, self).__init__(datapath) super(OFPTableStatsReply, self).__init__(datapath)
class OFPPortStats(collections.namedtuple('OFPPortStats', class OFPPortStats(collections.namedtuple('OFPPortStats', (
('port_no', 'rx_packets', 'tx_packets', 'rx_bytes', 'tx_bytes', 'port_no', 'rx_packets', 'tx_packets', 'rx_bytes', 'tx_bytes',
'rx_dropped', 'tx_dropped', 'rx_errors', 'tx_errors', 'rx_dropped', 'tx_dropped', 'rx_errors', 'tx_errors',
'rx_frame_err', 'rx_over_err', 'rx_crc_err', 'collisions', 'rx_frame_err', 'rx_over_err', 'rx_crc_err', 'collisions',
'duration_sec', 'duration_nsec'))): 'duration_sec', 'duration_nsec'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
port = struct.unpack_from(ofproto_v1_3.OFP_PORT_STATS_PACK_STR, port = struct.unpack_from(ofproto_v1_3.OFP_PORT_STATS_PACK_STR,
@ -979,13 +979,13 @@ class OFPPortStatsReply(OFPMultipartReply):
super(OFPPortStatsReply, self).__init__(datapath) super(OFPPortStatsReply, self).__init__(datapath)
class OFPQueueStats(collections.namedtuple('OFPQueueStats', class OFPQueueStats(collections.namedtuple('OFPQueueStats', (
('port_no', 'queue_id', 'tx_bytes', 'tx_packets', 'tx_errors', 'port_no', 'queue_id', 'tx_bytes', 'tx_packets', 'tx_errors',
'duration_sec', 'duration_nsec'))): 'duration_sec', 'duration_nsec'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
queue = struct.unpack_from(ofproto_v1_3.OFP_QUEUE_STATS_PACK_STR, queue = struct.unpack_from(ofproto_v1_3.OFP_QUEUE_STATS_PACK_STR,
buf, offset) buf, offset)
stats = cls(*queue) stats = cls(*queue)
stats.length = ofproto_v1_3.OFP_QUEUE_STATS_SIZE stats.length = ofproto_v1_3.OFP_QUEUE_STATS_SIZE
return stats return stats
@ -1014,9 +1014,9 @@ class OFPQueueStatsReply(OFPMultipartReply):
super(OFPQueueStatsReply, self).__init__(datapath) super(OFPQueueStatsReply, self).__init__(datapath)
class OFPGroupStats(collections.namedtuple('OFPGroupStats', class OFPGroupStats(collections.namedtuple('OFPGroupStats', (
('length', 'group_id', 'ref_count', 'packet_count', 'length', 'group_id', 'ref_count', 'packet_count',
'byte_count', 'duration_sec', 'duration_nsec'))): 'byte_count', 'duration_sec', 'duration_nsec'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
group = struct.unpack_from(ofproto_v1_3.OFP_GROUP_STATS_PACK_STR, group = struct.unpack_from(ofproto_v1_3.OFP_GROUP_STATS_PACK_STR,
@ -1091,8 +1091,8 @@ class OFPGroupDescStatsReply(OFPMultipartReply):
super(OFPGroupDescStatsReply, self).__init__(datapath) super(OFPGroupDescStatsReply, self).__init__(datapath)
class OFPGroupFeaturesStats(collections.namedtuple('OFPGroupFeaturesStats', class OFPGroupFeaturesStats(collections.namedtuple('OFPGroupFeaturesStats', (
('types', 'capabilities', 'max_groups', 'actions'))): 'types', 'capabilities', 'max_groups', 'actions'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
group_features = struct.unpack_from( group_features = struct.unpack_from(
@ -1150,7 +1150,7 @@ class OFPMeterStats(object):
meter_stats.flow_count, meter_stats.packet_in_count, meter_stats.flow_count, meter_stats.packet_in_count,
meter_stats.byte_in_count, meter_stats.duration_sec, meter_stats.byte_in_count, meter_stats.duration_sec,
meter_stats.duration_nsec) = struct.unpack_from( meter_stats.duration_nsec) = struct.unpack_from(
ofproto_v1_3.OFP_METER_STATS_PACK_STR, buf, offset) ofproto_v1_3.OFP_METER_STATS_PACK_STR, buf, offset)
offset += ofproto_v1_3.OFP_METER_STATS_SIZE offset += ofproto_v1_3.OFP_METER_STATS_SIZE
meter_stats.band_stats = [] meter_stats.band_stats = []
@ -1214,7 +1214,7 @@ class OFPMeterConfigStats(object):
(meter_config.length, meter_config.flags, (meter_config.length, meter_config.flags,
meter_config.meter_id) = struct.unpack_from( meter_config.meter_id) = struct.unpack_from(
ofproto_v1_3.OFP_METER_CONFIG_PACK_STR, buf, offset) ofproto_v1_3.OFP_METER_CONFIG_PACK_STR, buf, offset)
offset += ofproto_v1_3.OFP_METER_CONFIG_SIZE offset += ofproto_v1_3.OFP_METER_CONFIG_SIZE
meter_config.bands = [] meter_config.bands = []
@ -1250,9 +1250,9 @@ class OFPMeterConfigStatsReply(OFPMultipartReply):
super(OFPMeterConfigStatsReply, self).__init__(datapath) super(OFPMeterConfigStatsReply, self).__init__(datapath)
class OFPMeterFeaturesStats(collections.namedtuple('OFPMeterFeaturesStats', class OFPMeterFeaturesStats(collections.namedtuple('OFPMeterFeaturesStats', (
('max_meter', 'band_types', 'capabilities', 'max_band', 'max_meter', 'band_types', 'capabilities', 'max_band',
'max_color'))): 'max_color'))):
@classmethod @classmethod
def parser(cls, buf, offset): def parser(cls, buf, offset):
meter_features = struct.unpack_from( meter_features = struct.unpack_from(
@ -1295,9 +1295,9 @@ class OFPTableFeaturesStats(object):
(table_features.length, table_features.table_id, (table_features.length, table_features.table_id,
table_features.name, table_features.metadata_match, table_features.name, table_features.metadata_match,
table_features.write, table_features.config, table_features.write, table_features.config,
table_features.max_entries, table_features.properties) = \ table_features.max_entries, table_features.properties
struct.unpack_from(ofproto_v1_3.OFP_TABLE_FEATURES_PACK_STR, ) = struct.unpack_from(ofproto_v1_3.OFP_TABLE_FEATURES_PACK_STR,
buf, offset) buf, offset)
offset += ofproto_v1_3.OFP_TABLE_FEATURES_SIZE offset += ofproto_v1_3.OFP_TABLE_FEATURES_SIZE
# TODO: parse ofp_table_feature_prop_header # TODO: parse ofp_table_feature_prop_header
@ -1547,8 +1547,8 @@ class OFPGetAsyncReply(MsgBase):
xid, buf) xid, buf)
(msg.packet_in_mask, msg.port_status_mask, (msg.packet_in_mask, msg.port_status_mask,
msg.flow_removed_mask) = struct.unpack_from( msg.flow_removed_mask) = struct.unpack_from(
ofproto_v1_3.OFP_ASYNC_CONFIG_PACK_STR, msg.buf, ofproto_v1_3.OFP_ASYNC_CONFIG_PACK_STR, msg.buf,
ofproto_v1_3.OFP_HEADER_SIZE) ofproto_v1_3.OFP_HEADER_SIZE)
@_register_parser @_register_parser
@ -1564,5 +1564,5 @@ class OFPGetAsyncReply(MsgBase):
xid, buf) xid, buf)
(msg.packet_in_mask, msg.port_status_mask, (msg.packet_in_mask, msg.port_status_mask,
msg.flow_removed_mask) = struct.unpack_from( msg.flow_removed_mask) = struct.unpack_from(
ofproto_v1_3.OFP_ASYNC_CONFIG_PACK_STR, msg.buf, ofproto_v1_3.OFP_ASYNC_CONFIG_PACK_STR, msg.buf,
ofproto_v1_3.OFP_HEADER_SIZE) ofproto_v1_3.OFP_HEADER_SIZE)

View File

@ -37,7 +37,7 @@ classifiers = [
'Natural Language :: English', 'Natural Language :: English',
'Programming Language :: Python', 'Programming Language :: Python',
'Operating System :: Unix', 'Operating System :: Unix',
] ]
setup(name='ryu', setup(name='ryu',
version=version, version=version,
@ -53,5 +53,4 @@ setup(name='ryu',
scripts=['bin/ryu-manager', scripts=['bin/ryu-manager',
'bin/ryu-client'], 'bin/ryu-client'],
data_files=[('/etc/ryu', ['etc/ryu/ryu.conf'])], data_files=[('/etc/ryu', ['etc/ryu/ryu.conf'])],
# install_requires=[]
) )