From 5bbc3c21656395420ffcc0430e5ae9ab2193d211 Mon Sep 17 00:00:00 2001 From: Hiroshi Yokoi Date: Wed, 23 Jul 2014 17:39:55 +0900 Subject: [PATCH] bgp: add neighbor_update added neighbor_update method to BGPSpeaker class. Currently only MED value can be changed. Signed-off-by: Hiroshi Yokoi Signed-off-by: FUJITA Tomonori --- 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 67bd73c8..8e852ff4 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.