tests: Pass full apdev to add_ap() function (1)
[mech_eap.git] / tests / hwsim / test_p2p_channel.py
index 78e85d2..5b41c14 100644 (file)
@@ -198,8 +198,8 @@ def test_autogo_following_bss(dev, apdev):
 
     channels = { 3 : "2422", 5 : "2432", 9 : "2452" }
     for key in channels:
-        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid" : 'ap-test',
-                                                    "channel" : str(key) })
+        hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test',
+                                          "channel" : str(key) })
         dev[0].connect("ap-test", key_mgmt="NONE",
                        scan_freq=str(channels[key]))
         res_go = autogo(dev[0])
@@ -215,7 +215,7 @@ def test_go_neg_with_bss_connected(dev, apdev):
     dev[1].flush_scan_cache()
     dev[0].request("SET p2p_no_group_iface 0")
 
-    hapd = hostapd.add_ap(apdev[0]['ifname'],
+    hapd = hostapd.add_ap(apdev[0],
                           { "ssid": 'bss-2.4ghz', "channel": '5' })
     dev[0].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2432")
     #dev[0] as GO
@@ -263,8 +263,8 @@ def test_autogo_with_bss_on_disallowed_chan(dev, apdev):
            raise Exception("New radio does not support MCC")
 
         try:
-            hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
-                                                        "channel": '1' })
+            hapd = hostapd.add_ap(apdev[0], { "ssid": 'bss-2.4ghz',
+                                              "channel": '1' })
             wpas.request("P2P_SET disallow_freq 2412")
             wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
             res = autogo(wpas)
@@ -287,7 +287,7 @@ def test_go_neg_with_bss_on_disallowed_chan(dev, apdev):
            raise Exception("New radio does not support MCC")
 
         try:
-            hapd = hostapd.add_ap(apdev[0]['ifname'],
+            hapd = hostapd.add_ap(apdev[0],
                                   { "ssid": 'bss-2.4ghz', "channel": '1' })
             # make sure PBC overlap from old test cases is not maintained
             dev[1].flush_scan_cache()
@@ -340,7 +340,7 @@ def test_autogo_force_diff_channel(dev, apdev):
 
         wpas.request("SET p2p_no_group_iface 0")
 
-        hapd = hostapd.add_ap(apdev[0]['ifname'],
+        hapd = hostapd.add_ap(apdev[0],
                               {"ssid" : 'ap-test', "channel" : '1'})
         wpas.connect("ap-test", key_mgmt = "NONE", scan_freq = "2412")
         wpas.dump_monitor()
@@ -368,7 +368,7 @@ def test_go_neg_forced_freq_diff_than_bss_freq(dev, apdev):
 
         wpas.request("SET p2p_no_group_iface 0")
 
-        hapd = hostapd.add_ap(apdev[0]['ifname'],
+        hapd = hostapd.add_ap(apdev[0],
                               { "country_code": 'US',
                                 "ssid": 'bss-5ghz', "hw_mode": 'a',
                                 "channel": '40' })
@@ -410,8 +410,8 @@ def test_go_pref_chan_bss_on_diff_chan(dev, apdev):
     dev[0].request("SET p2p_no_group_iface 0")
 
     try:
-        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
-                                                    "channel": '1' })
+        hapd = hostapd.add_ap(apdev[0], { "ssid": 'bss-2.4ghz',
+                                          "channel": '1' })
         dev[0].request("SET p2p_pref_chan 81:2")
         dev[0].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
         res = autogo(dev[0])
@@ -433,8 +433,8 @@ def test_go_pref_chan_bss_on_disallowed_chan(dev, apdev):
         wpas.request("SET p2p_no_group_iface 0")
 
         try:
-            hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
-                                                        "channel": '1' })
+            hapd = hostapd.add_ap(apdev[0], { "ssid": 'bss-2.4ghz',
+                                              "channel": '1' })
             wpas.request("P2P_SET disallow_freq 2412")
             wpas.request("SET p2p_pref_chan 81:2")
             wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
@@ -597,7 +597,7 @@ def test_p2p_listen_chan_optimize(dev, apdev):
         channel = "1" if lfreq != '2412' else "6"
         freq = "2412" if lfreq != '2412' else "2437"
         params = { "ssid": "test-open", "channel": channel }
-        hapd = hostapd.add_ap(apdev[0]['ifname'], params)
+        hapd = hostapd.add_ap(apdev[0], params)
 
         id = wpas.connect("test-open", key_mgmt="NONE", scan_freq=freq)
         wpas.p2p_listen()
@@ -738,8 +738,8 @@ def _test_p2p_go_move_active(dev, apdev):
     dev[0].request("SET p2p_no_group_iface 0")
     try:
         dev[0].global_request("P2P_SET disallow_freq 2430-6000")
-        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid" : 'ap-test',
-                                                    "channel" : '11' })
+        hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test',
+                                          "channel" : '11' })
         dev[0].connect("ap-test", key_mgmt="NONE",
                        scan_freq="2462")
 
@@ -785,8 +785,8 @@ def _test_p2p_go_move_scm(dev, apdev):
     dev[0].request("SET p2p_no_group_iface 0")
     try:
         dev[0].global_request("P2P_SET disallow_freq 2430-6000")
-        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid" : 'ap-test',
-                                                    "channel" : '11' })
+        hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test',
+                                          "channel" : '11' })
         dev[0].connect("ap-test", key_mgmt="NONE",
                        scan_freq="2462")
 
@@ -849,8 +849,8 @@ def _test_p2p_go_move_scm_peer_supports(dev, apdev):
         if freq < 5000:
             raise Exception("Unexpected channel %d MHz - did not follow 5 GHz preference" % freq)
 
-        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid" : 'ap-test',
-                                                    "channel" : '11' })
+        hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test',
+                                          "channel" : '11' })
         logger.info('Connecting client to to an AP on channel 11');
         dev[0].connect("ap-test", key_mgmt="NONE",
                        scan_freq="2462")
@@ -899,8 +899,8 @@ def _test_p2p_go_move_scm_peer_does_not_support(dev, apdev):
         if freq < 5000:
             raise Exception("Unexpected channel %d MHz - did not follow 5 GHz preference" % freq)
 
-        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid" : 'ap-test',
-                                                    "channel" : '11' })
+        hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test',
+                                          "channel" : '11' })
         logger.info('Connecting client to to an AP on channel 11');
         dev[0].connect("ap-test", key_mgmt="NONE",
                        scan_freq="2462")
@@ -933,8 +933,8 @@ def _test_p2p_go_move_scm_multi(dev, apdev):
     dev[0].request("SET p2p_no_group_iface 0")
     try:
         dev[0].global_request("P2P_SET disallow_freq 2430-6000")
-        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid" : 'ap-test-1',
-                                                    "channel" : '11' })
+        hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test-1',
+                                          "channel" : '11' })
         dev[0].connect("ap-test-1", key_mgmt="NONE",
                        scan_freq="2462")
 
@@ -966,8 +966,8 @@ def _test_p2p_go_move_scm_multi(dev, apdev):
         if freq != '2462':
             raise Exception("Unexpected freq after group reform=" + freq)
 
-        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid" : 'ap-test-2',
-                                                    "channel" : '6' })
+        hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test-2',
+                                          "channel" : '6' })
         dev[0].connect("ap-test-2", key_mgmt="NONE",
                        scan_freq="2437")
 
@@ -1007,8 +1007,8 @@ def test_p2p_delay_go_csa(dev, apdev, params):
                 raise Exception("Peer " + addr1 + " not found")
             wpas.p2p_stop_find()
 
-            hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
-                                                        "channel": '1' })
+            hapd = hostapd.add_ap(apdev[0], { "ssid": 'bss-2.4ghz',
+                                              "channel": '1' })
 
             wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")