Page MenuHomeVyOS Platform

Docs for devs: How to use Python, XML et al instead of Bash and Perl for VyOS configuration
Resolved (N/A)Public

Description

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:

  1. 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:
  2. 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
  3. 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.

Currently, these tasks in-work requiring this information: T452, T341

Thanks a lot!

Yours truly,
Al

Details

Difficulty level
Unknown (require assessment)
Version
VyOS 1.2
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Internal change (not visible to end users)

Event Timeline

alainlamar changed the visibility from "Subscribers" to "Public (No Login Required)".Jan 7 2018, 12:52 PM
alainlamar added a subscriber: c-po.

@c-po thanks for pointing me to the interface definitions!

syncer triaged this task as Normal priority.Jan 14 2018, 5:49 PM
syncer renamed this task from Docs for devs: How to use Python, XML et al instead of Bash and Perl for VyOS configuration to .Oct 18 2018, 6:05 AM
dmbaturin set Is it a breaking change? to Unspecified (possibly destroys the router).Sep 3 2021, 7:31 AM
dmbaturin set Issue type to Internal change (not visible to end users).