tests: hs20-osu-client testing for PPS MO parsing

This adds a mechanism to allow hs20-osu-client set_pps command to be
tested with PPS MO files.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2018-06-21 19:18:54 +03:00 committed by Jouni Malinen
parent de3885fcc7
commit e6f8042d17
4 changed files with 158 additions and 0 deletions

47
tests/hwsim/devdetail.xml Normal file
View file

@ -0,0 +1,47 @@
<DevDetail xmlns="urn:oma:mo:oma-dm-devdetail:1.0">
<Ext>
<org.wi-fi>
<Wi-Fi>
<EAPMethodList>
<EAPMethod1>
<EAPType>13</EAPType>
</EAPMethod1>
<EAPMethod2>
<EAPType>21</EAPType>
<InnerMethod>MS-CHAP-V2</InnerMethod>
</EAPMethod2>
<EAPMethod3>
<EAPType>18</EAPType>
</EAPMethod3>
<EAPMethod4>
<EAPType>23</EAPType>
</EAPMethod4>
<EAPMethod5>
<EAPType>50</EAPType>
</EAPMethod5>
</EAPMethodList>
<ManufacturingCertificate>false</ManufacturingCertificate>
<Wi-FiMACAddress>020102030405</Wi-FiMACAddress>
<IMSI>310026000000000</IMSI>
<IMEI_MEID>imei:490123456789012</IMEI_MEID>
<ClientTriggerRedirectURI>http://localhost:12345/</ClientTriggerRedirectURI>
<Ops>
<launchBrowserToURI></launchBrowserToURI>
<negotiateClientCertTLS></negotiateClientCertTLS>
<getCertificate></getCertificate>
</Ops>
</Wi-Fi>
</org.wi-fi>
</Ext>
<URI>
<MaxDepth>0</MaxDepth>
<MaxTotLen>0</MaxTotLen>
<MaxSegLen>0</MaxSegLen>
</URI>
<DevType>MobilePhone</DevType>
<OEM>Manufacturer</OEM>
<FwV>1.0</FwV>
<SwV>1.0</SwV>
<HwV>1.0</HwV>
<LrgObj>false</LrgObj>
</DevDetail>

7
tests/hwsim/devinfo.xml Normal file
View file

@ -0,0 +1,7 @@
<DevInfo xmlns="urn:oma:mo:oma-dm-devinfo:1.0">
<DevId>urn:Example:HS20-station:123456</DevId>
<Man>Manufacturer</Man>
<Mod>HS20-station</Mod>
<DmV>1.2</DmV>
<Lang>en</Lang>
</DevInfo>

62
tests/hwsim/pps-mo-1.xml Normal file
View file

@ -0,0 +1,62 @@
<PerProviderSubscription>
<UpdateIdentifier>1</UpdateIdentifier>
<Cred01>
<Policy>
<PreferredRoamingPartnerList>
<RP01>
<FQDN_Match>another.example.org,includeSubdomains</FQDN_Match>
<Priority>10</Priority>
</RP01>
<RP02>
<FQDN_Match>example.com,exactMatch</FQDN_Match>
<Priority>20</Priority>
</RP02>
</PreferredRoamingPartnerList>
<PolicyUpdate>
<UpdateInterval>10</UpdateInterval>
<UpdateMethod>SPP-ClientInitiated</UpdateMethod>
<Restriction>Unrestricted</Restriction>
<URI>https://policy.example.com/run</URI>
<TrustRoot>
<CertURL>http://example.com/policy-root.der</CertURL>
<CertSHA256Fingerprint>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</CertSHA256Fingerprint>
</TrustRoot>
</PolicyUpdate>
</Policy>
<CredentialPriority>1</CredentialPriority>
<AAAServerTrustRoot>
<Root1>
<CertURL>http://example.com/cacert.der</CertURL>
<CertSHA256Fingerprint>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</CertSHA256Fingerprint>
</Root1>
</AAAServerTrustRoot>
<SubscriptionUpdate>
<UpdateInterval>4294967295</UpdateInterval>
<UpdateMethod>SPP-ClientInitiated</UpdateMethod>
<Restriction>HomeSP</Restriction>
<URI>https://remediation.example.com/run</URI>
<TrustRoot>
<CertURL>http://example.com/subscription-root.der</CertURL>
<CertSHA256Fingerprint>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</CertSHA256Fingerprint>
</TrustRoot>
</SubscriptionUpdate>
<HomeSP>
<FriendlyName>Example Operator</FriendlyName>
<FQDN>w1.fi</FQDN>
<RoamingConsortiumOI>010203040506</RoamingConsortiumOI>
</HomeSP>
<Credential>
<CreationDate>2012-12-01T12:00:00Z</CreationDate>
<UsernamePassword>
<Username>hs20-test</Username>
<Password>cGFzc3dvcmQ=</Password>
<MachineManaged>TRUE</MachineManaged>
<EAPMethod>
<EAPType>21</EAPType>
<InnerMethod>MS-CHAP-V2</InnerMethod>
</EAPMethod>
</UsernamePassword>
<Realm>w1.fi</Realm>
</Credential>
</Cred01>
</PerProviderSubscription>

View file

@ -0,0 +1,42 @@
# Hotspot 2.0 PPS MO tests
# Copyright (c) 2018, The Linux Foundation
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import os.path
import subprocess
import hostapd
from utils import HwsimSkip
from test_ap_hs20 import hs20_ap_params, interworking_select, interworking_connect, check_sp_type
from test_ap_eap import check_eap_capa
def check_hs20_osu_client():
if not os.path.exists("../../hs20/client/hs20-osu-client"):
raise HwsimSkip("No hs20-osu-client available")
def set_pps(pps_mo):
res = subprocess.check_output(["../../hs20/client/hs20-osu-client",
"set_pps", pps_mo])
logger.info("set_pps result: " + res)
def test_hs20_pps_mo_1(dev, apdev):
"""Hotspot 2.0 PPS MO with username/password credential"""
check_hs20_osu_client()
check_eap_capa(dev[0], "MSCHAPV2")
bssid = apdev[0]['bssid']
params = hs20_ap_params()
params['hessid'] = bssid
params['nai_realm'] = [ "0,w1.fi,13[5:6],21[2:4][5:7]",
"0,another.example.com" ]
params['domain_name'] = "w1.fi"
hapd = hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
set_pps("pps-mo-1.xml")
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
check_sp_type(dev[0], "home")