Add new scripts to support vpn.
---
 Makefile.am         |    3 ++-
 test/connect-vpn    |   29 +++++++++++++++++++++++++++++
 test/disconnect-vpn |   22 ++++++++++++++++++++++
 test/list-providers |   27 +++++++++++++++++++++++++++
 4 files changed, 80 insertions(+), 1 deletions(-)
 create mode 100755 test/connect-vpn
 create mode 100755 test/disconnect-vpn
 create mode 100755 test/list-providers

diff --git a/Makefile.am b/Makefile.am
index 67934d0..23b83e4 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/monitor-services test/debug-connman
+               test/monitor-services 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 <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
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 <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
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
-- 
1.6.2.5

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to