Re: Creating NetworkManager connections via DBus API



On Tue, 2014-07-08 at 08:57 +1000, Stuart Longland wrote:
On 08/07/14 07:56, Dan Williams wrote:
and so the 'connection' bit would be mandatory, and you might have *one*
each of the other setting types?
The "type" setting (eg 803-3-ethernet, 802-11-wireless, gsm, cdma,
bluetooth, etc) is required too.  The 'type' setting and the
'connection' setting are the only required ones.  Usually you'd lock the
connection to a MAC address with the "type" setting, or it would contain
stuff like MTU, SSID, and other hardware-specific stuff, so you can't
really leave it out.

Okay, so there's a setting called "type" too, that I presume is distinct
from the "connection" setting's "type" attribute.  i.e. the minimum
required:

Oh sorry :)  I was unclear.  By 'type' I mean "802-3-ethernet" or
"802-11-wireless" or "gsm" or "cdma" or "infiniband" or "bluetooth".
eg, the type of hardware to be used.  The name of that setting (a few of
which I've typed in quotes in the last sentence) is put into the "type"
property of the connection setting, like:

s_con = dbus.Dictionary({
--> 'type': '802-11-wireless',
    'uuid': '7371bb78-c1f7-42a3-a9db-5b9566e8ca07',
    'id': 'My Wifi'})
...
con = dbus.Dictionary({
    'connection': s_con,
--> '802-11-wireless': s_wifi
    })

Specifically, see:

http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/dbus/add-connection.py#n36
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/dbus/add-system-wifi-connection.py#n25

for two examples.

{'connection': {...},
 'type': {...},
 ...}

Where do I find information on this "type" setting?  Doing a search for
"type setting" on
https://developer.gnome.org/NetworkManager/0.9/ref-settings.html shows
no matches.

IPv4 and IPv6 are optional if you want automatic (DHCP, PPP/WWAN, etc)
addressing, but obviously if you want static you have to specify one or
both.

Ahh so a minimal one might give a 'connection' object, whose 'interface'
attribute references one of the physical network ports, and it'll just
configure the network via DHCP.

Right; if you don't specify the IPv4 and/or IPv6 settings, they default
to "automatic" which means DHCP for IPv4 and SLAAC for IPv6.

Dan



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