Re: [Ryu-devel] Nicira Extension Matches in ofctl

2018-06-12 Thread IWAMOTO Toshihiro
On Sat, 09 Jun 2018 01:44:04 +0900,
Tommy Romano wrote:
> 
> [1  ]
> [1.1  ]
> Hello all,
> 
> We are using the Ryu ofctl_rest app for testing and we noticed that using 
> Nicira Extension fields in a match structure returns an error (‘Unknown match 
> field’). We found that this is because when ofctl converts a match from a 
> dictionary to a OFPMatch object, Nicira Extension fields are ignored. See for 
> example ofctl_v1_4.py 
> https://github.com/osrg/ryu/blob/e1741b7d77d4e57ea96cefe4535c46c83522a677/ryu/lib/ofctl_v1_4.py#L129.
> 
> Before we go add this feature and create a pull request, is there any reason 
> this is missing at the moment? Or is there any other way to include Nicira 
> Extension fields in match structures?

My understanding is most nicira match field has a OpenFlow
counterpart. Which fields are you talking about?

When proposing a patch, please consult CONTRIBUTING.rst.
Thanks.

--
IWAMOTO Toshihiro


--
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


Re: [Ryu-devel] [PATCH 2/3] pycodestyle: Ignore W504 and W605

2018-06-12 Thread IWAMOTO Toshihiro
On Tue, 12 Jun 2018 17:26:50 +0900,
IWAMOTO Toshihiro wrote:
> 
> On Tue, 12 Jun 2018 15:17:35 +0900,
> IWASE Yusuke wrote:
> > 
> > Signed-off-by: IWASE Yusuke 
> > ---
> >  tox.ini | 6 --
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tox.ini b/tox.ini
> > index 758d1661..5d8712e1 100644
> > --- a/tox.ini
> > +++ b/tox.ini
> > @@ -52,14 +52,16 @@ commands =
> >  
> >  [pycodestyle]
> >  exclude = 
> > pbr-*,.venv,.tox,.git,doc,dist,tools,vcsversion.py,.pyc,ryu/contrib
> > -# W503: line break occurred before a binary operator
> > +# W503: line break before binary operator
> > +# W504: line break after binary operator
> > +# W605: invalid escape sequence
> 
> W605 would be a syntax error in python 3.10.
> https://bugs.python.org/issue32912
> 
> There are tens of docstrings like this in nx_actions.py, which
> violates W605.
> 
> ..
>   set_field:value[/mask]->dst
> ..
> 
> ++
> | **set_field**\:\ *value*\ **[**\/\ *mask*\ **]**\->\ *dst* |
> ++
> 
> We can just add 'r' to the head of the docstring to make it a
> rawstring, but I'd like to simplify this to
> 
>.. option:: set_field:value[/mask]->dst
> 
> That's not as pretty as the current doc but it's easier to maintain.
> 
> What do you think?

On second thought, I just used raw strings (r"""foo""").
If we won't change this docstring in future, smaller patches would be
better.

--
IWAMOTO Toshihiro


--
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


[Ryu-devel] [PATCH 2/2] nx_actions: Fix NXActionSetTunnel docstring

2018-06-12 Thread IWAMOTO Toshihiro
set_tunnel and set_field:xxx->tun_id are different actions.

Signed-off-by: IWAMOTO Toshihiro 
---
 ryu/ofproto/nx_actions.py | 34 ++
 1 file changed, 6 insertions(+), 28 deletions(-)

diff --git a/ryu/ofproto/nx_actions.py b/ryu/ofproto/nx_actions.py
index 5fe0d545..7f543471 100644
--- a/ryu/ofproto/nx_actions.py
+++ b/ryu/ofproto/nx_actions.py
@@ -561,10 +561,9 @@ def generate(ofp_name, ofpp_name):
 And equivalent to the followings action of ovs-ofctl command.
 
 .. note::
-ovs-ofctl command of the OpenFlow1.0 is different from that
-of OpenFlow1.2 or later.
-
-OpenFlow1.0
+This actions is supported by
+``OFPActionSetField``
+in OpenFlow1.2 or later.
 
 ..
   set_tunnel:id
@@ -574,16 +573,6 @@ def generate(ofp_name, ofpp_name):
 | **set_tunnel**\:\ *id* |
 ++
 
-OpenFlow1.2 or later
-
-..
-  set_field:value->tun_id
-..
-
-+---+
-| **set_field**\:\ *value*\->tun_id |
-+---+
-
  ==
 AttributeDescription
  ==
@@ -609,10 +598,9 @@ def generate(ofp_name, ofpp_name):
 And equivalent to the followings action of ovs-ofctl command.
 
 .. note::
-ovs-ofctl command of the OpenFlow1.0 is different from that
-of OpenFlow1.2 or later.
-
-OpenFlow1.0
+This actions is supported by
+``OFPActionSetField``
+in OpenFlow1.2 or later.
 
 ..
   set_tunnel64:id
@@ -622,16 +610,6 @@ def generate(ofp_name, ofpp_name):
 | **set_tunnel64**\:\ *id* |
 +--+
 
-OpenFlow1.2 or later
-
-..
-  set_field:value->tun_id
-..
-
-+---+
-| **set_field**\:\ *value*\->tun_id |
-+---+
-
  ==
 AttributeDescription
  ==
-- 
2.11.0


--
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


[Ryu-devel] [PATCH 1/2] Fix pycodestyle W605 warnings

2018-06-12 Thread IWAMOTO Toshihiro
W605 invalid escape sequence, which was recently added in pycodestyle,
would be a syntax error in future python3 versions.

Signed-off-by: IWAMOTO Toshihiro 
---
 ryu/app/rest_qos.py   |  6 +--
 ryu/lib/ofctl_string.py   |  4 +-
 ryu/lib/ovs/vsctl.py  |  4 +-
 ryu/lib/packet/bmp.py | 16 +++
 ryu/lib/packet/icmpv6.py  |  6 +--
 ryu/lib/packet/igmp.py|  2 +-
 ryu/lib/packet/ipv6.py|  4 +-
 ryu/lib/stringify.py  |  2 +-
 ryu/ofproto/nicira_ext.py |  2 +-
 ryu/ofproto/nx_actions.py | 64 +--
 ryu/tests/integrated/test_vrrp_linux_multi.py |  2 +-
 ryu/tests/integrated/test_vrrp_multi.py   |  2 +-
 ryu/tests/packet_data_generator3/gen.py   |  2 +-
 13 files changed, 58 insertions(+), 58 deletions(-)

diff --git a/ryu/app/rest_qos.py b/ryu/app/rest_qos.py
index c5bac29a..ee3d45f4 100644
--- a/ryu/app/rest_qos.py
+++ b/ryu/app/rest_qos.py
@@ -1147,13 +1147,13 @@ class Action(object):
 if REST_ACTION in flow:
 actions = []
 for act in flow[REST_ACTION]:
-field_value = re.search('SET_FIELD: \{ip_dscp:(\d+)', act)
+field_value = re.search(r'SET_FIELD: \{ip_dscp:(\d+)', act)
 if field_value:
 actions.append({REST_ACTION_MARK: field_value.group(1)})
-meter_value = re.search('METER:(\d+)', act)
+meter_value = re.search(r'METER:(\d+)', act)
 if meter_value:
 actions.append({REST_ACTION_METER: meter_value.group(1)})
-queue_value = re.search('SET_QUEUE:(\d+)', act)
+queue_value = re.search(r'SET_QUEUE:(\d+)', act)
 if queue_value:
 actions.append({REST_ACTION_QUEUE: queue_value.group(1)})
 action = {REST_ACTION: actions}
diff --git a/ryu/lib/ofctl_string.py b/ryu/lib/ofctl_string.py
index 30394c65..fe0eeaea 100644
--- a/ryu/lib/ofctl_string.py
+++ b/ryu/lib/ofctl_string.py
@@ -39,7 +39,7 @@ def ofp_instruction_from_str(ofproto, action_str):
 action_str  An action string.
 === =
 """
-action_re = re.compile("([a-z_]+)(\([^)]*\)|[^a-z_,()][^,()]*)*")
+action_re = re.compile(r"([a-z_]+)(\([^)]*\)|[^a-z_,()][^,()]*)*")
 result = []
 while len(action_str):
 m = action_re.match(action_str)
@@ -303,7 +303,7 @@ class OfctlActionConverter(object):
 if k == 'table':
 recirc_table = str_to_int(v)
 elif k == 'zone':
-m = re.search('\[(\d*)\.\.(\d*)\]', v)
+m = re.search(r'\[(\d*)\.\.(\d*)\]', v)
 if m:
 zone_ofs_nbits = nicira_ext.ofs_nbits(
 int(m.group(1)), int(m.group(2)))
diff --git a/ryu/lib/ovs/vsctl.py b/ryu/lib/ovs/vsctl.py
index f3355a1c..53ee7f42 100644
--- a/ryu/lib/ovs/vsctl.py
+++ b/ryu/lib/ovs/vsctl.py
@@ -66,12 +66,12 @@ def valid_ovsdb_addr(addr):
 :return: True if valid, otherwise False.
 """
 # Assumes Unix socket format: "unix:file"
-m = re.match('unix:(\S+)', addr)
+m = re.match(r'unix:(\S+)', addr)
 if m:
 file = m.group(1)
 return os.path.isfile(file)
 # Assumes TCP/SSL socket format: "tcp:ip:port" or "ssl:ip:port"
-m = re.match('(tcp|ssl):(\S+):(\d+)', addr)
+m = re.match(r'(tcp|ssl):(\S+):(\d+)', addr)
 if m:
 address = m.group(2)
 port = m.group(3)
diff --git a/ryu/lib/packet/bmp.py b/ryu/lib/packet/bmp.py
index bc49c577..0b4c3b84 100644
--- a/ryu/lib/packet/bmp.py
+++ b/ryu/lib/packet/bmp.py
@@ -69,7 +69,7 @@ BMP_PEER_DOWN_REASON_REMOTE_NO_NOTIFICATION = 4
 
 
 class BMPMessage(packet_base.PacketBase, TypeDisp):
-"""Base class for BGP Monitoring Protocol messages.
+r"""Base class for BGP Monitoring Protocol messages.
 
 An instance has the following attributes at least.
 Most of them are same to the on-wire counterparts but in host byte
@@ -141,7 +141,7 @@ class BMPMessage(packet_base.PacketBase, TypeDisp):
 
 
 class BMPPeerMessage(BMPMessage):
-"""BMP Message with Per Peer Header
+r"""BMP Message with Per Peer Header
 
 Following BMP Messages contain Per Peer Header after Common BMP Header.
 
@@ -250,7 +250,7 @@ class BMPPeerMessage(BMPMessage):
 
 @BMPMessage.register_type(BMP_MSG_ROUTE_MONITORING)
 class BMPRouteMonitoring(BMPPeerMessage):
-"""BMP Route Monitoring Message
+r"""BMP Route Monitoring Message
 
 == ===
 Attribute  Description
@@ -308,7 +308,7 @@ class BMPRouteMonitoring(BMPPeerMessage):
 
 

Re: [Ryu-devel] BGP Speakers

2018-06-12 Thread knet solutions
Hi Iwase,

The use case is like below,


Rtr1---SDN-Rtr1---Rtr2--SDN-Rtr2-Rtr3


Rtr1, Rtr2, Rtr3 are traditional BGP Routers
SDN-Rtr1, and SDN-Rtr2 are BGP Speakers.


SDN-Rtr1(RYU Bgp speaker) connects to  two neighbors Rtr1 and Rtr2.
SDN-Rtr2(RYU Bgp speaker) connects to  two neighbors Rtr2 and Rtr3.

In this use case,  Any possibility of running with single BGP Speaker
instance?

Thanks
Suresh


On Mon, Jun 11, 2018 at 7:30 AM, Iwase Yusuke 
wrote:

> Hi,
>
> I think you need to specify the following options in order to avoid the
> conflicts of listening ports.
>
> - BGP listen host addresses (or port number)
> https://github.com/osrg/ryu/blob/c29c9019ac8ab862bbc0caad7d4
> 9220f27ed0cf0/ryu/services/protocols/bgp/bgp_sample_conf.py#L51-L52
>
> - RPC listen host address (or port number) for BGP
>   $ ryu-manager -h
> ...(snip)...
> --bgp-app-rpc-host BGP-APP_RPC_HOST
>   IP for RPC server (default: 0.0.0.0)
> --bgp-app-rpc-port BGP-APP_RPC_PORT
>   Port for RPC server (default: 50002)
> ...(snip)...
>
> - SSH console host address (or port number) for BGP
> https://github.com/osrg/ryu/blob/c29c9019ac8ab862bbc0caad7d4
> 9220f27ed0cf0/ryu/services/protocols/bgp/bgp_sample_conf.py#L400-L401
>
>
> BTW, why you need to run multiple BGP Speakers at the same time? Ryu BGP
> Speaker
> supports per-peer AS number configuration, you can setup multiple
> connections
> with routers in different ASs. If this feature is sufficient for your
> use-case,
> it should be more appropriate than running multiple BGP Speakers.
> http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.
> html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.neighbor_add
>
>
> Thanks,
> Iwase
>
>
> On 2018年06月07日 23:03, knet solutions wrote:
>
>> Can we run multiple  BGP Speakers in the RYU application?
>>
>> --
>> */Regards,
>> /*
>> */Knet solutions./*
>>
>> https://github.com/knetsolutions/KNet
>> http://knet-topology-builder.readthedocs.io/
>> 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
>>
>>


-- 

*Regards, *
*Knet solutions.*

https://github.com/knetsolutions/KNet
http://knet-topology-builder.readthedocs.io/
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


Re: [Ryu-devel] [PATCH 2/3] pycodestyle: Ignore W504 and W605

2018-06-12 Thread IWAMOTO Toshihiro
On Tue, 12 Jun 2018 15:17:35 +0900,
IWASE Yusuke wrote:
> 
> Signed-off-by: IWASE Yusuke 
> ---
>  tox.ini | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tox.ini b/tox.ini
> index 758d1661..5d8712e1 100644
> --- a/tox.ini
> +++ b/tox.ini
> @@ -52,14 +52,16 @@ commands =
>  
>  [pycodestyle]
>  exclude = pbr-*,.venv,.tox,.git,doc,dist,tools,vcsversion.py,.pyc,ryu/contrib
> -# W503: line break occurred before a binary operator
> +# W503: line break before binary operator
> +# W504: line break after binary operator
> +# W605: invalid escape sequence

W605 would be a syntax error in python 3.10.
https://bugs.python.org/issue32912

There are tens of docstrings like this in nx_actions.py, which
violates W605.

..
  set_field:value[/mask]->dst
..

++
| **set_field**\:\ *value*\ **[**\/\ *mask*\ **]**\->\ *dst* |
++

We can just add 'r' to the head of the docstring to make it a
rawstring, but I'd like to simplify this to

   .. option:: set_field:value[/mask]->dst

That's not as pretty as the current doc but it's easier to maintain.

What do you think?

--
IWAMOTO Toshihiro



--
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


[Ryu-devel] [PATCH 1/3] BGPSpeaker: Advertise local routes to RR clients

2018-06-12 Thread IWASE Yusuke
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 
---
 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


[Ryu-devel] [PATCH 0/3] BGPSpeaker: Advertise local routes to RR clients

2018-06-12 Thread IWASE Yusuke
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.

The following patches fix to add or update attributes to for sending
locally generated routes its RR clients and include some improvements.

IWASE Yusuke (3):
  BGPSpeaker: Advertise local routes to RR clients
  pycodestyle: Ignore W504 and W605
  BGPSpeaker: Fix BGP state string conversion

 ryu/services/protocols/bgp/peer.py | 51 ++
 tox.ini|  6 ++--
 2 files changed, 27 insertions(+), 30 deletions(-)

--
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


[Ryu-devel] [PATCH 3/3] BGPSpeaker: Fix BGP state string conversion

2018-06-12 Thread IWASE Yusuke
The constants BGP_FSM_* are str type values and not callable.

Signed-off-by: IWASE Yusuke 
---
 ryu/services/protocols/bgp/peer.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ryu/services/protocols/bgp/peer.py 
b/ryu/services/protocols/bgp/peer.py
index 2a0e2a9f..2c6e3898 100644
--- a/ryu/services/protocols/bgp/peer.py
+++ b/ryu/services/protocols/bgp/peer.py
@@ -2000,8 +2000,8 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
 # Open/Notification messages are currently handled by protocol and
 # nothing is done inside peer, so should not see them here.
 raise ValueError('Peer does not support handling of %s'
- ' message during % state' %
- (msg, self.state.bgp_state()))
+ ' message during %s state' %
+ (msg, self.state.bgp_state))
 
 def _handle_err_sor_msg(self, afi, safi):
 # Check if ERR capability is enabled for this peer.
-- 
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


Re: [Ryu-devel] Query BGP speaker

2018-06-12 Thread Iwase Yusuke

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 ")


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 > 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



Thanks,
Iwase





--
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 
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 
---
 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,