test_ap_ht.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/python
  2. #
  3. # Test cases for HT operations with hostapd
  4. # Copyright (c) 2013, Jouni Malinen <j@w1.fi>
  5. #
  6. # This software may be distributed under the terms of the BSD license.
  7. # See README for more details.
  8. import time
  9. import logging
  10. logger = logging.getLogger()
  11. import hostapd
  12. def test_ap_ht40_scan(dev, apdev):
  13. """HT40 co-ex scan"""
  14. params = { "ssid": "test-ht40",
  15. "channel": "5",
  16. "ht_capab": "[HT40-]"}
  17. hapd = hostapd.add_ap(apdev[0]['ifname'], params, wait_enabled=False)
  18. state = hapd.get_status_field("state")
  19. if state != "HT_SCAN":
  20. time.sleep(0.1)
  21. state = hapd.get_status_field("state")
  22. if state != "HT_SCAN":
  23. raise Exception("Unexpected interface state - expected HT_SCAN")
  24. ev = hapd.wait_event(["AP-ENABLED"], timeout=10)
  25. if not ev:
  26. raise Exception("AP setup timed out")
  27. state = hapd.get_status_field("state")
  28. if state != "ENABLED":
  29. raise Exception("Unexpected interface state - expected ENABLED")
  30. freq = hapd.get_status_field("freq")
  31. if freq != "2432":
  32. raise Exception("Unexpected frequency")
  33. pri = hapd.get_status_field("channel")
  34. if pri != "5":
  35. raise Exception("Unexpected primary channel")
  36. sec = hapd.get_status_field("secondary_channel")
  37. if sec != "-1":
  38. raise Exception("Unexpected secondary channel")
  39. dev[0].connect("test-ht40", key_mgmt="NONE", scan_freq=freq)