A declarative network manager API for hosts.
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.
Install:
pip install tox pbrRun Unit Tests:
toxInstall (from sources) system-wide:
sudo pip install --upgrade .Install just for the local user:
pip install --user --upgrade .Make sure that ~/.local/bin is in your PATH when installing as a local user.
The export command can be used to add it for the current session:
export PATH="${HOME}/.local/bin:${PATH}"Show current state:
nmstatectl showChange to desired state:
nmstatectl set desired-state.jsonnmstatectl will also read from stdin when no file is specified:
nmstatectl set < desired-state.jsonDesired/Current state example:
{
"interfaces": [
{
"description": "Production Network",
"ethernet": {
"auto-negotiation": true,
"duplex": "full",
"speed": 1000
},
"ipv4": {
"address": [
{
"ip": "192.0.2.142",
"prefix-length": 24
}
],
"enabled": true
},
"mtu": 1500,
"name": "eth3",
"state": "up",
"type": "ethernet"
}
]
}The state is also supported as YAML, to get the current state in YAML format:
nmstatectl show --yamlThe set command accepts both YAML and JSON.
- bond
- dummy
- ethernet
- ovs-bridge