From 5d78e89e5e84eb164e035b8af390503ea2986722 Mon Sep 17 00:00:00 2001 From: IWASE Yusuke Date: Fri, 28 Jul 2017 13:06:57 +0900 Subject: test/lib/gobgp: Enable GoBGPContainer to del a route Signed-off-by: IWASE Yusuke --- test/lib/gobgp.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/lib') diff --git a/test/lib/gobgp.py b/test/lib/gobgp.py index a54428e3..b4beef73 100644 --- a/test/lib/gobgp.py +++ b/test/lib/gobgp.py @@ -519,6 +519,24 @@ class GoBGPContainer(BGPContainer): raise Exception('unsupported route faily: {0}'.format(v['rf'])) self.local(cmd) + def del_route(self, route, identifier=None, reload_config=True): + if route not in self.routes: + return + new_paths = [] + for path in self.routes[route]: + if path['identifier'] != identifier: + new_paths.append(path) + else: + r = CmdBuffer(' ') + r << 'gobgp global -a {0}'.format(path['rf']) + r << 'rib del {0}'.format(path['prefix']) + if identifier: + r << 'identifier {0}'.format(identifier) + cmd = str(r) + self.local(cmd) + self.routes[route] = new_paths + # no need to reload config + class RawGoBGPContainer(GoBGPContainer): def __init__(self, name, config, ctn_image_name='osrg/gobgp', -- cgit v1.2.3