Signed-off-by: Yoshihiro Kaneko <[email protected]>
---
 ryu/lib/igmplib.py    |   46 +++++++++++++++++++++++-----------------------
 ryu/lib/lacplib.py    |   20 ++++++++++----------
 ryu/lib/ofctl_v1_2.py |    4 ++--
 ryu/lib/ofctl_v1_3.py |    4 ++--
 ryu/lib/rpc.py        |    2 +-
 ryu/lib/stplib.py     |    8 ++++----
 ryu/lib/stringify.py  |    2 +-
 7 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/ryu/lib/igmplib.py b/ryu/lib/igmplib.py
index 9b3dc49..a282232 100644
--- a/ryu/lib/igmplib.py
+++ b/ryu/lib/igmplib.py
@@ -74,9 +74,9 @@ class EventMulticastGroupStateChanged(event.EventBase):
 class IgmpLib(app_manager.RyuApp):
     """IGMP snooping library."""
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PUBLIC METHODS
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def __init__(self):
         """initialization."""
         super(IgmpLib, self).__init__()
@@ -97,9 +97,9 @@ class IgmpLib(app_manager.RyuApp):
         """
         self._querier.set_querier_mode(dpid, server_port)
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PUBLIC METHODS ( EVENT HANDLERS )
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
     def packet_in_handler(self, evt):
         """PacketIn event handler. when the received packet was IGMP,
@@ -133,9 +133,9 @@ class IgmpLib(app_manager.RyuApp):
 class IgmpBase(object):
     """IGMP abstract class library."""
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PUBLIC METHODS
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def __init__(self):
         self._set_flow_func = {
             ofproto_v1_0.OFP_VERSION: self._set_flow_entry_v1_0,
@@ -148,9 +148,9 @@ class IgmpBase(object):
             ofproto_v1_3.OFP_VERSION: self._del_flow_entry_v1_2,
         }
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PROTECTED METHODS ( RELATED TO OPEN FLOW PROTOCOL )
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def _set_flow_entry_v1_0(self, datapath, actions, in_port, dst,
                              src=None):
         ofproto = datapath.ofproto
@@ -230,9 +230,9 @@ class IgmpBase(object):
             data=data, in_port=in_port, actions=actions)
         datapath.send_msg(out)
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PROTECTED METHODS ( OTHERS )
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def _ipv4_text_to_int(self, ip_text):
         """convert ip v4 string to integer."""
         if ip_text is None:
@@ -251,9 +251,9 @@ class IgmpQuerier(IgmpBase):
     - and so on
     """
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PUBLIC METHODS
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def __init__(self):
         """initialization."""
         super(IgmpQuerier, self).__init__()
@@ -319,9 +319,9 @@ class IgmpQuerier(IgmpBase):
         self._datapath = None
         self.logger.info("stopped a querier.")
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PRIVATE METHODS ( RELATED TO IGMP )
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def _send_query(self):
         """ send a QUERY message periodically."""
         timeout = 60
@@ -407,7 +407,7 @@ class IgmpQuerier(IgmpBase):
 
         update = False
         self._mcast.setdefault(report.address, {})
-        if not in_port in self._mcast[report.address]:
+        if in_port not in self._mcast[report.address]:
             update = True
         self._mcast[report.address][in_port] = True
 
@@ -442,9 +442,9 @@ class IgmpQuerier(IgmpBase):
                 self._del_flow_entry(
                     datapath, self.server_port, leave.address)
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PRIVATE METHODS ( OTHERS )
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def _set_logger(self):
         """change log format."""
         self.logger.propagate = False
@@ -457,9 +457,9 @@ class IgmpQuerier(IgmpBase):
 class IgmpSnooper(IgmpBase):
     """IGMP snooping class library."""
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PUBLIC METHODS
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def __init__(self, send_event):
         """initialization."""
         super(IgmpSnooper, self).__init__()
@@ -550,9 +550,9 @@ class IgmpSnooper(IgmpBase):
                              req_igmp.msgtype)
             self._do_flood(in_port, msg)
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PRIVATE METHODS ( RELATED TO IGMP )
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def _do_query(self, query, iph, eth, in_port, msg):
         """the process when the snooper received a QUERY message."""
         datapath = msg.datapath
@@ -798,9 +798,9 @@ class IgmpSnooper(IgmpBase):
             self._do_packet_out(
                 datapath, leave.data, in_port, actions)
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PRIVATE METHODS ( OTHERS )
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def _set_logger(self):
         """change log format."""
         self.logger.propagate = False
diff --git a/ryu/lib/lacplib.py b/ryu/lib/lacplib.py
index e425abb..84d4777 100644
--- a/ryu/lib/lacplib.py
+++ b/ryu/lib/lacplib.py
@@ -53,9 +53,9 @@ class EventSlaveStateChanged(event.EventBase):
 class LacpLib(app_manager.RyuApp):
     """LACP exchange library. this works only in a PASSIVE mode."""
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PUBLIC METHODS
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def __init__(self):
         """initialization."""
         super(LacpLib, self).__init__()
@@ -92,9 +92,9 @@ class LacpLib(app_manager.RyuApp):
         bond[dpid] = ifs
         self._bonds.append(bond)
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PUBLIC METHODS ( EVENT HANDLERS )
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
     def packet_in_handler(self, evt):
         """PacketIn event handler. when the received packet was LACP,
@@ -133,9 +133,9 @@ class LacpLib(app_manager.RyuApp):
         self.send_event_to_observers(
             EventSlaveStateChanged(datapath, port, False))
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PRIVATE METHODS ( RELATED TO LACP )
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def _do_lacp(self, req_lacp, src, msg):
         """packet-in process when the received packet is LACP."""
         datapath = msg.datapath
@@ -280,9 +280,9 @@ class LacpLib(app_manager.RyuApp):
                     break
         return result
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PRIVATE METHODS ( RELATED TO OPEN FLOW PROTOCOL )
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def _add_flow_v1_0(self, src, port, timeout, datapath):
         """enter a flow entry for the packet from the slave i/f
         with idle_timeout. for OpenFlow ver1.0."""
@@ -320,9 +320,9 @@ class LacpLib(app_manager.RyuApp):
             instructions=inst)
         datapath.send_msg(mod)
 
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     # PRIVATE METHODS ( OTHERS )
-    #-------------------------------------------------------------------
+    # -------------------------------------------------------------------
     def _set_logger(self):
         """change log format."""
         self.logger.propagate = False
diff --git a/ryu/lib/ofctl_v1_2.py b/ryu/lib/ofctl_v1_2.py
index 76e5520..52fe255 100644
--- a/ryu/lib/ofctl_v1_2.py
+++ b/ryu/lib/ofctl_v1_2.py
@@ -282,10 +282,10 @@ def to_match(dp, attrs):
 
     if attrs.get('dl_type') == ether.ETH_TYPE_ARP or \
             attrs.get('eth_type') == ether.ETH_TYPE_ARP:
-        if 'nw_src' in attrs and not 'arp_spa' in attrs:
+        if 'nw_src' in attrs and 'arp_spa' not in attrs:
             attrs['arp_spa'] = attrs['nw_src']
             del attrs['nw_src']
-        if 'nw_dst' in attrs and not 'arp_tpa' in attrs:
+        if 'nw_dst' in attrs and 'arp_tpa' not in attrs:
             attrs['arp_tpa'] = attrs['nw_dst']
             del attrs['nw_dst']
 
diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py
index d97da8a..16b1b52 100644
--- a/ryu/lib/ofctl_v1_3.py
+++ b/ryu/lib/ofctl_v1_3.py
@@ -309,10 +309,10 @@ def to_match(dp, attrs):
 
     if attrs.get('dl_type') == ether.ETH_TYPE_ARP or \
             attrs.get('eth_type') == ether.ETH_TYPE_ARP:
-        if 'nw_src' in attrs and not 'arp_spa' in attrs:
+        if 'nw_src' in attrs and 'arp_spa' not in attrs:
             attrs['arp_spa'] = attrs['nw_src']
             del attrs['nw_src']
-        if 'nw_dst' in attrs and not 'arp_tpa' in attrs:
+        if 'nw_dst' in attrs and 'arp_tpa' not in attrs:
             attrs['arp_tpa'] = attrs['nw_dst']
             del attrs['nw_dst']
 
diff --git a/ryu/lib/rpc.py b/ryu/lib/rpc.py
index 010f0a8..adbcb9a 100644
--- a/ryu/lib/rpc.py
+++ b/ryu/lib/rpc.py
@@ -202,7 +202,7 @@ class EndPoint(object):
             # bogus msgid
             # XXXwarn
             return
-        assert not msgid in self._responses
+        assert msgid not in self._responses
         self._responses[msgid] = (error, result)
         self._incoming += 1
 
diff --git a/ryu/lib/stplib.py b/ryu/lib/stplib.py
index fba2da2..8855cab 100644
--- a/ryu/lib/stplib.py
+++ b/ryu/lib/stplib.py
@@ -459,7 +459,7 @@ class Bridge(object):
                 if match_field.header == dp.ofproto.OXM_OF_IN_PORT:
                     in_port_no = match_field.value
                     break
-        if not in_port_no in self.ports:
+        if in_port_no not in self.ports:
             return
 
         in_port = self.ports[in_port_no]
@@ -506,7 +506,7 @@ class Bridge(object):
 
         elif bpdu.RstBPDUs in pkt:
             """ Receive Rst BPDU. """
-            #TODO: RSTP
+            # TODO: RSTP
             pass
 
         else:
@@ -1029,12 +1029,12 @@ class Port(object):
             flags=flags,
             root_priority=self.port_priority.root_id.priority,
             root_mac_address=self.port_priority.root_id.mac_addr,
-            root_path_cost=self.port_priority.root_path_cost+self.path_cost,
+            root_path_cost=self.port_priority.root_path_cost + self.path_cost,
             bridge_priority=self.bridge_id.priority,
             bridge_mac_address=self.bridge_id.mac_addr,
             port_priority=self.port_id.priority,
             port_number=self.ofport.port_no,
-            message_age=self.port_times.message_age+1,
+            message_age=self.port_times.message_age + 1,
             max_age=self.port_times.max_age,
             hello_time=self.port_times.hello_time,
             forward_delay=self.port_times.forward_delay)
diff --git a/ryu/lib/stringify.py b/ryu/lib/stringify.py
index 77de2b8..d6f5cc7 100644
--- a/ryu/lib/stringify.py
+++ b/ryu/lib/stringify.py
@@ -294,7 +294,7 @@ class StringifyMixin(object):
         try:
             return cls(**dict(kwargs, **additional_args))
         except TypeError:
-            #debug
+            # debug
             print "CLS", cls
             print "ARG", dict_
             print "KWARG", kwargs
-- 
1.7.9.5


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to