In generally, iBGP session is established between loopback interfaces.
Therefore, we need to specify loopback interface as neighbour_source_address.
This parameter is just like update-source command in cisco router.

Signed-off-by: Toshiki Tsuboi <[email protected]>
---
 ryu/services/protocols/bgp/bgpspeaker.py | 16 +++++++++++++++-
 ryu/services/protocols/bgp/peer.py       |  7 ++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/ryu/services/protocols/bgp/bgpspeaker.py 
b/ryu/services/protocols/bgp/bgpspeaker.py
index c969b08..70a5bc4 100644
--- a/ryu/services/protocols/bgp/bgpspeaker.py
+++ b/ryu/services/protocols/bgp/bgpspeaker.py
@@ -58,6 +58,8 @@ from ryu.services.protocols.bgp.rtconf.neighbors import 
IN_FILTER
 from ryu.services.protocols.bgp.rtconf.neighbors import OUT_FILTER
 from ryu.services.protocols.bgp.rtconf.neighbors import IS_ROUTE_SERVER_CLIENT
 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
 
 
@@ -181,7 +183,8 @@ class BGPSpeaker(object):
                      enable_vpnv6=DEFAULT_CAP_MBGP_VPNV6,
                      next_hop=None, password=None, multi_exit_disc=None,
                      site_of_origins=None, is_route_server_client=False,
-                     is_next_hop_self=False):
+                     is_next_hop_self=False, local_address=None,
+                     local_port=None):
         """ This method registers a new neighbor. The BGP speaker tries to
         establish a bgp session with the peer (accepts a connection
         from the peer and also tries to connect to it).
@@ -220,6 +223,11 @@ class BGPSpeaker(object):
 
         ``is_next_hop_self`` specifies whether the BGP speaker announces
         its own ip address to iBGP neighbor or not as path's next_hop address.
+
+        ``local_address`` specifies Loopback interface address for iBGP 
peering.
+
+        ``local_port`` specifies source TCP port for iBGP peering.
+
         """
         bgp_neighbor = {}
         bgp_neighbor[neighbors.IP_ADDRESS] = address
@@ -249,6 +257,12 @@ class BGPSpeaker(object):
         if site_of_origins:
             bgp_neighbor[SITE_OF_ORIGINS] = site_of_origins
 
+        if local_address:
+            bgp_neighbor[LOCAL_ADDRESS] = local_address
+
+        if local_port:
+            bgp_neighbor[LOCAL_PORT] = local_port
+
         call('neighbor.create', **bgp_neighbor)
 
     def neighbor_del(self, address):
diff --git a/ryu/services/protocols/bgp/peer.py 
b/ryu/services/protocols/bgp/peer.py
index 2baf4a8..8c17a58 100644
--- a/ryu/services/protocols/bgp/peer.py
+++ b/ryu/services/protocols/bgp/peer.py
@@ -1037,7 +1037,12 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
                 peer_address = (self._neigh_conf.ip_address,
                                 const.STD_BGP_SERVER_PORT_NUM)
 
-                LOG.debug('%s trying to connect to %s' % (self, peer_address))
+                if bind_addr:
+                    LOG.debug('%s trying to connect from %s to %s'
+                               % (self, bind_addr, peer_address))
+                else:
+                    LOG.debug('%s trying to connect to %s'
+                               % (self, peer_address))
                 tcp_conn_timeout = self._common_conf.tcp_conn_timeout
                 try:
                     password = self._neigh_conf.password
-- 
1.9.1
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to