Re: D-bus create device, tutorials, resources





----- Original Message -----
From: "Thomas Haller" <thaller redhat com>
To: "Yegor Yefremov" <yegorslists googlemail com>
Cc: "Petr Horacek" <phoracek redhat com>, "networkmanager." <networkmanager-list gnome org>
Sent: Tuesday, March 3, 2015 12:03:43 PM
Subject: Re: D-bus create device, tutorials, resources

On Tue, 2015-03-03 at 10:28 +0100, Yegor Yefremov wrote:
On Tue, Mar 3, 2015 at 10:03 AM, Petr Horacek <phoracek redhat com> wrote:
Hello folks,

I'm new to NetworkManager, getting familiar with D-bus interface etc.
I'd like to create a high level Python interface for nm, but I have
trouble
with insufficient documentation resources (or my Google skills).

Is there any tutorial or D-bus code example for e.g. creating a bond
device
with defined IP? I've found plenty of 'list devices' but nothing like
this.

What's wrong with this project
https://github.com/seveas/python-networkmanager ?
(Copying from another response:)
I know this lib, "problem" is, that you still have to handle NetworkManager with
some strings, dictionaries etc. I would like to do it more Pythonic way, like:

add_bond(name, slaves), or even better with some context managers and stuff.



See also,
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/dbus
which are examples for using Python to access the D-Bus interface directly.


then there is also
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/gi
which uses libnm via gobject introspection. If you want something quick,
this might be better. If you want to implement the best possible python
NM library, you might don't want to use it.

Note that libnm will always be installed together with NetworkManager,
so the additional dependency is not that cumbersome.
But libnm was only introduced with nm-1-0, so if you want to support
older NM (too), you must use the now deprecated libnm-utils library.
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/gi?h=nm-0-9-10
The deprecated library libnm-utils also works with NM 1.0 and newer, but
it is... deprecated.


The D-Bus API for NM is quite stable, so if you are using D-Bus
directly, you should easily be able to support various version of
NetworkManager.



I didn't look at python-networkmanager, but that might be worth using
(and improving) instead of adding yet another wrapper.




Thomas


I would love to use D-Bus API, but I don't know what strings should I use for for
example adding bond and stuff like that. Thanks for links, but I think, i read them all.

Improving python-networkmanager could be fine, but i would like to do more
higher interface, as I mentioned in response to Yegor. Something like
Python nmcli.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]