diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2014-05-30 11:25:39 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-06-02 12:01:58 +0900 |
commit | 2c7ca2ff2d92824cf8e26f129f70f2d2e743b436 (patch) | |
tree | f70e510c1ffe4a8b97a10a45672ade706befff1d | |
parent | 1f316cf1c1b01729d03a2377bc3384a89d1de265 (diff) |
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>
-rw-r--r-- | ryu/lib/packet/bgp.py | 4 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/core.py | 4 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/core_managers/table_manager.py | 4 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/info_base/vpn.py | 4 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/info_base/vrf.py | 20 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/model.py | 14 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/net_ctrl.py | 4 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/operator/views/bgp.py | 2 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/rtconf/vrfs.py | 12 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/utils/validation.py | 8 |
10 files changed, 36 insertions, 40 deletions
diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py index 045e6f60..8a0a2391 100644 --- a/ryu/lib/packet/bgp.py +++ b/ryu/lib/packet/bgp.py @@ -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): diff --git a/ryu/services/protocols/bgp/core.py b/ryu/services/protocols/bgp/core.py index 53882169..3a564114 100644 --- a/ryu/services/protocols/bgp/core.py +++ b/ryu/services/protocols/bgp/core.py @@ -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): diff --git a/ryu/services/protocols/bgp/core_managers/table_manager.py b/ryu/services/protocols/bgp/core_managers/table_manager.py index 2ec0d80b..d6535b81 100644 --- a/ryu/services/protocols/bgp/core_managers/table_manager.py +++ b/ryu/services/protocols/bgp/core_managers/table_manager.py @@ -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: diff --git a/ryu/services/protocols/bgp/info_base/vpn.py b/ryu/services/protocols/bgp/info_base/vpn.py index 3b0c81f2..ece8e2ce 100644 --- a/ryu/services/protocols/bgp/info_base/vpn.py +++ b/ryu/services/protocols/bgp/info_base/vpn.py @@ -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, diff --git a/ryu/services/protocols/bgp/info_base/vrf.py b/ryu/services/protocols/bgp/info_base/vrf.py index ad16d9aa..85a03992 100644 --- a/ryu/services/protocols/bgp/info_base/vrf.py +++ b/ryu/services/protocols/bgp/info_base/vrf.py @@ -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 diff --git a/ryu/services/protocols/bgp/model.py b/ryu/services/protocols/bgp/model.py index d8da7384..97bed536 100644 --- a/ryu/services/protocols/bgp/model.py +++ b/ryu/services/protocols/bgp/model.py @@ -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): diff --git a/ryu/services/protocols/bgp/net_ctrl.py b/ryu/services/protocols/bgp/net_ctrl.py index 174b2727..47cf9d72 100644 --- a/ryu/services/protocols/bgp/net_ctrl.py +++ b/ryu/services/protocols/bgp/net_ctrl.py @@ -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), diff --git a/ryu/services/protocols/bgp/operator/views/bgp.py b/ryu/services/protocols/bgp/operator/views/bgp.py index bd96443e..47245447 100644 --- a/ryu/services/protocols/bgp/operator/views/bgp.py +++ b/ryu/services/protocols/bgp/operator/views/bgp.py @@ -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): diff --git a/ryu/services/protocols/bgp/rtconf/vrfs.py b/ryu/services/protocols/bgp/rtconf/vrfs.py index 51c7a16d..36dd2f9b 100644 --- a/ryu/services/protocols/bgp/rtconf/vrfs.py +++ b/ryu/services/protocols/bgp/rtconf/vrfs.py @@ -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) diff --git a/ryu/services/protocols/bgp/utils/validation.py b/ryu/services/protocols/bgp/utils/validation.py index 6359183d..577e98ca 100644 --- a/ryu/services/protocols/bgp/utils/validation.py +++ b/ryu/services/protocols/bgp/utils/validation.py @@ -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): |