added parameter for Multi Exit Discriminator(MED) to the neighbor_add method.

Signed-off-by: Hiroshi Yokoi <yokoi.hiro...@po.ntts.co.jp>
---
 ryu/services/protocols/bgp/bgpspeaker.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/ryu/services/protocols/bgp/bgpspeaker.py 
b/ryu/services/protocols/bgp/bgpspeaker.py
index b4a273c..2fff03e 100644
--- a/ryu/services/protocols/bgp/bgpspeaker.py
+++ b/ryu/services/protocols/bgp/bgpspeaker.py
@@ -47,6 +47,7 @@ from ryu.services.protocols.bgp.rtconf.base import 
CAP_MBGP_IPV4
 from ryu.services.protocols.bgp.rtconf.base import CAP_MBGP_IPV6
 from ryu.services.protocols.bgp.rtconf.base import CAP_MBGP_VPNV4
 from ryu.services.protocols.bgp.rtconf.base import CAP_MBGP_VPNV6
+from ryu.services.protocols.bgp.rtconf.base import MULTI_EXIT_DISC
 from ryu.services.protocols.bgp.rtconf.neighbors import DEFAULT_CAP_MBGP_IPV4
 from ryu.services.protocols.bgp.rtconf.neighbors import DEFAULT_CAP_MBGP_VPNV4
 from ryu.services.protocols.bgp.rtconf.neighbors import DEFAULT_CAP_MBGP_VPNV6
@@ -302,7 +303,7 @@ class BGPSpeaker(object):
                      enable_ipv4=DEFAULT_CAP_MBGP_IPV4,
                      enable_vpnv4=DEFAULT_CAP_MBGP_VPNV4,
                      enable_vpnv6=DEFAULT_CAP_MBGP_VPNV6,
-                     next_hop=None, password=None):
+                     next_hop=None, password=None, med=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).
@@ -328,6 +329,11 @@ class BGPSpeaker(object):
 
         ``password`` is used for the MD5 authentication if it's
         specified. By default, the MD5 authenticaiton is disabled.
+
+        ``med`` specifies multi_exit discriminator (MED) value.
+        The default is None and if not specified, MED value is
+        not sent to the neighbor. It must be an integer.
+
         """
         bgp_neighbor = {}
         bgp_neighbor[neighbors.IP_ADDRESS] = address
@@ -348,6 +354,10 @@ class BGPSpeaker(object):
         else:
             # FIXME: should raise an exception
             pass
+
+        if med:
+            bgp_neighbor[MULTI_EXIT_DISC] = med
+
         call('neighbor.create', **bgp_neighbor)
 
     def neighbor_del(self, address):
-- 
1.8.5.2 (Apple Git-48)



------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to