def test_ap_country(dev, apdev):
    'WPA2-PSK AP setting country code and using 5 GHz band'
    try:
        hapd = None
        bssid = apdev[0]['bssid']
        ssid = 'test-wpa2-psk'
        passphrase = 'qwertyuiop'
        params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
        params['country_code'] = 'FI'
        params['ieee80211d'] = '1'
        params['hw_mode'] = 'a'
        params['channel'] = '36'
        hapd = hostapd.add_ap(apdev[0], params)
        dev[0].connect(ssid, psk=passphrase, scan_freq='5180')
        hwsim_utils.test_connectivity(dev[0], hapd)
    finally:
        if hapd:
            hapd.request('DISABLE')
        dev[0].disconnect_and_stop_scan()
        hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00'])
        dev[0].wait_event(['CTRL-EVENT-REGDOM-CHANGE'], timeout=0.5)
        dev[0].flush_scan_cache()
WPA2-PSK AP setting country code and using 5 GHz band
def test_ap_country(dev, apdev):
    
    try:
        hapd = None
        bssid = apdev[0]['bssid']
        ssid = 'test-wpa2-psk'
        passphrase = 'qwertyuiop'
        params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
        params['country_code'] = 'FI'
        params['ieee80211d'] = '1'
        params['hw_mode'] = 'a'
        params['channel'] = '36'
        hapd = hostapd.add_ap(apdev[0], params)
        dev[0].connect(ssid, psk=passphrase, scan_freq='5180')
        hwsim_utils.test_connectivity(dev[0], hapd)
    finally:
        if hapd:
            hapd.request('DISABLE')
        dev[0].disconnect_and_stop_scan()
        hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00'])
        dev[0].wait_event(['CTRL-EVENT-REGDOM-CHANGE'], timeout=0.5)
        dev[0].flush_scan_cache()