Fujita-san

Thanks for your comment.
This code is not support for Ipv6Path.
We need to handle Ipv6Path.

I will re-send patch after evaluating in ipv6 topology.
best regards.

2014/10/27 19:59、FUJITA Tomonori <[email protected]> のメッセージ:

> On Mon, 27 Oct 2014 19:41:05 +0900
> Toshiki Tsuboi <[email protected]> wrote:
> 
>> BGPSpeaker is aware of "best_path_change_handler" in MPLS-VPN topology.
>> This feature is available in calculating Best Path Selection of VPNv4/6 
>> prefixes.
>> 
>> Signed-off-by: Toshiki Tsuboi <[email protected]>
>> ---
>> ryu/services/protocols/bgp/bgpspeaker.py    | 34 
>> +++++++++++++++++++++++------
>> ryu/services/protocols/bgp/info_base/vpn.py |  2 ++
>> 2 files changed, 29 insertions(+), 7 deletions(-)
> 
> Great! I have one comment.
> 
>> diff --git a/ryu/services/protocols/bgp/bgpspeaker.py 
>> b/ryu/services/protocols/bgp/bgpspeaker.py
>> index d727c72..fbb601b 100644
>> --- a/ryu/services/protocols/bgp/bgpspeaker.py
>> +++ b/ryu/services/protocols/bgp/bgpspeaker.py
>> @@ -61,6 +61,9 @@ from ryu.services.protocols.bgp.rtconf.neighbors import 
>> IS_NEXT_HOP_SELF
>> from ryu.services.protocols.bgp.rtconf.neighbors import LOCAL_ADDRESS
>> from ryu.services.protocols.bgp.rtconf.neighbors import LOCAL_PORT
>> from ryu.services.protocols.bgp.info_base.base import Filter
>> +from ryu.services.protocols.bgp.info_base.ipv4 import Ipv4Path
>> +from ryu.services.protocols.bgp.info_base.vpnv4 import Vpnv4Path
>> +from ryu.services.protocols.bgp.info_base.vpnv6 import Vpnv6Path
>> 
>> 
>> NEIGHBOR_CONF_MED = 'multi_exit_disc'
>> @@ -80,16 +83,19 @@ class EventPrefix(object):
>>     route_dist       None in the case of ipv4 or ipv6 family
>>     prefix           A prefix was changed
>>     nexthop          The nexthop of the changed prefix
>> +    label            mpls label for vpnv4 prefix
>>     is_withdraw      True if this prefix has gone otherwise False
>>     ================ ======================================================
>> 
>>     """
>> 
>> -    def __init__(self, remote_as, route_dist, prefix, nexthop, is_withdraw):
>> +    def __init__(self, remote_as, route_dist, prefix, nexthop, label,
>> +                 is_withdraw):
>>         self.remote_as = remote_as
>>         self.route_dist = route_dist
>>         self.prefix = prefix
>>         self.nexthop = nexthop
>> +        self.label = label
>>         self.is_withdraw = is_withdraw
>> 
>> 
>> @@ -145,13 +151,27 @@ class BGPSpeaker(object):
>>             hub.spawn(ssh.SSH_CLI_CONTROLLER.start)
>> 
>>     def _notify_best_path_changed(self, path, is_withdraw):
>> -        if not path.source:
>> -            # ours
>> +        if path.source:
>> +            nexthop = path.nexthop
>> +            is_withdraw = is_withdraw
>> +            remote_as = path.source.remote_as
>> +        else:
>> +            return
>> +
>> +        if isinstance(path, Ipv4Path):
>> +            prefix = path.nlri.addr + '/' + str(path.nlri.length)
>> +            route_dist = None
>> +            label = None
> 
> Can the above code handle Ipv6Path?
> 
>> +        elif isinstance(path, Vpnv4Path) or isinstance(path, Vpnv6Path):
>> +            prefix = path.nlri.prefix
>> +            route_dist = path.nlri.route_dist
>> +            label = path.nlri.label_list
>> +        else:
>>             return
>> -        ev = EventPrefix(remote_as=path.source.remote_as,
>> -                         route_dist=None,
>> -                         prefix=path.nlri.addr + '/' + 
>> str(path.nlri.length),
>> -                         nexthop=path.nexthop, is_withdraw=is_withdraw)
>> +
>> +        ev = EventPrefix(remote_as, route_dist, prefix, nexthop, label,
>> +                         is_withdraw)
>> +
>>         if self._best_path_change_handler:
>>             self._best_path_change_handler(ev)
>> 
>> diff --git a/ryu/services/protocols/bgp/info_base/vpn.py 
>> b/ryu/services/protocols/bgp/info_base/vpn.py
>> index ece8e2c..e5cdef4 100644
>> --- a/ryu/services/protocols/bgp/info_base/vpn.py
>> +++ b/ryu/services/protocols/bgp/info_base/vpn.py
>> @@ -90,6 +90,7 @@ class VpnDest(Destination, NonVrfPathProcessingMixin):
>>     def _best_path_lost(self):
>>         old_best_path = self._best_path
>>         NonVrfPathProcessingMixin._best_path_lost(self)
>> +        self._core_service._signal_bus.best_path_changed(old_best_path, 
>> True)
>> 
>>         # Best-path might have been imported into VRF tables, we have to
>>         # withdraw from them, if the source is a peer.
>> @@ -102,6 +103,7 @@ class VpnDest(Destination, NonVrfPathProcessingMixin):
>> 
>>     def _new_best_path(self, best_path):
>>         NonVrfPathProcessingMixin._new_best_path(self, best_path)
>> +        self._core_service._signal_bus.best_path_changed(best_path, False)
>> 
>>         # Extranet feature requires that we import new best path into VRFs.
>>         tm = self._core_service.table_manager
>> -- 
>> 1.9.1
>> 
>> 
>> 
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Ryu-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel

------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to