tests: Add P2P channel selection test cases with world roaming
authorJouni Malinen <j@w1.fi>
Sat, 26 Oct 2013 18:02:42 +0000 (21:02 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 26 Oct 2013 20:49:54 +0000 (23:49 +0300)
This verifies that passive scan 5 GHz channels are not selected with and
without p2p_add_cli_chan=1.

Signed-hostap: Jouni Malinen <j@w1.fi>

tests/hwsim/test_p2p_grpform.py

index 19f5e06..90844c7 100644 (file)
@@ -268,3 +268,61 @@ def test_grpform_no_go_freq_conflict(dev):
     go_neg_pin_authorized(i_dev=dev[0], i_intent=0, i_freq=2422,
                           r_dev=dev[1], r_intent=15,
                           expect_failure=True, i_go_neg_status=7)
+
+def test_grpform_no_5ghz_world_roaming(dev):
+    """P2P group formation with world roaming regulatory"""
+    [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0,
+                                           r_dev=dev[1], r_intent=15,
+                                           test_data=False)
+    check_grpform_results(i_res, r_res)
+    if int(i_res['freq']) > 4000:
+        raise Exception("Unexpected channel - did not follow world roaming rules")
+    remove_group(dev[0], dev[1])
+
+def test_grpform_no_5ghz_add_cli(dev):
+    """P2P group formation with passive scan 5 GHz and p2p_add_cli_chan=1"""
+    dev[0].request("SET p2p_add_cli_chan 1")
+    dev[1].request("SET p2p_add_cli_chan 1")
+    [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0,
+                                           r_dev=dev[1], r_intent=14,
+                                           test_data=False)
+    check_grpform_results(i_res, r_res)
+    if int(i_res['freq']) > 4000:
+        raise Exception("Unexpected channel - did not follow world roaming rules")
+    remove_group(dev[0], dev[1])
+
+def test_grpform_no_5ghz_add_cli2(dev):
+    """P2P group formation with passive scan 5 GHz and p2p_add_cli_chan=1 (reverse)"""
+    dev[0].request("SET p2p_add_cli_chan 1")
+    dev[1].request("SET p2p_add_cli_chan 1")
+    [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=14,
+                                           r_dev=dev[1], r_intent=0,
+                                           test_data=False)
+    check_grpform_results(i_res, r_res)
+    if int(i_res['freq']) > 4000:
+        raise Exception("Unexpected channel - did not follow world roaming rules")
+    remove_group(dev[0], dev[1])
+
+def test_grpform_no_5ghz_add_cli3(dev):
+    """P2P group formation with passive scan 5 GHz and p2p_add_cli_chan=1 (intent 15)"""
+    dev[0].request("SET p2p_add_cli_chan 1")
+    dev[1].request("SET p2p_add_cli_chan 1")
+    [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0,
+                                           r_dev=dev[1], r_intent=15,
+                                           test_data=False)
+    check_grpform_results(i_res, r_res)
+    if int(i_res['freq']) > 4000:
+        raise Exception("Unexpected channel - did not follow world roaming rules")
+    remove_group(dev[0], dev[1])
+
+def test_grpform_no_5ghz_add_cli4(dev):
+    """P2P group formation with passive scan 5 GHz and p2p_add_cli_chan=1 (reverse; intent 15)"""
+    dev[0].request("SET p2p_add_cli_chan 1")
+    dev[1].request("SET p2p_add_cli_chan 1")
+    [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
+                                           r_dev=dev[1], r_intent=0,
+                                           test_data=False)
+    check_grpform_results(i_res, r_res)
+    if int(i_res['freq']) > 4000:
+        raise Exception("Unexpected channel - did not follow world roaming rules")
+    remove_group(dev[0], dev[1])