summaryrefslogtreecommitdiff
path: root/test/vpn-disconnect
blob: d7a49ba958be8de701ee5066257161a7698cac7c (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) < 1):
	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 disconnect VPN %s" % (path)

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

connection.Disconnect()