From: Mohamed Abbas Date: Tue, 8 Dec 2009 19:53:12 +0000 (-0800) Subject: Add new test scripts to support VPN connections X-Git-Tag: 0.48~139 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5357ba7ffc7236b1d38bf375eff84ad980323981;p=platform%2Fupstream%2Fconnman.git Add new test scripts to support VPN connections --- diff --git a/Makefile.am b/Makefile.am index 59de002..c0236b4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -128,7 +128,8 @@ test_scripts = test/get-state test/list-profiles test/list-services \ test/set-passphrase test/set-address test/test-profile \ test/simple-agent test/show-introspection test/test-compat \ test/test-manager test/test-connman test/monitor-connman \ - test/debug-connman + test/debug-connman test/connect-vpn \ + test/disconnect-vpn test/list-providers if TEST testdir = $(pkglibdir)/test diff --git a/test/connect-vpn b/test/connect-vpn new file mode 100755 index 0000000..c9cbd89 --- /dev/null +++ b/test/connect-vpn @@ -0,0 +1,29 @@ +#!/usr/bin/python + +import sys +import dbus + +if (len(sys.argv) < 4): + print "Usage: %s [cafile]" % (sys.argv[0]) + sys.exit(1) + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"), + "org.moblin.connman.Manager") + +print "Attempting to connect service %s" % (sys.argv[1]) + +if (len(sys.argv) > 4): + path = manager.ConnectProvider(({ "Type": "openconnect", "Name": sys.argv[1], + "OpenConnect.Host": sys.argv[2], + "OpenConnect.Cookie": sys.argv[3], + "OpenConnect.CACert": sys.argv[4], + "VPN.Domain": "intel.com"})) +else: + path = manager.ConnectProvider(({ "Type": "openconnect", "Name": sys.argv[1], + "OpenConnect.Host": sys.argv[2], + "OpenConnect.Cookie": sys.argv[3], + "VPN.Domain": "intel.com"})) + +print "Provider path is %s" %(path) diff --git a/test/disconnect-vpn b/test/disconnect-vpn new file mode 100755 index 0000000..2367f13 --- /dev/null +++ b/test/disconnect-vpn @@ -0,0 +1,22 @@ +#!/usr/bin/python + +import sys +import dbus + +if (len(sys.argv) < 2): + print "Usage: %s " % (sys.argv[0]) + sys.exit(1) + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"), + "org.moblin.connman.Manager") + +path = "" + sys.argv[1] + +print "remove path is %s" %(path) + +manager.RemoveProvider(sys.argv[1]) + +print "remove path is %s" %(path) + diff --git a/test/list-providers b/test/list-providers new file mode 100755 index 0000000..d808fa0 --- /dev/null +++ b/test/list-providers @@ -0,0 +1,27 @@ +#!/usr/bin/python + +import dbus + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"), + "org.moblin.connman.Manager") + +properties = manager.GetProperties() + +for path in properties["Providers"]: + service = dbus.Interface(bus.get_object("org.moblin.connman", path), + "org.moblin.connman.Provider") + + properties = service.GetProperties() + + print "[ %s ]" % (path) + + for key in properties.keys(): + if key in ["Strength"]: + val = int(properties[key]) + else: + val = str(properties[key]) + print " %s = %s" % (key, val) + + print