test_ap_dynamic.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/python
  2. #
  3. # Test cases for dynamic BSS changes with hostapd
  4. # Copyright (c) 2013, Qualcomm Atheros, Inc.
  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 subprocess
  10. import logging
  11. logger = logging.getLogger(__name__)
  12. import hwsim_utils
  13. import hostapd
  14. def test_ap_change_ssid(dev, apdev):
  15. """Dynamic SSID change with hostapd and WPA2-PSK"""
  16. params = hostapd.wpa2_params(ssid="test-wpa2-psk-start",
  17. passphrase="12345678")
  18. hostapd.add_ap(apdev[0]['ifname'], params)
  19. id = dev[0].connect("test-wpa2-psk-start", psk="12345678")
  20. dev[0].request("DISCONNECT")
  21. logger.info("Change SSID dynamically")
  22. hapd = hostapd.Hostapd(apdev[0]['ifname'])
  23. res = hapd.request("SET ssid test-wpa2-psk-new")
  24. if "OK" not in res:
  25. raise Exception("SET command failed")
  26. res = hapd.request("RELOAD")
  27. if "OK" not in res:
  28. raise Exception("RELOAD command failed")
  29. dev[0].set_network_quoted(id, "ssid", "test-wpa2-psk-new")
  30. dev[0].connect_network(id)