Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
smradius
smradius
Commits
0343eaeb
Commit
0343eaeb
authored
May 15, 2019
by
Nigel Kukard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed session ID's in tests
parent
8c539166
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
14 deletions
+49
-14
t/200-dbtests.t
t/200-dbtests.t
+49
-14
No files found.
t/200-dbtests.t
View file @
0343eaeb
...
...
@@ -500,7 +500,7 @@ if ($child = fork()) {
# Test missing accounting START packet
#
my
$session2_ID
=
817
00217
;
my
$session2_ID
=
"
817
a0f1b
"
;
my
$session2_Timestamp
=
time
();
my
$session2_Timestamp_str
=
DateTime
->
from_epoch
(
epoch
=>
$session2_Timestamp
,
time_zone
=>
'
UTC
')
->
strftime
('
%Y-%m-%d %H:%M:%S
');
...
...
@@ -750,7 +750,7 @@ if ($child = fork()) {
);
my
$session3_ID
=
9858240
;
my
$session3_ID
=
"
9c5f24a
"
;
my
$session3_Timestamp
=
time
();
$res
=
smradius::
client
->
run
(
...
...
@@ -810,7 +810,7 @@ if ($child = fork()) {
#
# Check that if we send an accounting ALIVE we trigger
the
FUP
# Check that if we send an accounting ALIVE we
do not
trigger FUP
#
my
$user5_ID
=
testDBInsert
("
Create user 'testuser5'
",
...
...
@@ -838,7 +838,7 @@ if ($child = fork()) {
$user5_ID
,'
SMRadius-Evaluate
','
||+=
',"
SMRadius_FUP > 0 ? [14988:Mikrotik-Rate-Limit] = 1638k/8m
"
);
my
$session4_ID
=
98582
40
;
my
$session4_ID
=
"
a8abc
40
"
;
my
$session4_Timestamp
=
time
()
-
3600
;
$res
=
smradius::
client
->
run
(
...
...
@@ -870,29 +870,61 @@ if ($child = fork()) {
'
Service-Type=Framed-User
',
);
is
(
ref
(
$res
),"
HASH
","
smradclient should return a HASH
");
is
(
$res
->
{'
response
'}
->
{'
vattributes
'},
undef
,"
Check that the vendor attributes are not defined
");
my
$session4_Timestamp2
=
time
();
#
# Check that if we send an accounting ALIVE with a usage amount that exceeds FUP, that we trigger it
#
my
$user6_ID
=
testDBInsert
("
Create user 'testuser6'
",
"
INSERT INTO users (UserName,Disabled) VALUES ('testuser6',0)
"
);
my
$user6attr1_ID
=
testDBInsert
("
Create user 'testuser6' attribute 'User-Password'
",
"
INSERT INTO user_attributes (UserID,Name,Operator,Value,Disabled) VALUES (?,?,?,?,0)
",
$user6_ID
,'
User-Password
','
==
','
test456
'
);
my
$user6attr2_ID
=
testDBInsert
("
Create user 'testuser6' attribute 'SMRadius-FUP-Period'
",
"
INSERT INTO user_attributes (UserID,Name,Operator,Value,Disabled) VALUES (?,?,?,?,0)
",
$user6_ID
,'
SMRadius-FUP-Period
','
:=
','
1
'
);
my
$user6attr3_ID
=
testDBInsert
("
Create user 'testuser6' attribute 'SMRadius-FUP-Traffic-Threshold'
",
"
INSERT INTO user_attributes (UserID,Name,Operator,Value,Disabled) VALUES (?,?,?,?,0)
",
$user6_ID
,'
SMRadius-FUP-Traffic-Threshold
','
:=
',
800
);
# Add an attribute so we can check the FUP match results
my
$user6attr4_ID
=
testDBInsert
("
Create user 'testuser6' attribute 'SMRadius-Evaluate'
",
"
INSERT INTO user_attributes (UserID,Name,Operator,Value,Disabled) VALUES (?,?,?,?,0)
",
$user6_ID
,'
SMRadius-Evaluate
','
||+=
',"
SMRadius_FUP > 0 ? [14988:Mikrotik-Rate-Limit] = 1638k/8m
"
);
my
$session5_ID
=
"
582dc00
";
my
$session5_Timestamp
=
time
()
-
3600
;
$res
=
smradius::
client
->
run
(
"
--raddb
","
dicts
",
"
127.0.0.1
",
"
acct
",
"
secret123
",
'
User-Name=testuser
5
',
'
User-Name=testuser
6
',
'
NAS-IP-Address=10.0.0.1
',
'
Acct-Delay-Time=
8
',
'
Acct-Delay-Time=
12
',
'
NAS-Identifier=Test-NAS2
',
'
Acct-Status-Type=Interim-Update
',
'
Acct-Output-Packets=7
00000
',
'
Acct-Output-Packets=7
86933
',
'
Acct-Output-Gigawords=0
',
'
Acct-Output-Octets=8
50000000
',
'
Acct-Input-Packets=
100000
',
'
Acct-Output-Octets=8
08163705
',
'
Acct-Input-Packets=
670235
',
'
Acct-Input-Gigawords=0
',
'
Acct-Input-Octets=
100000
000
',
'
Acct-Session-Time=
10
00
',
'
Event-Timestamp=
'
.
$session
4
_Timestamp
2
,
'
Acct-Input-Octets=
2026
000
46
',
'
Acct-Session-Time=
8
00
',
'
Event-Timestamp=
'
.
$session
5
_Timestamp
,
'
Framed-IP-Address=10.0.1.1
',
'
Acct-Session-Id=
'
.
$session
4
_ID
,
'
Acct-Session-Id=
'
.
$session
5
_ID
,
'
NAS-Port-Id=wlan1
',
'
Called-Station-Id=testservice2
',
'
Calling-Station-Id=00:00:0C:EE:47:BF
',
...
...
@@ -902,6 +934,9 @@ if ($child = fork()) {
'
Service-Type=Framed-User
',
);
is
(
ref
(
$res
),"
HASH
","
smradclient should return a HASH
");
is
(
$res
->
{'
response
'}
->
{'
vattributes
'}
->
{'
14988
'}
->
{'
Mikrotik-Rate-Limit
'}
->
[
0
],"
1638k/8m
","
Check that the vendor attribute
"
.
"
'14988:Mikrotik-Rate-Limit' is returned
");
sleep
(
5
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment