Skip to main content

netplan - a Python library for parsing the netplan configuration data.

About this Fork

This fork simply packages existing work done by other people, including :

Unfortunately, version presently on PyPI breaks on Ubuntu 20.04 and is unusable. Additionally :

  • The original author seems uninterested in continuing development and changes have not been published for 3 years.
  • The Algolia fork seems to have created debian packages, but I can't find them anywhere. It has seen recent development, though, so I hope at some point the packages will become available.

This is forked from algolia/python-netplan for the sole purpose of making it pip installable. This fork will be made available as the netplan-ebs package on PyPI.

Though the package will be installed as netplan-ebs, the actual importable package will still be netplan. Due to this, this fork and upstream cannot coexist in the same python environment.

This package contains no EBS-specific code and adds no additional dependencies from upstream.

If you are considering using this:

  • I do not really have the bandwidth to maintain this fork. I will make the best effort to keep this package installable and track any changes from upstream, but that's about it.
  • If upstream resumes development, or publishes an installable package either through pip or apt though a PPA, this fork and the associated pypi package will likely become unmaintained.
  • Issues dealing with install and basic functionality are welcome.
  • Pull Requests should ideally be sent to algolia/python-netplan, so that the codebase does not diverge for entirely non-technical reasons.
  • If you are able and willing to take over maintenance of this package, please get in touch with me.

If you do end up using this package - especially if you do so in a production setting - please reach out to me and let me know by email at shashank at chintal dot in. The number of users, if any, is likely to determine how much effort I will put into maintaining this.

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.

Release files for netplan-ebs 0.4.1

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

Source distribution (sdist)

Source distribution for netplan-ebs 0.4.1
File Size Uploaded
netplan-ebs-0.4.1.tar.gz 17.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for netplan-ebs 0.4.1
File Interpreter ABI Platform
netplan_ebs-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.7 kB

Release files / netplan-ebs-0.4.1.tar.gz

Download URL netplan-ebs-0.4.1.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
feb7464643e8cb8193235cd4bd0892d0ef850cb2dc66dd54135ebeb39e3a5985
BLAKE2b-256 checksum
How to use checksums
3cd810c1c4dde3094171c294a923233cfe2b359b577630e8c7f0ca6f7f071998
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.8

Release files / netplan_ebs-0.4.1-py3-none-any.whl

Download URL netplan_ebs-0.4.1-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
443e4a2824d2da08f59429626d41d858a6ce60bb01bb6f107133f85ee9937c20
BLAKE2b-256 checksum
How to use checksums
95d228aa13fd25abb75433388379786679c393391f8fe6706c049c349ddf28fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.8

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

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