From 16b3114108e5aba866a068659e340fd86fe11ecb Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Thu, 26 Jul 2018 19:11:30 -0300 Subject: [PATCH] isis-topo1: improve topology parser Don't match header otherwise it will create an even bigger JSON output than we need. Signed-off-by: Rafael Zalamena --- tests/topotests/isis-topo1/test_isis_topo1.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/topotests/isis-topo1/test_isis_topo1.py b/tests/topotests/isis-topo1/test_isis_topo1.py index 97d959ff06..a99691d32d 100644 --- a/tests/topotests/isis-topo1/test_isis_topo1.py +++ b/tests/topotests/isis-topo1/test_isis_topo1.py @@ -341,6 +341,15 @@ def parse_topology(lines, level): item_match = re.match( r"([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+)", line) if item_match is not None: + # Skip header + if (item_match.group(1) == 'Vertex' and + item_match.group(2) == 'Type' and + item_match.group(3) == 'Metric' and + item_match.group(4) == 'Next-Hop' and + item_match.group(5) == 'Interface' and + item_match.group(6) == 'Parent'): + continue + areas[area][level][ipv].append({ 'vertex': item_match.group(1), 'type': item_match.group(2), -- 2.39.5