From 27923c756dc6eff497562eeca677c446c78d6864 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Tue, 9 May 2017 15:22:34 +0200 Subject: [PATCH] Compability for parsing FRR like Quagga --- bin/routerparsers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/routerparsers.py b/bin/routerparsers.py index 9f3dbe7..06ee1d4 100644 --- a/bin/routerparsers.py +++ b/bin/routerparsers.py @@ -256,6 +256,9 @@ def _quaggaFindNeighbors(info): neighborDict = OrderedDict() for raw in rawNeighbors: descrIdx = 1 if raw[1][0] == "Description:" else 0 + if raw[descrIdx + 1][0] == "Hostname:": + descrIdx += 1 + peerdict = { "neighbor_address": raw[0][3].rstrip(","), "neighbor_as": int(raw[0][6].rstrip(",")), @@ -321,7 +324,7 @@ def _quaggaFindRoutes(raw): foundTable = True else: if line != '': - if line.startswith("Total number of prefixes"): + if line.startswith("Total number of prefixes") or line.startswith("Displayed "): break else: # parse one route line