summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test/quagga_access.py
diff options
context:
space:
mode:
authorHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-07-05 00:25:09 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-07-11 21:40:05 +0900
commitd5028c1b6e29c312c1364c41555cb77c09c3f64b (patch)
treeea84e836468dc5d195f30e1bcd1a929663e7256a /test/scenario_test/quagga_access.py
parentc2bf9c40c3ac8d0a7ef748c2cbd3c99ae469a6ca (diff)
scenario_test: add test case for aspath prepend action
Diffstat (limited to 'test/scenario_test/quagga_access.py')
-rw-r--r--test/scenario_test/quagga_access.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/test/scenario_test/quagga_access.py b/test/scenario_test/quagga_access.py
index a04ccd59..8e011398 100644
--- a/test/scenario_test/quagga_access.py
+++ b/test/scenario_test/quagga_access.py
@@ -133,14 +133,25 @@ def lookup_prefix(tn, prefix, af):
return
info = tn.read_until("bgpd#")
+ lines = info.split("\n")
paths = []
- for line in info.split("\n"):
+
+ if len(lines) > 1 and "BGP routing table entry for " + prefix in lines[1]:
+ idx_nw = -1
+ nexthop = ''
+ # check if the prefix is originated route by its own or not.
+ for idx, line in enumerate(lines):
+ if "from" in line:
+ nexthop = line.split()[0]
+ idx_nw = idx
+ if nexthop == "0.0.0.0":
+ return paths
+
path = {}
- if "from" in line:
- nexthop = line.split()[0]
- path['Network'] = prefix
- path['Next Hop'] = nexthop
- paths.append(path)
+ path['aspath'] = lines[idx_nw - 1].strip().split(" ")
+ path['Network'] = prefix
+ path['Next Hop'] = nexthop
+ paths.append(path)
return paths