added neighbor_update method to BGPSpeaker class.
Currently only MED value can be changed.

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

diff --git a/ryu/services/protocols/bgp/bgpspeaker.py 
b/ryu/services/protocols/bgp/bgpspeaker.py
index 2fff03e..70d3a9f 100644
--- a/ryu/services/protocols/bgp/bgpspeaker.py
+++ b/ryu/services/protocols/bgp/bgpspeaker.py
@@ -61,6 +61,7 @@ from ryu.lib.packet.bgp import RF_IPv4_UC, RF_IPv6_UC
 
 OUT_FILTER_RF_IPv4_UC = RF_IPv4_UC
 OUT_FILTER_RF_IPv6_UC = RF_IPv6_UC
+NEIGHBOR_CONF_MED = 'multi_exit_disc'
 
 
 class EventPrefix(object):
@@ -372,6 +373,28 @@ class BGPSpeaker(object):
         bgp_neighbor[neighbors.IP_ADDRESS] = address
         call('neighbor.delete', **bgp_neighbor)
 
+    def neighbor_update(self, address, conf_type, conf_value):
+        """ This method changes the neighbor configuration.
+
+        ``conf_type`` specifies configuration type which you want to change.
+        Currently ryu.services.protocols.bgp.bgpspeaker.NEIGHBOR_CONF_MED
+        can be specified.
+
+        ``conf_value`` specifies value for the configuration type.
+
+        """
+
+        assert conf_type == NEIGHBOR_CONF_MED
+
+        func_name = 'neighbor.update'
+        attribute_param = {}
+        if conf_type == NEIGHBOR_CONF_MED:
+            attribute_param = {neighbors.MULTI_EXIT_DISC: conf_value}
+
+        param = {neighbors.IP_ADDRESS: address,
+                 neighbors.CHANGES: attribute_param}
+        call(func_name, **param)
+
     def prefix_add(self, prefix, next_hop=None, route_dist=None,
                    route_family=None):
         """ This method adds a new prefix to be advertized.
-- 
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