Hi,

Hmmm... the current implementation seems not to suppose to have the locally
generated routes when configured itself as a Route Reflector. Only supposed to
reflect the received routes.

The attached patch fixes this problem?

Thanks,
Iwase

On 2018年06月11日 20:36, knet solutions wrote:
Hi Iwase,

When i configure route_reflector,  RYU BGP Speaker couldnt establish the comminication with traditional bird router.
My code snippet is as below,

        # code snippet

         self.bgp_speaker = BGPSpeaker(64511, router_id,
                                       ssh_console=True, ssh_port=4999,
                                       ssh_host='localhost',
best_path_change_handler=self.best_path_change_handler )        self.bgp_speaker.neighbor_add(neighbor1_id, 64511, is_route_reflector_client=True)         self.bgp_speaker.neighbor_add(neighbor2_id, 64511, is_route_reflector_client=True)
         self.bgp_speaker.prefix_add(prefix="10.2.1.0/24 <http://10.2.1.0/24>")


The error is(observed from wireshark trace),
Bird router closes the connection with UPDATE MESSAGE ERROR(3)/ Minor code: Optional attribute Error(9)

In the bird log , i see the below error

Connection to peer 192.168.2.2 lost, reason: Peer closed connection Resetting retry connect loop: True
Peer closed connectio



Note :  If i just remove the "is_route_reflector_client=True" flag, neighbor establishment and update happens.

Query1:
1. To enable route_reflector in RYU,  Do i need to configuration any other API or parameters?

Thanks
Suresh


On Thu, May 31, 2018 at 11:41 AM, Iwase Yusuke <iwase.yusu...@gmail.com <mailto:iwase.yusu...@gmail.com>> wrote:

    Hi,

    > All routers are same AS number.

    This means Ryu and other routers are connected with the iBGP(internal BGP)
    peering, right? On the iBGP, generally the received routes from other iBGP 
peers
    will not be advertised in order to avoid network loops. If you need to 
advertise
    the iBGP routers to other iBGP peers, please configure Ryu as a Route 
Reflector
    (or use different AS number on other routers for external BGP peering).

    To configure route reflector, please enable "is_route_reflector_client" 
option.
    
http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.neighbor_add
    
<http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.neighbor_add>

    Thanks,
    Iwase
    <http://knetsolutions.in/>




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot



_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

>From 24bd6940dd3bb5b31514329ad7c1f3349eabc900 Mon Sep 17 00:00:00 2001
From: IWASE Yusuke <iwase.yusu...@gmail.com>
Date: Tue, 12 Jun 2018 14:12:00 +0900
Subject: [PATCH] BGPSpeaker: Advertise local routes to RR clients

The current implementation misses the mandatory attributes when sending
locally generated routes to its Route Reflector (RR) clients, then the
clients will reject the received routes.

This patch fixes to add or update attributes to for sending locally
generated routes its RR clients.

Signed-off-by: IWASE Yusuke <iwase.yusu...@gmail.com>
---
 ryu/services/protocols/bgp/peer.py | 47 +++++++++++++-----------------
 1 file changed, 21 insertions(+), 26 deletions(-)

diff --git a/ryu/services/protocols/bgp/peer.py b/ryu/services/protocols/bgp/peer.py
index 70b486c0..2a0e2a9f 100644
--- a/ryu/services/protocols/bgp/peer.py
+++ b/ryu/services/protocols/bgp/peer.py
@@ -989,37 +989,32 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
         elif self.is_route_server_client:
             nlri_list = [path.nlri]
             new_pathattr.extend(pathattr_map.values())
-        elif self.is_route_reflector_client:
-            nlri_list = [path.nlri]
+        else:
+            if self.is_route_reflector_client:
+                # Append ORIGINATOR_ID attribute if not already exist.
+                if BGP_ATTR_TYPE_ORIGINATOR_ID not in pathattr_map:
+                    originator_id = path.source
+                    if originator_id is None:
+                        originator_id = self._common_conf.router_id
+                    elif isinstance(path.source, Peer):
+                        originator_id = path.source.ip_address
+                    new_pathattr.append(
+                        BGPPathAttributeOriginatorId(value=originator_id))
 
-            # Append ORIGINATOR_ID attribute if not already exists.
-            if BGP_ATTR_TYPE_ORIGINATOR_ID not in pathattr_map:
-                originator_id = path.source
-                if originator_id is None:
-                    originator_id = self._common_conf.router_id
-                elif isinstance(path.source, Peer):
-                    originator_id = path.source.ip_address
-                new_pathattr.append(
-                    BGPPathAttributeOriginatorId(value=originator_id))
-
-            # Append CLUSTER_LIST attribute if not already exists.
-            if BGP_ATTR_TYPE_CLUSTER_LIST not in pathattr_map:
-                new_pathattr.append(
-                    BGPPathAttributeClusterList(
-                        [self._common_conf.cluster_id]))
-
-            for t, path_attr in pathattr_map.items():
-                if t == BGP_ATTR_TYPE_CLUSTER_LIST:
-                    # Append own CLUSTER_ID into CLUSTER_LIST attribute
-                    # if already exists.
-                    cluster_list = list(path_attr.value)
+                # Preppend own CLUSTER_ID into CLUSTER_LIST attribute if exist.
+                # Otherwise append CLUSTER_LIST attribute.
+                cluster_lst_attr = pathattr_map.get(BGP_ATTR_TYPE_CLUSTER_LIST)
+                if cluster_lst_attr:
+                    cluster_list = list(cluster_lst_attr.value)
                     if self._common_conf.cluster_id not in cluster_list:
-                        cluster_list.append(self._common_conf.cluster_id)
+                        cluster_list.insert(0, self._common_conf.cluster_id)
                     new_pathattr.append(
                         BGPPathAttributeClusterList(cluster_list))
                 else:
-                    new_pathattr.append(path_attr)
-        else:
+                    new_pathattr.append(
+                        BGPPathAttributeClusterList(
+                            [self._common_conf.cluster_id]))
+
             # Supported and un-supported/unknown attributes.
             origin_attr = None
             nexthop_attr = None
-- 
2.17.1

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to