diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-07-28 13:06:57 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-07-30 15:18:35 +0900 |
commit | 5d78e89e5e84eb164e035b8af390503ea2986722 (patch) | |
tree | 25d3e6f5424e48f3f7ff3d6419f1765b908ed5eb /test | |
parent | 22254096fbb166f5a74ecbc893940d2b84121b34 (diff) |
test/lib/gobgp: Enable GoBGPContainer to del a route
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/gobgp.py | 18 |
1 files changed, 18 insertions, 0 deletions
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', |