Junoscfg (Python)
Convert and validate Junos configurations between JSON, structured, YAML, and display set formats.
Originally inspired by the Ruby Junoser gem, now a comprehensive Junos configuration toolkit.
Installation
pip install junoscfg
Usage
CLI
# Convert structured config to set commands
junoscfg -i structured -e set config.conf
# Convert JSON to set commands
junoscfg -i json -e set config.json
# Convert to structured format
junoscfg -e structured config.set
# Read from stdin
echo '{"configuration":{"system":{"host-name":"test"}}}' | junoscfg -i json -e set
# Transform YAML for Ansible (literal extraction)
junoscfg edityaml ansibilize -p "addr:interfaces.interface[*].name" config.yaml
# Offset mode for multi-router deployments (generates ipmath expressions)
junoscfg edityaml ansibilize -P "addr:interfaces.interface[*].unit[*].family.*.address[*].name" config.yaml
# Anonymize all sensitive data
junoscfg -i json -e set --anonymize-all config.json
# Anonymize with regex patterns (e.g. match site codes)
junoscfg -e set --anonymize-sensitive-patterns 'LAX\d+' config.json
# Retrieve XSD dump and generate schema artifacts
echo "<rpc> <get-xnm-information> <type>xml-schema</type> <namespace>junos-configuration</namespace> </get-xnm-information> </rpc>" | ssh -Csp 830 router.example.com netconf > netconf.xml
junoscfg schema generate netconf.xml -o ./artifacts/
Python API
from junoscfg import convert_config, Format, validate_json
# Convert between any format pair
result = convert_config(
'{"configuration":{"system":{"host-name":"test"}}}',
from_format=Format.JSON, to_format=Format.SET,
)
# Validate a JSON config
result = validate_json('{"configuration":{"system":{"host-name":"test"}}}')
print(result.valid) # True
# Convert with strict field-level validation (raises on invalid enum/pattern/IP values)
result = convert_config(source, from_format=Format.JSON, to_format=Format.SET, strict=True)
# Anonymize a configuration
from junoscfg.anonymize import anonymize
from junoscfg.anonymize.config import AnonymizeConfig
config = AnonymizeConfig(ips=True, passwords=True, salt="my-salt")
config.expand_all()
ir = {"configuration": {"system": {"host-name": "router1", "name-server": [{"name": "8.8.8.8"}]}}}
result = anonymize(ir, config)
Documentation
For full documentation, install the docs dependencies and run:
uv sync --group docs
uv run mkdocs serve
Then open http://127.0.0.1:8000.
Key sections:
- Getting Started — Installation and usage examples
- User Guide — Conversion, validation, and CLI reference
- API Reference — Auto-generated Python API docs
- Architecture — Design decisions and schema internals
Metadata
Release files for junoscfg 0.5.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| junoscfg-0.5.10.tar.gz | 2.3 MB | Without provenance | Details for junoscfg-0.5.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| junoscfg-0.5.10-py3-none-any.whl | Python 3 | none | any | Details for junoscfg-0.5.10-py3-none-any.whl |
Total release size: 4.7 MB
Release files / junoscfg-0.5.10.tar.gz
| Download URL | junoscfg-0.5.10.tar.gz |
|---|---|
| Size | 2.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9cf8d6e5ed2ef7583262f29d5302beb0000867bdadcb7b58fe3e4329f24fa74
|
|
BLAKE2b-256 checksum How to use checksums |
f86815352524fb1b23430f829e41b9dd13db11993cc997b55266a20d1b689c00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / junoscfg-0.5.10-py3-none-any.whl
| Download URL | junoscfg-0.5.10-py3-none-any.whl |
|---|---|
| Size | 2.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
32255126c3e418945a386c3f6dfcae8edb3ab974e2f739bf66497a05648ec44e
|
|
BLAKE2b-256 checksum How to use checksums |
570be92e1be6bcdab28766514489f90dd04a007df15c537a416b0ea5a02e4cd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for junoscfg 0.5.10
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.