[PATCH 3/6] tests: pass apdev to add_iface()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pass apdev to add_iface() function. Before
we pass only ifname. So, now we can handle
also remote hosts, while we can get apdev['hostname'].

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@xxxxxxxxx>
---
 tests/hwsim/hostapd.py         | 12 ++++++++++--
 tests/hwsim/test_ap_acs.py     |  2 +-
 tests/hwsim/test_ap_dynamic.py |  4 ++--
 tests/hwsim/test_ap_vlan.py    |  2 +-
 4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
index 5ee22bb..a4af629 100644
--- a/tests/hwsim/hostapd.py
+++ b/tests/hwsim/hostapd.py
@@ -400,8 +400,16 @@ def add_bss(phy, apdev, confname, ignore_error=False):
     if not hapd.ping():
         raise Exception("Could not ping hostapd")
 
-def add_iface(ifname, confname, hostname=None, port=8878):
-    logger.info("Starting interface " + ifname)
+def add_iface(apdev, confname):
+    ifname = apdev['ifname']
+    try:
+        hostname = apdev['hostname']
+        port = apdev['port']
+        logger.info("Starting interface " + hostname + "/" + port + " " + ifname)
+    except:
+        logger.info("Starting interface " + ifname)
+        hostname = None
+        port = 8878
     hapd_global = HostapdGlobal(hostname=hostname, port=port)
     hapd_global.add_iface(ifname, confname)
     port = hapd_global.get_ctrl_iface_port(ifname)
diff --git a/tests/hwsim/test_ap_acs.py b/tests/hwsim/test_ap_acs.py
index 71feb76..8f1f492 100644
--- a/tests/hwsim/test_ap_acs.py
+++ b/tests/hwsim/test_ap_acs.py
@@ -95,7 +95,7 @@ def test_ap_multi_bss_acs(dev, apdev):
     force_prev_ap_on_24g(apdev[0])
 
     # start the actual test
-    hostapd.add_iface(ifname, 'multi-bss-acs.conf')
+    hostapd.add_iface(apdev[0], 'multi-bss-acs.conf')
     hapd = hostapd.Hostapd(ifname)
     hapd.enable()
     wait_acs(hapd)
diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py
index dac2d20..742abfc 100644
--- a/tests/hwsim/test_ap_dynamic.py
+++ b/tests/hwsim/test_ap_dynamic.py
@@ -188,7 +188,7 @@ def test_ap_multi_bss_config(dev, apdev):
     apdev2['ifname'] = apdev[0]['ifname'] + '-2'
     apdev3['ifname'] = apdev[0]['ifname'] + '-3'
     logger.info("Set up three BSSes with one configuration file")
-    hostapd.add_iface(apdev1['ifname'], 'multi-bss.conf')
+    hostapd.add_iface(apdev1, 'multi-bss.conf')
     hapd = hostapd.Hostapd(apdev1['ifname'])
     hapd.enable()
     multi_check(dev, [ True, True, True ])
@@ -199,7 +199,7 @@ def test_ap_multi_bss_config(dev, apdev):
     hostapd.remove_bss(apdev1)
     multi_check(dev, [ False, False, False ])
 
-    hostapd.add_iface(apdev1['ifname'], 'multi-bss.conf')
+    hostapd.add_iface(apdev1, 'multi-bss.conf')
     hapd = hostapd.Hostapd(apdev1['ifname'])
     hapd.enable()
     hostapd.remove_bss(apdev1)
diff --git a/tests/hwsim/test_ap_vlan.py b/tests/hwsim/test_ap_vlan.py
index 030f3cb..79c4166 100644
--- a/tests/hwsim/test_ap_vlan.py
+++ b/tests/hwsim/test_ap_vlan.py
@@ -330,7 +330,7 @@ def ap_vlan_iface_cleanup_multibss(dev, apdev, cfgfile):
         ifname = apdev[0]['ifname']
 
         # start the actual test
-        hostapd.add_iface(ifname, cfgfile)
+        hostapd.add_iface(apdev[0], cfgfile)
         hapd = hostapd.Hostapd(ifname)
         hapd1 = hostapd.Hostapd("wlan3-2", 1)
         hapd1.enable()
-- 
1.9.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux