Skip to content
A declarative network manager API for hosts
Python Shell Makefile
Branch: master
Clone or download
tyll run-tests: Print a separator when the script fails
When the script fails without running any tests, it is hard to find the
actual failure. Print a marker before the teardown starts to make it
easier to locate the last line that triggered the error.

Example marker:
===== T E A R D O W N =====

Signed-off-by: Till Maas <opensource@till.name>
Latest commit 3590ef8 Nov 7, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.copr copr: Detect python version for SRPM deps Jun 5, 2019
.github github: Fix CODEOWNERS syntax Oct 22, 2019
automation run-tests: Print a separator when the script fails Nov 11, 2019
doc doc: Create nmstatectl man page Oct 17, 2019
examples ovs api: drop port's "type" attribute Oct 29, 2019
libnmstate schema: add linux bridge vlan filtering Nov 6, 2019
nmstatectl Relicense to LGPL2.1+ Jul 3, 2019
packaging test container: Fix CentOS 8 dev container Oct 25, 2019
tests schema: add linux bridge vlan filtering Nov 6, 2019
.coveragerc CI: Upload code coverage for all test type. Mar 4, 2019
.environment.yaml test stdci: Set CI environment variable Nov 7, 2019
.gitignore gitignore: ignore htmlcov-* directories Oct 23, 2019
.stdci.yml stdci: Run on Fedora29 with a Fedora container Jul 3, 2019
.travis.yml travis: Test against NetworkManager 1.20 Oct 15, 2019
CHANGELOG changelog: Release 0.0.8 Jul 25, 2019
CODE_OF_CONDUCT.md Code of Conduct: Introduce the Code of Conduct statement Jul 1, 2019
CONTRIBUTING.md CONTRIBUTING: Clarfiy black usage Oct 15, 2019
LICENSE Relicense to LGPL2.1+ Jul 3, 2019
MANIFEST.in packaging: add manual page generation Oct 17, 2019
README.debug.md README.debug: Extract debug HOWTO from README.developer Jul 1, 2019
README.install.md Remove the unused ipaddress codes. Aug 22, 2019
README.md README: Add a documentation section Oct 30, 2019
VERSION VERSION: Bump to 0.1.1 Oct 23, 2019
commit-template.txt readme: Add basic coding-guidelines and commit template Oct 31, 2018
pylintrc Initial commit May 8, 2018
pyproject.toml linting: Configure black via pyproject.toml Oct 18, 2019
requirements.txt state, static ipv6: compress ipv6 addrs Oct 24, 2019
setup.py packaging: add manual page generation Oct 17, 2019
tox.ini tox/black: Output diff for black check Nov 7, 2019

README.md

We are Nmstate!

A declarative network manager API for hosts.

Unit Test Status Coverage Status PyPI version Fedora Rawhide version Code Style Language grade: Python

Copr build status:

  • EPEL 7 GIT master: EPEL7 GIT master Copr build status
  • Fedora GIT master: Fedora GIT master Copr build status

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.

Development planning (sprints and progress reporting) happens in (Jira). Access requires login.

There is also #nmstate on Freenode IRC.

Installation

For Fedora 29+, sudo dnf install nmstate.

For others distribution, please see the install instructions.

Documentation

Limitations

Please refer to jira page for details.

Changelog

Please refer to CHANGELOG

You can’t perform that action at this time.