We are Nmstate!
A declarative network manager API for hosts.
Copr build status, all repos are built for Fedora Linux and RHEL/CentOS Stream/EPEL 8+:
What is it?
Nmstate is a library with an accompanying command line tool that manages host networking settings in a declarative manner. The networking state is described by a pre-defined schema. Reporting of current state and changes to it (desired state) both conform to the schema.
Nmstate is aimed to satisfy enterprise needs to manage host networking through a northbound declarative API and multi provider support on the southbound. NetworkManager acts as the main (and currently the only) provider supported.
State example:
Desired/Current state example (YAML):
interfaces:
- name: eth1
type: ethernet
state: up
ipv4:
enabled: true
address:
- ip: 192.0.2.10
prefix-length: 24
dhcp: false
ipv6:
enabled: true
address:
- ip: 2001:db8:1::a
prefix-length: 64
autoconf: false
dhcp: false
dns-resolver:
config:
search:
- example.com
- example.org
server:
- 2001:4860:4860::8888
- 8.8.8.8
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 192.0.2.1
next-hop-interface: eth1
- destination: ::/0
next-hop-address: 2001:db8:1::1
next-hop-interface: eth1
Basic Operations
Show eth0 current state (python/shell):
import libnmstate
state = libnmstate.show()
eth0_state = next(ifstate for ifstate in state['interfaces'] if ifstate['name'] == 'eth0')
# Here is the MAC address
eth0_mac = eth0_state['mac-address']
nmstatectl show eth0
Change to desired state (python/shell):
import libnmstate
# Specify a Linux bridge (created if it does not exist).
state = {'interfaces': [{'name': 'br0', 'type': 'linux-bridge', 'state': 'up'}]}
libnmstate.apply(state)
# use yaml or json formats
nmstatectl set desired-state.yml
nmstatectl set desired-state.json
Edit the current state(python/shell):
import libnmstate
state = libnmstate.show()
eth0_state = next(ifstate for ifstate in state['interfaces'] if ifstate['name'] == 'eth0')
# take eth0 down
eth0_state['state'] = 'down'
libnmstate.apply(state)
# open current state in a text editor, change and save to apply
nmstatectl edit eth3
Contact
Nmstate uses the nmstate-devel@lists.fedorahosted.org for discussions. To subscribe you can send an email with 'subscribe' in the subject to nmstate-devel-join@lists.fedorahosted.org or visit the mailing list page.
Sprint tracking happens in (Github projects).
There is also #nmstate on
Libera IRC.
Contributing
Yay! We are happy to accept new contributors to the Nmstate project. Please follow these instructions to contribute.
Installation
For Fedora 29+, sudo dnf install nmstate.
For others distribution, please see the install guide.
Documentation
- libnmstate API
- Code examples
- State examples
- nmstatectl user guide
- nmstatectl man page:
man nmstatectl
Limitations
- Maximum supported number of interfaces in a single desire state is 1000.
Changelog
Please refer to CHANGELOG
Metadata
Release files for nmstate 2.0.0
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 | |
|---|---|---|---|---|
| nmstate-2.0.0.tar.gz | 239.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nmstate-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 416.7 kB
Release files / nmstate-2.0.0.tar.gz
| Download URL | nmstate-2.0.0.tar.gz |
|---|---|
| Size | 239.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e369b983664227e2d51de8f984fd90d828b87f9fae65046289b27c76b0745a4b
|
|
BLAKE2b-256 checksum How to use checksums |
8f57dfc9404f4af4ee232071ef84a97185475b38d1f736d4820a3d2150403ebe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.10.1
|
Release files / nmstate-2.0.0-py3-none-any.whl
| Download URL | nmstate-2.0.0-py3-none-any.whl |
|---|---|
| Size | 176.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38fc1735e4d3d90582e8324a874bbf895cd8a7168e97e5828e6793a846bbe09b
|
|
BLAKE2b-256 checksum How to use checksums |
8bb90f2b66e135b71a0580f50f433b62488352e8738baf6d9ee3dd68dffafcee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.10.1
|
Security for nmstate 2.0.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.