summaryrefslogtreecommitdiff
path: root/test/set-policy
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-12-28 02:54:09 +0100
committerMarcel Holtmann <marcel@holtmann.org>2008-12-28 02:54:09 +0100
commitdba2854c4a36e8848aeec7b1e7d8c24b17147222 (patch)
tree3c66873f18d06a3a209b511ec2c4e621ebfd931d /test/set-policy
parent0e0df318a9d596ebe32f6691418e99f2eb750e40 (diff)
downloadconnman-dba2854c4a36e8848aeec7b1e7d8c24b17147222.tar.gz
connman-dba2854c4a36e8848aeec7b1e7d8c24b17147222.tar.bz2
connman-dba2854c4a36e8848aeec7b1e7d8c24b17147222.zip
Add test script for changing device policy
Diffstat (limited to 'test/set-policy')
-rwxr-xr-xtest/set-policy28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/set-policy b/test/set-policy
new file mode 100755
index 00000000..5f26690a
--- /dev/null
+++ b/test/set-policy
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+if (len(sys.argv) < 3):
+ print "Usage: %s <device> <policy>" % (sys.argv[0])
+ sys.exit(1)
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
+ "org.moblin.connman.Manager")
+
+properties = manager.GetProperties()
+
+for path in properties["Devices"]:
+ device = dbus.Interface(bus.get_object("org.moblin.connman", path),
+ "org.moblin.connman.Device")
+
+ properties = device.GetProperties()
+
+ if properties["Interface"] != sys.argv[1]:
+ continue;
+
+ print "Setting policy \"%s\" for %s" % (sys.argv[2], path)
+
+ device.SetProperty("Policy", sys.argv[2])