VyOS CLI parser operation


#1

Hello,

I am trying to read VyOS Wiki to understand how the parser works at:

https://wiki.vyos.net/wiki/Configuration_mode_templates

I tried to pick some commands and trace directory trees until node.def found and see what is the function or script called eventually. However, I realized some node.def does not contain any ‘commit action’ like ‘start’ and I am lost after this point. In this case, what does the command actually call or is there any place that I am missing here? Thanks!


#2

Some templates indeed only have value validation in them. The commit action is usually at the top level of the configuration subtree (e.g. /opt/vyatta/share/vyatta-cfg/templates/interfaces/tunnel/node.def or /opt/vyatta/share/vyatta-cfg/templates/service/dhcp-server/node.def).

Note that some tempplates only use “end:” tag, that’s when scripts already take care of checking what changed in the config. It’s quite messy really.


#3

Hello dmbaturin,

Thanks for your help! I see what you mean. But I have more questions:

  1. So if the commit action is at top level of the configuration, does it always apply to whatever commands after this top level? Or is there any general rule?

For your example, both /opt/vyatta/share/vyatta-cfg/templates/interfaces/tunnel/node.def and /opt/vyatta/share/vyatta-cfg/templates/interfaces/tunnel/node.tag/address/node.tag have ‘create’ commit action. Which one will be triggered if configuring 'set interface tunnel address '?

  1. Regarding to the ‘end’ tag, when you said that’s when scripts already take care …’, what is the script meant here?

Really appreciate for your help!