Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
smradius
smradius
Commits
eb648bef
Commit
eb648bef
authored
May 16, 2019
by
Nigel Kukard
Browse files
Added capping test for POD being sent
parent
ceb2e82a
Changes
1
Hide whitespace changes
Inline
Side-by-side
t/200-dbtests.t
View file @
eb648bef
...
...
@@ -871,6 +871,9 @@ if ($child = fork()) {
'
Service-Type=Framed-User
',
);
is
(
ref
(
$res
),"
HASH
","
smradclient should return a HASH
");
warn
"
DUMP:
"
.
Dumper
(
$res
);
is
(
$res
->
{'
listen
'}
->
{'
response
'}
->
{'
code
'},"
CoA-Request
","
Check that the packet we got back is infact a
"
.
"
CoA-Request
");
is
(
$res
->
{'
listen
'}
->
{'
response
'}
->
{'
vattributes
'}
->
{'
14988
'}
->
{'
Mikrotik-Rate-Limit
'}
->
[
0
],"
1k/1m
","
Check that the vendor attribute
"
.
"
'14988:Mikrotik-Rate-Limit' is returned on the negative side of the IF
");
...
...
@@ -937,9 +940,67 @@ if ($child = fork()) {
'
Service-Type=Framed-User
',
);
is
(
ref
(
$res
),"
HASH
","
smradclient should return a HASH
");
is
(
$res
->
{'
listen
'}
->
{'
response
'}
->
{'
vattributes
'}
->
{'
14988
'}
->
{'
Mikrotik-Rate-Limit
'}
->
[
0
],"
1638k/8m
","
Check that the vendor attribute
"
.
"
'14988:Mikrotik-Rate-Limit' is returned
");
is
(
$res
->
{'
listen
'}
->
{'
response
'}
->
{'
code
'},"
CoA-Request
","
Check that the packet we got back is infact a
"
.
"
CoA-Request
");
is
(
$res
->
{'
listen
'}
->
{'
response
'}
->
{'
vattributes
'}
->
{'
14988
'}
->
{'
Mikrotik-Rate-Limit
'}
->
[
0
],"
1638k/8m
","
Check that the
"
.
"
vendor attribute '14988:Mikrotik-Rate-Limit' is returned
");
#
# Check that if we send an accounting ALIVE with a usage amount that exceeds capping, that we trigger a POD
#
my
$user7_ID
=
testDBInsert
("
Create user 'testuser7'
",
"
INSERT INTO users (UserName,Disabled) VALUES ('testuser7',0)
"
);
my
$user7attr1_ID
=
testDBInsert
("
Create user 'testuser7' attribute 'User-Password'
",
"
INSERT INTO user_attributes (UserID,Name,Operator,Value,Disabled) VALUES (?,?,?,?,0)
",
$user7_ID
,'
User-Password
','
==
','
test456
'
);
# Add an attribute so we can check the capping does a POD
my
$user7attr4_ID
=
testDBInsert
("
Create user 'testuser7' attribute 'SMRadius-Capping-Traffic-Limit'
",
"
INSERT INTO user_attributes (UserID,Name,Operator,Value,Disabled) VALUES (?,?,?,?,0)
",
$user7_ID
,'
SMRadius-Capping-Traffic-Limit
','
:=
','
1
'
);
my
$session6_ID
=
"
5209dac0
";
my
$session6_Timestamp
=
time
();
$res
=
smradius::
client
->
run
(
"
--raddb
","
dicts
",
"
--listen
","
127.0.0.1:1700
",
"
127.0.0.1
",
"
acct
",
"
secret123
",
'
User-Name=testuser7
',
'
NAS-IP-Address=10.0.0.1
',
'
Acct-Delay-Time=12
',
'
NAS-Identifier=Test-NAS2
',
'
Acct-Status-Type=Interim-Update
',
'
Acct-Output-Packets=786933
',
'
Acct-Output-Gigawords=0
',
'
Acct-Output-Octets=808163705
',
'
Acct-Input-Packets=670235
',
'
Acct-Input-Gigawords=0
',
'
Acct-Input-Octets=202600046
',
'
Acct-Session-Time=800
',
'
Event-Timestamp=
'
.
$session6_Timestamp
,
'
Framed-IP-Address=10.0.1.1
',
'
Acct-Session-Id=
'
.
$session6_ID
,
'
NAS-Port-Id=wlan1
',
'
Called-Station-Id=testservice2
',
'
Calling-Station-Id=00:00:0C:EE:47:BF
',
'
NAS-Port-Type=Ethernet
',
'
NAS-Port=15729175
',
'
Framed-Protocol=PPP
',
'
Service-Type=Framed-User
',
);
is
(
ref
(
$res
),"
HASH
","
smradclient should return a HASH
");
is
(
$res
->
{'
listen
'}
->
{'
response
'}
->
{'
code
'},"
Disconnect-Request
","
Check that the packet we got back is infact a
"
.
"
Disconnect-Request
");
sleep
(
5
);
...
...
Write
Preview
Supports
Markdown
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