Skip to content

Commit bde9666

Browse files
committed
Add test of association_time to redis_ippool tests
1 parent b142bf0 commit bde9666

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

src/tests/modules/redis_ippool/module.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ redis_ippool {
1414

1515
offer_time = 30
1616
lease_time = 60
17+
association_time = control.Session-Timeout
1718

1819
requested_address = Framed-IP-Address
1920
allocated_address_attr = reply.Framed-IP-address

src/tests/modules/redis_ippool/release.unlang

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,58 @@ if (updated) {
8181
test_fail
8282
}
8383

84+
#
85+
# Set the attribute being referenced in association_time
86+
#
87+
control.Session-Timeout := 120
88+
89+
#
90+
# Now allocate and release the address to create the association.
91+
#
92+
redis_ippool {
93+
invalid = 1
94+
}
95+
if (!(updated)) {
96+
test_fail
97+
}
98+
99+
Framed-IP-Address := reply.Framed-IP-Address
100+
101+
redis_ippool.release {
102+
invalid = 1
103+
}
104+
if (!(updated)) {
105+
test_fail
106+
}
107+
108+
#
109+
# Verify the association with the device remains
110+
#
111+
if (%redis('EXISTS', "{%{control.IP-Pool.Name}}:device:%{Calling-Station-ID}") != '1') {
112+
test_fail
113+
}
114+
115+
#
116+
# Add an additional address. Without the device association this would be the next
117+
# allocated address.
118+
#
119+
%exec('./build/bin/local/rlm_redis_ippool_tool', '-a', '192.168.0.2/32', '$ENV{REDIS_IPPOOL_TEST_SERVER}:30001', %{control.IP-Pool.Name}, '192.168.0.0')
120+
121+
#
122+
# Re-allocate
123+
#
124+
request -= Framed-IP-Address[*]
125+
reply -= Framed-IP-Address[*]
126+
127+
redis_ippool {
128+
invalid = 1
129+
}
130+
if (!(updated)) {
131+
test_fail
132+
}
133+
134+
if (reply.Framed-IP-Address != 192.168.0.1) {
135+
test_fail
136+
}
137+
84138
reply := {}

0 commit comments

Comments
 (0)