summaryrefslogtreecommitdiff
path: root/test/vpn-connect
blob: 29753dc8a8754c686aefc6d32be8494432887824 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/python

import sys
import dbus

if (len(sys.argv) < 2):
	print("Usage: %s <VPN connection id>" % (sys.argv[0]))
	sys.exit(1)

bus = dbus.SystemBus()

manager = dbus.Interface(bus.get_object("net.connman.vpn", "/"),
					"net.connman.vpn.Manager")

connections = manager.GetConnections()

path = "/net/connman/vpn/connection/" + sys.argv[1]

print("Attempting to connect VPN %s" % (path))

connection = dbus.Interface(bus.get_object("net.connman.vpn", path),
					    "net.connman.vpn.Connection")

connection.Connect()