bgp: add neighbor_update

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

Signed-off-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Hiroshi Yokoi 2014-07-23 17:39:55 +09:00 committed by FUJITA Tomonori
parent 8ad3ce3ba6
commit 5bbc3c2165

View File

@ -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.