From 37fa2eb5ea2f79a05797d1a5088f2e1aeeed30c3 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 30 Oct 2013 00:16:36 +0200 Subject: [PATCH] tests: Add test cases for AP VLAN These verify dynamic AP VLAN interface addition with open and WPA2-PSK network. Signed-off-by: Jouni Malinen --- tests/hwsim/hostapd.accept | 2 ++ tests/hwsim/test_ap_vlan.py | 44 +++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/hwsim/hostapd.accept create mode 100644 tests/hwsim/test_ap_vlan.py diff --git a/tests/hwsim/hostapd.accept b/tests/hwsim/hostapd.accept new file mode 100644 index 000000000..ce455b1a2 --- /dev/null +++ b/tests/hwsim/hostapd.accept @@ -0,0 +1,2 @@ +02:00:00:00:00:00 1 +02:00:00:00:01:00 2 diff --git a/tests/hwsim/test_ap_vlan.py b/tests/hwsim/test_ap_vlan.py new file mode 100644 index 000000000..072d8d31c --- /dev/null +++ b/tests/hwsim/test_ap_vlan.py @@ -0,0 +1,44 @@ +#!/usr/bin/python +# +# Test cases for AP VLAN +# Copyright (c) 2013, Jouni Malinen +# +# This software may be distributed under the terms of the BSD license. +# See README for more details. + +import time +import subprocess +import logging +logger = logging.getLogger(__name__) + +import hwsim_utils +import hostapd + +def test_ap_vlan_open(dev, apdev): + """AP VLAN with open network""" + params = { "ssid": "test-vlan-open", + "dynamic_vlan": "1", + "accept_mac_file": "hostapd.accept" } + hostapd.add_ap(apdev[0]['ifname'], params) + + dev[0].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412") + dev[1].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412") + dev[2].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412") + hwsim_utils.test_connectivity(dev[0].ifname, "brvlan1") + hwsim_utils.test_connectivity(dev[1].ifname, "brvlan2") + hwsim_utils.test_connectivity(dev[2].ifname, apdev[0]['ifname']) + +def test_ap_vlan_wpa2(dev, apdev): + """AP VLAN with WPA2-PSK""" + params = hostapd.wpa2_params(ssid="test-vlan", + passphrase="12345678") + params['dynamic_vlan'] = "1"; + params['accept_mac_file'] = "hostapd.accept"; + hostapd.add_ap(apdev[0]['ifname'], params) + + dev[0].connect("test-vlan", psk="12345678", scan_freq="2412") + dev[1].connect("test-vlan", psk="12345678", scan_freq="2412") + dev[2].connect("test-vlan", psk="12345678", scan_freq="2412") + hwsim_utils.test_connectivity(dev[0].ifname, "brvlan1") + hwsim_utils.test_connectivity(dev[1].ifname, "brvlan2") + hwsim_utils.test_connectivity(dev[2].ifname, apdev[0]['ifname'])