bgp: fix typo

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
ISHIDA Wataru 2014-05-30 11:25:39 +09:00 committed by FUJITA Tomonori
parent 1f316cf1c1
commit 2c7ca2ff2d
10 changed files with 36 additions and 40 deletions

View File

@ -928,7 +928,7 @@ class LabelledVPNIPAddrPrefix(_LabelledAddrPrefix, _VPNAddrPrefix,
@property
def formatted_nlri_str(self):
return "%s:%s" % (self.route_disc, self.prefix)
return "%s:%s" % (self.route_dist, self.prefix)
class LabelledVPNIP6AddrPrefix(_LabelledAddrPrefix, _VPNAddrPrefix,
@ -951,7 +951,7 @@ class LabelledVPNIP6AddrPrefix(_LabelledAddrPrefix, _VPNAddrPrefix,
@property
def formatted_nlri_str(self):
return "%s:%s" % (self.route_disc, self.prefix)
return "%s:%s" % (self.route_dist, self.prefix)
class RouteTargetMembershipNLRI(StringifyMixin):

View File

@ -352,9 +352,9 @@ class CoreService(Factory, Activity):
def unregister_flexinet_sink(self, sink):
self._sinks.remove(sink)
def update_flexinet_peers(self, path, route_disc):
def update_flexinet_peers(self, path, route_dist):
for sink in self._sinks:
out_route = FlexinetOutgoingRoute(path, route_disc)
out_route = FlexinetOutgoingRoute(path, route_dist)
sink.enque_outgoing_msg(out_route)
def on_peer_added(self, peer):

View File

@ -431,10 +431,10 @@ class TableCoreManager(object):
if interested_tables:
# We iterate over all VRF tables that are interested in the RT
# of the given path and import this path into them.
route_disc = vpn_path.nlri.route_disc
route_dist = vpn_path.nlri.route_dist
for vrf_table in interested_tables:
if not (vpn_path.source is None
and route_disc == vrf_table.vrf_conf.route_dist):
and route_dist == vrf_table.vrf_conf.route_dist):
update_vrf_dest = vrf_table.import_vpn_path(vpn_path)
# Queue the destination for further processing.
if update_vrf_dest is not None:

View File

@ -44,7 +44,7 @@ class VpnTable(Table):
"""Return a key that will uniquely identify this vpnvX NLRI inside
this table.
"""
return vpn_nlri.route_disc + ':' + vpn_nlri.prefix
return vpn_nlri.route_dist + ':' + vpn_nlri.prefix
def _create_dest(self, nlri):
return self.VPN_DEST_CLASS(self, nlri)
@ -70,7 +70,7 @@ class VpnPath(Path):
vrf_path = self.VRF_PATH_CLASS(
self.VRF_PATH_CLASS.create_puid(
self._nlri.route_disc,
self._nlri.route_dist,
self._nlri.prefix
),
self.source, vrf_nlri,

View File

@ -151,7 +151,7 @@ class VrfTable(Table):
vrf_nlri = self.NLRI_CLASS(length=int(masklen), addr=ip)
vpn_nlri = vpn_path.nlri
puid = self.VRF_PATH_CLASS.create_puid(vpn_nlri.route_disc,
puid = self.VRF_PATH_CLASS.create_puid(vpn_nlri.route_dist,
vpn_nlri.prefix)
vrf_path = self.VRF_PATH_CLASS(
puid,
@ -279,7 +279,7 @@ class VrfDest(Destination):
def __init__(self, table, nlri):
super(VrfDest, self).__init__(table, nlri)
self._route_disc = self._table.vrf_conf.route_dist
self._route_dist = self._table.vrf_conf.route_dist
def _best_path_lost(self):
# Have to send update messages for withdraw of best-path to Network
@ -295,10 +295,10 @@ class VrfDest(Destination):
# out of old best path and queue it into flexinet sinks.
old_best_path = old_best_path.clone(for_withdrawal=True)
self._core_service.update_flexinet_peers(old_best_path,
self._route_disc)
self._route_dist)
else:
# Create withdraw-path out of old best path.
gpath = old_best_path.clone_to_vpn(self._route_disc,
gpath = old_best_path.clone_to_vpn(self._route_dist,
for_withdrawal=True)
# Insert withdraw into global table and enqueue the destination
# for further processing.
@ -327,16 +327,16 @@ class VrfDest(Destination):
if not old_best_path or (old_best_path and really_diff()):
# Create OutgoingRoute and queue it into NC sink.
self._core_service.update_flexinet_peers(
best_path, self._route_disc
best_path, self._route_dist
)
else:
# If NC is source, we create new path and insert into global
# table.
gpath = best_path.clone_to_vpn(self._route_disc)
gpath = best_path.clone_to_vpn(self._route_dist)
tm = self._core_service.table_manager
tm.learn_path(gpath)
LOG.debug('VRF table %s has new best path: %s' %
(self._route_disc, self.best_path))
(self._route_dist, self.best_path))
def _remove_withdrawals(self):
"""Removes withdrawn paths.
@ -466,9 +466,9 @@ class VrfPath(Path):
return self._label_list[:]
@staticmethod
def create_puid(route_disc, ip_prefix):
assert route_disc and ip_prefix
return route_disc + ':' + ip_prefix
def create_puid(route_dist, ip_prefix):
assert route_dist and ip_prefix
return str(route_dist) + ':' + ip_prefix
def clone(self, for_withdrawal=False):
pathattrs = None

View File

@ -93,9 +93,9 @@ class FlexinetOutgoingRoute(object):
"""
__slots__ = ('_path', 'sink', 'next_outgoing_route', 'prev_outgoing_route',
'next_sink_out_route', 'prev_sink_out_route', '_route_disc')
'next_sink_out_route', 'prev_sink_out_route', '_route_dist')
def __init__(self, path, route_disc):
def __init__(self, path, route_dist):
from ryu.services.protocols.bgp.info_base.vrf4 import Vrf4Path
from ryu.services.protocols.bgp.info_base.vrf6 import Vrf6Path
assert path.route_family in (Vrf4Path.ROUTE_FAMILY,
@ -103,7 +103,7 @@ class FlexinetOutgoingRoute(object):
self.sink = None
self._path = path
self._route_disc = route_disc
self._route_dist = route_dist
# Automatically generated, for list off of Destination.
#
@ -120,12 +120,12 @@ class FlexinetOutgoingRoute(object):
return self._path
@property
def route_disc(self):
return self._route_disc
def route_dist(self):
return self._route_dist
def __str__(self):
return ('FlexinetOutgoingRoute(path: %s, route_disc: %s)' %
(self.path, self.route_disc))
return ('FlexinetOutgoingRoute(path: %s, route_dist: %s)' %
(self.path, self.route_dist))
class SentRoute(object):

View File

@ -255,7 +255,7 @@ def _create_prefix_notif(outgoing_msg, rpc_session):
assert path.source is not None
if path.source != VRF_TABLE:
# Extract relevant info for update-add/update-delete.
params = [{ROUTE_DISTINGUISHER: outgoing_msg.route_disc,
params = [{ROUTE_DISTINGUISHER: outgoing_msg.route_dist,
PREFIX: vpn_nlri.prefix,
NEXT_HOP: path.nexthop,
VPN_LABEL: path.label_list[0],
@ -270,7 +270,7 @@ def _create_prefix_notif(outgoing_msg, rpc_session):
params)
else:
# Extract relevant info for update-add/update-delete.
params = [{ROUTE_DISTINGUISHER: outgoing_msg.route_disc,
params = [{ROUTE_DISTINGUISHER: outgoing_msg.route_dist,
PREFIX: vpn_nlri.prefix,
NEXT_HOP: path.nexthop,
VRF_RF: VrfConf.rf_2_vrf_rf(path.route_family),

View File

@ -217,7 +217,7 @@ class IpNlriDetailView(OperatorDetailView):
class VpnNlriDetailView(IpNlriDetailView):
labels = fields.DataField('label_list')
rd = fields.DataField('route_disc')
rd = fields.DataField('route_dist')
class NlriDetailView(OperatorDetailView):

View File

@ -103,15 +103,11 @@ def validate_export_rts(export_rts):
@validate(name=ROUTE_DISTINGUISHER)
def valdiate_rd(route_disc):
if not isinstance(route_disc, str):
raise ConfigTypeError(conf_name=ROUTE_DISTINGUISHER,
conf_value=route_disc)
if not validation.is_valid_route_disc(route_disc):
def validate_rd(route_dist):
if not validation.is_valid_route_dist(route_dist):
raise ConfigValueError(conf_name=ROUTE_DISTINGUISHER,
conf_value=route_disc)
return route_disc
conf_value=route_dist)
return route_dist
@validate(name=VRF_RF)

View File

@ -195,10 +195,10 @@ def is_valid_mpls_label(label):
return valid
def is_valid_route_disc(route_disc):
"""Validates *route_disc* as string representation of route distinguisher.
def is_valid_route_dist(route_dist):
"""Validates *route_dist* as string representation of route distinguisher.
Returns True if *route_disc* is as per our convention of RD, else False.
Returns True if *route_dist* is as per our convention of RD, else False.
Our convention is to represent RD as a string in format:
*admin_sub_field:assigned_num_field* and *admin_sub_field* can be valid
IPv4 string representation.
@ -206,7 +206,7 @@ def is_valid_route_disc(route_disc):
Invalid examples: '1.11.1: 333'
"""
# TODO(PH): Provide complete implementation.
return is_valid_ext_comm_attr(route_disc)
return is_valid_ext_comm_attr(route_dist)
def is_valid_ext_comm_attr(attr):