test: Add script for resetting contexts
authorAlfonso Sanchez-Beato <alfonso.sanchez-beato@canonical.com>
Mon, 18 May 2015 06:47:08 +0000 (08:47 +0200)
committerDenis Kenzior <denkenz@gmail.com>
Mon, 18 May 2015 14:08:28 +0000 (09:08 -0500)
test/reset-contexts [new file with mode: 0644]

diff --git a/test/reset-contexts b/test/reset-contexts
new file mode 100644 (file)
index 0000000..1676636
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/python3
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 2:
+       path = sys.argv[1]
+else:
+       manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+                       'org.ofono.Manager')
+       modems = manager.GetModems()
+       path = modems[0][0]
+
+print("Resetting contexts for SIM on modem %s..." % path)
+cm = dbus.Interface(bus.get_object('org.ofono', path),
+               'org.ofono.ConnectionManager')
+
+cm.ResetContexts()