This patch is made by using 2to3 command.
$ find . -name *.py | xargs 2to3 -f except -w -n
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
if os.path.isdir(wpas_ctrl):
try:
ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
- except OSError, error:
+ except OSError as error:
print "Could not find hostapd: ", error
return None
try:
wpas = wpaspy.Ctrl(ctrl)
return wpas
- except Exception, e:
+ except Exception as e:
pass
return None
summary("HandoverServer - request received")
try:
print "Parsed handover request: " + request.pretty()
- except Exception, e:
+ except Exception as e:
print e
print str(request).encode("hex")
print "Handover select:"
try:
print sel.pretty()
- except Exception, e:
+ except Exception as e:
print e
print str(sel).encode("hex")
print "NDEF tag: " + tag.type
try:
print tag.ndef.message.pretty()
- except Exception, e:
+ except Exception as e:
print e
success = wps_tag_read(tag)
if only_one and success:
llcp={'on-startup': llcp_startup,
'on-connect': llcp_connected}):
break
- except Exception, e:
+ except Exception as e:
print "clf.connect failed"
global srv
self.remove_all_sessions()
try:
self.send_iface_detach_request(self.iface)
- except Exception, e:
+ except Exception as e:
logger.info(str(e))
self.reg_ctrl.stop()
del self.global_instance
raise Exception("Failed to create radio (err:%d)" % self._radio_id)
try:
iface = os.listdir('/sys/class/mac80211_hwsim/hwsim%d/net/' % self._radio_id)[0]
- except Exception,e:
+ except Exception as e:
self._controller.destroy_radio(self._radio_id)
raise e
return self._radio_id, iface
broadcast=broadcast, send_len=send_len)
success = True
break
- except Exception, e:
+ except Exception as e:
last_err = e
if i + 1 < max_tries:
time.sleep(1)
try:
i_res = i_dev.p2p_go_neg_init(r_dev.p2p_dev_addr(), pin, i_method, timeout=20, go_intent=i_intent)
logger.debug("i_res: " + str(i_res))
- except Exception, e:
+ except Exception as e:
i_res = None
logger.info("go_neg_init thread caught an exception from p2p_go_neg_init: " + str(e))
res.put(i_res)
timeout=20, go_intent=i_intent, freq=freq,
provdisc=provdisc)
logger.debug("i_res: " + str(i_res))
- except Exception, e:
+ except Exception as e:
i_res = None
logger.info("go_neg_init_pbc thread caught an exception from p2p_go_neg_init: " + str(e))
res.put(i_res)
for d in dev:
try:
d.reset()
- except Exception, e:
+ except Exception as e:
logger.info("Failed to reset device " + d.ifname)
print str(e)
ok = False
for iface in ifaces:
if iface.startswith("wlan"):
wpas.interface_remove(iface)
- except Exception, e:
+ except Exception as e:
pass
if wpas:
wpas.close_ctrl()
hapd.remove('wlan3-2')
for ap in apdev:
hapd.remove(ap['ifname'])
- except Exception, e:
+ except Exception as e:
logger.info("Failed to remove hostapd interface")
print str(e)
ok = False
try:
conn.execute(sql, params)
conn.commit()
- except Exception, e:
+ except Exception as e:
print "sqlite: " + str(e)
print "sql: %r" % (params, )
conn.execute(sql, params)
if sql_commit:
conn.commit()
- except Exception, e:
+ except Exception as e:
print "sqlite: " + str(e)
print "sql: %r" % (params, )
if dev:
dev.relog()
subprocess.call(['chown', '-f', getpass.getuser(), srcname])
- except Exception, e:
+ except Exception as e:
logger.info("Failed to rename log files")
logger.info(e)
params = (name, t.__doc__)
try:
conn.execute(sql, params)
- except Exception, e:
+ except Exception as e:
print "sqlite: " + str(e)
print "sql: %r" % (params,)
if conn:
if not d.global_ping():
raise Exception("Global PING failed for {}".format(d.ifname))
d.request("NOTE TEST-START " + name)
- except Exception, e:
+ except Exception as e:
logger.info("Failed to issue TEST-START before " + name + " for " + d.ifname)
logger.info(e)
print "FAIL " + name + " - could not start test"
print "Country code remains set - expect following test cases to fail"
logger.info("Country code remains set - expect following test cases to fail")
break
- except HwsimSkip, e:
+ except HwsimSkip as e:
logger.info("Skip test case: %s" % e)
result = "SKIP"
- except NameError, e:
+ except NameError as e:
import traceback
logger.info(e)
traceback.print_exc()
result = "FAIL"
- except Exception, e:
+ except Exception as e:
import traceback
logger.info(e)
traceback.print_exc()
try:
d.dump_monitor()
d.request("NOTE TEST-STOP " + name)
- except Exception, e:
+ except Exception as e:
logger.info("Failed to issue TEST-STOP after {} for {}".format(name, d.ifname))
logger.info(e)
result = "FAIL"
rename_log(args.logdir, 'log5', name, wpas)
if not args.no_reset:
wpas.remove_ifname()
- except Exception, e:
+ except Exception as e:
pass
if wpas:
wpas.close_ctrl()
rename_log(args.logdir, 'log' + str(i), name, dev[i])
try:
hapd = HostapdGlobal()
- except Exception, e:
+ except Exception as e:
print "Failed to connect to hostapd interface"
print str(e)
reset_ok = False
continue
with open(keydir + "/rx_spec") as f:
return f.read()
- except OSError, e:
+ except OSError as e:
raise HwsimSkip("debugfs not supported in mac80211")
return None
continue
with open(keydir + "/replays") as f:
return int(f.read())
- except OSError, e:
+ except OSError as e:
raise HwsimSkip("debugfs not supported in mac80211")
return None
try:
hapd.enable()
started = True
- except Exception, e:
+ except Exception as e:
started = False
if started:
raise Exception("ENABLE command succeeded unexpectedly")
try:
hostapd.add_bss(apdev[0], ifname2, 'bss-2-dup.conf')
raise Exception("BSS add succeeded unexpectedly")
- except Exception, e:
+ except Exception as e:
if "Could not add hostapd BSS" in str(e):
pass
else:
if hapd.request("GET_ALLOC_FAIL").startswith('0'):
break
dev[0].request("REMOVE_NETWORK all")
- except Exception, e:
+ except Exception as e:
if str(e) == "Allocation failure did not trigger":
if count < 30:
raise Exception("Too few allocation failures")
ca_cert="auth_serv/ca.pem", phase2="auth=GTC",
pac_file="blob://fast_pac_ciphers",
report_failure=True)
- except Exception, e:
+ except Exception as e:
if cipher == "RC4-SHA" and \
("Could not select EAP method" in str(e) or \
"EAP failed" in str(e)):
params["ocv"] = "1"
try:
hapd0 = hostapd.add_ap(apdev[0], params)
- except Exception, e:
+ except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
params["ocv"] = "1"
try:
hapd0 = hostapd.add_ap(apdev[0], params)
- except Exception, e:
+ except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
try:
hwsim_utils.test_connectivity_iface(dev[0], hapd, "ap-br0")
- except Exception, e:
+ except Exception as e:
logger.info("test_connectibity_iface failed: " + str(e))
raise HwsimSkip("Assume kernel did not have the required patches for proxyarp")
hwsim_utils.test_connectivity_iface(dev[1], hapd, "ap-br0")
try:
hwsim_utils.test_connectivity_iface(dev[0], hapd, "ap-br0")
- except Exception, e:
+ except Exception as e:
logger.info("test_connectibity_iface failed: " + str(e))
raise HwsimSkip("Assume kernel did not have the required patches for proxyarp")
hwsim_utils.test_connectivity_iface(dev[1], hapd, "ap-br0")
try:
wpas.interface_add(ifname, br_ifname=br_ifname)
raise Exception("Interface addition succeeded unexpectedly")
- except Exception, e:
+ except Exception as e:
if "Failed to add" in str(e):
logger.info("Ignore expected interface_add failure due to missing bridge interface: " + str(e))
else:
# "WPA-PSK enabled, but PSK or passphrase is not configured."
hostapd.add_ap(apdev[0], params)
raise Exception("AP setup succeeded unexpectedly")
- except Exception, e:
+ except Exception as e:
if "Failed to enable hostapd" in str(e):
pass
else:
params["ocv"] = "1"
try:
hapd = hostapd.add_ap(apdev[0], params)
- except Exception, e:
+ except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
params["ocv"] = "1"
try:
hapd = hostapd.add_ap(apdev[0], params)
- except Exception, e:
+ except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
scan_freq="2412")
hwsim_utils.test_connectivity(dev[1], hapd)
raise Exception("PMF required STA connected to no PMF AP")
- except Exception, e:
+ except Exception as e:
logger.debug("Ignore expected exception: " + str(e))
wt.require_ap_no_pmf(apdev[0]['bssid'])
res = cmd.stdout.read()
cmd.stdout.close()
logger.info("Station dump on dev[%d]:\n%s" % (i, res))
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
res = cmd.stdout.read()
cmd.stdout.close()
logger.info("Station dump on dev[%d]:\n%s" % (i, res))
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
res = cmd.stdout.read()
cmd.stdout.close()
logger.info("Station dump on dev[%d]:\n%s" % (i, res))
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
raise Exception("Missing STA flag: HT")
if "[VHT]" not in sta['flags']:
raise Exception("Missing STA flag: VHT")
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80 MHz channel not supported in regulatory information")
dev.connect("vht", key_mgmt="NONE", scan_freq=str(5000 + 5 * channel))
hwsim_utils.test_connectivity(dev, hapd)
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80 MHz channel not supported in regulatory information")
raise Exception("dev[0] did not support SGI")
if capab2 & 0x60 != 0:
raise Exception("dev[2] claimed support for SGI")
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80 MHz channel not supported in regulatory information")
ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
if ev is None:
raise Exception("AP-DISABLED not reported")
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
if ev is None:
raise Exception("AP-DISABLED not reported")
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
if "WIDTH=160 MHz" not in sig:
raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
if "WIDTH=160 MHz" not in sig:
raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
if "WIDTH=160 MHz" not in sig:
raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
if "AP-ENABLED" in ev:
# This was supposed to fail due to sec_channel_offset == 0
raise Exception("Unexpected AP-ENABLED")
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
raise Exception("Unexpected SIGNAL_POLL value(3): " + str(sig))
if "CENTER_FRQ2=5775" not in sig:
raise Exception("Unexpected SIGNAL_POLL value(4): " + str(sig))
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
if ev is None:
raise Exception("AP-DISABLED not reported")
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
# extra code coverage.
hapd.request("CHAN_SWITCH 5 5745")
hapd.wait_event(["AP-CSA-FINISHED"], timeout=1)
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80 MHz channel not supported in regulatory information")
dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
dev[0].wait_regdom(country_ie=True)
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80 MHz channel not supported in regulatory information")
dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
hwsim_utils.test_connectivity(dev[0], hapd)
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80 MHz channel not supported in regulatory information")
raise Exception("Unexpected STATUS ieee80211ac value")
if status["secondary_channel"] != "0":
raise Exception("Unexpected STATUS secondary_channel value")
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80 MHz channel not supported in regulatory information")
hapd.enable()
dev[0].connect("vht", key_mgmt="NONE", scan_freq="2412")
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80 MHz channel not supported in regulatory information")
ifname2="brvlan1")
else:
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
- except Exception, e:
+ except Exception as e:
# It is possible for new bridge setup to not be ready immediately, so
# try again to avoid reporting issues related to that.
logger.info("First VLAN-ID 1 data test failed - try again")
try:
[name,value] = l.split('=', 1)
vals[name] = value
- except ValueError, e:
+ except ValueError as e:
if "# WPS configuration" in l:
pass
else:
try:
conn.request(cmd, "hello")
resp = conn.getresponse()
- except Exception, e:
+ except Exception as e:
pass
conn.close()
conn.request("HEAD", "hello", "\r\n\r\n", headers)
try:
resp = conn.getresponse()
- except Exception, e:
+ except Exception as e:
pass
conn.close()
conn.request("HEAD", "hello", "\r\n\r\n", headers)
try:
resp = conn.getresponse()
- except Exception, e:
+ except Exception as e:
pass
conn.close()
conn.request("HEAD", "hello", "\r\n\r\nhello", headers)
try:
resp = conn.getresponse()
- except Exception, e:
+ except Exception as e:
pass
conn.close()
conn.request("HEAD", 5000 * 'A')
try:
resp = conn.getresponse()
- except Exception, e:
+ except Exception as e:
pass
conn.close()
conn.request("POST", "hello", 10 * 'A' + "\r\n\r\n", headers)
try:
resp = conn.getresponse()
- except Exception, e:
+ except Exception as e:
pass
conn.close()
conn.request("POST", "hello", 60000 * 'A' + "\r\n\r\n")
try:
resp = conn.getresponse()
- except Exception, e:
+ except Exception as e:
pass
conn.close()
conn.send("0\r\n\r\n")
resp = conn.getresponse()
completed = True
- except Exception, e:
+ except Exception as e:
pass
conn.close()
if completed:
conn.request("POST", "hello", "80000000\r\na", headers)
try:
resp = conn.getresponse()
- except Exception, e:
+ except Exception as e:
pass
conn.close()
conn.request("POST", "hello", "10000000\r\na", headers)
try:
resp = conn.getresponse()
- except Exception, e:
+ except Exception as e:
pass
conn.close()
if no_response:
try:
conn.getresponse()
- except Exception, e:
+ except Exception as e:
pass
return
resp = conn.getresponse()
try:
dev.flush_scan_cache()
break
- except Exception, e:
+ except Exception as e:
if str(e).startswith("Failed to trigger scan"):
# Try again
time.sleep(1)
path = wpas.GetInterface(dev.ifname)
if_obj = bus.get_object(WPAS_DBUS_SERVICE, path)
return (bus,wpas_obj,path,if_obj)
- except Exception, e:
+ except Exception as e:
raise HwsimSkip("Could not connect to D-Bus: %s" % e)
class TestDbus(object):
try:
props = net_obj.GetAll(WPAS_DBUS_NETWORK,
dbus_interface=dbus.PROPERTIES_IFACE)
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
pass
def dbus_get(dbus, wpas_obj, prop, expect=None, byte_arrays=False):
try:
dbus_set(dbus, wpas_obj, "DebugLevel", val)
raise Exception("Invalid DebugLevel value accepted: " + str(val))
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if err not in str(e):
raise Exception("Unexpected error message: " + str(e))
dbus_set(dbus, wpas_obj, "DebugLevel", "msgdump")
try:
dbus_set(dbus, wpas_obj, "DebugTimestamp", "foo")
raise Exception("Invalid DebugTimestamp value accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: wrong property type" not in str(e):
raise Exception("Unexpected error message: " + str(e))
dbus_set(dbus, wpas_obj, "DebugTimestamp", True)
try:
dbus_set(dbus, wpas_obj, "DebugShowKeys", "foo")
raise Exception("Invalid DebugShowKeys value accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: wrong property type" not in str(e):
raise Exception("Unexpected error message: " + str(e))
dbus_set(dbus, wpas_obj, "DebugShowKeys", True)
try:
dbus_set(dbus, wpas_obj, "WFDIEs", dbus.ByteArray('\x00'))
raise Exception("Invalid WFDIEs value accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message: " + str(e))
dbus_set(dbus, wpas_obj, "WFDIEs", dbus.ByteArray(''))
try:
dbus_set(dbus, wpas_obj, "EapMethods", res)
raise Exception("Invalid Set accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs: Property is read-only" not in str(e):
raise Exception("Unexpected error message: " + str(e))
wpas_obj.SetFoo(WPAS_DBUS_SERVICE, "DebugShowKeys", True,
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Unknown method accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "UnknownMethod" not in str(e):
raise Exception("Unexpected error message: " + str(e))
wpas_obj.Get("foo", "DebugShowKeys",
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Get accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs: No such property" not in str(e):
raise Exception("Unexpected error message: " + str(e))
test_obj.Get(123, "DebugShowKeys",
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Get accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs: Invalid arguments" not in str(e):
raise Exception("Unexpected error message: " + str(e))
try:
test_obj.Get(WPAS_DBUS_SERVICE, 123,
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Get accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs: Invalid arguments" not in str(e):
raise Exception("Unexpected error message: " + str(e))
dbus.ByteArray('', variant_level=2),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs: invalid message format" not in str(e):
raise Exception("Unexpected error message: " + str(e))
try:
wps.Foo()
raise Exception("Unknown method accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "UnknownMethod" not in str(e):
raise Exception("Unexpected error message: " + str(e))
try:
test_wps.Start(123)
raise Exception("WPS.Start with incorrect signature accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs: Invalid arg" not in str(e):
raise Exception("Unexpected error message: " + str(e))
try:
wps.Start(args)
raise Exception("Invalid WPS.Start() arguments accepted: " + str(args))
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if not str(e).startswith("fi.w1.wpa_supplicant1.InvalidArgs"):
raise Exception("Unexpected error message: " + str(e))
try:
bss_obj.Get(WPAS_DBUS_BSS, "Rates",
dbus_interface=dbus.PROPERTIES_IFACE)
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
pass
id = dev[0].add_network()
try:
iface.Scan(t)
raise Exception("Invalid Scan() arguments accepted: " + str(t))
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if err not in str(e):
raise Exception("Unexpected error message for invalid Scan(%s): %s" % (str(t), str(e)))
try:
iface.Scan({'Type': 'active', 'AllowRoam': False})
raise Exception("Scan() accepted when busy")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "ScanError: Scan request reject" not in str(e):
raise Exception("Unexpected error message: " + str(e))
signature='sv')
try:
self.netw = iface.AddNetwork(args)
- except Exception, e:
+ except Exception as e:
logger.info("Exception on AddNetwork: " + str(e))
self.loop.quit()
return False
try:
iface.SelectNetwork(self.netw)
- except Exception, e:
+ except Exception as e:
logger.info("Exception on SelectNetwork: " + str(e))
self.loop.quit()
try:
iface.Disconnect()
raise Exception("Disconnect() accepted when not connected")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "NotConnected" not in str(e):
raise Exception("Unexpected error message for invalid Disconnect: " + str(e))
try:
iface.Reattach()
raise Exception("Reattach() accepted when not connected")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "NotConnected" not in str(e):
raise Exception("Unexpected error message for invalid Reattach: " + str(e))
try:
iface.RemoveNetwork(netw)
raise Exception("Invalid RemoveNetwork() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "NetworkUnknown" not in str(e):
raise Exception("Unexpected error message for invalid RemoveNetwork: " + str(e))
try:
iface.SelectNetwork(netw)
raise Exception("Invalid SelectNetwork() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "NetworkUnknown" not in str(e):
raise Exception("Unexpected error message for invalid RemoveNetwork: " + str(e))
net_obj.Set(WPAS_DBUS_NETWORK, "Enabled", dbus.UInt32(1),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(Enabled,1) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: wrong property type" not in str(e):
raise Exception("Unexpected error message for invalid Set(Enabled,1): " + str(e))
try:
iface.AddNetwork(args)
raise Exception("Invalid AddNetwork args accepted: " + str(args))
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid AddNetwork: " + str(e))
# Currently, AddNetwork() succeeds even if os_strdup() for path
# fails, so remove the network if that occurs.
iface.RemoveNetwork(netw)
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
pass
for i in range(1, 3):
# Currently, AddNetwork() succeeds even if network registration
# fails, so remove the network if that occurs.
iface.RemoveNetwork(netw)
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
pass
with alloc_fail_dbus(dev[0], 1,
try:
wpas.CreateInterface(params)
raise Exception("Invalid CreateInterface() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InterfaceExists" not in str(e):
raise Exception("Unexpected error message for invalid CreateInterface: " + str(e))
try:
wpas.RemoveInterface(path)
raise Exception("Invalid RemoveInterface() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InterfaceUnknown" not in str(e):
raise Exception("Unexpected error message for invalid RemoveInterface: " + str(e))
try:
wpas.CreateInterface(params)
raise Exception("Invalid CreateInterface() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid CreateInterface: " + str(e))
try:
wpas.CreateInterface(params)
raise Exception("Invalid CreateInterface() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid CreateInterface: " + str(e))
try:
wpas.GetInterface("lo")
raise Exception("Invalid GetInterface() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InterfaceUnknown" not in str(e):
raise Exception("Unexpected error message for invalid RemoveInterface: " + str(e))
raise Exception("CreateInterface succeeded during out-of-memory")
if not state.startswith('0:'):
break
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
pass
for arg in [ 'Driver', 'Ifname', 'ConfigFile', 'BridgeIfname' ]:
try:
iface.AddBlob('blob1', dbus.ByteArray("\x01\x02\x04"))
raise Exception("Invalid AddBlob() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "BlobExists" not in str(e):
raise Exception("Unexpected error message for invalid AddBlob: " + str(e))
res = iface.GetBlob('blob1')
try:
iface.RemoveBlob('blob1')
raise Exception("Invalid RemoveBlob() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "BlobUnknown" not in str(e):
raise Exception("Unexpected error message for invalid RemoveBlob: " + str(e))
try:
iface.GetBlob('blob1')
raise Exception("Invalid GetBlob() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "BlobUnknown" not in str(e):
raise Exception("Unexpected error message for invalid GetBlob: " + str(e))
try:
iface.TDLSDiscover("foo")
raise Exception("Invalid TDLSDiscover() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid TDLSDiscover: " + str(e))
try:
iface.TDLSStatus("foo")
raise Exception("Invalid TDLSStatus() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid TDLSStatus: " + str(e))
try:
iface.TDLSSetup("foo")
raise Exception("Invalid TDLSSetup() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid TDLSSetup: " + str(e))
try:
iface.TDLSTeardown("foo")
raise Exception("Invalid TDLSTeardown() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid TDLSTeardown: " + str(e))
try:
iface.TDLSTeardown("00:11:22:33:44:55")
raise Exception("TDLSTeardown accepted for unknown peer")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "UnknownError: error performing TDLS teardown" not in str(e):
raise Exception("Unexpected error message: " + str(e))
try:
iface.TDLSChannelSwitch({})
raise Exception("Invalid TDLSChannelSwitch() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid TDLSChannelSwitch: " + str(e))
try:
iface.TDLSCancelChannelSwitch("foo")
raise Exception("Invalid TDLSCancelChannelSwitch() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid TDLSCancelChannelSwitch: " + str(e))
signature='sv')
try:
iface.TDLSChannelSwitch(args)
- except Exception, e:
+ except Exception as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected exception")
args = dbus.Dictionary({}, signature='sv')
try:
iface.TDLSChannelSwitch(args)
- except Exception, e:
+ except Exception as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected exception")
signature='sv')
try:
iface.TDLSChannelSwitch(args)
- except Exception, e:
+ except Exception as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected exception")
signature='sv')
try:
iface.TDLSChannelSwitch(args)
- except Exception, e:
+ except Exception as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected exception")
try:
iface.SetPKCS11EngineAndModulePath("foo", "bar")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: Reinit of the EAPOL" not in str(e):
raise Exception("Unexpected error message for invalid SetPKCS11EngineAndModulePath: " + str(e))
try:
iface.SetPKCS11EngineAndModulePath("foo", "")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: Reinit of the EAPOL" not in str(e):
raise Exception("Unexpected error message for invalid SetPKCS11EngineAndModulePath: " + str(e))
if_obj.Set(WPAS_DBUS_IFACE, "ApScan", dbus.Int16(-1),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(ApScan,-1) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: wrong property type" not in str(e):
raise Exception("Unexpected error message for invalid Set(ApScan,-1): " + str(e))
if_obj.Set(WPAS_DBUS_IFACE, "ApScan", dbus.UInt32(123),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(ApScan,123) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: ap_scan must be 0, 1, or 2" not in str(e):
raise Exception("Unexpected error message for invalid Set(ApScan,123): " + str(e))
if_obj.Set(WPAS_DBUS_IFACE, "FastReauth", dbus.Int16(-1),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(FastReauth,-1) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: wrong property type" not in str(e):
raise Exception("Unexpected error message for invalid Set(ApScan,-1): " + str(e))
if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireAge", dbus.Int16(-1),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(BSSExpireAge,-1) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: wrong property type" not in str(e):
raise Exception("Unexpected error message for invalid Set(BSSExpireAge,-1): " + str(e))
if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireAge", dbus.UInt32(9),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(BSSExpireAge,9) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: BSSExpireAge must be >= 10" not in str(e):
raise Exception("Unexpected error message for invalid Set(BSSExpireAge,9): " + str(e))
if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireCount", dbus.Int16(-1),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(BSSExpireCount,-1) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: wrong property type" not in str(e):
raise Exception("Unexpected error message for invalid Set(BSSExpireCount,-1): " + str(e))
if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireCount", dbus.UInt32(0),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(BSSExpireCount,0) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: BSSExpireCount must be > 0" not in str(e):
raise Exception("Unexpected error message for invalid Set(BSSExpireCount,0): " + str(e))
if_obj.Set(WPAS_DBUS_IFACE, "Country", dbus.Int16(-1),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(Country,-1) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: wrong property type" not in str(e):
raise Exception("Unexpected error message for invalid Set(Country,-1): " + str(e))
if_obj.Set(WPAS_DBUS_IFACE, "Country", "F",
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(Country,F) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: invalid country code" not in str(e):
raise Exception("Unexpected error message for invalid Set(Country,F): " + str(e))
if_obj.Set(WPAS_DBUS_IFACE, "ScanInterval", dbus.UInt16(100),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(ScanInterval,100) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: wrong property type" not in str(e):
raise Exception("Unexpected error message for invalid Set(ScanInterval,100): " + str(e))
if_obj.Set(WPAS_DBUS_IFACE, "ScanInterval", dbus.Int32(-1),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(ScanInterval,-1) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: scan_interval must be >= 0" not in str(e):
raise Exception("Unexpected error message for invalid Set(ScanInterval,-1): " + str(e))
try:
t.iface.UnsubscribeProbeReq()
raise Exception("Invalid UnsubscribeProbeReq() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "NoSubscription" not in str(e):
raise Exception("Unexpected error message for invalid UnsubscribeProbeReq(): " + str(e))
t.group_p2p.Disconnect()
try:
iface.UnsubscribeProbeReq()
was_subscribed = True
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
was_subscribed = False
pass
try:
p2p.RejectPeer(path + "/Peers/00112233445566")
raise Exception("Invalid RejectPeer accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "UnknownError: Failed to call wpas_p2p_reject" not in str(e):
raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e))
try:
p2p.RejectPeer("/foo")
raise Exception("Invalid RejectPeer accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e))
try:
p2p.RemoveClient(t)
raise Exception("Invalid RemoveClient accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid RemoveClient(): " + str(e))
try:
p2p.Find(dbus.Dictionary(t))
raise Exception("Invalid Find accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid Find(): " + str(e))
try:
p2p.RemovePersistentGroup(dbus.ObjectPath(p))
raise Exception("Invalid RemovePersistentGroup accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid RemovePersistentGroup: " + str(e))
dev[0].request("P2P_SET disabled 1")
p2p.Listen(5)
raise Exception("Invalid Listen accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "UnknownError: Could not start P2P listen" not in str(e):
raise Exception("Unexpected error message for invalid Listen: " + str(e))
finally:
try:
test_p2p.Listen("foo")
raise Exception("Invalid Listen accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid Listen: " + str(e))
dev[0].request("P2P_SET disabled 1")
p2p.ExtendedListen(dbus.Dictionary({}))
raise Exception("Invalid ExtendedListen accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "UnknownError: failed to initiate a p2p_ext_listen" not in str(e):
raise Exception("Unexpected error message for invalid ExtendedListen: " + str(e))
finally:
'duration2': 20000, 'interval2': 102400 }
p2p.PresenceRequest(args)
raise Exception("Invalid PresenceRequest accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "UnknownError: Failed to invoke presence request" not in str(e):
raise Exception("Unexpected error message for invalid PresenceRequest: " + str(e))
finally:
params = dbus.Dictionary({'frequency': dbus.Int32(-1)})
p2p.GroupAdd(params)
raise Exception("Invalid GroupAdd accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid GroupAdd: " + str(e))
'frequency': 2412})
p2p.GroupAdd(params)
raise Exception("Invalid GroupAdd accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid GroupAdd: " + str(e))
try:
p2p.Disconnect()
raise Exception("Invalid Disconnect accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "UnknownError: failed to disconnect" not in str(e):
raise Exception("Unexpected error message for invalid Disconnect: " + str(e))
dev[0].request("P2P_SET disabled 1")
p2p.Flush()
raise Exception("Invalid Flush accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: P2P is not available for this interface" not in str(e):
raise Exception("Unexpected error message for invalid Flush: " + str(e))
finally:
'frequency': 2412 }
pin = p2p.Connect(args)
raise Exception("Invalid Connect accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: P2P is not available for this interface" not in str(e):
raise Exception("Unexpected error message for invalid Connect: " + str(e))
finally:
try:
pin = p2p.Connect(args)
raise Exception("Invalid Connect accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid Connect: " + str(e))
args = { 'peer': path }
pin = p2p.Invite(args)
raise Exception("Invalid Invite accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: P2P is not available for this interface" not in str(e):
raise Exception("Unexpected error message for invalid Invite: " + str(e))
finally:
args = { 'foo': 'bar' }
pin = p2p.Invite(args)
raise Exception("Invalid Invite accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid Connect: " + str(e))
try:
p2p.ProvisionDiscoveryRequest(p, method)
raise Exception("Invalid ProvisionDiscoveryRequest accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if err not in str(e):
raise Exception("Unexpected error message for invalid ProvisionDiscoveryRequest: " + str(e))
if_obj.Get(WPAS_DBUS_IFACE_P2PDEVICE, "Peers",
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Get(Peers) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: P2P is not available for this interface" not in str(e):
raise Exception("Unexpected error message for invalid Get(Peers): " + str(e))
finally:
try:
p2p.RejectPeer(path)
raise Exception("Invalid RejectPeer accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "UnknownError: Failed to call wpas_p2p_reject" not in str(e):
raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e))
self.loop.quit()
try:
p2p.ExtendedListen(dbus.Dictionary({'foo': 100}))
raise Exception("Invalid ExtendedListen accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid ExtendedListen(): " + str(e))
try:
p2p.DeleteService(args)
raise Exception("Invalid DeleteService() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid DeleteService(): " + str(e))
try:
p2p.DeleteService(args)
raise Exception("Invalid DeleteService() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid DeleteService(): " + str(e))
try:
p2p.DeleteService(args)
raise Exception("Invalid DeleteService() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid DeleteService(): " + str(e))
try:
p2p.DeleteService(args)
raise Exception("Invalid DeleteService() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid DeleteService(): " + str(e))
try:
p2p.AddService(args)
raise Exception("Invalid AddService() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid AddService(): " + str(e))
try:
p2p.ServiceDiscoveryCancelRequest(ref)
raise Exception("Invalid ServiceDiscoveryCancelRequest() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid AddService(): " + str(e))
try:
p2p.ServiceDiscoveryCancelRequest(dbus.UInt64(0))
raise Exception("Invalid ServiceDiscoveryCancelRequest() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid AddService(): " + str(e))
try:
p2p.ServiceDiscoveryRequest(args)
raise Exception("Invalid ServiceDiscoveryRequest accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid ServiceDiscoveryRequest(): " + str(e))
try:
p2p.ServiceDiscoveryResponse(dbus.Dictionary(args, signature='sv'))
raise Exception("Invalid ServiceDiscoveryResponse accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid ServiceDiscoveryResponse(): " + str(e))
wps.Start(params)
self.exceptions = True
raise Exception("Invalid WPS.Start() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
self.exceptions = True
raise Exception("Unexpected error message: " + str(e))
dbus_interface=dbus.PROPERTIES_IFACE)
self.exceptions = True
raise Exception("Invalid Set(WPSVendorExtensions) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed" not in str(e):
self.exceptions = True
raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
dbus_interface=dbus.PROPERTIES_IFACE)
self.exceptions = True
raise Exception("Invalid Set(WPSVendorExtensions) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
self.exceptions = True
raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
dbus_interface=dbus.PROPERTIES_IFACE)
self.exceptions = True
raise Exception("Invalid Set(WPSVendorExtensions) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed" not in str(e):
self.exceptions = True
raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
dbus_interface=dbus.PROPERTIES_IFACE)
self.exceptions = True
raise Exception("Invalid Set(WPSVendorExtensions) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed" not in str(e):
self.exceptions = True
raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
g_obj.Set(WPAS_DBUS_GROUP, 'WPSVendorExtensions', res,
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(WPSVendorExtensions) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: Failed to set property" not in str(e):
raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
dbus_interface=dbus.PROPERTIES_IFACE,
byte_arrays=True)
raise Exception("Invalid Get(P2PDeviceConfig) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: P2P is not available for this interface" not in str(e):
raise Exception("Unexpected error message for invalid Invite: " + str(e))
finally:
dbus.Dictionary(changes, signature='sv'),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(P2PDeviceConfig) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "Error.Failed: P2P is not available for this interface" not in str(e):
raise Exception("Unexpected error message for invalid Invite: " + str(e))
finally:
dbus.Dictionary(changes, signature='sv'),
dbus_interface=dbus.PROPERTIES_IFACE)
raise Exception("Invalid Set(P2PDeviceConfig) accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid Invite: " + str(e))
try:
p2p.RemovePersistentGroup(persistent)
raise Exception("Invalid RemovePersistentGroup accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "NetworkUnknown: There is no such persistent group" not in str(e):
raise Exception("Unexpected error message for invalid RemovePersistentGroup: " + str(e))
try:
pin = p2p.Invite(args)
raise Exception("Invalid Invite accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid Invite: " + str(e))
try:
p2p.Connect(args)
raise Exception("Invalid Connect accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "ConnectChannelUnsupported" not in str(e):
raise Exception("Unexpected error message for invalid Connect: " + str(e))
try:
p2p.Connect(args)
raise Exception("Invalid Connect accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid Connect: " + str(e))
try:
p2p.Cancel()
raise Exception("Unexpected p2p.Cancel() success")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
pass
addr0 = dev[0].p2p_dev_addr()
try:
iface.SaveConfig()
raise Exception("SaveConfig() accepted unexpectedly")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if not str(e).startswith("fi.w1.wpa_supplicant1.UnknownError: Not allowed to update configuration"):
raise Exception("Unexpected error message for SaveConfig(): " + str(e))
ie = dbus.ByteArray("\x00\x00")
iface.VendorElemAdd(-1, ie)
raise Exception("Invalid VendorElemAdd() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e) or "Invalid ID" not in str(e):
raise Exception("Unexpected error message for invalid VendorElemAdd[1]: " + str(e))
ie = dbus.ByteArray("")
iface.VendorElemAdd(1, ie)
raise Exception("Invalid VendorElemAdd() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e) or "Invalid value" not in str(e):
raise Exception("Unexpected error message for invalid VendorElemAdd[2]: " + str(e))
ie = dbus.ByteArray("\x00\x01")
iface.VendorElemAdd(1, ie)
raise Exception("Invalid VendorElemAdd() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e) or "Parse error" not in str(e):
raise Exception("Unexpected error message for invalid VendorElemAdd[3]: " + str(e))
try:
iface.VendorElemGet(-1)
raise Exception("Invalid VendorElemGet() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e) or "Invalid ID" not in str(e):
raise Exception("Unexpected error message for invalid VendorElemGet[1]: " + str(e))
try:
iface.VendorElemGet(1)
raise Exception("Invalid VendorElemGet() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e) or "ID value does not exist" not in str(e):
raise Exception("Unexpected error message for invalid VendorElemGet[2]: " + str(e))
ie = dbus.ByteArray("\x00\x00")
iface.VendorElemRem(-1, ie)
raise Exception("Invalid VendorElemRemove() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e) or "Invalid ID" not in str(e):
raise Exception("Unexpected error message for invalid VendorElemRemove[1]: " + str(e))
ie = dbus.ByteArray("")
iface.VendorElemRem(1, ie)
raise Exception("Invalid VendorElemRemove() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e) or "Invalid value" not in str(e):
raise Exception("Unexpected error message for invalid VendorElemRemove[1]: " + str(e))
test_ie = dbus.ByteArray("\x01\x01")
iface.VendorElemRem(1, test_ie)
raise Exception("Invalid VendorElemRemove() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e) or "Parse error" not in str(e):
raise Exception("Unexpected error message for invalid VendorElemRemove[1]: " + str(e))
try:
iface.VendorElemGet(1)
raise Exception("Invalid VendorElemGet() accepted after removal")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidArgs" not in str(e) or "ID value does not exist" not in str(e):
raise Exception("Unexpected error message for invalid VendorElemGet after removal: " + str(e))
path = wpas.getInterface(dev.ifname)
if_obj = bus.get_object(WPAS_DBUS_OLD_SERVICE, path)
return (bus,wpas_obj,path,if_obj)
- except Exception, e:
+ except Exception as e:
raise HwsimSkip("Could not connect to D-Bus: %s" % e)
class TestDbusOldWps(TestDbus):
try:
if_obj.setAPScan(t, dbus_interface=WPAS_DBUS_OLD_IFACE)
raise Exception("Invalid setAPScan() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidOptions" not in str(e):
raise Exception("Unexpected error message for invalid setAPScan: " + str(e))
try:
obj.disable(dbus_interface=WPAS_DBUS_OLD_NETWORK)
raise Exception("Invalid disable() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidNetwork" not in str(e):
raise Exception("Unexpected error message for invalid disable: " + str(e))
try:
obj.properties(dbus_interface=WPAS_DBUS_OLD_BSSID)
raise Exception("Invalid properties() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidBSSID" not in str(e):
raise Exception("Unexpected error message for invalid properties: " + str(e))
try:
bss_obj.properties2(dbus_interface=WPAS_DBUS_OLD_BSSID)
raise Exception("Unknown BSSID method accepted")
- except Exception, e:
+ except Exception as e:
logger.debug("Unknown BSSID method exception: " + str(e))
if not if_obj.flush(0, dbus_interface=WPAS_DBUS_OLD_IFACE):
try:
if_obj.flush("foo", dbus_interface=WPAS_DBUS_OLD_IFACE)
raise Exception("Invalid flush arguments accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
raise Exception("Unexpected error message for invalid flush: " + str(e))
try:
bss_obj.properties(dbus_interface=WPAS_DBUS_OLD_BSSID,
byte_arrays=True)
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.Interface.InvalidBSSID"):
raise Exception("Unexpected error message for invalid BSS: " + str(e))
try:
wpas.setDebugParams(123)
raise Exception("Invalid setDebugParams accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidOptions" not in str(e):
raise Exception("Unexpected error message for invalid setDebugParam: " + str(e))
try:
wpas.setDebugParams(123, True, True)
raise Exception("Invalid setDebugParams accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidOptions" not in str(e):
raise Exception("Unexpected error message for invalid setDebugParam: " + str(e))
try:
if_obj.setSmartcardModules(t, dbus_interface=WPAS_DBUS_OLD_IFACE)
raise Exception("Invalid setSmartcardModules accepted: " + str(t))
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
raise Exception("Unexpected error message for invalid setSmartcardModules(%s): %s" % (str(t), str(e)))
try:
wpas.getInterface(ifname)
raise Exception("Invalid getInterface accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if err not in str(e):
raise Exception("Unexpected error message for invalid getInterface: " + str(e))
try:
wpas.removeInterface(path)
raise Exception("Invalid removeInterface() accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidInterface" not in str(e):
raise Exception("Unexpected error message for invalid removeInterface: " + str(e))
else:
wpas.addInterface(ifname, params)
raise Exception("Invalid addInterface accepted: " + str(params))
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if err not in str(e):
raise Exception("Unexpected error message for invalid addInterface(%s): %s" % (str(params), str(e)))
try:
wpas.removeInterface(123)
raise Exception("Invalid removeInterface accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
raise Exception("Unexpected error message for invalid removeInterface: " + str(e))
try:
if_obj.setBlobs(arg, dbus_interface=WPAS_DBUS_OLD_IFACE)
raise Exception("Invalid setBlobs() accepted: " + str(arg))
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
logger.debug("setBlobs(%s): %s" % (str(arg), str(e)))
if err not in str(e):
raise Exception("Unexpected error message for invalid setBlobs: " + str(e))
try:
if_obj.removeBlobs(arg, dbus_interface=WPAS_DBUS_OLD_IFACE)
raise Exception("Invalid removeBlobs() accepted: " + str(arg))
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
logger.debug("removeBlobs(%s): %s" % (str(arg), str(e)))
if err not in str(e):
raise Exception("Unexpected error message for invalid removeBlobs: " + str(e))
try:
if_obj.removeNetwork(obj, dbus_interface=WPAS_DBUS_OLD_IFACE)
raise Exception("Invalid removeNetwork accepted: " + p)
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.Interface.InvalidNetwork"):
raise Exception("Unexpected error message for invalid removeNetwork: " + str(e))
try:
if_obj.removeNetwork("foo", dbus_interface=WPAS_DBUS_OLD_IFACE)
raise Exception("Invalid removeNetwork accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
raise Exception("Unexpected error message for invalid removeNetwork: " + str(e))
try:
if_obj.removeNetwork(path, dbus_interface=WPAS_DBUS_OLD_IFACE)
raise Exception("Invalid removeNetwork accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.Interface.InvalidNetwork"):
raise Exception("Unexpected error message for invalid removeNetwork: " + str(e))
try:
if_obj.selectNetwork(t, dbus_interface=WPAS_DBUS_OLD_IFACE)
raise Exception("Invalid selectNetwork accepted: " + str(t))
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if err not in str(e):
raise Exception("Unexpected error message for invalid selectNetwork(%s): %s" % (str(t), str(e)))
try:
netw_obj.set(t, dbus_interface=WPAS_DBUS_OLD_NETWORK)
raise Exception("Invalid set() accepted: " + str(t))
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidOptions" not in str(e):
raise Exception("Unexpected error message for invalid set: " + str(e))
params = dbus.Dictionary({ 'ssid': ssid,
if_obj.removeNetwork(self.path,
dbus_interface=WPAS_DBUS_OLD_IFACE)
raise Exception("Invalid removeNetwork accepted")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.Interface.InvalidNetwork"):
raise Exception("Unexpected error message for invalid wpsPbc: " + str(e))
try:
netw_obj.set(params, dbus_interface=WPAS_DBUS_OLD_NETWORK)
raise Exception("set succeeded with unexpected type")
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if "InvalidOptions" not in str(e):
raise Exception("Unexpected error message for unexpected type: " + str(e))
try:
if_obj.wpsPbc(arg, dbus_interface=WPAS_DBUS_OLD_IFACE)
raise Exception("Invalid wpsPbc arguments accepted: " + str(arg))
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
raise Exception("Unexpected error message for invalid wpsPbc: " + str(e))
try:
if_obj.wpsPin(arg[0], arg[1], dbus_interface=WPAS_DBUS_OLD_IFACE)
raise Exception("Invalid wpsPin arguments accepted: " + str(arg))
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
raise Exception("Unexpected error message for invalid wpsPbc: " + str(e))
try:
if_obj.wpsReg(arg[0], arg[1], dbus_interface=WPAS_DBUS_OLD_IFACE)
raise Exception("Invalid wpsReg arguments accepted: " + str(arg))
- except dbus.exceptions.DBusException, e:
+ except dbus.exceptions.DBusException as e:
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
raise Exception("Unexpected error message for invalid wpsPbc: " + str(e))
params['ocv'] = '1'
try:
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
- except Exception, e:
+ except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
try:
pid = int(pidtxt)
break
- except Exception, e:
+ except Exception as e:
self.logger.debug("kill_pid: No valid PID found: %s" % str(e))
time.sleep(1)
self.logger.debug("kill_pid %s --> pid %d" % (pidfile, pid))
break
# Wait and check again
time.sleep(1)
- except Exception, e:
+ except Exception as e:
self.logger.debug("Didn't stop the pid=%d. Was it stopped already? (%s)" % (pid, str(e)))
sid = '-1'
initiator.set_fst_parameters(llt=llt)
initiator.configure_session(sid, new_iface, old_iface)
- except Exception, e:
+ except Exception as e:
if e.args[0].startswith("Cannot add FST session with groupid"):
if bad_param_type == bad_param_group_id or bad_param_type == bad_param_session_add_no_params:
bad_parameter_detected = True
bad_parameter_detected = True
else:
initiator.initiate_session(sid, "accept")
- except Exception, e:
+ except Exception as e:
if e.args[0].startswith("Cannot initiate fst session"):
if bad_param_type != bad_param_none:
bad_parameter_detected = True
elif bad_param_type == bad_param_session_transfer_bad_session_id:
sid = '-1'
initiator.transfer_session(sid)
- except Exception, e:
+ except Exception as e:
if e.args[0].startswith("Cannot transfer fst session"):
if bad_param_type != bad_param_none:
bad_parameter_detected = True
elif bad_param_type == bad_param_session_teardown_bad_session_id:
sid = '-1'
initiator.teardown_session(sid)
- except Exception, e:
+ except Exception as e:
if e.args[0].startswith("Cannot tear down fst session"):
if (bad_param_type == bad_param_session_teardown_no_params or
bad_param_type == bad_param_session_teardown_bad_session_id or
elif remove_session_scenario == remove_scenario_bad_session_id:
sid = '-1'
initiator.remove_session(sid)
- except Exception, e:
+ except Exception as e:
if e.args[0].startswith("Cannot remove fst session"):
if (remove_session_scenario == remove_scenario_no_params or
remove_session_scenario == remove_scenario_bad_session_id):
#fsts_id doesn't matter, no actual session exists
sender.send_test_tear_down('0')
receiver.wait_for_session_event(5)
- except Exception, e:
+ except Exception as e:
if e.args[0].startswith("No FST-EVENT-SESSION received"):
if frame_type != frame_type_session_request:
frame_receive_timeout = True
responder.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
else:
raise Exception("Unknown bad scenario identifier")
- except Exception, e:
+ except Exception as e:
if e.args[0].startswith("No FST-EVENT-SESSION received"):
bad_parameter_detected = True
if not bad_parameter_detected:
res_sta1_mbies.startswith("FAIL") or
res_sta2_mbies.startswith("FAIL")):
raise Exception("Failure. MB IEs must be present on the stations")
- except Exception, e:
+ except Exception as e:
logger.info(e)
raise
finally:
res_sta2_mbies = sta2.get_local_mbies()
if res_sta2_mbies == orig_sta2_mbies:
raise Exception("Failure. MB IEs have not been updated")
- except Exception, e:
+ except Exception as e:
logger.info(e)
raise
finally:
res_ap_mbies = ap1.get_local_mbies()
if res_ap_mbies != orig_ap_mbies:
raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
- except Exception, e:
+ except Exception as e:
logger.info(e)
raise
finally:
res_ap_mbies = ap2.get_local_mbies()
if res_ap_mbies != orig_ap_mbies:
raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
- except Exception, e:
+ except Exception as e:
logger.info(e)
raise
finally:
res_sta1_mbies.startswith("FAIL") or
res_sta2_mbies.startswith("FAIL")):
raise Exception("Failure. MB IEs must be present on the stations")
- except Exception, e:
+ except Exception as e:
logger.info(e)
raise
finally:
res_sta1_mbies.startswith("FAIL") or
res_sta2_mbies.startswith("FAIL")):
raise Exception("Failure. MB IEs must be present on the stations")
- except Exception, e:
+ except Exception as e:
logger.info(e)
raise
finally:
res_sta1_mbies.startswith("FAIL") or
res_sta2_mbies.startswith("FAIL")):
raise Exception("Failure. MB IEs must be present on the stations")
- except Exception, e:
+ except Exception as e:
logger.info(e)
raise
finally:
res_sta1_mbies.startswith("FAIL") or
res_sta2_mbies.startswith("FAIL")):
raise Exception("Failure. MB IEs must be present on the stations")
- except Exception, e:
+ except Exception as e:
logger.info(e)
raise
finally:
res_sta1_mbies.startswith("FAIL") or
res_sta2_mbies.startswith("FAIL")):
raise Exception("Failure. MB IEs must be present on the stations")
- except Exception, e:
+ except Exception as e:
logger.info(e)
raise
finally:
addr_sta2_mbie1 != addr_sta2_mbie2 or
addr_sta2_mbie1 != addr_sta1_str):
raise Exception("Failure. STA Address in MB IEs should have been same as the other STA's")
- except Exception, e:
+ except Exception as e:
logger.info(e)
raise
finally:
res_ap_mbies = ap2.get_local_mbies()
if res_ap_mbies != orig_ap_mbies:
raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
- except Exception, e:
+ except Exception as e:
logger.info(e)
raise
finally:
res_ap_mbies = ap2.get_local_mbies()
if res_ap_mbies != orig_ap_mbies:
raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
- except Exception, e:
+ except Exception as e:
logger.info(e)
raise
finally:
res_sta2_mbies.startswith("FAIL") or
res_ap2_mbies.startswith("FAIL")):
raise Exception("Failure. MB IEs should have appeared on the station and on the AP")
- except Exception, e:
+ except Exception as e:
logger.info(e)
raise
finally:
ap1.send_iface_attach_request(ap1.iface, ap1.fst_group,
ap1.fst_llt, ap1.fst_pri)
raise Exception("Duplicate FST-ATTACH succeeded")
- except Exception, e:
+ except Exception as e:
if not str(e).startswith("Cannot attach"):
raise
try:
ap1.get_fsts_id_by_sid("123")
- except Exception, e:
+ except Exception as e:
if not str(e).startswith("Cannot get fsts_id for sid"):
raise
finally:
with alloc_fail(hapd, 1, "mb_ies_by_info"):
fst_setup_req(wpas, hglobal, 5180, apdev[0]['bssid'], req, stie,
mbie, no_wait=True)
- except HwsimSkip, e:
+ except HwsimSkip as e:
# Skip exception to allow proper cleanup
pass
count += 1
if count == 5:
break
- except Exception, e:
+ except Exception as e:
logger.info("Iteration %d - %s" % (i, str(e)))
@remote_compatible
try:
hostapd.add_ap(apdev[1], params, timeout=2.5)
raise Exception("Unexpected add_ap() success during OOM")
- except Exception, e:
+ except Exception as e:
if "Failed to enable hostapd" in str(e):
pass
else:
# mac80211 currently..
try:
hwsim_utils.test_connectivity(dev[0], dev[1])
- except Exception, e:
+ except Exception as e:
logger.info("Ignoring known connectivity failure: " + str(e))
try:
hwsim_utils.test_connectivity(dev[0], dev[2])
- except Exception, e:
+ except Exception as e:
logger.info("Ignoring known connectivity failure: " + str(e))
try:
hwsim_utils.test_connectivity(dev[1], dev[2])
- except Exception, e:
+ except Exception as e:
logger.info("Ignoring known connectivity failure: " + str(e))
key_mgmt = dev[0].get_status_field("key_mgmt")
# mac80211 currently..
try:
hwsim_utils.test_connectivity(dev[0], dev[1])
- except Exception, e:
+ except Exception as e:
logger.info("Ignoring known connectivity failure: " + str(e))
def test_ibss_open(dev):
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("veth%d" % i, driver="macsec_linux")
wpa.append(wpas)
- except Exception, e:
+ except Exception as e:
if "Failed to add a dynamic wpa_supplicant interface" in str(e):
raise HwsimSkip("macsec supported (wpa_supplicant CONFIG_MACSEC, CONFIG_MACSEC_LINUX; kernel CONFIG_MACSEC)")
raise
# "MBO: PMF needs to be enabled whenever using WPA2 with MBO"
hostapd.add_ap(apdev[0], params)
raise Exception("AP setup succeeded unexpectedly")
- except Exception, e:
+ except Exception as e:
if "Failed to enable hostapd" in str(e):
pass
else:
params.update(hostapd.wpa2_params(ssid=ssid, passphrase=passphrase))
try:
hapd = hostapd.add_ap(apdev, params)
- except Exception, e:
+ except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
params["ocv"] = ap_ocv
try:
self.hapd = hostapd.add_ap(apdev, params)
- except Exception, e:
+ except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
params['wpa_disable_eapol_key_retries'] = "1"
try:
hapd = hostapd.add_ap(apdev[0], params)
- except Exception, e:
+ except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
try:
self.hapd = hostapd.add_ap(apdev, params)
- except Exception, e:
+ except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
try:
[i_res2, r_res2] = go_neg_pbc(i_dev=dev[0], i_intent=14, i_freq=5180,
r_dev=dev[1], r_intent=0, r_freq=5200)
- except Exception, e:
+ except Exception as e:
return
raise Exception("Unexpected group formation success")
for r, s, h in RFKill.list():
if r.name == phy:
return r
- except Exception, e:
+ except Exception as e:
raise HwsimSkip("No rfkill available: " + str(e))
raise HwsimSkip("No rfkill match found for the interface")
elif report.bssid_str == apdev[1]['bssid']:
if report.opclass != 117 or report.channel != 48:
raise Exception("Incorrect opclass/channel for AP1")
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80 MHz channel not supported in regulatory information")
logger.info("Received beacon report: " + str(report))
if report.opclass != 128 or report.channel != 36:
raise Exception("Incorrect opclass/channel for AP")
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
raise HwsimSkip("80 MHz channel not supported in regulatory information")
logger.info("Received beacon report: " + str(report))
if report.opclass != 129 or report.channel != 104:
raise Exception("Incorrect opclass/channel for AP")
- except Exception, e:
+ except Exception as e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
raise HwsimSkip("ZA regulatory rule likely did not have DFS requirement removed")
raise
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
try:
wpas.interface_add("wlan5", driver="wext")
- except Exception, e:
+ except Exception as e:
wpas.close_ctrl()
raise HwsimSkip("WEXT driver support not included in wpa_supplicant")
return wpas
try:
verstr = subprocess.check_output(['wmediumd', '-V'])
- except OSError, e:
+ except OSError as e:
if e.errno == errno.ENOENT:
raise HwsimSkip('wmediumd not available')
raise
p = subprocess.Popen(['wmediumd', '-c', fn],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
- except OSError, e:
+ except OSError as e:
if e.errno == errno.ENOENT:
raise HwsimSkip('wmediumd not available')
raise
params["bss_transition"] = "1"
try:
hapd = hostapd.add_ap(apdev[0], params)
- except Exception, e:
+ except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
params['wnm_sleep_mode'] = '1'
try:
hapd = hostapd.add_ap(apdev[0], params)
- except Exception, e:
+ except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
res = dev[0].get_network(id, "key_mgmt")
if res != value:
raise Exception("Unexpected response for key_mgmt")
- except Exception, e:
+ except Exception as e:
if str(e).startswith("Unexpected"):
raise
else:
logger.debug("Command %d" % i)
try:
s.send("MIB")
- except Exception, e:
+ except Exception as e:
logger.info("Could not send command %d: %s" % (i, str(e)))
break
# Close without receiving response
logger.debug("Command %d [2]" % i)
try:
s2.send("MIB")
- except Exception, e:
+ except Exception as e:
logger.info("Could not send command %d [2]: %s" % (i, str(e)))
break
# Close without receiving response
logger.debug("Command %d [3]" % i)
try:
s2.send("MIB")
- except Exception, e:
+ except Exception as e:
logger.info("Could not send command %d [3]: %s" % (i, str(e)))
break
# Close without receiving response
if ocv:
try:
dev.set_network(id, "ocv", "1")
- except Exception, e:
+ except Exception as e:
if "SET_NETWORK failed" in str(e):
raise HwsimSkip("OCV not supported")
raise
try:
hwsim_utils.test_connectivity(dev[i], dev[2], timeout=1)
raise Exception("Data connectivity test passed unexpectedly")
- except Exception, e:
+ except Exception as e:
if "data delivery failed" not in str(e):
raise
"MESH-GROUP-STARTED"])
if ev is None:
raise Exception("Init failure not reported")
- except Exception, e:
+ except Exception as e:
if i < 15:
raise
logger.info("Ignore no-oom for i=%d" % i)
try:
dev[0].add_ts(tsid, 3)
raise Exception("ADDTS succeeded although it should have failed")
- except Exception, e:
+ except Exception as e:
if not str(e).startswith("ADDTS failed"):
raise
status = dev[0].request("WMM_AC_STATUS")
try:
dev[0].add_ts(tsid, 5)
raise Exception("ADDTS succeeded although it should have failed")
- except Exception, e:
+ except Exception as e:
if not str(e).startswith("ADDTS failed"):
raise
try:
dev[0].add_ts(tsid, 7, direction="uplink")
raise Exception("ADDTS succeeded although it should have failed")
- except Exception, e:
+ except Exception as e:
if not str(e).startswith("ADDTS failed"):
raise
try:
dev[0].add_ts(tsid, 7, direction="bidi")
raise Exception("ADDTS succeeded although it should have failed")
- except Exception, e:
+ except Exception as e:
if not str(e).startswith("ADDTS failed"):
raise
try:
dev[0].del_ts(tsid)
raise Exception("DELTS succeeded although it should have failed")
- except Exception, e:
+ except Exception as e:
if not str(e).startswith("DELTS failed"):
raise
try:
dev[0].add_ts(5, 6)
raise Exception("ADDTS succeeded although it should have failed")
- except Exception, e:
+ except Exception as e:
if not str(e).startswith("ADDTS failed"):
raise
try:
dev[0].del_ts(5)
raise Exception("DELTS succeeded although it should have failed")
- except Exception, e:
+ except Exception as e:
if not str(e).startswith("DELTS failed"):
raise
arg.append('-V')
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
- except Exception, e:
+ except Exception as e:
logger.info("Could run run tshark check: " + str(e))
cmd = None
return None
if display is None: display = []
try:
return _run_tshark(filename, filter, display, wait)
- except UnknownFieldsException, e:
+ except UnknownFieldsException as e:
all_wlan_mgt = True
for f in e.fields:
if not f.startswith('wlan_mgt.'):
try:
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
- except Exception, e:
+ except Exception as e:
logger.info("Could run run tshark: " + str(e))
return None
output = cmd.communicate()
def get_bss_counter(self, field, bssid):
try:
res = self.cli_cmd(["get_bss_counter", field, bssid])
- except Exception, e:
+ except Exception as e:
return 0
if "FAIL" in res:
return 0
try:
[name,value] = l.split('=', 1)
vals[name] = value
- except ValueError, e:
+ except ValueError as e:
logger.info(self.ifname + ": Ignore unexpected STATUS line: " + l)
return vals
try:
[name,value] = l.split('=', 1)
vals[name] = value
- except ValueError, e:
+ except ValueError as e:
logger.info(self.ifname + ": Ignore unexpected MIB line: " + l)
return vals
# lock devices
try:
get_devices(devices, duts, refs, monitors)
- except Exception, e:
+ except Exception as e:
logger.warning("get devices failed: " + str(e))
logger.info(traceback.format_exc())
put_devices(devices, duts, refs, monitors)
logger.warning("RUN check_devices")
try:
check_devices(devices, setup_params, refs, duts, monitors)
- except Exception, e:
+ except Exception as e:
logger.warning("FAILED: " + str(e))
logger.info(traceback.format_exc())
put_devices(devices, duts, refs, monitors)
except KeyboardInterrupt:
put_devices(devices, duts, refs, monitors)
raise
- except TestSkip, e:
+ except TestSkip as e:
end = datetime.now()
logger.warning("SKIP (" + str(e) + ") - " + str((end - start).total_seconds()) + "s")
- except Exception, e:
+ except Exception as e:
end = datetime.now()
logger.warning("FAILED (" + str(e) + ") - " + str((end - start).total_seconds()) + "s")
logger.info(traceback.format_exc())
except KeyboardInterrupt:
put_devices(devices, duts, refs, monitors)
raise
- except HwsimSkip,e:
+ except HwsimSkip as e:
end = datetime.now()
logger.warning("SKIP (" + str(e) + ") - " + str((end - start).total_seconds()) + "s")
failed.append(hwsim_test.__name__.replace('test_', '', 1))
- except Exception, e:
+ except Exception as e:
end = datetime.now()
logger.warning("FAILED (" + str(e) + ") - " + str((end - start).total_seconds()) + "s")
logger.info(traceback.format_exc())
if os.path.isdir(wpas_ctrl):
try:
ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
- except OSError, error:
+ except OSError as error:
print "Could not find wpa_supplicant: ", error
return None
try:
wpas = wpaspy.Ctrl(ctrl)
return wpas
- except Exception, e:
+ except Exception as e:
pass
return None
if os.path.isdir(wpas_ctrl):
try:
ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
- except OSError, error:
+ except OSError as error:
print "Could not find wpa_supplicant: ", error
return None
print "Trying to use control interface " + ctrl
wpas = wpaspy.Ctrl(ctrl)
return wpas
- except Exception, e:
+ except Exception as e:
pass
return None
print "Handover request (pre-WPS):"
try:
print message.pretty()
- except Exception, e:
+ except Exception as e:
print e
data = wpas_get_handover_req_wps()
print "Handover request:"
try:
print message.pretty()
- except Exception, e:
+ except Exception as e:
print e
print str(message).encode("hex")
summary("Handover connection refused")
client.close()
return
- except Exception, e:
+ except Exception as e:
summary("Other exception: " + str(e))
client.close()
return
print "Received message"
try:
print message.pretty()
- except Exception, e:
+ except Exception as e:
print e
print str(message).encode("hex")
message = nfc.ndef.HandoverSelectMessage(message)
summary("Handover select received")
try:
print message.pretty()
- except Exception, e:
+ except Exception as e:
print e
for carrier in message.carriers:
print "HandoverServer - request received"
try:
print "Parsed handover request: " + request.pretty()
- except Exception, e:
+ except Exception as e:
print e
sel = nfc.ndef.HandoverSelectMessage(version="1.2")
print "Carrier record:"
try:
print carrier.record.pretty()
- except Exception, e:
+ except Exception as e:
print e
data = wpas_get_handover_sel()
if data is None:
print "Carrier record:"
try:
print carrier.record.pretty()
- except Exception, e:
+ except Exception as e:
print e
data = wpas_get_handover_sel_wps()
if data is None:
print "Handover select:"
try:
print sel.pretty()
- except Exception, e:
+ except Exception as e:
print e
print str(sel).encode("hex")
print "Handover select:"
try:
print p2p_sel_data.pretty()
- except Exception, e:
+ except Exception as e:
print e
print str(p2p_sel_data).encode("hex")
print "NDEF tag: " + tag.type
try:
print tag.ndef.message.pretty()
- except Exception, e:
+ except Exception as e:
print e
success = p2p_tag_read(tag)
if only_one and success:
'on-connect': llcp_connected},
terminate=terminate_loop):
break
- except Exception, e:
+ except Exception as e:
print "clf.connect failed"
global srv
{'Ifname': ifname, 'Driver': 'test'})
time.sleep(1)
- except dbus.DBusException, exc:
+ except dbus.DBusException as exc:
if not str(exc).startswith(
self.wpas_dbus_interface + \
".InterfaceExists:"):
result_pin = self.p2p_interface.Connect(
self.p2p_connect_arguements)
- except dbus.DBusException, exc:
+ except dbus.DBusException as exc:
raise exc
if (self.wps_method == 'pin' and \
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException, exc:
+ except dbus.DBusException as exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
print error
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException, exc:
+ except dbus.DBusException as exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
print error
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException, exc:
+ except dbus.DBusException as exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
print error
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException, exc:
+ except dbus.DBusException as exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
print error
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException, exc:
+ except dbus.DBusException as exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
print error
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException, exc:
+ except dbus.DBusException as exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
print error
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException, exc:
+ except dbus.DBusException as exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
print error
path = None
try:
path = wpas.GetInterface(ifname)
- except dbus.DBusException, exc:
+ except dbus.DBusException as exc:
if not str(exc).startswith("fi.w1.wpa_supplicant1.InterfaceUnknown:"):
raise exc
try:
path = wpas.CreateInterface({'Ifname': ifname, 'Driver': 'test'})
time.sleep(1)
- except dbus.DBusException, exc:
+ except dbus.DBusException as exc:
if not str(exc).startswith("fi.w1.wpa_supplicant1.InterfaceExists:"):
raise exc
path = None
try:
path = wpas.getInterface(ifname)
- except dbus.dbus_bindings.DBusException, exc:
+ except dbus.dbus_bindings.DBusException as exc:
if str(exc) != "wpa_supplicant knows nothing about this interface.":
raise exc
try:
path = wpas.addInterface(ifname, {'driver': dbus.Variant('wext')})
- except dbus.dbus_bindings.DBusException, exc:
+ except dbus.dbus_bindings.DBusException as exc:
if str(exc) != "wpa_supplicant already controls this interface.":
raise exc
if os.path.isdir(wpas_ctrl):
try:
ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
- except OSError, error:
+ except OSError as error:
print "Could not find wpa_supplicant: ", error
return None
try:
wpas = wpaspy.Ctrl(ctrl)
return wpas
- except Exception, e:
+ except Exception as e:
pass
return None
summary("HandoverServer - request received")
try:
print "Parsed handover request: " + request.pretty()
- except Exception, e:
+ except Exception as e:
print e
sel = nfc.ndef.HandoverSelectMessage(version="1.2")
print "Handover select:"
try:
print sel.pretty()
- except Exception, e:
+ except Exception as e:
print e
print str(sel).encode("hex")
print "Handover request:"
try:
print message.pretty()
- except Exception, e:
+ except Exception as e:
print e
print str(message).encode("hex")
summary("Handover connection refused")
client.close()
return
- except Exception, e:
+ except Exception as e:
summary("Other exception: " + str(e))
client.close()
return
print "Received message"
try:
print message.pretty()
- except Exception, e:
+ except Exception as e:
print e
print str(message).encode("hex")
message = nfc.ndef.HandoverSelectMessage(message)
summary("Handover select received")
try:
print message.pretty()
- except Exception, e:
+ except Exception as e:
print e
for carrier in message.carriers:
print "NDEF tag: " + tag.type
try:
print tag.ndef.message.pretty()
- except Exception, e:
+ except Exception as e:
print e
success = wps_tag_read(tag, not only_one)
if only_one and success:
'on-connect': llcp_connected},
terminate=terminate_loop):
break
- except Exception, e:
+ except Exception as e:
print "clf.connect failed"
global srv
if os.path.isdir(wpas_ctrl):
try:
ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
- except OSError, error:
+ except OSError as error:
print "Could not find wpa_supplicant: ", error
return None
try:
wpas = wpaspy.Ctrl(ctrl)
return wpas
- except Exception, e:
+ except Exception as e:
pass
return None