Some nodes can have multiple values, like "address" in interfaces. Your parser confuses them with tag nodes.
A useful rule of thumb is presence of a left curly brace on the same line. Leaf nodes never have them, tag nodes always do.
For the record, there's now built-in, fully "anatomically correct" parser and Python3 bindings for it that power the migration scripts and in the latest rolling release, the vyos.config library, and it can manipulate the trees in memory (it's a part of the future config backend to replace libvyattacfg).
Installing it on random machine is not quite easy since it has native code dependencies (https://github.com/vyos/libvyosconfig/), so an independent pure Python "config to a dict" parser retains its value.
Some nodes can have multiple values, like "address" in interfaces. Your parser confuses them with tag nodes. A useful rule of thumb is presence of a left curly brace on the same line. Leaf nodes never have them, tag nodes always do.
For the record, there's now built-in, fully "anatomically correct" parser and Python3 bindings for it that power the migration scripts and in the latest rolling release, the
vyos.config
library, and it can manipulate the trees in memory (it's a part of the future config backend to replace libvyattacfg).Installing it on random machine is not quite easy since it has native code dependencies (https://github.com/vyos/libvyosconfig/), so an independent pure Python "config to a dict" parser retains its value.