Netplan v0.107 released, incl. Python bindings
I’m happy to announce that Netplan version 0.107 is now available on GitHub and is soon to be deployed into a Linux installation near you! Six months and more than 200 commits after the previous version (including a .1 stable release), this release is brought to you by 8 free software contributors from around the globe.
Highlights
Highlights of this release include the new configuration types for veth and dummy interfaces:
network:
version: 2
virtual-ethernets:
veth0:
peer: veth1
veth1:
peer: veth0
dummy-devices: # loopback
dm0:
addresses:
- 192.168.0.123/24
...
Furthermore, we implemented CFFI based Python bindings on top of libnetplan’s API, that are available as part of the python3-netplan package and can easily be consumed by 3rd party applications (see full cffi-bindings.py example):
from netplan import Parser, State, NetDefinition
from netplan import NetplanException, NetplanParserException
parser = Parser()
# Parse the full, existing YAML config hierarchy
parser.load_yaml_hierarchy(rootdir='/')
# Validate the final parser state
state = State()
try:
# validation of current state + new settings
state.import_parser_results(parser)
except NetplanParserException as e:
print('Error in', e.filename, 'Row/Col', e.line, e.column, '->', e.message)
except NetplanException as e:
print('Error:', e.message)
# Walk through ethernet NetdefIDs in the state and print their backend
# renderer, to demonstrate working with NetDefinitionIterator &
# NetDefinition
for netdef in state.ethernets.values():
print('Netdef', netdef.id, 'is managed by:', netdef.backend)
print('Is it configured to use DHCP?', netdef.dhcp4 or netdef.dhcp6)
Changelog:
- Support for “dummy” (
dummy-devices
) interfaces (LP#1774203) by @daniloegea in #361 - Support for “veth” (
virtual-ethernets
) interfaces by @daniloegea in #368 - Add Python bindings for libnetplan by @slyon in #385
- netplan: Handle command exceptions by @daniloegea in #334
- WPA3 (personal) support (LP#2023238) by @daniloegea in #369
- Add all the commands to the bash completion file (LP#1749869) by @daniloegea in #326
- New submodule for state manipulation by @daniloegea in #379
- commands/status: show routes from all routing tables by @daniloegea in #390
- cli:status: Make rich pretty printing optional by @slyon in #388
- libnetplan: expose dhcp4 and dhcp6 properties by @daniloegea in #394
- Expose macaddress and DNS configuration from the netdef by @daniloegea in #395
- libnetplan: expose the routes list in the netdef by @daniloegea in #397
- NetworkManager: Wireguard private key flag support by @daniloegea in #371
- Add a netplan_parser_load_keyfile() Python binding by @daniloegea in #351
- keyfile parser: add support for all tunnel types (LP#2016473) by @daniloegea in #360
- parse-nm:wg: add support for reading the listen-port property by @daniloegea in #372
- parse-nm: add support for VRF devices by @daniloegea in #398
- Vlan keyfile parser support by @daniloegea in #370
- Netplan docs rework by @daniloegea in #333 & #337
- docs: Add a short netplan-everywhere howto by @daniloegea in #325
- doc: make us of sphinx copybutton plugin by @slyon in #354
- doc: Add Ubuntu Code of Conduct 2.0 by @slyon in #355
- doc: Explanation about 00-network-manager-all.yaml by @slyon in #378