]>
git.ipfire.org Git - thirdparty/hostap.git/blob - tests/hwsim/test_dfs.py
2b7fc4a855a8f6c7aa317a7d84511b891a9e0875
2 # Copyright (c) 2013-2019, Jouni Malinen <j@w1.fi>
4 # This software may be distributed under the terms of the BSD license.
5 # See README for more details.
7 from remotehost
import remote_compatible
12 logger
= logging
.getLogger()
18 def wait_dfs_event(hapd
, event
, timeout
):
19 dfs_events
= ["DFS-RADAR-DETECTED", "DFS-NEW-CHANNEL",
20 "DFS-CAC-START", "DFS-CAC-COMPLETED",
21 "DFS-NOP-FINISHED", "AP-ENABLED", "AP-CSA-FINISHED"]
22 ev
= hapd
.wait_event(dfs_events
, timeout
=timeout
)
24 raise Exception("DFS event timed out")
25 if event
and event
not in ev
:
26 raise Exception("Unexpected DFS event: " + ev
+ " (expected: %s)" % event
)
29 def start_dfs_ap(ap
, ssid
="dfs", ht
=True, ht40
=False,
30 ht40minus
=False, vht80
=False, vht20
=False, chanlist
=None,
31 channel
=None, country
="FI", rrm_beacon_report
=False,
34 logger
.info("Starting AP " + ifname
+ " on DFS channel")
35 hapd
= hostapd
.add_ap(ap
, {}, no_enable
=True)
36 hapd
.set("ssid", ssid
)
37 hapd
.set("country_code", country
)
38 hapd
.set("ieee80211d", "1")
39 hapd
.set("ieee80211h", "1")
40 hapd
.set("hw_mode", "a")
42 hapd
.set("channel", "100")
44 hapd
.set("channel", "52")
46 hapd
.set("ieee80211n", "0")
48 hapd
.set("ht_capab", "[HT40+]")
50 hapd
.set("ht_capab", "[HT40-]")
51 hapd
.set("channel", "56")
53 hapd
.set("ieee80211ac", "1")
54 hapd
.set("vht_oper_chwidth", "1")
56 hapd
.set("vht_oper_centr_freq_seg0_idx", "106")
58 hapd
.set("vht_oper_centr_freq_seg0_idx", "58")
60 hapd
.set("ieee80211ac", "1")
61 hapd
.set("vht_oper_chwidth", "0")
62 hapd
.set("vht_oper_centr_freq_seg0_idx", "0")
64 hapd
.set("chanlist", chanlist
)
66 hapd
.set("channel", str(channel
))
68 hapd
.set("rrm_beacon_report", "1")
71 ev
= wait_dfs_event(hapd
, "DFS-CAC-START", 5)
72 if "DFS-CAC-START" not in ev
:
73 raise Exception("Unexpected DFS event: " + ev
)
75 state
= hapd
.get_status_field("state")
77 raise Exception("Unexpected interface state: " + state
)
81 def dfs_simulate_radar(hapd
):
82 logger
.info("Trigger a simulated radar event")
83 phyname
= hapd
.get_driver_status_field("phyname")
84 radar_file
= '/sys/kernel/debug/ieee80211/' + phyname
+ '/hwsim/dfs_simulate_radar'
85 with
open(radar_file
, 'w') as f
:
88 def test_dfs(dev
, apdev
):
89 """DFS CAC functionality on clear channel"""
92 hapd
= start_dfs_ap(apdev
[0], country
="US")
94 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 70)
95 if "success=1" not in ev
:
96 raise Exception("CAC failed")
97 if "freq=5260" not in ev
:
98 raise Exception("Unexpected DFS freq result")
100 ev
= hapd
.wait_event(["AP-ENABLED"], timeout
=5)
102 raise Exception("AP setup timed out")
104 state
= hapd
.get_status_field("state")
105 if state
!= "ENABLED":
106 raise Exception("Unexpected interface state")
108 freq
= hapd
.get_status_field("freq")
110 raise Exception("Unexpected frequency")
112 dev
[0].connect("dfs", key_mgmt
="NONE")
113 dev
[0].wait_regdom(country_ie
=True)
114 hwsim_utils
.test_connectivity(dev
[0], hapd
)
116 hapd
.request("RADAR DETECTED freq=5260 ht_enabled=1 chan_width=1")
117 ev
= hapd
.wait_event(["DFS-RADAR-DETECTED"], timeout
=10)
119 raise Exception("DFS-RADAR-DETECTED event not reported")
120 if "freq=5260" not in ev
:
121 raise Exception("Incorrect frequency in radar detected event: " + ev
)
122 ev
= hapd
.wait_event(["DFS-NEW-CHANNEL"], timeout
=70)
124 raise Exception("DFS-NEW-CHANNEL event not reported")
125 if "freq=5260" in ev
:
126 raise Exception("Channel did not change after radar was detected")
128 ev
= hapd
.wait_event(["AP-CSA-FINISHED"], timeout
=70)
130 raise Exception("AP-CSA-FINISHED event not reported")
131 if "freq=5260" in ev
:
132 raise Exception("Channel did not change after radar was detected(2)")
134 hwsim_utils
.test_connectivity(dev
[0], hapd
)
136 clear_regdom(hapd
, dev
)
138 def test_dfs_etsi(dev
, apdev
, params
):
139 """DFS and uniform spreading requirement for ETSI [long]"""
140 if not params
['long']:
141 raise HwsimSkip("Skip test case with long duration due to --long not specified")
144 hapd
= start_dfs_ap(apdev
[0])
146 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 70)
147 if "success=1" not in ev
:
148 raise Exception("CAC failed")
149 if "freq=5260" not in ev
:
150 raise Exception("Unexpected DFS freq result")
152 ev
= hapd
.wait_event(["AP-ENABLED"], timeout
=5)
154 raise Exception("AP setup timed out")
156 state
= hapd
.get_status_field("state")
157 if state
!= "ENABLED":
158 raise Exception("Unexpected interface state")
160 freq
= hapd
.get_status_field("freq")
162 raise Exception("Unexpected frequency")
164 dev
[0].connect("dfs", key_mgmt
="NONE")
165 dev
[0].wait_regdom(country_ie
=True)
166 hwsim_utils
.test_connectivity(dev
[0], hapd
)
168 hapd
.request("RADAR DETECTED freq=%s ht_enabled=1 chan_width=1" % freq
)
169 ev
= hapd
.wait_event(["DFS-RADAR-DETECTED"], timeout
=5)
171 raise Exception("DFS-RADAR-DETECTED event not reported")
172 if "freq=%s" % freq
not in ev
:
173 raise Exception("Incorrect frequency in radar detected event: " + ev
)
174 ev
= hapd
.wait_event(["DFS-NEW-CHANNEL"], timeout
=5)
176 raise Exception("DFS-NEW-CHANNEL event not reported")
177 if "freq=%s" % freq
in ev
:
178 raise Exception("Channel did not change after radar was detected")
180 ev
= hapd
.wait_event(["AP-CSA-FINISHED", "DFS-CAC-START"], timeout
=10)
182 raise Exception("AP-CSA-FINISHED or DFS-CAC-START event not reported")
183 if "DFS-CAC-START" in ev
:
184 # The selected new channel requires CAC
185 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 70)
186 if "success=1" not in ev
:
187 raise Exception("CAC failed")
189 ev
= hapd
.wait_event(["AP-ENABLED"], timeout
=5)
191 raise Exception("AP setup timed out")
192 ev
= hapd
.wait_event(["AP-STA-CONNECTED"], timeout
=30)
194 raise Exception("STA did not reconnect on new DFS channel")
196 # The new channel did not require CAC - try again
197 if "freq=%s" % freq
in ev
:
198 raise Exception("Channel did not change after radar was detected(2)")
200 hwsim_utils
.test_connectivity(dev
[0], hapd
)
202 clear_regdom(hapd
, dev
)
204 def test_dfs_radar1(dev
, apdev
):
205 """DFS CAC functionality with radar detected during initial CAC"""
208 hapd
= start_dfs_ap(apdev
[0])
211 dfs_simulate_radar(hapd
)
213 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 5)
215 raise Exception("Timeout on DFS aborted event")
216 if "success=0 freq=5260" not in ev
:
217 raise Exception("Unexpected DFS aborted event contents: " + ev
)
219 ev
= wait_dfs_event(hapd
, "DFS-RADAR-DETECTED", 5)
220 if "freq=5260" not in ev
:
221 raise Exception("Unexpected DFS radar detection freq")
223 ev
= wait_dfs_event(hapd
, "DFS-NEW-CHANNEL", 5)
224 if "freq=5260" in ev
:
225 raise Exception("Unexpected DFS new freq")
227 ev
= wait_dfs_event(hapd
, None, 5)
228 if "AP-ENABLED" in ev
:
229 logger
.info("Started AP on non-DFS channel")
231 logger
.info("Trying to start AP on another DFS channel")
232 if "DFS-CAC-START" not in ev
:
233 raise Exception("Unexpected DFS event: " + ev
)
234 if "freq=5260" in ev
:
235 raise Exception("Unexpected DFS CAC freq")
237 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 70)
238 if "success=1" not in ev
:
239 raise Exception("CAC failed")
240 if "freq=5260" in ev
:
241 raise Exception("Unexpected DFS freq result - radar channel")
243 ev
= hapd
.wait_event(["AP-ENABLED"], timeout
=5)
245 raise Exception("AP setup timed out")
247 state
= hapd
.get_status_field("state")
248 if state
!= "ENABLED":
249 raise Exception("Unexpected interface state")
251 freq
= hapd
.get_status_field("freq")
253 raise Exception("Unexpected frequency: " + freq
)
255 dev
[0].connect("dfs", key_mgmt
="NONE")
256 dev
[0].wait_regdom(country_ie
=True)
258 clear_regdom(hapd
, dev
)
260 def test_dfs_radar2(dev
, apdev
):
261 """DFS CAC functionality with radar detected after initial CAC"""
264 hapd
= start_dfs_ap(apdev
[0], ssid
="dfs2", ht40
=True)
266 ev
= hapd
.wait_event(["AP-ENABLED"], timeout
=70)
268 raise Exception("AP2 setup timed out")
270 dfs_simulate_radar(hapd
)
272 ev
= wait_dfs_event(hapd
, "DFS-RADAR-DETECTED", 5)
273 if "freq=5260 ht_enabled=1 chan_offset=1 chan_width=2" not in ev
:
274 raise Exception("Unexpected DFS radar detection freq from AP2")
276 ev
= wait_dfs_event(hapd
, "DFS-NEW-CHANNEL", 5)
277 if "freq=5260" in ev
:
278 raise Exception("Unexpected DFS new freq for AP2")
280 wait_dfs_event(hapd
, None, 5)
282 clear_regdom(hapd
, dev
)
285 def test_dfs_radar_on_non_dfs_channel(dev
, apdev
):
286 """DFS radar detection test code on non-DFS channel"""
287 params
= {"ssid": "radar"}
288 hapd
= hostapd
.add_ap(apdev
[0], params
)
290 hapd
.request("RADAR DETECTED freq=5260 ht_enabled=1 chan_width=1")
291 hapd
.request("RADAR DETECTED freq=2412 ht_enabled=1 chan_width=1")
293 def test_dfs_radar_chanlist(dev
, apdev
):
294 """DFS chanlist when radar is detected"""
297 hapd
= start_dfs_ap(apdev
[0], chanlist
="40 44")
300 dfs_simulate_radar(hapd
)
302 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 5)
304 raise Exception("Timeout on DFS aborted event")
305 if "success=0 freq=5260" not in ev
:
306 raise Exception("Unexpected DFS aborted event contents: " + ev
)
308 ev
= wait_dfs_event(hapd
, "DFS-RADAR-DETECTED", 5)
309 if "freq=5260" not in ev
:
310 raise Exception("Unexpected DFS radar detection freq")
312 ev
= wait_dfs_event(hapd
, "DFS-NEW-CHANNEL", 5)
313 if "freq=5200 chan=40" not in ev
and "freq=5220 chan=44" not in ev
:
314 raise Exception("Unexpected DFS new freq: " + ev
)
316 ev
= wait_dfs_event(hapd
, None, 5)
317 if "AP-ENABLED" not in ev
:
318 raise Exception("Unexpected DFS event: " + ev
)
319 dev
[0].connect("dfs", key_mgmt
="NONE")
320 dev
[0].wait_regdom(country_ie
=True)
322 clear_regdom(hapd
, dev
)
324 def test_dfs_radar_chanlist_vht80(dev
, apdev
):
325 """DFS chanlist when radar is detected and VHT80 configured"""
328 hapd
= start_dfs_ap(apdev
[0], chanlist
="36", ht40
=True, vht80
=True)
331 dfs_simulate_radar(hapd
)
333 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 5)
335 raise Exception("Timeout on DFS aborted event")
336 if "success=0 freq=5260" not in ev
:
337 raise Exception("Unexpected DFS aborted event contents: " + ev
)
339 ev
= wait_dfs_event(hapd
, "DFS-RADAR-DETECTED", 5)
340 if "freq=5260" not in ev
:
341 raise Exception("Unexpected DFS radar detection freq")
343 ev
= wait_dfs_event(hapd
, "DFS-NEW-CHANNEL", 5)
344 if "freq=5180 chan=36 sec_chan=1" not in ev
:
345 raise Exception("Unexpected DFS new freq: " + ev
)
347 ev
= wait_dfs_event(hapd
, None, 5)
348 if "AP-ENABLED" not in ev
:
349 raise Exception("Unexpected DFS event: " + ev
)
350 dev
[0].connect("dfs", key_mgmt
="NONE")
351 dev
[0].wait_regdom(country_ie
=True)
353 if hapd
.get_status_field('vht_oper_centr_freq_seg0_idx') != "42":
354 raise Exception("Unexpected seg0 idx")
356 clear_regdom(hapd
, dev
)
358 def test_dfs_radar_chanlist_vht20(dev
, apdev
):
359 """DFS chanlist when radar is detected and VHT40 configured"""
362 hapd
= start_dfs_ap(apdev
[0], chanlist
="36", vht20
=True)
365 dfs_simulate_radar(hapd
)
367 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 5)
369 raise Exception("Timeout on DFS aborted event")
370 if "success=0 freq=5260" not in ev
:
371 raise Exception("Unexpected DFS aborted event contents: " + ev
)
373 ev
= wait_dfs_event(hapd
, "DFS-RADAR-DETECTED", 5)
374 if "freq=5260" not in ev
:
375 raise Exception("Unexpected DFS radar detection freq")
377 ev
= wait_dfs_event(hapd
, "DFS-NEW-CHANNEL", 5)
378 if "freq=5180 chan=36 sec_chan=0" not in ev
:
379 raise Exception("Unexpected DFS new freq: " + ev
)
381 ev
= wait_dfs_event(hapd
, None, 5)
382 if "AP-ENABLED" not in ev
:
383 raise Exception("Unexpected DFS event: " + ev
)
384 dev
[0].connect("dfs", key_mgmt
="NONE")
385 dev
[0].wait_regdom(country_ie
=True)
387 clear_regdom(hapd
, dev
)
389 def test_dfs_radar_no_ht(dev
, apdev
):
390 """DFS chanlist when radar is detected and no HT configured"""
393 hapd
= start_dfs_ap(apdev
[0], chanlist
="36", ht
=False)
396 dfs_simulate_radar(hapd
)
398 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 5)
400 raise Exception("Timeout on DFS aborted event")
401 if "success=0 freq=5260" not in ev
:
402 raise Exception("Unexpected DFS aborted event contents: " + ev
)
404 ev
= wait_dfs_event(hapd
, "DFS-RADAR-DETECTED", 5)
405 if "freq=5260 ht_enabled=0" not in ev
:
406 raise Exception("Unexpected DFS radar detection freq: " + ev
)
408 ev
= wait_dfs_event(hapd
, "DFS-NEW-CHANNEL", 5)
409 if "freq=5180 chan=36 sec_chan=0" not in ev
:
410 raise Exception("Unexpected DFS new freq: " + ev
)
412 ev
= wait_dfs_event(hapd
, None, 5)
413 if "AP-ENABLED" not in ev
:
414 raise Exception("Unexpected DFS event: " + ev
)
415 dev
[0].connect("dfs", key_mgmt
="NONE")
416 dev
[0].wait_regdom(country_ie
=True)
418 clear_regdom(hapd
, dev
)
420 def test_dfs_radar_ht40minus(dev
, apdev
):
421 """DFS chanlist when radar is detected and HT40- configured"""
424 hapd
= start_dfs_ap(apdev
[0], chanlist
="36", ht40minus
=True)
427 dfs_simulate_radar(hapd
)
429 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 5)
431 raise Exception("Timeout on DFS aborted event")
432 if "success=0 freq=5280 ht_enabled=1 chan_offset=-1" not in ev
:
433 raise Exception("Unexpected DFS aborted event contents: " + ev
)
435 ev
= wait_dfs_event(hapd
, "DFS-RADAR-DETECTED", 5)
436 if "freq=5280 ht_enabled=1 chan_offset=-1" not in ev
:
437 raise Exception("Unexpected DFS radar detection freq: " + ev
)
439 ev
= wait_dfs_event(hapd
, "DFS-NEW-CHANNEL", 5)
440 if "freq=5180 chan=36 sec_chan=1" not in ev
:
441 raise Exception("Unexpected DFS new freq: " + ev
)
443 ev
= wait_dfs_event(hapd
, None, 5)
444 if "AP-ENABLED" not in ev
:
445 raise Exception("Unexpected DFS event: " + ev
)
446 dev
[0].connect("dfs", key_mgmt
="NONE")
447 dev
[0].wait_regdom(country_ie
=True)
448 dev
[0].request("STA_AUTOCONNECT 0")
450 clear_regdom(hapd
, dev
)
451 dev
[0].request("STA_AUTOCONNECT 1")
453 def test_dfs_ht40_minus(dev
, apdev
, params
):
454 """DFS CAC functionality on channel 104 HT40- [long]"""
455 if not params
['long']:
456 raise HwsimSkip("Skip test case with long duration due to --long not specified")
459 hapd
= start_dfs_ap(apdev
[0], ht40minus
=True, channel
=104)
461 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 70)
462 if "success=1" not in ev
:
463 raise Exception("CAC failed")
464 if "freq=5520" not in ev
:
465 raise Exception("Unexpected DFS freq result")
467 ev
= hapd
.wait_event(["AP-ENABLED"], timeout
=5)
469 raise Exception("AP setup timed out")
471 state
= hapd
.get_status_field("state")
472 if state
!= "ENABLED":
473 raise Exception("Unexpected interface state")
475 freq
= hapd
.get_status_field("freq")
477 raise Exception("Unexpected frequency")
479 dev
[0].connect("dfs", key_mgmt
="NONE", scan_freq
="5520")
480 dev
[0].wait_regdom(country_ie
=True)
481 hwsim_utils
.test_connectivity(dev
[0], hapd
)
483 clear_regdom(hapd
, dev
)
485 def test_dfs_cac_restart_on_enable(dev
, apdev
):
486 """DFS CAC interrupted and restarted"""
489 hapd
= start_dfs_ap(apdev
[0])
491 subprocess
.check_call(['ip', 'link', 'set', 'dev', hapd
.ifname
, 'down'])
492 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 5)
494 raise Exception("Timeout on DFS aborted event")
495 if "success=0 freq=5260" not in ev
:
496 raise Exception("Unexpected DFS aborted event contents: " + ev
)
498 subprocess
.check_call(['ip', 'link', 'set', 'dev', hapd
.ifname
, 'up'])
500 ev
= wait_dfs_event(hapd
, "DFS-CAC-START", 5)
501 if "DFS-CAC-START" not in ev
:
502 raise Exception("Unexpected DFS event: " + ev
)
506 clear_regdom(hapd
, dev
)
508 def test_dfs_rrm(dev
, apdev
, params
):
509 """DFS with RRM [long]"""
510 if not params
['long']:
511 raise HwsimSkip("Skip test case with long duration due to --long not specified")
514 hapd
= start_dfs_ap(apdev
[0], country
="US", rrm_beacon_report
=True)
516 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 70)
517 if "success=1" not in ev
or "freq=5260" not in ev
:
518 raise Exception("Unexpected DFS freq result")
519 ev
= hapd
.wait_event(["AP-ENABLED"], timeout
=5)
521 raise Exception("AP setup timed out")
523 dev
[0].connect("dfs", key_mgmt
="NONE", scan_freq
="5260")
524 dev
[0].wait_regdom(country_ie
=True)
526 hwsim_utils
.test_connectivity(dev
[0], hapd
)
527 addr
= dev
[0].own_addr()
528 token
= hapd
.request("REQ_BEACON " + addr
+ " " + "51000000000002ffffffffffff")
530 raise Exception("REQ_BEACON failed")
531 ev
= hapd
.wait_event(["BEACON-RESP-RX"], timeout
=10)
533 raise Exception("Beacon report response not received")
535 clear_regdom(hapd
, dev
)
537 def test_dfs_radar_vht80_downgrade(dev
, apdev
, params
):
538 """DFS channel bandwidth downgrade from VHT80 to VHT40 [long]"""
539 if not params
['long']:
540 raise HwsimSkip("Skip test case with long duration due to --long not specified")
542 # Start with 80 MHz channel 100 (5500 MHz) to find a radar
544 hapd
= start_dfs_ap(apdev
[0], chanlist
="100-140",
545 ht40
=True, vht80
=True, chan100
=True)
547 dfs_simulate_radar(hapd
)
549 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 5)
551 raise Exception("Timeout on DFS aborted event")
552 if "success=0 freq=5500" not in ev
:
553 raise Exception("Unexpected DFS aborted event contents: " + ev
)
555 ev
= wait_dfs_event(hapd
, "DFS-RADAR-DETECTED", 5)
556 if "freq=5500" not in ev
:
557 raise Exception("Unexpected DFS radar detection freq: " + ev
)
559 # The only other available 80 MHz channel in the chanlist is
560 # 116 (5580 MHz), so that will be selected next.
561 ev
= wait_dfs_event(hapd
, "DFS-NEW-CHANNEL", 5)
562 if "freq=5580 chan=116 sec_chan=1" not in ev
:
563 raise Exception("Unexpected DFS new freq: " + ev
)
565 ev
= wait_dfs_event(hapd
, None, 5)
566 if "DFS-CAC-START" not in ev
:
567 raise Exception("Unexpected DFS event: " + ev
)
568 if "freq=5580" not in ev
:
569 raise Exception("Unexpected DFS CAC freq: " + ev
)
572 dfs_simulate_radar(hapd
)
573 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 5)
575 raise Exception("Timeout on DFS aborted event (2)")
576 if "success=0 freq=5580" not in ev
:
577 raise Exception("Unexpected DFS aborted event (2) contents: " + ev
)
579 ev
= wait_dfs_event(hapd
, "DFS-RADAR-DETECTED", 5)
580 if "freq=5580" not in ev
:
581 raise Exception("Unexpected DFS radar detection (2) freq: " + ev
)
583 # No more 80 MHz channels are available, so have to downgrade to 40 MHz
584 # channels and the only remaining one is channel 132 (5660 MHz).
585 ev
= wait_dfs_event(hapd
, "DFS-NEW-CHANNEL", 5)
586 if "freq=5660 chan=132 sec_chan=1" not in ev
:
587 raise Exception("Unexpected DFS new freq (2): " + ev
)
589 ev
= wait_dfs_event(hapd
, None, 5)
590 if "DFS-CAC-START" not in ev
:
591 raise Exception("Unexpected DFS event: " + ev
)
592 if "freq=5660" not in ev
:
593 raise Exception("Unexpected DFS CAC freq (2): " + ev
)
595 ev
= wait_dfs_event(hapd
, "DFS-CAC-COMPLETED", 70)
596 if "success=1" not in ev
:
597 raise Exception("CAC failed")
598 if "freq=5660" not in ev
:
599 raise Exception("Unexpected DFS freq result: " + ev
)
601 ev
= wait_dfs_event(hapd
, None, 5)
602 if "AP-ENABLED" not in ev
:
603 raise Exception("Unexpected DFS event: " + ev
)
604 dev
[0].connect("dfs", key_mgmt
="NONE", scan_freq
="5660")
605 dev
[0].wait_regdom(country_ie
=True)
606 sig
= dev
[0].request("SIGNAL_POLL").splitlines()
607 if "FREQUENCY=5660" not in sig
or "WIDTH=40 MHz" not in sig
:
608 raise Exception("Unexpected SIGNAL_POLL value: " + str(sig
))
610 clear_regdom(hapd
, dev
)