tests: Dynamic radio in p2ps_channel_sta_connected_disallow_freq_mcc

Use a dynamic HWSimRadio in p2ps_channel_sta_connected_disallow_freq_mcc
to allow MCC test case to be executed in default setting (MCC disabled
for the default radios).

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-10-11 20:49:14 +03:00
parent 3392503eb0
commit fd8f443247

View file

@ -17,6 +17,7 @@ from test_p2p_grpform import check_grpform_results
from test_p2p_grpform import remove_group from test_p2p_grpform import remove_group
from test_p2p_persistent import go_neg_pin_authorized_persistent from test_p2p_persistent import go_neg_pin_authorized_persistent
from utils import HwsimSkip from utils import HwsimSkip
from hwsim import HWSimRadio
# Dev[0] -> Advertiser # Dev[0] -> Advertiser
# Dev[1] -> Seeker # Dev[1] -> Seeker
@ -1262,26 +1263,31 @@ def test_p2ps_channel_sta_connected_disallow_freq(dev, apdev):
def test_p2ps_channel_sta_connected_disallow_freq_mcc(dev, apdev): def test_p2ps_channel_sta_connected_disallow_freq_mcc(dev, apdev):
"""P2PS connection with P2PS method - one station and disallow freqs with mcc""" """P2PS connection with P2PS method - one station and disallow freqs with mcc"""
if dev[0].get_mcc() == 1: with HWSimRadio(n_channels=2) as (radio, iface):
raise HwsimSkip('Skip due to MCC not being enabled') wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add(iface)
if wpas.get_mcc() < 2:
raise Exception("New radio does not support MCC")
set_no_group_iface(dev[0], 0) set_no_group_iface(dev[0], 0)
set_no_group_iface(dev[1], 0) set_no_group_iface(wpas, 0)
try: try:
dev[0].global_request("P2P_SET disallow_freq 2437") dev[0].global_request("P2P_SET disallow_freq 2437")
hapd1 = hostapd.add_ap(apdev[0]['ifname'], hapd1 = hostapd.add_ap(apdev[0]['ifname'],
{ "ssid": 'bss-channel-6', "channel": '6' }) { "ssid": 'bss-channel-6', "channel": '6' })
dev[1].connect("bss-channel-6", key_mgmt="NONE", scan_freq="2437") wpas.connect("bss-channel-6", key_mgmt="NONE", scan_freq="2437")
(grp_ifname0, grp_ifname1, ifnames) = p2ps_connect_p2ps_method(dev, keep_group=True) tmpdev = [ dev[0], wpas ]
(grp_ifname0, grp_ifname1, ifnames) = p2ps_connect_p2ps_method(tmpdev, keep_group=True)
freq = dev[0].get_group_status_field('freq'); freq = dev[0].get_group_status_field('freq');
if freq == '2437': if freq == '2437':
raise Exception('Unexpected frequency=2437') raise Exception('Unexpected frequency=2437')
finally: finally:
remove_group(dev[0], dev[1]) remove_group(dev[0], wpas)
dev[0].global_request("P2P_SET disallow_freq ") dev[0].global_request("P2P_SET disallow_freq ")
dev[0].global_request("P2P_SERVICE_DEL asp all") dev[0].global_request("P2P_SERVICE_DEL asp all")