aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2016-11-16 18:32:42 (GMT)
committerJouni Malinen <j@w1.fi>2016-11-17 14:00:59 (GMT)
commit8e5c2c208ecb6cc1de4cea19e9c32dc3a3ba47e0 (patch)
tree31b0b7f7180cda600191e6b76894da7fe1b76872 /tests
parent4051dd86672d571eed66c067edd8e788e348c682 (diff)
downloadhostap-8e5c2c208ecb6cc1de4cea19e9c32dc3a3ba47e0.zip
hostap-8e5c2c208ecb6cc1de4cea19e9c32dc3a3ba47e0.tar.gz
hostap-8e5c2c208ecb6cc1de4cea19e9c32dc3a3ba47e0.tar.bz2
tests: GAS/ANQP and Venue URL
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_gas.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/hwsim/test_gas.py b/tests/hwsim/test_gas.py
index 2ac610f..6e73163 100644
--- a/tests/hwsim/test_gas.py
+++ b/tests/hwsim/test_gas.py
@@ -1465,3 +1465,56 @@ def test_gas_failures(dev, apdev):
wpas.request("SET preassoc_mac_addr 0")
if ev is None:
raise Exception("No random MAC address error seen")
+
+def test_gas_anqp_venue_url(dev, apdev):
+ """GAS/ANQP and Venue URL"""
+ venue_group = 1
+ venue_type = 13
+ venue_info = struct.pack('BB', venue_group, venue_type)
+ lang1 = "eng"
+ name1= "Example venue"
+ lang2 = "fin"
+ name2 = "Esimerkkipaikka"
+ venue1 = struct.pack('B', len(lang1 + name1)) + lang1 + name1
+ venue2 = struct.pack('B', len(lang2 + name2)) + lang2 + name2
+ venue_name = binascii.hexlify(venue_info + venue1 + venue2)
+
+ url1 = "http://example.com/venue"
+ url2 = "https://example.org/venue-info/"
+ duple1 = struct.pack('BB', 1 + len(url1), 0)
+ duple2 = struct.pack('BB', 1 + len(url2), 1)
+ venue_url = binascii.hexlify(duple1 + duple2)
+
+ params = { "ssid": "gas/anqp",
+ "interworking": "1",
+ "venue_group": str(venue_group),
+ "venue_type": str(venue_type),
+ "venue_name": [ lang1 + ":" + name1, lang2 + ":" + name2 ],
+ "anqp_elem": [ "277:" + venue_url ] }
+ hapd = hostapd.add_ap(apdev[0], params)
+ bssid = apdev[0]['bssid']
+
+ dev[0].scan_for_bss(bssid, freq="2412", force_scan=True)
+ if "OK" not in dev[0].request("ANQP_GET " + bssid + " 257,258,277"):
+ raise Exception("ANQP_GET command failed")
+
+ ev = dev[0].wait_event(["GAS-QUERY-DONE"], timeout=10)
+ if ev is None:
+ raise Exception("GAS query timed out")
+
+ bss = dev[0].get_bss(bssid)
+
+ if 'anqp_venue_name' not in bss:
+ raise Exception("Venue Name ANQP-element not seen")
+ if bss['anqp_venue_name'] != venue_name:
+ raise Exception("Unexpected Venue Name ANQP-element value: " + bss['anqp_venue_name'])
+ if 'anqp[277]' not in bss:
+ raise Exception("Venue URL ANQP-element not seen")
+ if bss['anqp[277]'] != venue_url:
+ raise Exception("Unexpected Venue URL ANQP-element value: " + bss['anqp[277]'])
+
+ if 'anqp_capability_list' not in bss:
+ raise Exception("Capability List ANQP-element not seen")
+ ids = struct.pack('<HHH', 257, 258, 277)
+ if not bss['anqp_capability_list'].startswith(binascii.hexlify(ids)):
+ raise Exception("Unexpected Capability List ANQP-element value: " + bss['anqp_capability_list'])