552-tests-Multi-AP-association.patch 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. From 7488e0ade6dffb6df4c1fb6526a9f3ede0eb18ef Mon Sep 17 00:00:00 2001
  2. From: Jouni Malinen <[email protected]>
  3. Date: Thu, 20 Dec 2018 12:41:00 +0200
  4. Subject: [PATCH] tests: Multi-AP association
  5. Signed-off-by: Jouni Malinen <[email protected]>
  6. ---
  7. tests/hwsim/test_multi_ap.py | 73 ++++++++++++++++++++++++++++++++++++
  8. tests/hwsim/wpasupplicant.py | 3 +-
  9. 2 files changed, 75 insertions(+), 1 deletion(-)
  10. create mode 100644 tests/hwsim/test_multi_ap.py
  11. --- /dev/null
  12. +++ b/tests/hwsim/test_multi_ap.py
  13. @@ -0,0 +1,73 @@
  14. +# Test cases for Multi-AP
  15. +# Copyright (c) 2018, The Linux Foundation
  16. +#
  17. +# This software may be distributed under the terms of the BSD license.
  18. +# See README for more details.
  19. +
  20. +import hostapd
  21. +
  22. +def test_multi_ap_association(dev, apdev):
  23. + """Multi-AP association in backhaul BSS"""
  24. + run_multi_ap_association(dev, apdev, 1)
  25. + dev[1].connect("multi-ap", psk="12345678", scan_freq="2412",
  26. + wait_connect=False)
  27. + ev = dev[1].wait_event([ "CTRL-EVENT-DISCONNECTED",
  28. + "CTRL-EVENT-CONNECTED",
  29. + "CTRL-EVENT-ASSOC-REJECT" ],
  30. + timeout=5)
  31. + dev[1].request("DISCONNECT")
  32. + if ev is None:
  33. + raise Exception("Connection result not reported")
  34. + if "CTRL-EVENT-ASSOC-REJECT" not in ev:
  35. + raise Exception("Association rejection not reported")
  36. + if "status_code=12" not in ev:
  37. + raise Exception("Unexpected association status code: " + ev)
  38. +
  39. +def test_multi_ap_association_shared_bss(dev, apdev):
  40. + """Multi-AP association in backhaul BSS (with fronthaul BSS enabled)"""
  41. + run_multi_ap_association(dev, apdev, 3)
  42. + dev[1].connect("multi-ap", psk="12345678", scan_freq="2412")
  43. +
  44. +def run_multi_ap_association(dev, apdev, multi_ap):
  45. + params = hostapd.wpa2_params(ssid="multi-ap", passphrase="12345678")
  46. + params["multi_ap"] = str(multi_ap)
  47. + hapd = hostapd.add_ap(apdev[0], params)
  48. +
  49. + dev[0].connect("multi-ap", psk="12345678", multi_ap_backhaul_sta="1",
  50. + scan_freq="2412")
  51. +
  52. +def test_multi_ap_disabled_on_ap(dev, apdev):
  53. + """Multi-AP association attempt when disabled on AP"""
  54. + params = hostapd.wpa2_params(ssid="multi-ap", passphrase="12345678")
  55. + hapd = hostapd.add_ap(apdev[0], params)
  56. +
  57. + dev[0].connect("multi-ap", psk="12345678", multi_ap_backhaul_sta="1",
  58. + scan_freq="2412", wait_connect=False)
  59. + ev = dev[0].wait_event([ "CTRL-EVENT-DISCONNECTED",
  60. + "CTRL-EVENT-CONNECTED" ],
  61. + timeout=5)
  62. + dev[0].request("DISCONNECT")
  63. + if ev is None:
  64. + raise Exception("Connection result not reported")
  65. + if "CTRL-EVENT-DISCONNECTED" not in ev:
  66. + raise Exception("Unexpected connection result")
  67. +
  68. +def test_multi_ap_fronthaul_on_ap(dev, apdev):
  69. + """Multi-AP association attempt when only fronthaul BSS on AP"""
  70. + params = hostapd.wpa2_params(ssid="multi-ap", passphrase="12345678")
  71. + params["multi_ap"] = "2"
  72. + hapd = hostapd.add_ap(apdev[0], params)
  73. +
  74. + dev[0].connect("multi-ap", psk="12345678", multi_ap_backhaul_sta="1",
  75. + scan_freq="2412", wait_connect=False)
  76. + ev = dev[0].wait_event([ "CTRL-EVENT-DISCONNECTED",
  77. + "CTRL-EVENT-CONNECTED",
  78. + "CTRL-EVENT-ASSOC-REJECT" ],
  79. + timeout=5)
  80. + dev[0].request("DISCONNECT")
  81. + if ev is None:
  82. + raise Exception("Connection result not reported")
  83. + if "CTRL-EVENT-ASSOC-REJECT" not in ev:
  84. + raise Exception("Association rejection not reported")
  85. + if "status_code=12" not in ev:
  86. + raise Exception("Unexpected association status code: " + ev)
  87. --- a/tests/hwsim/wpasupplicant.py
  88. +++ b/tests/hwsim/wpasupplicant.py
  89. @@ -1031,7 +1031,8 @@ class WpaSupplicant:
  90. "dpp_csign", "dpp_csign_expiry",
  91. "dpp_netaccesskey", "dpp_netaccesskey_expiry",
  92. "group_mgmt", "owe_group",
  93. - "roaming_consortium_selection" ]
  94. + "roaming_consortium_selection", "multi_ap_backhaul_sta" ]
  95. +
  96. for field in not_quoted:
  97. if field in kwargs and kwargs[field]:
  98. self.set_network(id, field, kwargs[field])