From 7294e829c825e0f7b56b4fdb83dbc2939c33ca71 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 12 Mar 2008 14:53:14 +0100 Subject: [PATCH] Add simple test script for D-Bus supplicant --- test/Makefile.am | 3 ++- test/test-supplicant | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100755 test/test-supplicant diff --git a/test/Makefile.am b/test/Makefile.am index f3ae183..0276029 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,4 +1,5 @@ -EXTRA_DIST = list-interfaces start-scanning simple-agent show-introspection +EXTRA_DIST = list-interfaces start-scanning simple-agent \ + show-introspection test-supplicant MAINTAINERCLEANFILES = Makefile.in diff --git a/test/test-supplicant b/test/test-supplicant new file mode 100755 index 0000000..e79228d --- /dev/null +++ b/test/test-supplicant @@ -0,0 +1,59 @@ +#!/usr/bin/python + +import dbus +import time + +WPA_NAME='fi.epitest.hostap.WPASupplicant' +WPA_INTF='fi.epitest.hostap.WPASupplicant' +WPA_PATH='/fi/epitest/hostap/WPASupplicant' + +bus = dbus.SystemBus() + +dummy = dbus.Interface(bus.get_object(WPA_NAME, WPA_PATH), + 'org.freedesktop.DBus.Introspectable') + +#print dummy.Introspect() + +manager = dbus.Interface(bus.get_object(WPA_NAME, WPA_PATH), WPA_INTF) + +try: + path = manager.getInterface("wlan0") +except: + path = manager.addInterface("wlan0") + +interface = dbus.Interface(bus.get_object(WPA_NAME, path), + WPA_INTF + ".Interface") + +print interface.state() + +print interface.scan() + +print "[ %s ]" % (path) + +capabilities = interface.capabilities() + +for key in capabilities.keys(): + list = "" + for value in capabilities[key]: + list += " " + value + print " %s =%s" % (key, list) + +time.sleep(2) + +print interface.state() + +results = interface.scanResults() + +print results + +path = results[0] + +print "[ %s ]" % (path) + +bssid = dbus.Interface(bus.get_object(WPA_NAME, path), + WPA_INTF + ".BSSID") + +properties = bssid.properties() + +for key in properties.keys(): + print " %s = %s" % (key, properties[key]) -- 2.7.4