Re: Creating NetworkManager connections via DBus API

Hi Dan,
On 04/07/14 10:51, Dan Williams wrote:
On Fri, 2014-07-04 at 09:18 +1000, Stuart Longland wrote:
But how do I encode my address settings in a Settings.Connection object?
 Where do I find a list of the settings and their possible values?
There's actually a bunch of Python examples here:

that use both plain dbus and Python GObject introspection.  The GObject
introspection ones are similar to python-networkmanager actually.  I'm
not sure how python-networkmanager accepts a new connection to add, but
perhaps the examples give you an idea how to do that?

Ahh okay, that's handy.  I'll have a dig through those and see what I
can uncover.

I'd expect it to
be a normal "dict of dicts" like the examples above show which is then
passed to org.freedesktop.NetworkManager.Settings.AddConnection().

It does appear that way, I tried pulling the information out for my
Ethernet connection and got:
In [9]: conn.GetSettings()
{u'bridge': {u'interface-name': u'br0', u'stp': False},
 u'connection': {u'id': u'Bridge Ethernet',
  u'type': u'bridge',
  u'uuid': u'357c4dcf-2600-45fa-8687-05f4c2cb82b4',
  u'zone': u'work'},
 u'ipv4': {u'addresses': [],
  u'dns': [],
  u'may-fail': False,
  u'method': u'auto',
  u'routes': []},
 u'ipv6': {u'addresses': [], u'dns': [], u'method': u'auto', u'routes': []}}

It seems NetworkManager doesn't much like my hand-configured bridge
(won't see its IP address), but that's a side issue.

What I'm curious about is what sorts of keys and values are expected in
that dict of dicts?  At a basic level I need to be able to set IP
addresses, static routes, DNS servers, domain and DNS search order.

Probably host name too (not sure if that's doable in NetworkManager).

At least that will be the starting point.  The devices in question we're
setting up will be headless boxes, basically appliances, intended to
poll energy meters in an energy management system and pump the data

So mostly wired access, there's a couple of places where we have a
bridges and OpenVPN for technical support on some sites and I envisage
some possibly needing cellular 3G support.

No one has approached us with the need for WIFI support, but I bet
someone will some day, thus it'd be useful to know how that's configured

Is there some documentation as to how these various network types are
specified as dict objects to NetworkManager?

Stuart Longland
Systems Engineer
     _ ___
\  /|_) |                           T: +61 7 3535 9619
 \/ | \ |     38b Douglas Street    F: +61 7 3535 9699
   SYSTEMS    Milton QLD 4064

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