summaryrefslogtreecommitdiffhomepage
path: root/test/lib/base.py
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2017-12-25 14:46:04 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-01-19 13:25:19 +0900
commit3707b5aedf11e1adc2bd35baba9d05a308ba384b (patch)
treea77e042560c21b42366b79f5dd393001e034a3c6 /test/lib/base.py
parent52770785bd2c9b77744ace2a2e2092132b534406 (diff)
test/lib/base: Delete FlowSpec routes with keyword
Currently, in case of the FlowSpec routes, "prefix" value which stored on each container instance is just a keyword and not valid NLRI arguments for adding or deleting routes. So when deleting routes with "route" keyword, it is required to construct the NLRI arguments using "matchs" value. This patch enables to construct the valid NLIR arguments as "prefix" value when adding the FlowSpec routes and enables to delete the FlowSpec routes with "route" keyword. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'test/lib/base.py')
-rw-r--r--test/lib/base.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/lib/base.py b/test/lib/base.py
index d7d33f40..19452896 100644
--- a/test/lib/base.py
+++ b/test/lib/base.py
@@ -409,14 +409,24 @@ class BGPContainer(Container):
def log(self):
return local('cat {0}/*.log'.format(self.config_dir), capture=True)
+ def _extract_routes(self, families):
+ routes = {}
+ for prefix, paths in self.routes.items():
+ if paths and paths[0]['rf'] in families:
+ routes[prefix] = paths
+ return routes
+
def add_route(self, route, rf='ipv4', attribute=None, aspath=None,
community=None, med=None, extendedcommunity=None,
nexthop=None, matchs=None, thens=None,
local_pref=None, identifier=None, reload_config=True):
if route not in self.routes:
self.routes[route] = []
+ prefix = route
+ if 'flowspec' in rf:
+ prefix = ' '.join(['match'] + matchs)
self.routes[route].append({
- 'prefix': route,
+ 'prefix': prefix,
'rf': rf,
'attr': attribute,
'next-hop': nexthop,