Signed-off-by: ISHIDA Wataru <ishida.wat...@lab.ntt.co.jp>
---
 ryu/lib/packet/bgp/__init__.py                     |   40 ++++++++++++--------
 ryu/lib/packet/bgp/exceptions.py                   |   29 +++++++-------
 ryu/services/protocols/bgp/api/core.py             |    4 +-
 ryu/services/protocols/bgp/api/rtconf.py           |   12 +++---
 ryu/services/protocols/bgp/core.py                 |    8 ++--
 ryu/services/protocols/bgp/info_base/base.py       |    2 +-
 ryu/services/protocols/bgp/info_base/vrf.py        |    6 +--
 .../protocols/bgp/operator/internal_api.py         |    2 +-
 ryu/services/protocols/bgp/peer.py                 |   17 +++++----
 ryu/services/protocols/bgp/processor.py            |    4 +-
 ryu/services/protocols/bgp/rtconf/base.py          |   20 +++++-----
 ryu/services/protocols/bgp/rtconf/common.py        |    8 ++--
 ryu/services/protocols/bgp/rtconf/neighbors.py     |   28 +++++++-------
 ryu/services/protocols/bgp/rtconf/vrfs.py          |    8 ++--
 ryu/services/protocols/bgp/utils/rtfilter.py       |    3 +-
 15 files changed, 103 insertions(+), 88 deletions(-)

diff --git a/ryu/lib/packet/bgp/__init__.py b/ryu/lib/packet/bgp/__init__.py
index 84b1cb2..d5cb536 100644
--- a/ryu/lib/packet/bgp/__init__.py
+++ b/ryu/lib/packet/bgp/__init__.py
@@ -53,7 +53,7 @@ BGP_CAP_ROUTE_REFRESH = 2  # RFC 2918
 BGP_CAP_CARRYING_LABEL_INFO = 4  # RFC 3107
 BGP_CAP_FOUR_OCTET_AS_NUMBER = 65  # RFC 4893
 BGP_CAP_ENHANCED_ROUTE_REFRESH = 70  # https://tools.ietf.org/html/\
-                               # draft-ietf-idr-bgp-enhanced-route-refresh-05
+# draft-ietf-idr-bgp-enhanced-route-refresh-05
 
 BGP_ATTR_FLAG_OPTIONAL = 1 << 7
 BGP_ATTR_FLAG_TRANSITIVE = 1 << 6
@@ -90,6 +90,7 @@ BGP_COMMUNITY_NO_EXPORT_SUBCONFED = 0xffffff03
 BGP_EXTENDED_COMMUNITY_ROUTE_TARGET = 0x02
 BGP_EXTENDED_COMMUNITY_ROUTE_ORIGIN = 0x03
 
+
 class RouteFamily(StringifyMixin):
     def __init__(self, afi, safi):
         self.afi = afi
@@ -102,9 +103,10 @@ class RouteFamily(StringifyMixin):
 RF_IPv4_UC = RouteFamily(afi.IP, safi.UNICAST)
 RF_IPv6_UC = RouteFamily(afi.IP6, safi.UNICAST)
 RF_IPv4_VPN = RouteFamily(afi.IP, safi.MPLS_VPN)
-RF_IPv6_VPN = RouteFamily(afi.IP6, safi.MPLS_VPN) 
+RF_IPv6_VPN = RouteFamily(afi.IP6, safi.MPLS_VPN)
 RF_RTC_UC = RouteFamily(afi.IP, safi.ROUTE_TARGET_CONSTRTAINS)
 
+
 def pad(bin, len_):
     assert len(bin) <= len_
     return bin + (len_ - len(bin)) * '\0'
@@ -259,6 +261,7 @@ class _IPAddrPrefix(_AddrPrefix):
     def _prefix_from_bin(addr):
         return (addrconv.ipv4.bin_to_text(pad(addr, 4)),)
 
+
 class _IP6AddrPrefix(_AddrPrefix):
     _TYPE = {
         'ascii': [
@@ -308,6 +311,7 @@ class _VPNAddrPrefix(_AddrPrefix):
         (rd,) = struct.unpack_from(cls._RD_PACK_STR, buffer(binrd))
         return (rd,) + super(_VPNAddrPrefix, cls)._prefix_from_bin(binrest)
 
+
 class IPAddrPrefix(_UnlabelledAddrPrefix, _IPAddrPrefix):
     ROUTE_FAMILY = RF_IPv4_UC
 
@@ -315,6 +319,7 @@ class IPAddrPrefix(_UnlabelledAddrPrefix, _IPAddrPrefix):
     def prefix(self):
         return self.addr
 
+
 class IP6AddrPrefix(_UnlabelledAddrPrefix, _IP6AddrPrefix):
     ROUTE_FAMILY = RF_IPv6_UC
 
@@ -322,21 +327,24 @@ class IP6AddrPrefix(_UnlabelledAddrPrefix, 
_IP6AddrPrefix):
     def prefix(self):
         return self.addr
 
+
 class LabelledVPNIPAddrPrefix(_LabelledAddrPrefix, _VPNAddrPrefix,
                               _IPAddrPrefix):
     ROUTE_FAMILY = RF_IPv4_VPN
 
+
 class LabelledVPNIP6AddrPrefix(_LabelledAddrPrefix, _VPNAddrPrefix,
-                              _IP6AddrPrefix):
+                               _IP6AddrPrefix):
     ROUTE_FAMILY = RF_IPv6_VPN
 
+
 class RouteTargetMembershipNLRI(StringifyMixin):
     """Route Target Membership NLRI.
 
     Route Target membership NLRI is advertised in BGP UPDATE messages using
     the MP_REACH_NLRI and MP_UNREACH_NLRI attributes.
     """
- 
+
     ROUTE_FAMILY = RF_RTC_UC
     DEFAULT_AS = '0:0'
     DEFAULT_RT = '0:0'
@@ -415,14 +423,14 @@ class RouteTargetMembershipNLRI(StringifyMixin):
         # RT Nlri is 12 octets
         return struct.pack('B', (8 * 12)) + rt_nlri
 
-_addr_class_key = lambda x : (x.afi, x.safi)
+_addr_class_key = lambda x: (x.afi, x.safi)
 
 _ADDR_CLASSES = {
-    _addr_class_key(RF_IPv4_UC) : IPAddrPrefix,
-    _addr_class_key(RF_IPv6_UC) : IP6AddrPrefix,
-    _addr_class_key(RF_IPv4_VPN) : LabelledVPNIPAddrPrefix,
-    _addr_class_key(RF_IPv6_VPN) : LabelledVPNIP6AddrPrefix,
-    _addr_class_key(RF_RTC_UC) : RouteTargetMembershipNLRI,
+    _addr_class_key(RF_IPv4_UC): IPAddrPrefix,
+    _addr_class_key(RF_IPv6_UC): IP6AddrPrefix,
+    _addr_class_key(RF_IPv4_VPN): LabelledVPNIPAddrPrefix,
+    _addr_class_key(RF_IPv6_VPN): LabelledVPNIP6AddrPrefix,
+    _addr_class_key(RF_RTC_UC): RouteTargetMembershipNLRI,
 }
 
 
@@ -507,7 +515,7 @@ class _OptParam(StringifyMixin, _TypeDisp, _Value):
             type_ = self._rev_lookup_type(self.__class__)
         self.type = type_
         self.length = length
-        if not value is None:
+        if value is not None:
             self.value = value
 
     @classmethod
@@ -553,9 +561,9 @@ class _OptParamCapability(_OptParam, _TypeDisp):
         if cap_code is None:
             cap_code = self._rev_lookup_type(self.__class__)
         self.cap_code = cap_code
-        if not cap_value is None:
+        if cap_value is not None:
             self.cap_value = cap_value
-        if not cap_length is None:
+        if cap_length is not None:
             self.cap_length = cap_length
 
     @classmethod
@@ -605,10 +613,12 @@ class BGPOptParamCapabilityUnknown(_OptParamCapability):
 class BGPOptParamCapabilityRouteRefresh(_OptParamEmptyCapability):
     pass
 
+
 @_OptParamCapability.register_type(BGP_CAP_ENHANCED_ROUTE_REFRESH)
 class BGPOptParamCapabilityEnhancedRouteRefresh(_OptParamEmptyCapability):
     pass
 
+
 @_OptParamCapability.register_type(BGP_CAP_FOUR_OCTET_AS_NUMBER)
 class BGPOptParamCapabilityFourOctetAsNumber(_OptParamCapability):
     _CAP_PACK_STR = '!I'
@@ -679,7 +689,7 @@ class _PathAttribute(StringifyMixin, _TypeDisp, _Value):
         self.flags = flags
         self.type = type_
         self.length = length
-        if not value is None:
+        if value is not None:
             self.value = value
 
     @classmethod
@@ -700,7 +710,7 @@ class _PathAttribute(StringifyMixin, _TypeDisp, _Value):
 
     def serialize(self):
         # fixup
-        if not self._ATTR_FLAGS is None:
+        if self._ATTR_FLAGS is not None:
             self.flags = self.flags \
                 & ~(BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANSITIVE) \
                 | self._ATTR_FLAGS
diff --git a/ryu/lib/packet/bgp/exceptions.py b/ryu/lib/packet/bgp/exceptions.py
index 4fced89..922bfd3 100644
--- a/ryu/lib/packet/bgp/exceptions.py
+++ b/ryu/lib/packet/bgp/exceptions.py
@@ -37,7 +37,7 @@ BGP_ERROR_SUB_UNSUPPORTED_VERSION_NUMBER = 1  # Data: 2 octet 
version number
 BGP_ERROR_SUB_BAD_PEER_AS = 2
 BGP_ERROR_SUB_BAD_BGP_IDENTIFIER = 3
 BGP_ERROR_SUB_UNSUPPORTED_OPTIONAL_PARAMETER = 4
-BGP_ERROR_SUB_AUTHENTICATION_FAILURE = 5# deprecated RFC 1771
+BGP_ERROR_SUB_AUTHENTICATION_FAILURE = 5  # deprecated RFC 1771
 BGP_ERROR_SUB_UNACCEPTABLE_HOLD_TIME = 6
 
 # NOTIFICATION Error Subcode for BGP_ERROR_UPDATE_MESSAGE_ERROR
@@ -47,7 +47,7 @@ BGP_ERROR_SUB_MISSING_WELL_KNOWN_ATTRIBUTE = 3  # Data: ditto
 BGP_ERROR_SUB_ATTRIBUTE_FLAGS_ERROR = 4  # Data: the attr (type, len, value)
 BGP_ERROR_SUB_ATTRIBUTE_LENGTH_ERROR = 5  # Data: ditto
 BGP_ERROR_SUB_INVALID_ORIGIN_ATTRIBUTE = 6  # Data: ditto
-BGP_ERROR_SUB_ROUTING_LOOP = 7 # deprecated RFC 1771 AS Routing Loop
+BGP_ERROR_SUB_ROUTING_LOOP = 7  # deprecated RFC 1771 AS Routing Loop
 BGP_ERROR_SUB_INVALID_NEXT_HOP_ATTRIBUTE = 8  # Data: ditto
 BGP_ERROR_SUB_OPTIONAL_ATTRIBUTE_ERROR = 9  # Data: ditto
 BGP_ERROR_SUB_INVALID_NETWORK_FIELD = 10
@@ -69,6 +69,7 @@ BGP_ERROR_SUB_OTHER_CONFIGURATION_CHANGE = 6
 BGP_ERROR_SUB_CONNECTION_COLLISION_RESOLUTION = 7
 BGP_ERROR_SUB_OUT_OF_RESOURCES = 8
 
+
 class BgpExc(Exception):
     """Base bgp exception."""
 
@@ -91,9 +92,9 @@ class BgpExc(Exception):
 class BadNotification(BgpExc):
     SEND_ERROR = False
 
-#=============================================================================
+# ============================================================================
 # Message Header Errors
-#=============================================================================
+# ============================================================================
 
 
 class NotSync(BgpExc):
@@ -131,9 +132,9 @@ class BadMsg(BgpExc):
     def __str__(self):
         return '<BadMsg %d>' % (self.msg,)
 
-#=============================================================================
+# ============================================================================
 # OPEN Message Errors
-#=============================================================================
+# ============================================================================
 
 
 class MalformedOptionalParam(BgpExc):
@@ -214,9 +215,9 @@ class UnacceptableHoldTime(BgpExc):
     CODE = BGP_ERROR_OPEN_MESSAGE_ERROR
     SUB_CODE = BGP_ERROR_SUB_UNACCEPTABLE_HOLD_TIME
 
-#=============================================================================
+# ============================================================================
 # UPDATE message related errors
-#=============================================================================
+# ============================================================================
 
 
 class MalformedAttrList(BgpExc):
@@ -319,9 +320,9 @@ class MalformedAsPath(BgpExc):
     SUB_CODE = BGP_ERROR_SUB_MALFORMED_AS_PATH
 
 
-#=============================================================================
+# ============================================================================
 # Hold Timer Expired
-#=============================================================================
+# ============================================================================
 
 
 class HoldTimerExpired(BgpExc):
@@ -335,9 +336,9 @@ class HoldTimerExpired(BgpExc):
     CODE = BGP_ERROR_HOLD_TIMER_EXPIRED
     SUB_CODE = BGP_ERROR_SUB_HOLD_TIMER_EXPIRED
 
-#=============================================================================
+# ============================================================================
 # Finite State Machine Error
-#=============================================================================
+# ============================================================================
 
 
 class FiniteStateMachineError(BgpExc):
@@ -351,9 +352,9 @@ class FiniteStateMachineError(BgpExc):
     SUB_CODE = BGP_ERROR_SUB_FSM_ERROR
 
 
-#=============================================================================
+# ============================================================================
 # Cease Errors
-#=============================================================================
+# ============================================================================
 
 class MaxPrefixReached(BgpExc):
     CODE = BGP_ERROR_CEASE
diff --git a/ryu/services/protocols/bgp/api/core.py 
b/ryu/services/protocols/bgp/api/core.py
index b90ff89..d8ee144 100644
--- a/ryu/services/protocols/bgp/api/core.py
+++ b/ryu/services/protocols/bgp/api/core.py
@@ -79,9 +79,9 @@ def reset_neighor(ip_address):
     return True
 
 
-#==============================================================================
+# =============================================================================
 # Common configuration related APIs
-#==============================================================================
+# =============================================================================
 
 @register(name='comm_conf.get')
 def get_common_conf():
diff --git a/ryu/services/protocols/bgp/api/rtconf.py 
b/ryu/services/protocols/bgp/api/rtconf.py
index 98f51d9..bca6cc7 100644
--- a/ryu/services/protocols/bgp/api/rtconf.py
+++ b/ryu/services/protocols/bgp/api/rtconf.py
@@ -33,9 +33,9 @@ from ryu.services.protocols.bgp.rtconf.vrfs import VrfConf
 LOG = logging.getLogger('bgpspeaker.api.rtconf')
 
 
-#==============================================================================
+# =============================================================================
 # Neighbor configuration related APIs
-#==============================================================================
+# =============================================================================
 
 
 def _get_neighbor_conf(neigh_ip_address):
@@ -112,9 +112,9 @@ def get_neighbors_conf():
     return CORE_MANAGER.neighbors_conf.settings
 
 
-#==============================================================================
+# =============================================================================
 # VRF configuration related APIs
-#==============================================================================
+# =============================================================================
 
 @register(name='vrf.create')
 def create_vrf(**kwargs):
@@ -168,9 +168,9 @@ def get_vrfs_conf():
     vrfs_conf = CORE_MANAGER.vrfs_conf
     return vrfs_conf.settings
 
-#==============================================================================
+# =============================================================================
 # network configuration related APIs
-#==============================================================================
+# =============================================================================
 
 
 @register(name='network.add')
diff --git a/ryu/services/protocols/bgp/core.py 
b/ryu/services/protocols/bgp/core.py
index db3d791..f38ece1 100644
--- a/ryu/services/protocols/bgp/core.py
+++ b/ryu/services/protocols/bgp/core.py
@@ -225,9 +225,9 @@ class CoreService(Factory, Activity):
         server_thread.wait()
         processor_thread.wait()
 
-    #=========================================================================
+    # ========================================================================
     # RTC address family related utilities
-    #=========================================================================
+    # ========================================================================
 
     def update_rtfilters(self):
         """Updates RT filters for each peer.
@@ -343,9 +343,9 @@ class CoreService(Factory, Activity):
 
         return rtfilter_map
 
-    #=========================================================================
+    # ========================================================================
     # Peer or Neighbor related handles/utilities.
-    #=========================================================================
+    # ========================================================================
     def register_flexinet_sink(self, sink):
         self._sinks.add(sink)
 
diff --git a/ryu/services/protocols/bgp/info_base/base.py 
b/ryu/services/protocols/bgp/info_base/base.py
index 741825d..c735c30 100644
--- a/ryu/services/protocols/bgp/info_base/base.py
+++ b/ryu/services/protocols/bgp/info_base/base.py
@@ -761,7 +761,7 @@ class Path(object):
 
     def get_rts(self):
         extcomm_attr = self._path_attr_map.get(
-                BGP_ATTR_TYPE_EXTENDED_COMMUNITIES)
+            BGP_ATTR_TYPE_EXTENDED_COMMUNITIES)
         if extcomm_attr is None:
             rts = []
         else:
diff --git a/ryu/services/protocols/bgp/info_base/vrf.py 
b/ryu/services/protocols/bgp/info_base/vrf.py
index 1468450..30b53a2 100644
--- a/ryu/services/protocols/bgp/info_base/vrf.py
+++ b/ryu/services/protocols/bgp/info_base/vrf.py
@@ -210,11 +210,11 @@ class VrfTable(Table):
             from ryu.services.protocols.bgp.core import EXPECTED_ORIGIN
 
             pattrs[BGP_ATTR_TYPE_ORIGIN] = BGPPathAttributeOrigin(
-                                                            EXPECTED_ORIGIN)
+                EXPECTED_ORIGIN)
             pattrs[BGP_ATTR_TYPE_AS_PATH] = BGPPathAttributeAsPath([])
             pattrs[BGP_ATTR_TYPE_EXTENDED_COMMUNITIES] = \
-                    BGPPathAttributeExtendedCommunities(
-                    rt_list=vrf_conf.export_rts, soo_list=vrf_conf.soo_list)
+                BGPPathAttributeExtendedCommunities(
+                rt_list=vrf_conf.export_rts, soo_list=vrf_conf.soo_list)
             if vrf_conf.multi_exit_disc:
                 pattrs[BGP_ATTR_TYPE_MULTI_EXIT_DISC] = \
                     BGPPathAttributeMultiExitDisc(vrf_conf.multi_exit_disc)
diff --git a/ryu/services/protocols/bgp/operator/internal_api.py 
b/ryu/services/protocols/bgp/operator/internal_api.py
index c3c7e62..b83ce0d 100644
--- a/ryu/services/protocols/bgp/operator/internal_api.py
+++ b/ryu/services/protocols/bgp/operator/internal_api.py
@@ -3,7 +3,7 @@ import traceback
 
 from ryu.lib.packet.bgp import RouteFamily
 from ryu.lib.packet.bgp import RF_IPv4_UC
-from ryu.lib.packet.bgp import RF_IPv6_UC 
+from ryu.lib.packet.bgp import RF_IPv6_UC
 from ryu.lib.packet.bgp import RF_IPv4_VPN
 from ryu.lib.packet.bgp import RF_IPv6_VPN
 from ryu.lib.packet.bgp import RF_RTC_UC
diff --git a/ryu/services/protocols/bgp/peer.py 
b/ryu/services/protocols/bgp/peer.py
index ec37d12..4bb59fb 100644
--- a/ryu/services/protocols/bgp/peer.py
+++ b/ryu/services/protocols/bgp/peer.py
@@ -138,7 +138,7 @@ class PeerState(object):
         }
         self._signal_bus = signal_bus
 
-        #TODO(JK): refactor other counters to use signals also
+        # TODO(JK): refactor other counters to use signals also
         self._signal_bus.register_listener(
             ('error', 'bgp', self.peer),
             self._remember_last_bgp_error
@@ -681,7 +681,8 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
             # For eBGP session we can send multi-exit-disc if configured.
             multi_exit_disc = None
             if self.is_ebgp_peer():
-                multi_exit_disc = 
pathattr_map.get(BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+                multi_exit_disc = pathattr_map.get(
+                    BGP_ATTR_TYPE_MULTI_EXIT_DISC)
                 if not multi_exit_disc and self._neigh_conf.multi_exit_disc:
                     multi_exit_disc = BGPPathAttributeMultiExitDisc(
                         self._neigh_conf.multi_exit_disc
@@ -699,7 +700,7 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
             # EXTENDED COMMUNITY Attribute.
             # Construct ExtCommunity path-attr based on given.
             path_extcomm_attr = pathattr_map.get(
-                    BGP_ATTR_TYPE_EXTENDED_COMMUNITIES
+                BGP_ATTR_TYPE_EXTENDED_COMMUNITIES
             )
             if path_extcomm_attr:
                 # SOO list can be configured per VRF and/or per Neighbor.
@@ -837,7 +838,7 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
             multi_exit_disc = None
             if self.is_ebgp_peer():
                 multi_exit_disc = pathattr_map.get(
-                        BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+                    BGP_ATTR_TYPE_MULTI_EXIT_DISC)
 
             # LOCAL_PREF Attribute.
             if not self.is_ebgp_peer():
@@ -851,7 +852,7 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
             # EXTENDED COMMUNITY Attribute.
             # Construct ExtCommunity path-attr based on given.
             path_extcomm_attr = pathattr_map.get(
-                    BGP_ATTR_TYPE_EXTENDED_COMMUNITIES
+                BGP_ATTR_TYPE_EXTENDED_COMMUNITIES
             )
             if path_extcomm_attr:
                 # SOO list can be configured per VRF and/or per Neighbor.
@@ -1044,6 +1045,7 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
         asnum = self._common_conf.local_as
         bgpid = self._common_conf.router_id
         holdtime = self._neigh_conf.hold_time
+
         def flatten(L):
             if isinstance(L, list):
                 for i in xrange(len(L)):
@@ -1051,7 +1053,8 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
                         yield e
             else:
                 yield L
-        opts = 
list(flatten(self._neigh_conf.get_configured_capabilites().values()))
+        opts = list(flatten(
+            self._neigh_conf.get_configured_capabilites().values()))
         open_msg = BGPOpen(
             my_as=asnum,
             bgp_identifier=bgpid,
@@ -1183,7 +1186,7 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
         # Increment count of update received.
         mp_reach_attr = update_msg.get_path_attr(BGP_ATTR_TYPE_MP_REACH_NLRI)
         mp_unreach_attr = update_msg.get_path_attr(
-                BGP_ATTR_TYPE_MP_UNREACH_NLRI
+            BGP_ATTR_TYPE_MP_UNREACH_NLRI
         )
 
         nlri_list = update_msg.nlri
diff --git a/ryu/services/protocols/bgp/processor.py 
b/ryu/services/protocols/bgp/processor.py
index b24d6a4..e56224d 100644
--- a/ryu/services/protocols/bgp/processor.py
+++ b/ryu/services/protocols/bgp/processor.py
@@ -152,9 +152,9 @@ class BgpProcessor(Activity):
         # Wake-up processing thread if sleeping.
         self.dest_que_evt.set()
 
-#==============================================================================
+# =============================================================================
 # Best path computation related utilities.
-#==============================================================================
+# =============================================================================
 
 # Various reasons a path is chosen as best path.
 BPR_UNKNOWN = 'Unknown'
diff --git a/ryu/services/protocols/bgp/rtconf/base.py 
b/ryu/services/protocols/bgp/rtconf/base.py
index d7aa31f..7b625fd 100644
--- a/ryu/services/protocols/bgp/rtconf/base.py
+++ b/ryu/services/protocols/bgp/rtconf/base.py
@@ -71,9 +71,9 @@ MAX_NUM_EXPORT_RT = 250
 MAX_NUM_SOO = 10
 
 
-#==============================================================================
+# =============================================================================
 # Runtime configuration errors or exceptions.
-#==============================================================================
+# =============================================================================
 
 @add_bgp_error_metadata(code=RUNTIME_CONF_ERROR_CODE, sub_code=1,
                         def_desc='Error with runtime-configuration.')
@@ -137,9 +137,9 @@ class ConfigValueError(RuntimeConfigError):
             super(ConfigValueError, self).__init__(desc=kwargs.get('desc'))
 
 
-#==============================================================================
+# =============================================================================
 # Configuration base classes.
-#==============================================================================
+# =============================================================================
 
 class BaseConf(object):
     """Base class for a set of configuration values.
@@ -223,8 +223,8 @@ class BaseConf(object):
             self._settings[req_attr] = req_attr_value
 
     def add_listener(self, evt, callback):
-#         if (evt not in self.get_valid_evts()):
-#             raise RuntimeConfigError(desc=('Unknown event %s' % evt))
+        #   if (evt not in self.get_valid_evts()):
+        #       raise RuntimeConfigError(desc=('Unknown event %s' % evt))
 
         listeners = self._listeners.get(evt, None)
         if not listeners:
@@ -521,9 +521,9 @@ class ConfEvent(object):
                    (self.src, self.name, self.value))
 
 
-#==============================================================================
+# =============================================================================
 # Runtime configuration setting validators and their registry.
-#==============================================================================
+# =============================================================================
 
 @validate(name=ConfWithId.ID)
 def validate_conf_id(identifier):
@@ -687,9 +687,9 @@ def validate_advertise_peer_as(advertise_peer_as):
     return advertise_peer_as
 
 
-#==============================================================================
+# =============================================================================
 # Other utils.
-#==============================================================================
+# =============================================================================
 
 def compute_optional_conf(conf_name, default_value, **all_config):
     """Returns *conf_name* settings if provided in *all_config*, else returns
diff --git a/ryu/services/protocols/bgp/rtconf/common.py 
b/ryu/services/protocols/bgp/rtconf/common.py
index b4fc5ca..05d3a7a 100644
--- a/ryu/services/protocols/bgp/rtconf/common.py
+++ b/ryu/services/protocols/bgp/rtconf/common.py
@@ -229,9 +229,9 @@ class CommonConf(BaseConf):
             MAX_PATH_EXT_RTFILTER_ALL, DEFAULT_MAX_PATH_EXT_RTFILTER_ALL,
             **kwargs)
 
-    #==========================================================================
+    # =========================================================================
     # Required attributes
-    #==========================================================================
+    # =========================================================================
 
     @property
     def local_as(self):
@@ -241,9 +241,9 @@ class CommonConf(BaseConf):
     def router_id(self):
         return self._settings[ROUTER_ID]
 
-    #==========================================================================
+    # =========================================================================
     # Optional attributes with valid defaults.
-    #==========================================================================
+    # =========================================================================
 
     @property
     def bgp_conn_retry_time(self):
diff --git a/ryu/services/protocols/bgp/rtconf/neighbors.py 
b/ryu/services/protocols/bgp/rtconf/neighbors.py
index f716db4..9983626 100644
--- a/ryu/services/protocols/bgp/rtconf/neighbors.py
+++ b/ryu/services/protocols/bgp/rtconf/neighbors.py
@@ -225,9 +225,9 @@ class NeighborConf(ConfWithId, ConfWithStats):
         self_valid_evts.update(NeighborConf.VALID_EVT)
         return self_valid_evts
 
-    #==========================================================================
+    # =========================================================================
     # Required attributes
-    #==========================================================================
+    # =========================================================================
 
     @property
     def remote_as(self):
@@ -245,9 +245,9 @@ class NeighborConf(ConfWithId, ConfWithStats):
     def host_bind_port(self):
         return self._settings[LOCAL_PORT]
 
-    #==========================================================================
+    # =========================================================================
     # Optional attributes with valid defaults.
-    #==========================================================================
+    # =========================================================================
 
     @property
     def hold_time(self):
@@ -289,9 +289,9 @@ class NeighborConf(ConfWithId, ConfWithStats):
             self._notify_listeners(NeighborConf.UPDATE_ENABLED_EVT,
                                    enable)
 
-    #==========================================================================
+    # =========================================================================
     # Optional attributes with no valid defaults.
-    #==========================================================================
+    # =========================================================================
 
     @property
     def multi_exit_disc(self):
@@ -335,20 +335,20 @@ class NeighborConf(ConfWithId, ConfWithStats):
         capabilities = OrderedDict()
         mbgp_caps = []
         if self.cap_mbgp_ipv4:
-            mbgp_caps.append(BGPOptParamCapabilityMultiprotocol(RF_IPv4_UC.afi,
-                                                                
RF_IPv4_UC.safi))
+            mbgp_caps.append(BGPOptParamCapabilityMultiprotocol(
+                RF_IPv4_UC.afi, RF_IPv4_UC.safi))
 
         if self.cap_mbgp_vpnv4:
-            
mbgp_caps.append(BGPOptParamCapabilityMultiprotocol(RF_IPv4_VPN.afi,
-                                                                
RF_IPv4_VPN.safi))
+            mbgp_caps.append(BGPOptParamCapabilityMultiprotocol(
+                RF_IPv4_VPN.afi, RF_IPv4_VPN.safi))
 
         if self.cap_mbgp_vpnv6:
-            
mbgp_caps.append(BGPOptParamCapabilityMultiprotocol(RF_IPv6_VPN.afi,
-                                                                
RF_IPv6_VPN.safi))
+            mbgp_caps.append(BGPOptParamCapabilityMultiprotocol(
+                RF_IPv6_VPN.afi, RF_IPv6_VPN.safi))
 
         if self.cap_rtc:
-            mbgp_caps.append(BGPOptParamCapabilityMultiprotocol(RF_RTC_UC.afi,
-                                                                
RF_RTC_UC.safi))
+            mbgp_caps.append(BGPOptParamCapabilityMultiprotocol(
+                RF_RTC_UC.afi, RF_RTC_UC.safi))
 
         if mbgp_caps:
             capabilities[BGP_CAP_MULTIPROTOCOL] = mbgp_caps
diff --git a/ryu/services/protocols/bgp/rtconf/vrfs.py 
b/ryu/services/protocols/bgp/rtconf/vrfs.py
index 2993e29..48b4809 100644
--- a/ryu/services/protocols/bgp/rtconf/vrfs.py
+++ b/ryu/services/protocols/bgp/rtconf/vrfs.py
@@ -165,17 +165,17 @@ class VrfConf(ConfWithId, ConfWithStats):
         import_maps = kwargs.pop(IMPORT_MAPS, [])
         self._settings[IMPORT_MAPS] = import_maps
 
-    #==========================================================================
+    # =========================================================================
     # Required attributes
-    #==========================================================================
+    # =========================================================================
 
     @property
     def route_dist(self):
         return self._settings[ROUTE_DISTINGUISHER]
 
-    #==========================================================================
+    # =========================================================================
     # Optional attributes with valid defaults.
-    #==========================================================================
+    # =========================================================================
 
     @property
     def import_rts(self):
diff --git a/ryu/services/protocols/bgp/utils/rtfilter.py 
b/ryu/services/protocols/bgp/utils/rtfilter.py
index 4a044b6..aa8d42a 100644
--- a/ryu/services/protocols/bgp/utils/rtfilter.py
+++ b/ryu/services/protocols/bgp/utils/rtfilter.py
@@ -83,7 +83,8 @@ class RouteTargetManager(object):
         if not is_withdraw:
             # MpReachNlri and/or MpUnReachNlri attribute info. is contained
             # in the path. Hence we do not add these attributes here.
-            pattrs[BGP_ATTR_TYPE_ORIGIN] = 
BGPPathAttributeOrigin(EXPECTED_ORIGIN)
+            pattrs[BGP_ATTR_TYPE_ORIGIN] = BGPPathAttributeOrigin(
+                EXPECTED_ORIGIN)
             pattrs[BGP_ATTR_TYPE_AS_PATH] = BGPPathAttributeAsPath([])
 
         # Create Path instance and initialize appropriately.
-- 
1.7.9.5


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to