]>
Commit | Line | Data |
---|---|---|
41af1305 JM |
1 | # P2P concurrency test cases |
2 | # Copyright (c) 2013, Jouni Malinen <j@w1.fi> | |
3 | # | |
4 | # This software may be distributed under the terms of the BSD license. | |
5 | # See README for more details. | |
6 | ||
7 | import logging | |
8 | logger = logging.getLogger() | |
9 | import time | |
10 | ||
11 | import hwsim_utils | |
12 | import hostapd | |
13 | from test_p2p_grpform import go_neg_pin_authorized | |
14 | from test_p2p_grpform import go_neg_pbc | |
15 | from test_p2p_grpform import check_grpform_results | |
16 | from test_p2p_grpform import remove_group | |
17 | ||
18 | def test_concurrent_autogo(dev, apdev): | |
19 | """Concurrent P2P autonomous GO""" | |
20 | logger.info("Connect to an infrastructure AP") | |
21 | hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-open" }) | |
22 | dev[0].connect("test-open", key_mgmt="NONE", scan_freq="2412") | |
23 | hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) | |
24 | ||
25 | logger.info("Start a P2P group while associated to an AP") | |
26 | dev[0].request("SET p2p_no_group_iface 0") | |
27 | dev[0].p2p_start_go() | |
28 | pin = dev[1].wps_read_pin() | |
29 | dev[0].p2p_go_authorize_client(pin) | |
30 | dev[1].p2p_connect_group(dev[0].p2p_dev_addr(), pin, timeout=60, | |
31 | social=True) | |
32 | hwsim_utils.test_connectivity_p2p(dev[0], dev[1]) | |
33 | dev[0].remove_group() | |
34 | dev[1].wait_go_ending_session() | |
35 | ||
36 | logger.info("Confirm AP connection after P2P group removal") | |
37 | hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) | |
38 | ||
39 | def test_concurrent_p2pcli(dev, apdev): | |
40 | """Concurrent P2P client join""" | |
41 | logger.info("Connect to an infrastructure AP") | |
42 | hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-open" }) | |
43 | dev[0].connect("test-open", key_mgmt="NONE", scan_freq="2412") | |
44 | hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) | |
45 | ||
46 | logger.info("Join a P2P group while associated to an AP") | |
47 | dev[0].request("SET p2p_no_group_iface 0") | |
48 | dev[1].p2p_start_go(freq=2412) | |
49 | pin = dev[0].wps_read_pin() | |
50 | dev[1].p2p_go_authorize_client(pin) | |
51 | dev[0].p2p_connect_group(dev[1].p2p_dev_addr(), pin, timeout=60, | |
52 | social=True) | |
53 | hwsim_utils.test_connectivity_p2p(dev[0], dev[1]) | |
54 | dev[1].remove_group() | |
55 | dev[0].wait_go_ending_session() | |
56 | ||
57 | logger.info("Confirm AP connection after P2P group removal") | |
58 | hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) | |
59 | ||
60 | def test_concurrent_grpform_go(dev, apdev): | |
61 | """Concurrent P2P group formation to become GO""" | |
62 | logger.info("Connect to an infrastructure AP") | |
63 | hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-open" }) | |
64 | dev[0].connect("test-open", key_mgmt="NONE", scan_freq="2412") | |
65 | hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) | |
66 | ||
67 | logger.info("Form a P2P group while associated to an AP") | |
68 | dev[0].request("SET p2p_no_group_iface 0") | |
69 | ||
70 | [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, | |
71 | r_dev=dev[1], r_intent=0) | |
72 | check_grpform_results(i_res, r_res) | |
73 | remove_group(dev[0], dev[1]) | |
74 | ||
75 | logger.info("Confirm AP connection after P2P group removal") | |
76 | hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) | |
77 | ||
78 | def test_concurrent_grpform_cli(dev, apdev): | |
79 | """Concurrent P2P group formation to become P2P Client""" | |
80 | logger.info("Connect to an infrastructure AP") | |
81 | hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-open" }) | |
82 | dev[0].connect("test-open", key_mgmt="NONE", scan_freq="2412") | |
83 | hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) | |
84 | ||
85 | logger.info("Form a P2P group while associated to an AP") | |
86 | dev[0].request("SET p2p_no_group_iface 0") | |
87 | ||
88 | [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0, | |
89 | r_dev=dev[1], r_intent=15) | |
90 | check_grpform_results(i_res, r_res) | |
91 | remove_group(dev[0], dev[1]) | |
92 | ||
93 | logger.info("Confirm AP connection after P2P group removal") | |
94 | hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) | |
95 | ||
96 | def test_concurrent_grpform_while_connecting(dev, apdev): | |
97 | """Concurrent P2P group formation while connecting to an AP""" | |
98 | logger.info("Start connection to an infrastructure AP") | |
99 | hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-open" }) | |
100 | dev[0].connect("test-open", key_mgmt="NONE", wait_connect=False) | |
101 | ||
102 | logger.info("Form a P2P group while connecting to an AP") | |
103 | dev[0].request("SET p2p_no_group_iface 0") | |
104 | ||
105 | [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_freq=2412, | |
106 | r_dev=dev[1], r_freq=2412) | |
107 | check_grpform_results(i_res, r_res) | |
108 | remove_group(dev[0], dev[1]) | |
109 | ||
110 | logger.info("Confirm AP connection after P2P group removal") | |
111 | hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) | |
112 | ||
113 | def test_concurrent_grpform_while_connecting2(dev, apdev): | |
114 | """Concurrent P2P group formation while connecting to an AP (2)""" | |
115 | logger.info("Start connection to an infrastructure AP") | |
116 | hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-open" }) | |
117 | dev[0].connect("test-open", key_mgmt="NONE", wait_connect=False) | |
118 | ||
119 | logger.info("Form a P2P group while connecting to an AP") | |
120 | dev[0].request("SET p2p_no_group_iface 0") | |
121 | ||
122 | [i_res, r_res] = go_neg_pbc(i_dev=dev[0], i_intent=15, i_freq=2412, | |
123 | r_dev=dev[1], r_intent=0, r_freq=2412) | |
124 | check_grpform_results(i_res, r_res) | |
125 | remove_group(dev[0], dev[1]) | |
126 | ||
127 | logger.info("Confirm AP connection after P2P group removal") | |
128 | dev[0].wait_completed() | |
129 | hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) | |
130 | ||
131 | def test_concurrent_grpform_while_connecting3(dev, apdev): | |
132 | """Concurrent P2P group formation while connecting to an AP (3)""" | |
133 | logger.info("Start connection to an infrastructure AP") | |
134 | hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-open" }) | |
135 | dev[0].connect("test-open", key_mgmt="NONE", wait_connect=False) | |
136 | ||
137 | logger.info("Form a P2P group while connecting to an AP") | |
138 | dev[0].request("SET p2p_no_group_iface 0") | |
139 | ||
140 | [i_res, r_res] = go_neg_pbc(i_dev=dev[1], i_intent=15, i_freq=2412, | |
141 | r_dev=dev[0], r_intent=0, r_freq=2412) | |
142 | check_grpform_results(i_res, r_res) | |
143 | remove_group(dev[0], dev[1]) | |
144 | ||
145 | logger.info("Confirm AP connection after P2P group removal") | |
146 | dev[0].wait_completed() | |
147 | hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) |