Fixed routerparser, supports incomplete routes now
This commit is contained in:
parent
76920cf3f1
commit
902bc6be3d
|
@ -292,7 +292,7 @@ def _quaggaFindRoutes(raw):
|
||||||
# BGP table version is 0, local router ID is 10.50.0.1
|
# BGP table version is 0, local router ID is 10.50.0.1
|
||||||
# *> 10.3.14.0/27 10.75.0.22 0 65002 65112 i
|
# *> 10.3.14.0/27 10.75.0.22 0 65002 65112 i
|
||||||
cmdre = re.compile(r"^([^\s#]+#) show ip bgp$")
|
cmdre = re.compile(r"^([^\s#]+#) show ip bgp$")
|
||||||
routere = re.compile(r"^(?P<status>.)(?P<status2>.)(?P<origin>.)(?P<network>[0-9./]+)?\s+(?P<nexthop>[0-9./]+)[\s0-9i]+$")
|
routere = re.compile(r"^(?P<status>.)(?P<status2>.)(?P<origin>.)(?P<network>[0-9./]+)?\s+(?P<nexthop>[0-9./]+)[\s0-9i?]+$")
|
||||||
|
|
||||||
# find output
|
# find output
|
||||||
output = []
|
output = []
|
||||||
|
@ -336,6 +336,8 @@ def _quaggaFindRoutes(raw):
|
||||||
# "parse" path (everything after 61 chars, but no i)
|
# "parse" path (everything after 61 chars, but no i)
|
||||||
path = filter(lambda _x: _x not in ('', 'i'), line[61:].split(" "))
|
path = filter(lambda _x: _x not in ('', 'i'), line[61:].split(" "))
|
||||||
|
|
||||||
|
# currently skip incomplete routes
|
||||||
|
if '?' not in path:
|
||||||
route = {"prefix": d["network"], "nexthop": d["nexthop"], "path": path, "iBGP": d["origin"] == "i"}
|
route = {"prefix": d["network"], "nexthop": d["nexthop"], "path": path, "iBGP": d["origin"] == "i"}
|
||||||
routes.append(route)
|
routes.append(route)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue