1#!/usr/bin/python
2
3import dbus, flimflam, sys
4
5if (len(sys.argv) < 2):
6    print "Usage: %s <device | interface>" % (sys.argv[0])
7    sys.exit(1)
8
9(_, name) = sys.argv
10
11flim = flimflam.FlimFlam(dbus.SystemBus())
12
13device = flim.FindElementByNameSubstring('Device', name)
14if device is None:
15    device = flim.FindElementByPropertySubstring('Device', 'Interface', name)
16if device is None:
17    print "No such device or interface %s" % name
18    sys.exit(1)
19
20properties = device.GetProperties(utf8_strings = True)
21for path in properties["IPConfigs"]:
22    ipconfig = flim.GetObjectInterface("IPConfig", path)
23    ipconfig_properties = ipconfig.GetProperties(utf8_strings = True)
24
25    print "[ %s ]" % (ipconfig.object_path)
26
27    for key in ipconfig_properties.keys():
28        print "        %s = %s" % \
29            (key, flimflam.convert_dbus_value(ipconfig_properties[key], 8))
30
31print
32