diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-07-28 11:58:48 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-07-30 15:18:35 +0900 |
commit | 22254096fbb166f5a74ecbc893940d2b84121b34 (patch) | |
tree | 8989f1e1936c2ee75fc2e2bddc97a5347f9135d3 | |
parent | 122f08c1c511656723dd8b1a570264b9da3bf23b (diff) |
test/lib/base: Avoid to del all routes without identifier specified
Currently, del_route() with "identifier=None" deletes all routes even if
some installed routes have the valid identifier.
This patch fixes to delete only route which exactly matches against the
given identifier.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
-rw-r--r-- | test/lib/base.py | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/test/lib/base.py b/test/lib/base.py index 161bb9eb..7718de93 100644 --- a/test/lib/base.py +++ b/test/lib/base.py @@ -403,14 +403,7 @@ class BGPContainer(Container): def del_route(self, route, identifier=None, reload_config=True): if route not in self.routes: return - if identifier: - new_paths = [] - for path in self.routes[route]: - if path['identifier'] != identifier: - new_paths.append(path) - self.routes[route] = new_paths - else: - self.routes[route] = [] + self.routes[route] = [p for p in self.routes[route] if p['identifier'] != identifier] if self.is_running and reload_config: self.create_config() self.reload_config() |