Skip to main content

Network Config Builder

As a network automation engineer I need to template build network device configurations. I want to use Jinja2 as my templating language. I want to be able to use the Jinaj include directive so that I can include relative template files. I want the ability to dynamically create variable collections for each host using native Python, and have a tool that correlates these variables based on a priority ordering.

This repostory provides such a tool.

$ netcfg-builder --template <template-file.j2> -e <extra-variables>

When -e <varname>=<value>, then the variable name varname is defined with the value <value>.

For example, define a varialbe called varsdir that has the value /usr/local/myvars.

$ netcfg-build --template <template-file> -e vardirs=/usr/local/lib/myvars

When <extra-varialbes> is a .py file, that file needs to decorator functions; each of these functions will be called in priority order. Priority 0 is first.

For example:

from pathlib import Path
from netcfg_builder.variables import ingest, load_directory

@ingest(0)
def load_variables(tvars: dict, **extras):
    varsdir = Path(extras['varsdir'])
    tvars.update(load_directory(varsdir.joinpath('common')))
    tvars.update(load_directory(varsdir.joinpath(extras['hostname'])))

The first parameter, tvars to the decordated function is current set of template variables. The second parameter, **extras are any extra variables defined on the command line.

Metadata

Release files for netcfg-builder 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for netcfg-builder 0.3.0
File Size Uploaded Provenance
netcfg-builder-0.3.0.tar.gz 6.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for netcfg-builder 0.3.0
File Interpreter ABI Platform
netcfg_builder-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / netcfg-builder-0.3.0.tar.gz

Download URL netcfg-builder-0.3.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
94a01899393a3364cc9c311d45ccd24267e1dc8a087f759653b592f0bb80c351
BLAKE2b-256 checksum
How to use checksums
00dd45fdb0dafd819b85c6cb3a41ca7def1e818261517df461cd423668984d37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.3

Release files / netcfg_builder-0.3.0-py3-none-any.whl

Download URL netcfg_builder-0.3.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
138622c2f5586bdc63e67ed4535036341441365cfda0a1186dc91278ad3d0c49
BLAKE2b-256 checksum
How to use checksums
c636846b0106c7a487b3efbef6a2f85a6c9950fac13d6d30c7cb5d4c54d6b7c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.3

Security for netcfg-builder 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page