Home | History | Annotate | Download | only in test-scripts
      1 #!/usr/bin/python
      2 
      3 import dbus, flimflam, sys
      4 
      5 if (len(sys.argv) < 2):
      6     print "Usage: %s <device | interface>" % (sys.argv[0])
      7     sys.exit(1)
      8 
      9 (_, name) = sys.argv
     10 
     11 flim = flimflam.FlimFlam(dbus.SystemBus())
     12 
     13 device = flim.FindElementByNameSubstring('Device', name)
     14 if device is None:
     15     device = flim.FindElementByPropertySubstring('Device', 'Interface', name)
     16 if device is None:
     17     print "No such device or interface %s" % name
     18     sys.exit(1)
     19 
     20 properties = device.GetProperties(utf8_strings = True)
     21 for 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 
     31 print
     32