]>
git.ipfire.org Git - thirdparty/hostap.git/blob - tests/hwsim/test_ap_qosmap.py
2 # Copyright (c) 2013, Jouni Malinen <j@w1.fi>
4 # This software may be distributed under the terms of the BSD license.
5 # See README for more details.
9 logger
= logging
. getLogger ()
13 from utils
import HwsimSkip
14 from wlantest
import Wlantest
16 def check_qos_map ( ap
, hapd
, dev
, sta
, dscp
, tid
, ap_tid
= None ):
22 wt
. clear_sta_counters ( bssid
, sta
)
23 hwsim_utils
. test_connectivity ( dev
, hapd
, dscp
= dscp
, config
= False )
25 tx
= wt
. get_tx_tid ( bssid
, sta
, tid
)
27 [ tx
, rx
] = wt
. get_tid_counters ( bssid
, sta
)
28 logger
. info ( "Expected TX DSCP " + str ( dscp
) + " with TID " + str ( tid
) + " but counters: " + str ( tx
))
29 raise Exception ( "No STA->AP data frame using the expected TID" )
30 rx
= wt
. get_rx_tid ( bssid
, sta
, ap_tid
)
32 [ tx
, rx
] = wt
. get_tid_counters ( bssid
, sta
)
33 logger
. info ( "Expected RX DSCP " + str ( dscp
) + " with TID " + str ( ap_tid
) + " but counters: " + str ( rx
))
34 raise Exception ( "No AP->STA data frame using the expected TID" )
36 def test_ap_qosmap ( dev
, apdev
):
38 drv_flags
= dev
[ 0 ]. get_driver_status_field ( "capa.flags" )
39 if int ( drv_flags
, 0 ) & 0x40000000 == 0 :
40 raise HwsimSkip ( "Driver does not support QoS Map" )
42 params
= { "ssid" : ssid
}
43 params
[ 'qos_map_set' ] = '53,2,22,6,8,15,0,7,255,255,16,31,32,39,255,255,40,47,48,55'
44 hapd
= hostapd
. add_ap ( apdev
[ 0 ], params
)
45 dev
[ 0 ]. connect ( ssid
, key_mgmt
= "NONE" , scan_freq
= "2412" )
47 addr
= dev
[ 0 ]. p2p_interface_addr ()
48 dev
[ 0 ]. request ( "DATA_TEST_CONFIG 1" )
49 hapd
. request ( "DATA_TEST_CONFIG 1" )
50 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 53 , 2 )
51 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 22 , 6 )
52 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 8 , 0 )
53 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 15 , 0 )
54 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 0 , 1 )
55 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 7 , 1 )
56 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 16 , 3 )
57 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 31 , 3 )
58 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 32 , 4 )
59 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 39 , 4 )
60 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 40 , 6 )
61 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 47 , 6 )
62 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 48 , 7 )
63 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 55 , 7 )
64 hapd
. request ( "SET_QOS_MAP_SET 22,6,8,15,0,7,255,255,16,31,32,39,255,255,40,47,48,55" )
65 hapd
. request ( "SEND_QOS_MAP_CONF " + dev
[ 0 ]. get_status_field ( "address" ))
66 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 53 , 7 )
67 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 22 , 6 )
68 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 48 , 7 )
69 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 55 , 7 )
70 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 56 , 56 >> 3 )
71 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, 63 , 63 >> 3 )
72 dev
[ 0 ]. request ( "DATA_TEST_CONFIG 0" )
73 hapd
. request ( "DATA_TEST_CONFIG 0" )
75 def test_ap_qosmap_default ( dev
, apdev
):
76 """QoS mapping with default values"""
77 ssid
= "test-qosmap-default"
78 params
= { "ssid" : ssid
}
79 hapd
= hostapd
. add_ap ( apdev
[ 0 ], params
)
80 dev
[ 0 ]. connect ( ssid
, key_mgmt
= "NONE" , scan_freq
= "2412" )
81 addr
= dev
[ 0 ]. p2p_interface_addr ()
82 dev
[ 0 ]. request ( "DATA_TEST_CONFIG 1" )
83 hapd
. request ( "DATA_TEST_CONFIG 1" )
84 for dscp
in [ 0 , 7 , 8 , 15 , 16 , 23 , 24 , 31 , 32 , 39 , 40 , 47 , 48 , 55 , 56 , 63 ]:
85 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, dscp
, dscp
>> 3 )
86 dev
[ 0 ]. request ( "DATA_TEST_CONFIG 0" )
87 hapd
. request ( "DATA_TEST_CONFIG 0" )
89 def test_ap_qosmap_default_acm ( dev
, apdev
):
90 """QoS mapping with default values and ACM=1 for VO/VI"""
91 ssid
= "test-qosmap-default"
92 params
= { "ssid" : ssid
,
93 "wmm_ac_bk_aifs" : "7" ,
94 "wmm_ac_bk_cwmin" : "4" ,
95 "wmm_ac_bk_cwmax" : "10" ,
96 "wmm_ac_bk_txop_limit" : "0" ,
98 "wmm_ac_be_aifs" : "3" ,
99 "wmm_ac_be_cwmin" : "4" ,
100 "wmm_ac_be_cwmax" : "10" ,
101 "wmm_ac_be_txop_limit" : "0" ,
102 "wmm_ac_be_acm" : "0" ,
103 "wmm_ac_vi_aifs" : "2" ,
104 "wmm_ac_vi_cwmin" : "3" ,
105 "wmm_ac_vi_cwmax" : "4" ,
106 "wmm_ac_vi_txop_limit" : "94" ,
107 "wmm_ac_vi_acm" : "1" ,
108 "wmm_ac_vo_aifs" : "2" ,
109 "wmm_ac_vo_cwmin" : "2" ,
110 "wmm_ac_vo_cwmax" : "2" ,
111 "wmm_ac_vo_txop_limit" : "47" ,
112 "wmm_ac_vo_acm" : "1" }
113 hapd
= hostapd
. add_ap ( apdev
[ 0 ], params
)
114 dev
[ 0 ]. connect ( ssid
, key_mgmt
= "NONE" , scan_freq
= "2412" )
115 addr
= dev
[ 0 ]. p2p_interface_addr ()
116 dev
[ 0 ]. request ( "DATA_TEST_CONFIG 1" )
117 hapd
. request ( "DATA_TEST_CONFIG 1" )
118 for dscp
in [ 0 , 7 , 8 , 15 , 16 , 23 , 24 , 31 , 32 , 39 , 40 , 47 , 48 , 55 , 56 , 63 ]:
121 # downgrade VI/VO to BE
122 if tid
in [ 4 , 5 , 6 , 7 ]:
124 check_qos_map ( apdev
[ 0 ], hapd
, dev
[ 0 ], addr
, dscp
, tid
, ap_tid
)
125 dev
[ 0 ]. request ( "DATA_TEST_CONFIG 0" )
126 hapd
. request ( "DATA_TEST_CONFIG 0" )
128 def test_ap_qosmap_invalid ( dev
, apdev
):
129 """QoS mapping ctrl_iface error handling"""
131 params
= { "ssid" : ssid
}
132 hapd
= hostapd
. add_ap ( apdev
[ 0 ], params
)
133 if "FAIL" not in hapd
. request ( "SEND_QOS_MAP_CONF 00:11:22:33:44:55" ):
134 raise Exception ( "Unexpected SEND_QOS_MAP_CONF success" )
135 if "FAIL" not in hapd
. request ( "SET_QOS_MAP_SET " ):
136 raise Exception ( "Unexpected SET_QOS_MAP_SET success" )
137 if "FAIL" not in hapd
. request ( "SET_QOS_MAP_SET 1,2,3" ):
138 raise Exception ( "Unexpected SET_QOS_MAP_SET success" )
139 if "FAIL" not in hapd
. request ( "SET_QOS_MAP_SET 1,-2,3" ):
140 raise Exception ( "Unexpected SET_QOS_MAP_SET success" )
141 if "FAIL" not in hapd
. request ( "SET_QOS_MAP_SET 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59" ):
142 raise Exception ( "Unexpected SET_QOS_MAP_SET success" )
143 if "FAIL" not in hapd
. request ( "SET_QOS_MAP_SET 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21" ):
144 raise Exception ( "Unexpected SET_QOS_MAP_SET success" )
146 if "FAIL" in hapd
. request ( "SET_QOS_MAP_SET 22,6,8,15,0,7,255,255,16,31,32,39,255,255,40,47,48,55" ):
147 raise Exception ( "Unexpected SET_QOS_MAP_SET failure" )
148 if "FAIL" not in hapd
. request ( "SEND_QOS_MAP_CONF 00:11:22:33:44:55" ):
149 raise Exception ( "Unexpected SEND_QOS_MAP_CONF success" )
150 if "FAIL" not in hapd
. request ( "SEND_QOS_MAP_CONF 00:11:22:33:44" ):
151 raise Exception ( "Unexpected SEND_QOS_MAP_CONF success" )