Re: Managing a connection using D-Bus API



On Thu, Jul 1, 2010 at 2:56 PM, Ozan Çağlayan <ozan pardus org tr> wrote:
> Hi,
>
> I'm writing a Python script which uses python-networkmanager for communicating
> with NetworkManager's D-Bus facilities.
>
> I want to disconnect an active connection. Using the nm-applet, we are not
> forced to write a MAC address for a connection.
>
> Say that I want to disconnect the device eth0 AA:BB:CC:DD:EE:FF which is
> currently connected to the connection with the ID "WiredConnection1".
>
> Since the connection doesn't have an hwaddress set, I can't match the
> connection with the device. What I want to do is sth like that:

You need the ActiveConnection object.
That is, obtain ActiveConnections property from /org/freedesktop/NetworkManager.
Obtain the Connection object with the ID you want
Find the ActiveConnection whose Connection property is the Connection
object you found
For each device in the Devices property, invoke Deactivate.

> python network.py down WiredConnection1
>
> Is it ever possible (without providing connection UUID)?

(btw, can't you just use nmcli?)

> Thanks,
>
> ---
> Ozan Çağlayan
> TUBITAK/UEKAE - Pardus Linux
> http://www.pardus.org.tr/eng
> _______________________________________________
> networkmanager-list mailing list
> networkmanager-list gnome org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list

Giovanni


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