test_ap_open.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # Open mode AP tests
  2. # Copyright (c) 2014, Qualcomm Atheros, Inc.
  3. #
  4. # This software may be distributed under the terms of the BSD license.
  5. # See README for more details.
  6. import hostapd
  7. import hwsim_utils
  8. def test_ap_open(dev, apdev):
  9. """AP with open mode (no security) configuration"""
  10. hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "open" })
  11. dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
  12. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  13. ev = hapd.wait_event([ "AP-STA-CONNECTED" ], timeout=5)
  14. if ev is None:
  15. raise Exception("No connection event received from hostapd")
  16. dev[0].request("DISCONNECT")
  17. ev = hapd.wait_event([ "AP-STA-DISCONNECTED" ], timeout=5)
  18. if ev is None:
  19. raise Exception("No disconnection event received from hostapd")
  20. def test_ap_open_packet_loss(dev, apdev):
  21. """AP with open mode configuration and large packet loss"""
  22. params = { "ssid": "open",
  23. "ignore_probe_probability": "0.5",
  24. "ignore_auth_probability": "0.5",
  25. "ignore_assoc_probability": "0.5",
  26. "ignore_reassoc_probability": "0.5" }
  27. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  28. for i in range(0, 3):
  29. dev[i].connect("open", key_mgmt="NONE", scan_freq="2412",
  30. wait_connect=False)
  31. for i in range(0, 3):
  32. ev = dev[i].wait_event(["CTRL-EVENT-CONNECTED"], timeout=20)
  33. if ev is None:
  34. raise Exception("Association with the AP timed out")