test: Handle new tethering properties
[platform/upstream/connman.git] / test / disable-tethering
1 #!/usr/bin/python
2
3 import sys
4 import dbus
5
6 if (len(sys.argv) < 2):
7         print "Usage: %s type" % (sys.argv[0])
8
9 print "Disabling %s tethering" % (sys.argv[1])
10
11 bus = dbus.SystemBus()
12
13 manager = dbus.Interface(bus.get_object('net.connman', "/"),
14                                         'net.connman.Manager')
15
16 def technology_disable_tethering(path, tech_type):
17         tech = dbus.Interface(bus.get_object("net.connman", path),
18                                                 "net.connman.Technology")
19
20         properties = tech.GetProperties()
21
22         for key in properties.keys():
23                 if key in ["Type"]:
24                         if properties[key] == tech_type:
25                                 tech.SetProperty("Tethering", dbus.Boolean(0))
26
27 properties = manager.GetProperties()
28
29 for key in properties.keys():
30         if key in ["Technologies"]:
31                 for path in properties[key]:
32                         technology_disable_tethering(path, sys.argv[1])