Add new test scripts to support VPN connections
authorMohamed Abbas <mohamed.abbas@intel.com>
Tue, 8 Dec 2009 19:53:12 +0000 (11:53 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 8 Dec 2009 23:41:13 +0000 (00:41 +0100)
Makefile.am
test/connect-vpn [new file with mode: 0755]
test/disconnect-vpn [new file with mode: 0755]
test/list-providers [new file with mode: 0755]

index 59de002..c0236b4 100644 (file)
@@ -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 (executable)
index 0000000..c9cbd89
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+if (len(sys.argv) < 4):
+       print "Usage: %s <name> <host> <cookie> [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 (executable)
index 0000000..2367f13
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+if (len(sys.argv) < 2):
+       print "Usage: %s <provider name> " % (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 (executable)
index 0000000..d808fa0
--- /dev/null
@@ -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