-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
40 lines (32 loc) · 1.18 KB
/
test.sh
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
rm vpnaccount.db
echo "Creating 3 subnets with /20 default subnet."
# create pool with default subnet of
./vpn_account.py --create-pool
./vpn_account.py --create-pool 16 sta
./vpn_account.py --create-pool 32 tst
if [ "$(./vpn_account.py --show-pools | wc -l)" -eq 3024 ];
then
echo "Got expected number of IPs available.";
else
echo "Did not get expected number of IP.";
exit 1;
fi
echo "Creating 3 accounts"
./vpn_account.py --create-account [email protected]
./vpn_account.py --create-account [email protected]
./vpn_account.py --create-account [email protected]
echo "Disabling one account"
./vpn_account.py --revoke-account [email protected]
./vpn_account.py --show-accounts | grep -q "'status': 0" \
&& echo "User was disabled." || (echo "User was not disabled" && exit 1)
./vpn_account.py --show-pools | head -n 1 | grep -q "'status': 0" \
&& echo "IP was freed." || (echo "IP was not freed." && exit 1)
echo "Creating another account"
./vpn_account.py --create-account [email protected]
if [ "$(./vpn_account.py --show-pools | grep "'status': 1" | wc -l )" -eq 3 ];
then
echo "IP of removed user was freed and reutilized.";
else
echo "IP of removed user was NOT freed and reutilized.";
exit 1;
fi