~indicator-network-developers/wpasupplicant/trunk

« back to all changes in this revision

Viewing changes to tests/hwsim/test_sigma_dut.py

  • Committer: Jouni Malinen
  • Author(s): Jouni Malinen
  • Date: 2020-05-25 20:24:55 UTC
  • Revision ID: git-v1:b96a3bd5dfe21656a9fe2d4fce0f428da483d7fe
tests: sigma_dut controlled STA using OCV

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>

Show diffs side-by-side

added added

removed removed

Lines of Context:
4587
4587
            sigma_dut_cmd_check("ap_reset_default")
4588
4588
        finally:
4589
4589
            stop_sigma_dut(sigma)
 
4590
 
 
4591
def test_sigma_dut_ocv(dev, apdev):
 
4592
    """sigma_dut controlled STA using OCV"""
 
4593
    if "SAE" not in dev[0].get_capability("auth_alg"):
 
4594
        raise HwsimSkip("SAE not supported")
 
4595
 
 
4596
    ifname = dev[0].ifname
 
4597
    sigma = start_sigma_dut(ifname)
 
4598
 
 
4599
    try:
 
4600
        ssid = "test-sae"
 
4601
        params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
 
4602
        params['wpa_key_mgmt'] = 'SAE'
 
4603
        params["ieee80211w"] = "2"
 
4604
        params['sae_groups'] = '19'
 
4605
        params['ocv'] = '1'
 
4606
        hapd = hostapd.add_ap(apdev[0], params)
 
4607
 
 
4608
        sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,WPA3" % ifname)
 
4609
        sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
 
4610
        sigma_dut_cmd_check("sta_set_wireless,interface,%s,program,WPA3,ocvc,1" % ifname)
 
4611
        sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,keymgmttype,wpa2" % (ifname, "test-sae", "12345678"))
 
4612
        sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae"),
 
4613
                            timeout=10)
 
4614
        sigma_dut_wait_connected(ifname)
 
4615
 
 
4616
        sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,WPA3" % ifname)
 
4617
        sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
 
4618
        sigma_dut_cmd_check("sta_set_wireless,interface,%s,program,WPA3,ocvc,1" % ifname)
 
4619
        sigma_dut_cmd_check("sta_set_rfeature,interface,%s,prog,WPA3,OCIFrameType,eapolM2,OCIChannel,11" % ifname)
 
4620
        sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,keymgmttype,wpa2" % (ifname, "test-sae", "12345678"))
 
4621
        sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae"))
 
4622
        ev = hapd.wait_event(["OCV-FAILURE"], timeout=1)
 
4623
        if ev is None:
 
4624
            raise Exception("OCV failure for EAPOL-Key msg 2/4 not reported")
 
4625
        if "addr=" + dev[0].own_addr() not in ev:
 
4626
            raise Exception("Unexpected OCV failure addr: " + ev)
 
4627
        if "frame=eapol-key-m2" not in ev:
 
4628
            raise Exception("Unexpected OCV failure frame: " + ev)
 
4629
        if "error=primary channel mismatch" not in ev:
 
4630
            raise Exception("Unexpected OCV failure error: " + ev)
 
4631
 
 
4632
        sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
 
4633
    finally:
 
4634
        stop_sigma_dut(sigma)