bgp: add parameter 'label_ranges' for 'core.start' method in BGPSpeaker

In case of locating some Ryu-BGPs in the same Topology for BGP/MPLS VPNs :
When same label has been assigned '100 (defalut label)' by each Ryu-BGP, it is difficult to analyze for trouble shooting of RIB for vpnv4 .
Therefore, each Ryu-BGPs should assign different label for vpnv4 prefix according to own label_range .

bgpd> show rib all
Status codes: * valid, > best
Origin codes: i - IGP, e - EGP, ? - incomplete
     Network                          Labels   Next Hop             Reason          Metric LocPrf Path
Family: rtfilter
 *>  65001:65010:101                  None     0.0.0.0              Only Path                     ?
Family: vpnv6
Family: vpnv4
 *>  65010:101:192.168.104.0/30       [100]    172.16.0.102         Only Path                     65002 ?
 *>  65010:101:192.168.201.0/24       [43]     192.168.100.101      Only Path       100           65010 65011 i
 *>  65010:101:10.10.10.1/32          [38]     192.168.100.101      Only Path       100           65010 65011 ?
 *>  65010:101:192.168.103.0/30       [100]    0.0.0.0              Only Path                     ?
 *>  65010:101:192.168.101.0/30       [42]     192.168.100.101      Only Path       100           65010 ?
 *>  65010:101:192.168.102.0/30       [40]     192.168.100.101      Only Path       100           65010 ?
 *>  65010:101:10.10.10.2/32          [37]     192.168.100.101      Only Path       100           65010 65012 ?
 *>  65010:101:192.168.202.0/24       [44]     192.168.100.101      Only Path       100           65010 65012 i

Signed-off-by: Toshiki Tsuboi <t.tsubo2000@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Toshiki Tsuboi 2014-08-21 22:43:17 +09:00 committed by FUJITA Tomonori
parent 04766aaa93
commit dd795150f3

View File

@ -96,7 +96,8 @@ class BGPSpeaker(object):
refresh_stalepath_time=DEFAULT_REFRESH_STALEPATH_TIME,
refresh_max_eor_time=DEFAULT_REFRESH_MAX_EOR_TIME,
best_path_change_handler=None,
ssh_console=False):
ssh_console=False,
label_range=DEFAULT_LABEL_RANGE):
"""Create a new BGPSpeaker object with as_number and router_id to
listen on bgp_server_port.
@ -133,6 +134,7 @@ class BGPSpeaker(object):
settings[BGP_SERVER_PORT] = bgp_server_port
settings[REFRESH_STALEPATH_TIME] = refresh_stalepath_time
settings[REFRESH_MAX_EOR_TIME] = refresh_max_eor_time
settings[LABEL_RANGE] = label_range
self._core_start(settings)
self._init_signal_listeners()
self._best_path_change_handler = best_path_change_handler