[PATCH] test: check DUMMY and VLAN_8021q support before running tagged vlan test

Michael Braun michael-dev
Sun May 10 09:10:59 PDT 2015


This is on top of
  "test: verify correct vlan operation in multi-bss multi-vlan case"
and maybe should be squashed into that.

It makes the test to verify proper kernel support for dummy and vlan interfaces
first.

Signed-off-by: Michael Braun <michael-dev at fami-braun.de>
---
 tests/hwsim/test_ap_vlan.py | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/tests/hwsim/test_ap_vlan.py b/tests/hwsim/test_ap_vlan.py
index f5348a5..99a47c0 100644
--- a/tests/hwsim/test_ap_vlan.py
+++ b/tests/hwsim/test_ap_vlan.py
@@ -220,6 +220,35 @@ def helper_ap_vlan_iface_cleanup_multibss_cleanup():
     subprocess.call(['ip','link','del','brvlan2'],
                     stderr=open('/dev/null', 'w'))
 
+def helper_ap_vlan_iface_test_and_prepare_environ():
+    ifaces = netifaces.interfaces()
+    if "dummy0" in ifaces:
+        raise Exception("dummy0 already exists before")
+    ifaces = netifaces.interfaces()
+    if "dummy0.1" in ifaces:
+        raise Exception("dummy0.1 already exists before")
+
+    subprocess.call(['ip','link','add','dummy0','type','dummy'])
+    subprocess.call(['ifconfig','dummy0','up'])
+
+    ifaces = netifaces.interfaces()
+    if not("dummy0" in ifaces):
+        raise Exception("failed to add dummy0 - missing kernel config DUMMY ?")
+
+    subprocess.call(['ip','link','add','link','dummy0','name','dummy0.1',
+                     'type','vlan','id','1'])
+
+    ifaces = netifaces.interfaces()
+    if not("dummy0.1" in ifaces):
+        raise Exception("failed to add dummy0.1 - missing kernel config "
+                        "VLAN_8021Q ?")
+
+    subprocess.call(['ip','link','del','dummy0.1'])
+
+    ifaces = netifaces.interfaces()
+    if "dummy0.1" in ifaces:
+        raise Exception("dummy0.1 was not removed before testing")
+
 def test_ap_vlan_iface_cleanup_multibss(dev, apdev):
     """AP VLAN with WPA2-Enterprise and RADIUS attributes changing VLANID
        check that multiple bss do not interfere with each other with respect
@@ -227,8 +256,7 @@ def test_ap_vlan_iface_cleanup_multibss(dev, apdev):
     """
     try:
         helper_ap_vlan_iface_cleanup_multibss_cleanup()
-        subprocess.call(['ip','link','add','dummy0','type','dummy'])
-        subprocess.call(['ifconfig','dummy0','up'])
+        helper_ap_vlan_iface_test_and_prepare_environ()
 
         as_params = { "ssid": "as",
                       "beacon_int": "2000",
-- 
1.9.1




More information about the Hostap mailing list