- Python 70.4%
- Jinja 29%
- Shell 0.6%
| data | Add option to specify a deploy password | |
| gpncfg | FIX: removed interface faults (unkown) for arista-dcs7050s-64 | |
| .envrc | Add Direnv | |
| .gitignore | chore(git): unignore config file endings | |
| .pre-commit-config.yaml | chore(pre-commit): allow private ssh keys for example key | |
| dev-env.sh | feat(dev-env.sh): delete and recreate the virtual environment | |
| poetry.lock | Fix some stuff | |
| pyproject.toml | Fix some stuff | |
| README.md | style(fiddle): split cumulus template data structure into separate file | |
GPN Config-Generator
gpncfg generates switch and router configs based on information from nautobot. This tool is used by the Gulaschprogrammiernacht Network Operation Center to create the configuration for most devices.
Inspired by ravens config-generator for GPN21 and Internetmanufaktur's imfcfg
Development
Directory Layout
dev-env.shsets up the environmentdataexample config filesdata/gpncfg.tomlper user settings and secrets for gpncfgdata/testuser2_*ssh keys for testing configuration and deploymentdata/login.tomllogin file specifying root and user login data
generated-configsdefault output dir for generated device configsgpncfgpython module with gpncfg source codegpncfg/__init__.pyentry point for librariesgpncfg/__main__.pyentry point for module executiongpncfg/configconfig parsing which affects gpncfgs behaviorgpncfg/config/event.tomlevent specific configuration
gpncfg/data_providerinformation fetching from source of truthgpncfg/fiddle/__init__.pymutate and adjust data structures of network datagpncfg/fiddle/cumulus.pytemplate data structure for cumulus devicesgpncfg/main_actiondriver and glue between other componentsgpncfg/renderrender the templates using the nautobot datagpncfg/render/templatesswitch/router config templates
pyproject.tomlpackaging and build definitionsREADME.mdhuman readable project information
Setup
gpncfg is using poetry to manage dependencies and packaging. Use the provided
dev-env.sh script to set up a development environemnt. This will provide a
python virtual environment
with all the dependencies and install the pre-commit hooks. The virtual
environment needs to be activated by sourcing the activation script at
<venv>/bin/activate. Versions for shells other than bash are provided as well.
Inside the venv, run gpncfg or python3 -m gpncfg to execute the code.
To provide gpncfg with necessary configuration, for example nautobot credentials, copy the example config file into your config directory and edit it:
mkdir $XDG_CONFIG_HOME/gpncfg
cp data/gpncfg.toml.example $XDG_CONFIG_HOME/gpncfg/gpncfg.toml
eval $EDITOR $XDG_CONFIG_HOME/gpncfg/gpncfg.toml
# see data/login.toml for an example login file
eval $EDITOR $XDG_CONFIG_HOME/gpncfg/login.toml