Shall we adopt the new (uniform) tag node syntax?
The old syntax: "ethernet eth0" or "vif 99" on the same line, "ethernet" and "vif" words are repeated if multiple nodes are present.
```
interfaces {
ethernet eth0 {
vif 99 {
address 192.0.2.1/24
}
vif 101 {
address 203.0.113.1/24
}
}
}
```
The new syntax: "eth0", "eth1", ... and "99", "101", ... are inside the "ethernet" or "vif" nodes respectively, inside the curly braces. The words "ethernet" or "vif" are not repeated.
```
interfaces {
ethernet {
eth0 {
vif {
99 {
address 192.0.2.1/24;
}
101 {
address 203.0.113.1/24;
}
}
}
```
Pros and cons:
- The new syntax is more uniform
- The old syntax is more concise, however
- The new syntax is substantially easier to implement in the parser and renderer
- The old syntax may be easier on eyes when reading nodes with multiple tag nodes inside
The main difficulty with the old syntax is that the parser gets to keep the state. "ethernet eth0" is really two nodes (eth0 being a child of ethernet), and "ethernet eth0; ethernet eth1" is **three** nodes, so the parser gets to track if "ethernet" node was already seen earlier and add a child to it instead of creating a new one. That's quite annoying to implement, though if people want it back, it's doable.
Also, while this change may look cosmetic, it's a big change for the grammar, and we will not be able to change it in a forward-compatible manner after stable release, so we'd better decide on it as early as possible.
**Update:** Added support for the old style syntax. T245 describes an edge case that requires the same code I wanted to avoid, so there are no technical reasons to not support the old syntax actually, only aesthetic ones.
**Notes:** There are common misconceptions about the issue that stem from my failure to communicate the details and from limitations of the old system.
- This syntax has no effect on user's ability to do "edit interfaces ethernet" and similar, it's just a formatting issue
- If we support the old syntax, it doesn't remove support for the new one since the old one is a strict superset of the new one, and the parser doesn't know if something is supposed to be a tag node or not, this distinction only becomes important at config valiation which happens after parsing is complete
- The old system (VyOS 1.1.x/1.2.x) also allows "ethernet { eth0" and similar in config loading, for the same reasons
So, right now the real question if we should use old or new syntax in the config output ("save" and "show" that is).