diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-12-20 12:46:50 -0800 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-12-20 12:46:50 -0800 |
commit | 5b1c118c543bb2bde58878cadb509558c28acbb8 (patch) | |
tree | 2e960cf2dbd3336865dff2dd775442db00e087af /test | |
parent | cf18e1cca44857e17d5c7b476d09fe38c7212b9c (diff) | |
download | connman-5b1c118c543bb2bde58878cadb509558c28acbb8.tar.gz connman-5b1c118c543bb2bde58878cadb509558c28acbb8.tar.bz2 connman-5b1c118c543bb2bde58878cadb509558c28acbb8.zip |
Add D-Bus interface for configuring IP addresses
Diffstat (limited to 'test')
-rwxr-xr-x | test/list-services | 2 | ||||
-rwxr-xr-x | test/set-address | 24 |
2 files changed, 18 insertions, 8 deletions
diff --git a/test/list-services b/test/list-services index 64439b57..8c0ecf9b 100755 --- a/test/list-services +++ b/test/list-services @@ -26,7 +26,7 @@ for path in properties["Services"]: print "[ %s ]" % (path) for key in properties.keys(): - if key in ["IPv4", "Ethernet"]: + if key in ["IPv4", "IPv4.Configuration", "Ethernet"]: val = extract_values(properties[key]) elif key in ["Favorite", "AutoConnect", "SetupRequired", "PassphraseRequired"]: diff --git a/test/set-address b/test/set-address index ebff30ad..cb3e2036 100755 --- a/test/set-address +++ b/test/set-address @@ -4,7 +4,7 @@ import sys import dbus if (len(sys.argv) < 2): - print "Usage: %s <address>" % (sys.argv[0]) + print "Usage: %s <address> [netmask]" % (sys.argv[0]) sys.exit(1) bus = dbus.SystemBus() @@ -14,13 +14,23 @@ manager = dbus.Interface(bus.get_object('org.moblin.connman', "/"), properties = manager.GetProperties() -for path in properties["Devices"]: - device = dbus.Interface(bus.get_object('org.moblin.connman', path), - 'org.moblin.connman.Device') +for path in properties["Services"]: + service = dbus.Interface(bus.get_object('org.moblin.connman', path), + 'org.moblin.connman.Service') - print "Setting static address %s for %s" % (sys.argv[1], path) + properties = service.GetProperties() - device.SetProperty("IPv4.Method", "static") - device.SetProperty("IPv4.Address", sys.argv[1]) + if properties["State"] != "ready": + continue + + print "Setting address %s for %s" % (sys.argv[1], path) + + if len(sys.argv) > 2: + service.SetProperty("IPv4.Configuration", + { "Method": "manual", "Address": sys.argv[1], + "Netmask": sys.argv[2] }) + else: + service.SetProperty("IPv4.Configuration", + { "Method": "manual", "Address": sys.argv[1] }) print |