test_wpas_wmm_ac.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # Test cases for wpa_supplicant WMM-AC operations
  2. # Copyright (c) 2014, Intel Corporation
  3. #
  4. # This software may be distributed under the terms of the BSD license.
  5. # See README for more details.
  6. import logging
  7. logger = logging.getLogger()
  8. import hwsim_utils
  9. import hostapd
  10. def add_wmm_ap(apdev, acm_list):
  11. params = { "ssid": "wmm_ac",
  12. "hw_mode": "g",
  13. "channel": "11",
  14. "wmm_enabled" : "1"}
  15. for ac in acm_list:
  16. params["wmm_ac_%s_acm" % (ac.lower())] = "1"
  17. return hostapd.add_ap(apdev[0]['ifname'], params)
  18. def test_tspec(dev, apdev):
  19. """Basic addts/delts tests"""
  20. # configure ap with VO and VI requiring admission-control
  21. hapd = add_wmm_ap(apdev, ["VO", "VI"])
  22. dev[0].connect("wmm_ac", key_mgmt="NONE", scan_freq="2462")
  23. hwsim_utils.test_connectivity(dev[0], hapd)
  24. status = dev[0].request("WMM_AC_STATUS")
  25. if "WMM AC is Enabled" not in status:
  26. raise Exception("WMM-AC not enabled")
  27. if "TSID" in status:
  28. raise Exception("Unexpected TSID info")
  29. if "BK: acm=0 uapsd=0" not in status:
  30. raise Exception("Unexpected BK info" + status)
  31. if "BE: acm=0 uapsd=0" not in status:
  32. raise Exception("Unexpected BE info" + status)
  33. if "VI: acm=1 uapsd=0" not in status:
  34. raise Exception("Unexpected VI info" + status)
  35. if "VO: acm=1 uapsd=0" not in status:
  36. raise Exception("Unexpected VO info" + status)
  37. tsid = 5
  38. # make sure we fail when the ac is not configured for acm
  39. try:
  40. dev[0].add_ts(tsid, 3)
  41. raise Exception("ADDTS succeeded although it should have failed")
  42. except Exception, e:
  43. if not str(e).startswith("ADDTS failed"):
  44. raise
  45. status = dev[0].request("WMM_AC_STATUS")
  46. if "TSID" in status:
  47. raise Exception("Unexpected TSID info")
  48. # add tspec for UP=6
  49. dev[0].add_ts(tsid, 6)
  50. status = dev[0].request("WMM_AC_STATUS")
  51. if "TSID" not in status:
  52. raise Exception("Missing TSID info")
  53. # using the same tsid for a different ac is invalid
  54. try:
  55. dev[0].add_ts(tsid, 5)
  56. raise Exception("ADDTS succeeded although it should have failed")
  57. except Exception, e:
  58. if not str(e).startswith("ADDTS failed"):
  59. raise
  60. # update the tspec for a different UP of the same ac
  61. dev[0].add_ts(tsid, 7)
  62. dev[0].del_ts(tsid)
  63. status = dev[0].request("WMM_AC_STATUS")
  64. if "TSID" in status:
  65. raise Exception("Unexpected TSID info")