diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-12-30 23:39:43 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-12-30 23:39:43 +0100 |
commit | c8f5c35d5d577642dcd014f4d8294d8f38f498df (patch) | |
tree | 44682050bb2bf15a83ee2899807ebcb97a149943 | |
parent | 6601d98940b0d97b99afe71bcc2a8db90bd6a593 (diff) | |
download | connman-c8f5c35d5d577642dcd014f4d8294d8f38f498df.tar.gz connman-c8f5c35d5d577642dcd014f4d8294d8f38f498df.tar.bz2 connman-c8f5c35d5d577642dcd014f4d8294d8f38f498df.zip |
Add test scripts for connecting and disconnecting networks
-rw-r--r-- | test/Makefile.am | 5 | ||||
-rwxr-xr-x | test/connect-network | 37 | ||||
-rwxr-xr-x | test/disconnect-network | 37 |
3 files changed, 77 insertions, 2 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index f39d13e2..7b4c12ba 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2,7 +2,8 @@ EXTRA_DIST = get-state list-profiles list-connections select-connection \ list-devices enable-device disable-device start-scanning \ list-networks select-network disable-network create-network \ - set-passphrase set-address simple-agent show-introspection \ - set-policy test-manager test-compat monitor-connman + set-passphrase set-address set-policy test-manager \ + connect-network disconnect-network \ + simple-agent show-introspection test-compat monitor-connman MAINTAINERCLEANFILES = Makefile.in diff --git a/test/connect-network b/test/connect-network new file mode 100755 index 00000000..8f4f26bf --- /dev/null +++ b/test/connect-network @@ -0,0 +1,37 @@ +#!/usr/bin/python + +import sys +import dbus + +if (len(sys.argv) < 2): + print "Usage: %s <network>" % (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["Type"] not in ["wifi", "wimax", + "bluetooth", "cellular"]: + continue; + + for path in properties["Networks"]: + network = dbus.Interface(bus.get_object("org.moblin.connman", path), + "org.moblin.connman.Network") + + properties = network.GetProperties() + + dev = path[path.rfind("/") + 1:] + + if dev == sys.argv[1] or properties["Name"] == sys.argv[1]: + print "Connecting %s" % (path) + network.Connect() diff --git a/test/disconnect-network b/test/disconnect-network new file mode 100755 index 00000000..8529c19c --- /dev/null +++ b/test/disconnect-network @@ -0,0 +1,37 @@ +#!/usr/bin/python + +import sys +import dbus + +if (len(sys.argv) < 2): + print "Usage: %s <network>" % (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["Type"] not in ["wifi", "wimax", + "bluetooth", "cellular"]: + continue; + + for path in properties["Networks"]: + network = dbus.Interface(bus.get_object("org.moblin.connman", path), + "org.moblin.connman.Network") + + properties = network.GetProperties() + + dev = path[path.rfind("/") + 1:] + + if dev == sys.argv[1] or properties["Name"] == sys.argv[1]: + print "Disconnecting %s" % (path) + network.Disconnect() |