Re: Creating NetworkManager connections via DBus API

Hi Dan,
On 08/07/14 02:55, Dan Williams wrote:
As thomas already mentioned, these should be covered in the API
documentation that he linked.  Note that IPv4 addresses are arrays of
uint32 (address/prefix/optional gateway) and IPv4 routes are too
(network/prefix/next-hop/metric).  The address/network/next-hop IP
address members are network-byte-order.  So the code in Python to push
that into the dict that can be sent over D-Bus is something like this,
taken from:
this is mainly because Python doesn't have strongly-typed variables, but
D-Bus does, so you have to tell Python what the mapping is between the
Python types and the D-Bus types.

Yep, just experimenting with python-networkmanager, it seems this is one
of the details it looks after: IP addresses are translated to strings,
endianness is taken care of, etc.  Dicts are plain Python dicts.

Just looking at the documentation there though, am I correct in assuming
that to set up a simple connection, you would have a dict of the form:

{'connection': { global connection settings },
 'ipv4': { IPv4 address settings },
 'ipv6': { IPv6 address settings },

and so the 'connection' bit would be mandatory, and you might have *one*
each of the other setting types?

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]