summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test/quagga_access.py
diff options
context:
space:
mode:
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