With the dawn of VyOS 1.2, there is effort underway to increase the code base of config scripts based on Python and XML in relation to legacy Perl and Bash code.
@dmbaturin wrote some very good blogs on that road map several months ago. Thanks for your great effort and contribution there!!! It is highly appreciated!
While the idea and the overall architectural approach is great, I find myself stuck in developing Python / XML config and template code efficiently for multiple reasons. In an attempt to find some guidelines on how to read the running config, how to work with its in-Python representation, implement stuff and test it I just found several hints that are hidden in blog history and unlinked wiki pages.
I therefore suggest these sub-tasks:
- T514: Concentration and streamlining of documentation. Some bits are contradicting, for example how exactly to get hands on the running config within a Python script. A few bits are scattered here:
- T515: Complete the documentation. Several ideas seem to completely lack a documentation
or a PoC(example: XML templates). PoC found here: vyos1-x interface definitions
- T516: Make Python / XML code development more testable. For now, Python scripts may be implemented and tested "in vivo" only. You need a running VyOS 1.2 and develop your code right there, on the router with no IDE support. This may be solvable by making a lightweight framework of scripts ("in vitro"), files, directory structure to be copied to an Eclipse Pydev project which enables the dev to:
- make code under development read a custom config.boot (running config mockup)
- make a in-Python representation of it
- debug code handling / manipulating this representation
- investigate the script output (for ex: the generated service config file, firewall ruleset, etc)
- investigate the chain of commands generated by the Python script to implement these config changes to VyOS.
For now, I may investigate the two Python config scripts currently present in VyOS 1.2 and learn from them. Yet, I was unable to get a in-Python representation of the running config and find ot how it was structured to be able to work with it.
Thanks a lot!