On Wed, 27 Jun 2018 16:50:41 +0900, Iwase Yusuke wrote: > > [1 <text/plain; utf-8 (8bit)>] > Hi Suresh, > > Does your patch fix other problem at the following? > https://github.com/sureshkvl/ryu/commit/aebf3974d121134931d79805b35f8f252db9d7a5#diff-161a69adc7e5dd2fb041599033e9089bL1001 > > FYI, I made a similar patch for this issue. > Please refer to the attached patch.
Thanks. Seems fine to me. > Thanks, > Iwase > > On 2018年06月26日 09:04, knet solutions wrote: > > Hi IWAMOTO, > > > > I updated the changes in this commit (on top of your route reflector change) > > > > https://github.com/sureshkvl/ryu/commit/aebf3974d121134931d79805b35f8f252db9d7a5 > > > > Could you review? Thanks for the patch, but your peer.py seems to have several unrelated (unintended?) changes too. > > How to submit this in upstream?. Is it pull request or some other process? This is written in ryu/CONTRIBUTING.rst. ;-) > > Thanks > > suresh > > > > > > > > On Thu, Jun 21, 2018 at 8:18 AM, IWAMOTO Toshihiro > > <iwam...@valinux.co.jp <mailto:iwam...@valinux.co.jp>> wrote: > > > > On Thu, 21 Jun 2018 00:39:17 +0900, > > knet solutions wrote: > > > > > > [1 <multipart/alternative (7bit)>] > > > [1.1 <text/plain; UTF-8 (7bit)>] > > > In peer.py file, PEER port number is hard coded to BGP Port Num. > > > > peer_address = > > (self._neigh_conf.ip_address, > > > const.STD_BGP_SERVER_PORT_NUM) > > > > I think, it can be configurable parameter from the API. > > > > It should default to 179 but it's good to be configurable. > > Can you make a patch? > > > > > On Wed, Jun 20, 2018 at 4:15 PM, knet solutions > > <knetsolutio...@gmail.com > > <mailto:knetsolutio...@gmail.com>> > > > wrote: > > > > > > > Hi, > > > > > > > > neighbor_add api doesnot have the "port number" parameter. > > > > > > > > > > > > For examples > > > > > > > > Traditional BGP Router > > <---------------------------------------------------> > > > > RYU BGP Speaker > > > > (BGP runs in port 180) > > > > > > > > > > > > > > > > In the RYU BGP Speaker, > > > > bgp_speaker.neighbor_add(remote_router_id, remote_as) > > > > > > > > no option to specify the remote port number. > > > > > > > > Any suggestions? > > > > > > > > Thanks > > > > suresh > > > > > > > > > > > > > > -- > > */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 > > > [2 0001-BGPSpeaker-Enable-to-specify-remote-port-for-neighbo.patch > <text/x-patch (7bit)>] > >From 14f48def88012f779ac30d2068e4c7c8b1948233 Mon Sep 17 00:00:00 2001 > From: IWASE Yusuke <iwase.yusu...@gmail.com> > Date: Wed, 27 Jun 2018 16:13:25 +0900 > Subject: [PATCH] BGPSpeaker: Enable to specify remote port for neighbor > > Currently, the remote port of neighbor is the hard-coded value 179. > > This patch enables to specify the remote port of neighbor in > "BGPSpeaker.neighbor_add()" API. > > Suggested-by: Suresh Kumar <knetsolutio...@gmail.com> > Signed-off-by: IWASE Yusuke <iwase.yusu...@gmail.com> > --- > ryu/services/protocols/bgp/bgpspeaker.py | 34 +++++++++++-------- > ryu/services/protocols/bgp/peer.py | 2 +- > .../protocols/bgp/rtconf/neighbors.py | 18 +++++++++- > 3 files changed, 38 insertions(+), 16 deletions(-) > > diff --git a/ryu/services/protocols/bgp/bgpspeaker.py > b/ryu/services/protocols/bgp/bgpspeaker.py > index 46cbcaf1..2f53f636 100644 > --- a/ryu/services/protocols/bgp/bgpspeaker.py > +++ b/ryu/services/protocols/bgp/bgpspeaker.py > @@ -112,21 +112,23 @@ from ryu.services.protocols.bgp.rtconf.neighbors import > ( > DEFAULT_CAP_MBGP_VPNV4FS, > DEFAULT_CAP_MBGP_VPNV6FS, > DEFAULT_CAP_MBGP_L2VPNFS, > + DEFAULT_CAP_ENHANCED_REFRESH, > + DEFAULT_CAP_FOUR_OCTET_AS_NUMBER, > + DEFAULT_CONNECT_MODE, > + REMOTE_PORT, > + DEFAULT_BGP_PORT, > + PEER_NEXT_HOP, > + PASSWORD, > + DEFAULT_IS_ROUTE_SERVER_CLIENT, > + IS_ROUTE_SERVER_CLIENT, > + DEFAULT_IS_ROUTE_REFLECTOR_CLIENT, > + IS_ROUTE_REFLECTOR_CLIENT, > + DEFAULT_IS_NEXT_HOP_SELF, > + IS_NEXT_HOP_SELF, > + CONNECT_MODE, > + LOCAL_ADDRESS, > + LOCAL_PORT, > ) > -from ryu.services.protocols.bgp.rtconf.neighbors import ( > - DEFAULT_CAP_ENHANCED_REFRESH, DEFAULT_CAP_FOUR_OCTET_AS_NUMBER) > -from ryu.services.protocols.bgp.rtconf.neighbors import DEFAULT_CONNECT_MODE > -from ryu.services.protocols.bgp.rtconf.neighbors import PEER_NEXT_HOP > -from ryu.services.protocols.bgp.rtconf.neighbors import PASSWORD > -from ryu.services.protocols.bgp.rtconf.neighbors import ( > - DEFAULT_IS_ROUTE_SERVER_CLIENT, IS_ROUTE_SERVER_CLIENT) > -from ryu.services.protocols.bgp.rtconf.neighbors import ( > - DEFAULT_IS_ROUTE_REFLECTOR_CLIENT, IS_ROUTE_REFLECTOR_CLIENT) > -from ryu.services.protocols.bgp.rtconf.neighbors import ( > - DEFAULT_IS_NEXT_HOP_SELF, IS_NEXT_HOP_SELF) > -from ryu.services.protocols.bgp.rtconf.neighbors import CONNECT_MODE > -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.rtconf.vrfs import SUPPORTED_VRF_RF > from ryu.services.protocols.bgp.info_base.base import Filter > from ryu.services.protocols.bgp.info_base.ipv4 import Ipv4Path > @@ -406,6 +408,7 @@ class BGPSpeaker(object): > call('core.stop') > > def neighbor_add(self, address, remote_as, > + remote_port=DEFAULT_BGP_PORT, > enable_ipv4=DEFAULT_CAP_MBGP_IPV4, > enable_ipv6=DEFAULT_CAP_MBGP_IPV6, > enable_vpnv4=DEFAULT_CAP_MBGP_VPNV4, > @@ -437,6 +440,8 @@ class BGPSpeaker(object): > ``remote_as`` specifies the AS number of the peer. It must be > an integer between 1 and 65535. > > + ``remote_port`` specifies the TCP port number of the peer. > + > ``enable_ipv4`` enables IPv4 address family for this > neighbor. > > @@ -513,6 +518,7 @@ class BGPSpeaker(object): > bgp_neighbor = { > neighbors.IP_ADDRESS: address, > neighbors.REMOTE_AS: remote_as, > + REMOTE_PORT: remote_port, > PEER_NEXT_HOP: next_hop, > PASSWORD: password, > IS_ROUTE_SERVER_CLIENT: is_route_server_client, > diff --git a/ryu/services/protocols/bgp/peer.py > b/ryu/services/protocols/bgp/peer.py > index 2c6e3898..f41715eb 100644 > --- a/ryu/services/protocols/bgp/peer.py > +++ b/ryu/services/protocols/bgp/peer.py > @@ -1283,7 +1283,7 @@ class Peer(Source, Sink, NeighborConfListener, > Activity): > else: > bind_addr = None > peer_address = (self._neigh_conf.ip_address, > - const.STD_BGP_SERVER_PORT_NUM) > + self._neigh_conf.port) > > if bind_addr: > LOG.debug('%s trying to connect from' > diff --git a/ryu/services/protocols/bgp/rtconf/neighbors.py > b/ryu/services/protocols/bgp/rtconf/neighbors.py > index 6c481a49..b0853f10 100644 > --- a/ryu/services/protocols/bgp/rtconf/neighbors.py > +++ b/ryu/services/protocols/bgp/rtconf/neighbors.py > @@ -45,6 +45,7 @@ from ryu.lib.packet.bgp import BGP_CAP_MULTIPROTOCOL > from ryu.lib.packet.bgp import BGP_CAP_ROUTE_REFRESH > > from ryu.services.protocols.bgp.base import OrderedDict > +from ryu.services.protocols.bgp.constants import STD_BGP_SERVER_PORT_NUM > from ryu.services.protocols.bgp.rtconf.base import ADVERTISE_PEER_AS > from ryu.services.protocols.bgp.rtconf.base import BaseConf > from ryu.services.protocols.bgp.rtconf.base import BaseConfListener > @@ -88,6 +89,7 @@ LOG = logging.getLogger('bgpspeaker.rtconf.neighbor') > # Various neighbor settings. > REMOTE_AS = 'remote_as' > IP_ADDRESS = 'ip_address' > +REMOTE_PORT = 'remote_port' > ENABLED = 'enabled' > CHANGES = 'changes' > LOCAL_ADDRESS = 'local_address' > @@ -108,6 +110,7 @@ CONNECT_MODE_PASSIVE = 'passive' > CONNECT_MODE_BOTH = 'both' > > # Default value constants. > +DEFAULT_BGP_PORT = STD_BGP_SERVER_PORT_NUM > DEFAULT_CAP_GR_NULL = True > DEFAULT_CAP_REFRESH = True > DEFAULT_CAP_ENHANCED_REFRESH = False > @@ -213,6 +216,13 @@ def validate_remote_as(asn): > return asn > > > +@validate(name=REMOTE_PORT) > +def validate_remote_port(port): > + if not isinstance(port, numbers.Integral): > + raise ConfigTypeError(desc='Invalid remote port: %s' % port) > + return port > + > + > def valid_prefix_filter(filter_): > policy = filter_.get('policy', None) > if policy == 'permit': > @@ -339,7 +349,7 @@ class NeighborConf(ConfWithId, ConfWithStats): > CAP_MBGP_IPV4FS, CAP_MBGP_VPNV4FS, > CAP_MBGP_IPV6FS, CAP_MBGP_VPNV6FS, > CAP_MBGP_L2VPNFS, > - RTC_AS, HOLD_TIME, > + RTC_AS, HOLD_TIME, REMOTE_PORT, > ENABLED, MULTI_EXIT_DISC, MAX_PREFIXES, > ADVERTISE_PEER_AS, SITE_OF_ORIGINS, > LOCAL_ADDRESS, LOCAL_PORT, LOCAL_AS, > @@ -406,6 +416,8 @@ class NeighborConf(ConfWithId, ConfWithStats): > DEFAULT_IS_NEXT_HOP_SELF, **kwargs) > self._settings[CONNECT_MODE] = compute_optional_conf( > CONNECT_MODE, DEFAULT_CONNECT_MODE, **kwargs) > + self._settings[REMOTE_PORT] = compute_optional_conf( > + REMOTE_PORT, DEFAULT_BGP_PORT, **kwargs) > > # We do not have valid default MED value. > # If no MED attribute is provided then we do not have to use MED. > @@ -483,6 +495,10 @@ class NeighborConf(ConfWithId, ConfWithStats): > def ip_address(self): > return self._settings[IP_ADDRESS] > > + @property > + def port(self): > + return self._settings[REMOTE_PORT] > + > @property > def host_bind_ip(self): > return self._settings[LOCAL_ADDRESS] -- 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