fix pep8 1.3.3 warnings
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
1dcf8f76d9
commit
c8cd4226d7
@ -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,9 +171,12 @@ 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,
|
||||||
|
idle_timeout=0,
|
||||||
|
hard_timeout=0,
|
||||||
|
priority=ofproto.OFP_DEFAULT_PRIORITY,
|
||||||
out_port=old_port)
|
out_port=old_port)
|
||||||
|
|
||||||
# to make sure the old flow entries are purged.
|
# to make sure the old flow entries are purged.
|
||||||
|
@ -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))
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
@ -908,8 +908,8 @@ class NXActionFinTimeout(NXActionHeader):
|
|||||||
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,
|
||||||
@ -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,8 +980,8 @@ 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):
|
||||||
@ -992,8 +992,8 @@ 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
|
||||||
@ -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,
|
||||||
|
@ -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,
|
||||||
@ -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(
|
||||||
|
@ -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,
|
||||||
@ -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,8 +916,8 @@ 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):
|
||||||
@ -943,8 +943,8 @@ 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'))):
|
||||||
@ -979,8 +979,8 @@ 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):
|
||||||
@ -1014,8 +1014,8 @@ 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):
|
||||||
@ -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(
|
||||||
@ -1250,8 +1250,8 @@ 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):
|
||||||
@ -1295,8 +1295,8 @@ 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
|
||||||
|
|
||||||
|
3
setup.py
3
setup.py
@ -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=[]
|
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user