bgp: fix pep8

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
FUJITA Tomonori
2014-03-31 19:37:27 +09:00
parent 7c67afd263
commit 40da85eca2
8 changed files with 18 additions and 18 deletions

View File

@@ -40,7 +40,7 @@ def start(**kwargs):
waiter = kwargs.pop('waiter')
common_config = CommonConf(**kwargs)
eventlet.spawn(CORE_MANAGER.start, *[], **{'common_conf': common_config,
'waiter' : waiter})
'waiter': waiter})
return True

View File

@@ -172,10 +172,9 @@ def get_vrfs_conf():
# network configuration related APIs
#==============================================================================
@register(name='network.add')
def add_network(prefix):
tm = CORE_MANAGER.get_core_service().table_manager
tm.add_to_ipv4_global_table(prefix)
return True

View File

@@ -193,8 +193,6 @@ class TableCoreManager(object):
return vpn_table
def get_vpn6_table(self):
"""Returns global VPNv6 table.

View File

@@ -31,6 +31,7 @@ class IPv4Dest(Destination, NonVrfPathProcessingMixin):
def _new_best_path(self, best_path):
NonVrfPathProcessingMixin._new_best_path(self, best_path)
class Ipv4Table(Table):
"""Global table to store IPv4 routing information.
@@ -58,7 +59,6 @@ class Ipv4Table(Table):
)
class Ipv4Path(Path):
"""Represents a way of reaching an VPNv4 destination."""
ROUTE_FAMILY = RF_IPv4_UC

View File

@@ -1046,31 +1046,35 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
# non-MPBGP Update msg.
if not (mp_reach_attr or mp_unreach_attr):
LOG.info('Received UPDATE msg. with no MpReachNlri or '
'MpUnReachNlri attribute.')
'MpUnReachNlri attribute.')
if not self.is_mpbgp_cap_valid(nlri.RF_IPv4_UC):
LOG.error('Got UPDATE message with un-available afi/safi %s' % nlri.RF_IPv4_UC)
LOG.error('Got UPDATE message with un-available'
' afi/safi %s' % nlri.RF_IPv4_UC)
nlri_list = update_msg.nlri_list
if len(nlri_list) > 0:
# Check for missing well-known mandatory attributes.
aspath = update_msg.get_path_attr(pathattr.AsPath.ATTR_NAME)
if not aspath:
raise exceptions.MissingWellKnown(pathattr.AsPath.TYPE_CODE)
raise exceptions.MissingWellKnown(
pathattr.AsPath.TYPE_CODE)
# We do not have a setting to enable/disable first-as check.
# We by default do first-as check below.
if (self.is_ebgp_peer() and
not aspath.has_matching_leftmost(self.remote_as)):
LOG.error('First AS check fails. Raise appropriate exception.')
LOG.error('First AS check fails. Raise appropriate'
' exception.')
raise exceptions.MalformedAsPath()
origin = update_msg.get_path_attr(pathattr.Origin.ATTR_NAME)
if not origin:
raise exceptions.MissingWellKnown(pathattr.Origin.TYPE_CODE)
raise exceptions.MissingWellKnown(
pathattr.Origin.TYPE_CODE)
nexthop = update_msg.get_path_attr(pathattr.NextHop.ATTR_NAME)
if not nexthop:
raise exceptions.MissingWellKnown(pathattr.NextHop.TYPE_CODE)
raise exceptions.MissingWellKnown(
pathattr.NextHop.TYPE_CODE)
return True
@@ -1262,8 +1266,6 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
tm = self._core_service.table_manager
tm.learn_path(w_path)
def _extract_and_handle_mpbgp_new_paths(self, update_msg):
"""Extracts new paths advertised in the given update message's
*MpReachNlri* attribute.

View File

@@ -462,7 +462,6 @@ class Update(BgpMessage):
idx += plen
recv_len += plen
if d[Update.WITHDRAW_NLRI]:
withdraw_list = nlri.parse(d[Update.WITHDRAW_NLRI])
# TODO(PH): We have to test how ipv4 nlri packed after path-attr are

View File

@@ -588,6 +588,7 @@ def validate_cap_enhanced_refresh(cer):
'settings: %s boolean value expected' % cer)
return cer
@validate(name=CAP_MBGP_IPV4)
def validate_cap_mbgp_ipv4(cmv4):
if cmv4 not in (True, False):

View File

@@ -149,8 +149,9 @@ class NeighborConf(ConfWithId, ConfWithStats):
REQUIRED_SETTINGS = frozenset([REMOTE_AS, IP_ADDRESS, LOCAL_ADDRESS,
LOCAL_PORT])
OPTIONAL_SETTINGS = frozenset([CAP_REFRESH,
CAP_ENHANCED_REFRESH, CAP_MBGP_VPNV4, CAP_MBGP_IPV4,
CAP_MBGP_VPNV6, CAP_RTC, RTC_AS, HOLD_TIME,
CAP_ENHANCED_REFRESH, CAP_MBGP_VPNV4,
CAP_MBGP_IPV4, CAP_MBGP_VPNV6,
CAP_RTC, RTC_AS, HOLD_TIME,
ENABLED, MULTI_EXIT_DISC, MAX_PREFIXES,
ADVERTISE_PEER_AS, SITE_OF_ORIGINS])