summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-12-20 12:46:50 -0800
committerMarcel Holtmann <marcel@holtmann.org>2009-12-20 12:46:50 -0800
commit5b1c118c543bb2bde58878cadb509558c28acbb8 (patch)
tree2e960cf2dbd3336865dff2dd775442db00e087af /test
parentcf18e1cca44857e17d5c7b476d09fe38c7212b9c (diff)
downloadconnman-5b1c118c543bb2bde58878cadb509558c28acbb8.tar.gz
connman-5b1c118c543bb2bde58878cadb509558c28acbb8.tar.bz2
connman-5b1c118c543bb2bde58878cadb509558c28acbb8.zip
Add D-Bus interface for configuring IP addresses
Diffstat (limited to 'test')
-rwxr-xr-xtest/list-services2
-rwxr-xr-xtest/set-address24
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