radius-test: include radius accounting test

This commit is contained in:
Nikos Mavrogiannopoulos
2015-03-13 15:53:07 +01:00
parent fed17e005a
commit 00e775dac6
2 changed files with 28 additions and 13 deletions
+2 -2
View File
@@ -4,7 +4,7 @@
#auth = "certificate" #auth = "certificate"
#auth = "plain[/etc/ocserv/passwd]" #auth = "plain[/etc/ocserv/passwd]"
#auth = "pam" #auth = "pam"
auth = "radius[/etc/radiusclient/radiusclient.conf,groupconfig]" auth = "radius[config=/etc/radiusclient/radiusclient.conf,groupconfig=true,nas=ocserv1]"
# Whether to enable support for the occtl tool (i.e., either through D-BUS, # Whether to enable support for the occtl tool (i.e., either through D-BUS,
# or via a unix socket). # or via a unix socket).
@@ -21,7 +21,7 @@ use-occtl = true
# to generate password entries. # to generate password entries.
#auth = "plain[/etc/ocserv/ocpasswd]" #auth = "plain[/etc/ocserv/ocpasswd]"
acct = "radius[/etc/radiusclient/radiusclient.conf]" acct = "radius[config=/etc/radiusclient/radiusclient.conf]"
# A banner to be displayed on clients # A banner to be displayed on clients
#banner = "Welcome" #banner = "Welcome"
+26 -11
View File
@@ -149,34 +149,49 @@ if test $? != 0;then
fi fi
fi fi
sleep 2 echo "Waiting for accounting report"
sleep 60
kill $PID kill $PID
sleep 4 sleep 4
TMPDIR=radius-$TMP
mkdir -p $TMPDIR
#check whether /tmp/disconnect/ok was created #check whether /tmp/disconnect/ok was created
rm -f ./not-ok rm -f $TMPDIR/not-ok
$DOCKER cp test_ocserv_radius:/tmp/disconnect/not-ok ./ $DOCKER cp test_ocserv_radius:/tmp/disconnect/not-ok $TMPDIR/
if test -f ./not-ok;then if test -f $TMPDIR/not-ok;then
echo "There was an issue getting stats" echo "There was an issue getting stats"
stop stop
fi fi
rm -f ./not-ok rm -f $TMPDIR/not-ok
ret=0 rm -f $TMPDIR/stats
rm -f ./tmp-full/ok FILE=`$DOCKER exec test_ocserv_radius ls /var/log/radius/radacct/127.0.0.1/`
$DOCKER cp test_ocserv_radius:/tmp/disconnect/ok ./tmp-full/ echo $DOCKER exec test_ocserv_radius cat "/var/log/radius/radacct/127.0.0.1/$FILE"
if ! test -f ./tmp-full/ok;then $DOCKER exec test_ocserv_radius cat "/var/log/radius/radacct/127.0.0.1/$FILE"
OCTETS=`$DOCKER exec test_ocserv_radius cat "/var/log/radius/radacct/127.0.0.1/$FILE"|grep Acct-Input-Octets|tail -1|sed 's/Acct-Input-Octets = //g'`
if test -z "$OCTETS" || test "$OCTETS" = 0;then
echo "Interim update showed no data!"
stop
fi
rm -f $TMPDIR/ok
$DOCKER cp test_ocserv_radius:/tmp/disconnect/ok $TMPDIR/
if ! test -f $TMPDIR/ok;then
echo "Don't know if stats were received" echo "Don't know if stats were received"
ret=77 ret=77
else else
echo -n "stats: " echo -n "stats: "
echo `cat ./tmp-full/ok` echo `cat $TMPDIR/ok`
rm -rf ./tmp-full/ rm -rf $TMPDIR/
fi fi
ret=0
$DOCKER stop test_ocserv_radius $DOCKER stop test_ocserv_radius
$DOCKER rm test_ocserv_radius $DOCKER rm test_ocserv_radius