netplan - a Python library for parsing the netplan configuration data.
Description
This module parses the YAML configuration files describing the system's network configuration in the format used by the netplan.io package. The main parser is the "netplan.parser.Parser" class (also exported as "netplan.Parser"); its "parse()" method returns a data structure of the "netplan.config.NetPlan" class (also exported as "netplan.NetPlan").
Example usage
import netplan
p = netplan.Parser()
data = p.parse()
for iface, cfg in data.items():
print('{section}/{name}'.format(section=cfg.section, name=iface)
p = netplan.Parser()
data = p.parse(exclude=['set-mtu.yaml'])
fix = {'version': 2}
for iface, cfg in data.get_all_interfaces(['br-enp4s0']).data.items():
if cfg.get('mtu') != 9000:
if cfg.section not in fix:
fix[cfg.section] = {}
fix[cfg.section][iface] = {'mtu': 9000}
fix = {'network': fix}
with open('/etc/netplan/set-mtu.yaml', mode='w') as f:
print(yaml.dump(fix), file=f, end='')
The netplan-parser tool
The three types of queries - parse the interface data, get all related
interfaces, and get only the physical related interfaces - are also
available via the command-line netplan-parser tool:
# Show the configuration of all interfaces in YAML format
netplan-parser show
# Show the configuration of the specified interfaces in JSON format
netplan-parser -f json show eno1 eno2.617
# List the names of the interfaces related to the specified one
netplan-parser -f names related eno2.617
# Show the configuration of the physical interfaces related to
# the specified ones
netplan-parser --format=json physical eno2.617 br1-eno1
Contact
The netplan Python library was written by Peter Pentchev as part of
the OpenStack development team at StorPool.
Metadata
Release files for netplan 0.3.3
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 |
|---|---|---|---|---|
| netplan-0.3.3.tar.gz | 12.8 kB | Without provenance | Details for netplan-0.3.3.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| netplan-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for netplan-0.3.3-py3-none-any.whl |
| netplan-0.3.3-py2-none-any.whl | Python 2 | none | any | Details for netplan-0.3.3-py2-none-any.whl |
Total release size: 34.7 kB
Release files / netplan-0.3.3.tar.gz
| Download URL | netplan-0.3.3.tar.gz |
|---|---|
| Size | 12.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7ba8377d9fde05cb1a446f0082c0f4011ca74537e1647e4e9c227b893c031b1
|
|
BLAKE2b-256 checksum How to use checksums |
3646284e325e534b615f591fcf2b61381f67c82fce01de110be3f3fdb8db08a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.4
|
Release files / netplan-0.3.3-py3-none-any.whl
| Download URL | netplan-0.3.3-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a0c08243ef26a3816bd3aecacebd4b57865f8e80e727c9198b1b7b66e65c4ce
|
|
BLAKE2b-256 checksum How to use checksums |
a2613d64b6422f5c44f00aba0ade39cb4b96707bcdcab740b9c7e2a9bb777298
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.4
|
Release files / netplan-0.3.3-py2-none-any.whl
| Download URL | netplan-0.3.3-py2-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
46d3c9c28d5044dd51035555db0fc7dcec1a373d86bc6b358e57aec8a58a6847
|
|
BLAKE2b-256 checksum How to use checksums |
078f4c83bcdc63bb04ec0931afd8fbeff07d893c5dcadd6b86e83f7c717c90d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.4
|
Security for netplan 0.3.3
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.