appease pep8

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:
YAMAMOTO Takashi 2013-07-19 12:04:31 +09:00 committed by FUJITA Tomonori
parent 7099838c3f
commit 24e9c1546d
6 changed files with 46 additions and 46 deletions

View File

@ -394,7 +394,7 @@ class GRETunnel(app_manager.RyuApp):
self.port_set = PortSet(**kwargs)
map(lambda ev_cls: self.port_set.register_observer(ev_cls, self.name),
[dpset.EventDP, PortSet.EventTunnelKeyDel, PortSet.EventVMPort,
PortSet.EventTunnelPort, ofp_event.EventOFPPacketIn])
PortSet.EventTunnelPort, ofp_event.EventOFPPacketIn])
# TODO: track active vm/tunnel ports

View File

@ -117,7 +117,7 @@ class NetFlowV5Flow(object):
(srcaddr, dstaddr, nexthop, input_, output, dpkts, doctets,
first, last, srcport, dstport, tcp_flags, prot, tos, src_as,
dst_as, src_mask, dst_mask) = struct.unpack_from(
cls._PACK_STR, buf, offset)
cls._PACK_STR, buf, offset)
msg = cls(srcaddr, dstaddr, nexthop, input_, output, dpkts,
doctets, first, last, srcport, dstport, tcp_flags,
prot, tos, src_as, dst_as, src_mask, dst_mask)

View File

@ -618,7 +618,7 @@ class NXActionRegMove(NXActionHeader):
def parser(cls, buf, offset):
(type_, len_, vendor, subtype, n_bits, src_ofs, dst_ofs,
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)
@ -640,7 +640,7 @@ class NXActionRegLoad(NXActionHeader):
def parser(cls, buf, offset):
(type_, len_, vendor, subtype, ofs_nbits, dst,
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)
@ -687,7 +687,7 @@ class NXActionMultipath(NXActionHeader):
def parser(cls, buf, offset):
(type_, len_, vendor, subtype, fields, basis, algorithm,
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,
dst)
@ -772,7 +772,7 @@ class NXActionBundleBase(NXActionHeader):
def parser(cls, action_cls, buf, offset):
(type_, len_, vendor, subtype, algorithm, fields, basis,
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
slaves = []
@ -829,7 +829,7 @@ class NXActionAutopath(NXActionHeader):
def parser(cls, buf, offset):
(type_, len_, vendor, subtype, ofs_nbits, dst,
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_)
@ -851,7 +851,7 @@ class NXActionOutputReg(NXActionHeader):
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)
ofproto_v1_0.NX_ACTION_OUTPUT_REG_PACK_STR, buf, offset)
return cls(ofs_nbits, src, max_len)
@ -921,7 +921,7 @@ class NXActionLearn(NXActionHeader):
(type_, len_, vendor, subtype, idle_timeout, hard_timeout, priority,
cookie, flags, table_id, fin_idle_timeout,
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:]
return cls(idle_timeout, hard_timeout, priority,
cookie, flags, table_id, fin_idle_timeout,
@ -946,7 +946,7 @@ class NXActionController(NXActionHeader):
def parser(cls, buf, offset):
(type_, len_, vendor, subtype, max_len, controller_id, reason,
_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)
@ -967,7 +967,7 @@ class NXActionFinTimeout(NXActionHeader):
def parser(cls, buf, offset):
(type_, len_, vendor, subtype, fin_idle_timeout,
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)
@ -1017,7 +1017,7 @@ class OFPFlowStats(StringifyMixin):
flow_stats.cookie,
flow_stats.packet_count,
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
flow_stats.actions = []
@ -1116,7 +1116,7 @@ class NXFlowStats(StringifyMixin):
nxflow_stats.idle_age, nxflow_stats.hard_age,
nxflow_stats.cookie, nxflow_stats.packet_count,
nxflow_stats.byte_count) = struct.unpack_from(
ofproto_v1_0.NX_FLOW_STATS_PACK_STR, buf, offset)
ofproto_v1_0.NX_FLOW_STATS_PACK_STR, buf, offset)
offset += ofproto_v1_0.NX_FLOW_STATS_SIZE
fields = []
@ -1506,7 +1506,7 @@ class NXTFlowRemoved(NiciraHeader):
(cookie, priority, reason, duration_sec, duration_nsec,
idle_timeout, match_len,
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
- ofproto_v1_0.NICIRA_HEADER_SIZE)
match = nx_match.NXMatch.parser(buf, offset, match_len)
@ -1547,7 +1547,7 @@ class NXTPacketIn(NiciraHeader):
def parser(cls, datapath, buf, offset):
(buffer_id, total_len, reason, table_id,
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
- ofproto_v1_0.NICIRA_HEADER_SIZE)
@ -1629,8 +1629,8 @@ class OFPSwitchFeatures(MsgBase):
msg.n_tables,
msg.capabilities,
msg.actions) = struct.unpack_from(
ofproto_v1_0.OFP_SWITCH_FEATURES_PACK_STR, msg.buf,
ofproto_v1_0.OFP_HEADER_SIZE)
ofproto_v1_0.OFP_SWITCH_FEATURES_PACK_STR, msg.buf,
ofproto_v1_0.OFP_HEADER_SIZE)
msg.ports = {}
n_ports = ((msg_len - ofproto_v1_0.OFP_SWITCH_FEATURES_SIZE) /
@ -1685,8 +1685,8 @@ class OFPPacketIn(MsgBase):
msg.total_len,
msg.in_port,
msg.reason) = struct.unpack_from(
ofproto_v1_0.OFP_PACKET_IN_PACK_STR,
msg.buf, ofproto_v1_0.OFP_HEADER_SIZE)
ofproto_v1_0.OFP_PACKET_IN_PACK_STR,
msg.buf, ofproto_v1_0.OFP_HEADER_SIZE)
msg.data = msg.buf[ofproto_v1_0.OFP_PACKET_IN_DATA_OFFSET:]
if msg.total_len < len(msg.data):
# discard padding for 8-byte alignment of OFP packet
@ -1738,8 +1738,8 @@ class OFPFlowRemoved(MsgBase):
msg.idle_timeout,
msg.packet_count,
msg.byte_count) = struct.unpack_from(
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_FLOW_REMOVED_PACK_STR0, msg.buf,
ofproto_v1_0.OFP_HEADER_SIZE + ofproto_v1_0.OFP_MATCH_SIZE)
return msg

View File

@ -205,8 +205,8 @@ class OFPSwitchFeatures(MsgBase):
msg.n_tables,
msg.capabilities,
msg._reserved) = struct.unpack_from(
ofproto_v1_2.OFP_SWITCH_FEATURES_PACK_STR, msg.buf,
ofproto_v1_2.OFP_HEADER_SIZE)
ofproto_v1_2.OFP_SWITCH_FEATURES_PACK_STR, msg.buf,
ofproto_v1_2.OFP_HEADER_SIZE)
msg.ports = {}
n_ports = ((msg_len - ofproto_v1_2.OFP_SWITCH_FEATURES_SIZE) /
@ -278,8 +278,8 @@ class OFPPacketIn(MsgBase):
msg_len, xid, buf)
(msg.buffer_id, msg.total_len, msg.reason,
msg.table_id) = struct.unpack_from(
ofproto_v1_2.OFP_PACKET_IN_PACK_STR,
msg.buf, ofproto_v1_2.OFP_HEADER_SIZE)
ofproto_v1_2.OFP_PACKET_IN_PACK_STR,
msg.buf, ofproto_v1_2.OFP_HEADER_SIZE)
msg.match = OFPMatch.parser(msg.buf, ofproto_v1_2.OFP_PACKET_IN_SIZE -
ofproto_v1_2.OFP_MATCH_SIZE)
@ -324,9 +324,9 @@ class OFPFlowRemoved(MsgBase):
msg.table_id, msg.duration_sec, msg.duration_nsec,
msg.idle_timeout, msg.hard_timeout, msg.packet_count,
msg.byte_count) = struct.unpack_from(
ofproto_v1_2.OFP_FLOW_REMOVED_PACK_STR0,
msg.buf,
ofproto_v1_2.OFP_HEADER_SIZE)
ofproto_v1_2.OFP_FLOW_REMOVED_PACK_STR0,
msg.buf,
ofproto_v1_2.OFP_HEADER_SIZE)
offset = (ofproto_v1_2.OFP_FLOW_REMOVED_SIZE -
ofproto_v1_2.OFP_MATCH_SIZE)
@ -1075,8 +1075,8 @@ class OFPFlowStats(StringifyMixin):
duration_nsec, priority,
idle_timeout, hard_timeout,
cookie, packet_count, byte_count) = struct.unpack_from(
ofproto_v1_2.OFP_FLOW_STATS_PACK_STR,
buf, offset)
ofproto_v1_2.OFP_FLOW_STATS_PACK_STR,
buf, offset)
offset += (ofproto_v1_2.OFP_FLOW_STATS_SIZE -
ofproto_v1_2.OFP_MATCH_SIZE)
match = OFPMatch.parser(buf, offset)
@ -1274,8 +1274,8 @@ class OFPGroupStats(StringifyMixin):
def parser(cls, buf, offset):
(length, group_id, ref_count, packet_count,
byte_count) = struct.unpack_from(
ofproto_v1_2.OFP_GROUP_STATS_PACK_STR,
buf, offset)
ofproto_v1_2.OFP_GROUP_STATS_PACK_STR,
buf, offset)
bucket_len = length - ofproto_v1_2.OFP_GROUP_STATS_SIZE
offset += ofproto_v1_2.OFP_GROUP_STATS_SIZE

View File

@ -228,8 +228,8 @@ class OFPSwitchFeatures(MsgBase):
msg.auxiliary_id,
msg.capabilities,
msg._reserved) = struct.unpack_from(
ofproto_v1_3.OFP_SWITCH_FEATURES_PACK_STR, msg.buf,
ofproto_v1_3.OFP_HEADER_SIZE)
ofproto_v1_3.OFP_SWITCH_FEATURES_PACK_STR, msg.buf,
ofproto_v1_3.OFP_HEADER_SIZE)
return msg
@ -1420,8 +1420,8 @@ class OFPPacketIn(MsgBase):
msg_len, xid, buf)
(msg.buffer_id, msg.total_len, msg.reason,
msg.table_id, msg.cookie) = struct.unpack_from(
ofproto_v1_3.OFP_PACKET_IN_PACK_STR,
msg.buf, ofproto_v1_3.OFP_HEADER_SIZE)
ofproto_v1_3.OFP_PACKET_IN_PACK_STR,
msg.buf, ofproto_v1_3.OFP_HEADER_SIZE)
msg.match = OFPMatch.parser(msg.buf, ofproto_v1_3.OFP_PACKET_IN_SIZE -
ofproto_v1_3.OFP_MATCH_SIZE)
@ -1466,8 +1466,8 @@ class OFPFlowRemoved(MsgBase):
msg.table_id, msg.duration_sec, msg.duration_nsec,
msg.idle_timeout, msg.hard_timeout, msg.packet_count,
msg.byte_count) = struct.unpack_from(
ofproto_v1_3.OFP_FLOW_REMOVED_PACK_STR0,
msg.buf, ofproto_v1_3.OFP_HEADER_SIZE)
ofproto_v1_3.OFP_FLOW_REMOVED_PACK_STR0,
msg.buf, ofproto_v1_3.OFP_HEADER_SIZE)
offset = (ofproto_v1_3.OFP_FLOW_REMOVED_SIZE -
ofproto_v1_3.OFP_MATCH_SIZE)
@ -2254,7 +2254,7 @@ class OFPFlowStats(StringifyMixin):
flow_stats.hard_timeout, flow_stats.flags,
flow_stats.cookie, flow_stats.packet_count,
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
flow_stats.match = OFPMatch.parser(buf, offset)
@ -2523,7 +2523,7 @@ class OFPGroupDescStatsReply(OFPMultipartReply):
class OFPGroupFeaturesStats(ofproto_parser.namedtuple('OFPGroupFeaturesStats',
('types', 'capabilities', 'max_groups',
'actions'))):
'actions'))):
@classmethod
def parser(cls, buf, offset):
group_features = struct.unpack_from(
@ -2586,7 +2586,7 @@ class OFPMeterStats(StringifyMixin):
meter_stats.flow_count, meter_stats.packet_in_count,
meter_stats.byte_in_count, meter_stats.duration_sec,
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
meter_stats.band_stats = []
@ -2738,7 +2738,7 @@ class OFPMeterConfigStats(StringifyMixin):
(meter_config._length, meter_config.flags,
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
meter_config.bands = []
@ -2776,7 +2776,7 @@ class OFPMeterConfigStatsReply(OFPMultipartReply):
class OFPMeterFeaturesStats(ofproto_parser.namedtuple('OFPMeterFeaturesStats',
('max_meter', 'band_types', 'capabilities',
'max_band', 'max_color'))):
'max_band', 'max_color'))):
@classmethod
def parser(cls, buf, offset):
meter_features = struct.unpack_from(
@ -3078,8 +3078,8 @@ class OFPGetAsyncReply(MsgBase):
(packet_in_mask_m, packet_in_mask_s,
port_status_mask_m, port_status_mask_s,
flow_removed_mask_m, flow_removed_mask_s) = struct.unpack_from(
ofproto_v1_3.OFP_ASYNC_CONFIG_PACK_STR, msg.buf,
ofproto_v1_3.OFP_HEADER_SIZE)
ofproto_v1_3.OFP_ASYNC_CONFIG_PACK_STR, msg.buf,
ofproto_v1_3.OFP_HEADER_SIZE)
msg.packet_in_mask = [packet_in_mask_m, packet_in_mask_s]
msg.port_status_mask = [port_status_mask_m, port_status_mask_s]
msg.flow_removed_mask = [flow_removed_mask_m, flow_removed_mask_s]

View File

@ -5926,7 +5926,7 @@ class TestOFPGroupDescStats(unittest.TestCase):
# OFP_GROUP_DESC_STATS_PACK_STR = '!HBxI'
length = ofproto_v1_2.OFP_GROUP_DESC_STATS_SIZE \
+ (ofproto_v1_2.OFP_BUCKET_SIZE
+ ofproto_v1_2.OFP_ACTION_OUTPUT_SIZE) * bucket_cnt
+ ofproto_v1_2.OFP_ACTION_OUTPUT_SIZE) * bucket_cnt
fmt = ofproto_v1_2.OFP_GROUP_DESC_STATS_PACK_STR
buf = pack(fmt, length, type_, group_id)