Browse Source

tests: Verify RADIUS accounting functionality

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen 11 years ago
parent
commit
4287bb76bf
2 changed files with 24 additions and 0 deletions
  1. 1 0
      tests/hwsim/auth_serv/as.conf
  2. 23 0
      tests/hwsim/test_radius.py

+ 1 - 0
tests/hwsim/auth_serv/as.conf

@@ -1,5 +1,6 @@
 driver=none
 radius_server_clients=auth_serv/radius_clients.conf
+radius_server_acct_port=1813
 eap_server=1
 eap_user_file=auth_serv/eap_user.conf
 

+ 23 - 0
tests/hwsim/test_radius.py

@@ -56,3 +56,26 @@ def test_radius_acct_unreachable(dev, apdev):
         raise Exception("Missing RADIUS Accounting retransmissions")
     if int(mib["radiusAccClientPendingRequests"]) < 2:
         raise Exception("Missing pending RADIUS Accounting requests")
+
+def test_radius_acct(dev, apdev):
+    """RADIUS Accounting"""
+    params = hostapd.wpa2_eap_params(ssid="radius-acct")
+    params['acct_server_addr'] = "127.0.0.1"
+    params['acct_server_port'] = "1813"
+    params['acct_server_shared_secret'] = "radius"
+    hostapd.add_ap(apdev[0]['ifname'], params)
+    hapd = hostapd.Hostapd(apdev[0]['ifname'])
+    connect(dev[0], "radius-acct")
+    logger.info("Checking for RADIUS counters")
+    count = 0
+    while True:
+        mib = hapd.get_mib()
+        if int(mib['radiusAccClientResponses']) >= 2:
+            break
+        time.sleep(0.1)
+        count += 1
+        if count > 10:
+            raise Exception("Did not receive Accounting-Response packets")
+
+    if int(mib['radiusAccClientRetransmissions']) > 0:
+        raise Exception("Unexpected Accounting-Request retransmission")