2444 Commits

Author SHA1 Message Date
Edward Haas
499814f5a4 libnmstate: Cover nm.ip* module using unit tests 2018-06-24 11:42:05 +03:00
Edward Haas
30d2e3fc38 libnmstate: Cover nm.bond module using unit tests 2018-06-24 11:42:05 +03:00
Edward Haas
a94fc9ce63 libnmstate: Cover nm.device module using unit tests 2018-06-24 11:42:05 +03:00
Edward Haas
6516441b63 libnmstate: Extract NM specific config setup to nm.applier
As part of the effort to seperate provider specific logic from generic
applier setup flow, the configuration preparation for adding and editing
interfaces has been relocated from netapplier to nm.applier module.

Signed-off-by: Edward Haas <edwardh@redhat.com>
2018-06-20 13:50:56 +03:00
Edward Haas
dbe6f253d1 libnmstate: Remove netapplier dependency on nmclient
Code that used to depend on nmclient has been relocated to nm.device.

Only a client 'refresh' has been left in netapplier, target for removal
when the mainloop is integrated in the setup flow.

Signed-off-by: Edward Haas <edwardh@redhat.com>
2018-06-20 13:50:56 +03:00
Edward Haas
a22c03380f libnmstate: Reorganize netinfo, moving NM specific code
With the aim to decouple main infrastructure code from the specific
NM provider, netinfo module has been refactored.

The code has been split into 3 main parts:
- Collection of data is performed from the netinfo module, controlling
  which data is collected.
- nm.* (excluding the translator) is responsible to provide raw NM
  information, collected from NM.
- nm.translator is responsible for the translation of the NM info to the
  nmstate schema format (and vice versa).

As a general rule, only the nm provider package should depend on NM.

Signed-off-by: Edward Haas <edwardh@redhat.com>
2018-06-20 13:50:56 +03:00
Edward Haas
fde5ba0c17 libnmstate: Reorganizing nm.translator into classes
Signed-off-by: Edward Haas <edwardh@redhat.com>
2018-06-20 13:50:56 +03:00
Edward Haas
d466b52f82 libnmstate: Relocate link admin state translation to nm
The translation between NM admin state and the API has been moved to
nm.translator.

Signed-off-by: Edward Haas <edwardh@redhat.com>
2018-06-20 13:50:56 +03:00
Edward Haas
de738a6550 doc: Update README file with up-to-date information
Signed-off-by: Edward Haas <edwardh@redhat.com>
2018-06-19 14:52:54 +03:00
Edward Haas
e6ec935bde libnmstate: On iface state 'up', always activate the connection
When the iface properties are changed, an activate command should be
executed. Therefore, if the iface admin state is up, we will always
execute an activate on them.
2018-06-13 16:21:39 +03:00
Edward Haas
6ad29581eb libnmstate: Add 1sec sleep on config set
Until the main loop is introduced, a 1 sec delay is added for the set
operation, allowing nmstate to execute the async calls to libnm.
2018-06-13 16:21:39 +03:00
Edward Haas
1f7c734d8b libnmstate: Ethernet ifaces report with correct type 2018-06-13 16:21:39 +03:00
Edward Haas
8a4c33a14a schema: Support dummy interfaces 2018-06-13 16:21:39 +03:00
Edward Haas
82c2efc82a libnmstate: Support bond slaves configuration
Slaves can now be defined for a bond.

Note that in the nmstate schema, slaves are specified under the bond
interface while NM expects each slave to be marked as "slave".
In order to adjust, the desired state is normalized with slaves metadata
in the form of an internal property "master" which takes the value of
the bond master.
2018-06-13 16:21:39 +03:00
Edward Haas
0f84890ac5 libnmstate: Report the slaves of a bond 2018-06-13 16:21:39 +03:00
Edward Haas
ac9289491a libnmstate: Add bond state validation
Validate bonds slaves existance and reuse of slaves.
2018-06-13 16:21:39 +03:00
Edward Haas
4d8d45f5fd libnmstate: Support interface state editation
Interfaces configuration is now editable.

Checked against the bond type, other types may require special handling
and should be checked when support for them is introduced.
2018-06-13 16:21:39 +03:00
Edward Haas
ef1272c46f libnmstate: Canonicalize desired state with current state
The desired state may only specify partial configuration and it is up to
nmstate to add the missing parts.

In this patch, the requested desired state is merged into the reported
interfaces state.
2018-06-13 16:21:39 +03:00
Edward Haas
190be348ee libnmstate: Add support for new bond configuration
Bond interfaces may be now defined through the schema.

Attaching slaves is planned for the following patches.
2018-06-13 16:21:39 +03:00
Edward Haas
d4a03888b2 libnmstate: Add support for bond reporting
The bond interface type is now supported through the reports.

It is introduced with a new nm (networkmanager) package which will act
as the NM provider, linking between the nmstate business logic and the
nm api.
2018-06-13 16:21:39 +03:00
Edward Haas
8abf5044c0 libnmstate: Refactor netapplier structure
Accommodate for future functionality additions.
2018-06-13 16:21:39 +03:00
Till Maas
4fc0e09206 Pretty print new state after applying, too 2018-06-13 16:13:11 +03:00
Edward Haas
019ace18e2 libnmstate: Support software interface removal
Non physical devices may now be removed by stating 'absent' in the iface
admin state.
2018-06-13 10:47:06 +03:00
Till Maas
148aef231b Refresh nmclient after changing state
This is required to be able to have a chance to see changes after
applying a new state:

```python
    previous_state = netinfo.show()
    netapplier.apply(state)
    import time; time.sleep(10)
    current_state = netinfo.show()
```

Without this, `current_state` and `previous_state` will be the same as
long as `netapplier.apply()` does not run `GLib.MainLoop`.
2018-06-12 11:34:42 +03:00
Till Maas
426f61d4f0 Allow action functions to determine exit code 2018-06-06 16:38:03 +03:00
Till Maas
77eaead049 Detect JSON 2018-06-06 16:25:46 +03:00
Till Maas
68306cf9b9 Add initial yaml support 2018-06-06 16:25:46 +03:00
Petr Horáček
07d3800bf3 add link to project homepage
This link will be shown on PyPI page.
2018-05-31 17:02:10 +03:00
Petr Horáček
5731e619b1 set description content type to markdown
With this setting, README will be correctly rendered on PyPI.
2018-05-31 17:02:10 +03:00
Edward Haas
d2b58a679a libnmstate: If iface state is not "activated", consider it "down" 2018-05-30 17:33:57 +03:00
Edward Haas
7b5cf6b797 nmstatectl: Introduce basic set command
nmstatectl can now be called with a 'set' command and a file path that
describes the desired state.

Usage:
nmstatectl set -f <filepath>
2018-05-30 17:33:57 +03:00
Edward Haas
84c7230d0d libnmstate: Control an interface state (up/down)
Given a desired state of interfaces, update their operational state
based on the 'state' keyword value.

Note: 'absent' is not supported at this time.
2018-05-30 17:33:57 +03:00
Edward Haas
15e4fd9844 libnmstate: Small spell fix 2018-05-28 10:22:55 +03:00
Till Maas
bf3242145b Pretty print network state 2018-05-24 07:40:29 +03:00
Edward Haas
4c6885654c nmstatectl: Introduce 'show' command to display state
Use 'nmstatectl show' to show the network state.
Current (libnmstate) inplementation includes only listing the interfaces
with basic properties of each.
2018-05-23 09:11:50 +03:00
Edward Haas
bba1811ad2 libnmstate: Minimal support for showing iface state
The netinfo module is used to list all existing interfaces on the
machine with basic properties (name, type, state).

The unit tests required the introduction of the compat module which
imports the mock package for Python2 and uses the standard lib mock from
Python3.
2018-05-23 09:11:50 +03:00
Edward Haas
7482c46c2d tox: Specify full path to the requirements.txt file
The requirements.txt file is not being processed correctly when
specified as a relative path in the tox.ini configuration.

Using toxinidir to solve the problem.
2018-05-23 09:11:50 +03:00
Edward Haas
900d008428 Add interface schema ethernet properties
Note that the ethernet specific properties should be moved to a seperate
schema file when the python-jsonschema will support relative path
referencing.
2018-05-17 14:41:12 +03:00
Edward Haas
6426660d5b Add interface schema common properties 2018-05-17 14:41:12 +03:00
Edward Haas
91f97f1483 Introduce a basic schema with validation tests
A basic schema is introduced, defined in json-schema[1] and implemented
by jsonschema[2] python implementation.

The full/partial definition for the nmstate schema will be introduced in
a seperate patch.

[1] http://json-schema.org
[2] https://github.com/Julian/jsonschema
2018-05-15 17:10:35 +03:00
Petr Horáček
c92b0fa839 add code skeleton, setup config and do some cleanup 2018-05-15 08:29:46 +03:00
Edward Haas
6c6cd31c5e Integrate with coveralls 2018-05-09 18:58:33 +03:00
Edward Haas
821ceb81d6 Integrate with travis-ci 2018-05-09 18:48:33 +03:00
Edward Haas
eab7ab08ef Initial commit 2018-05-08 11:03:48 +03:00