#
# Check ZSCORE
#
-&Tmp-Date-0 := "%l"
-
-if ("%{expr:%(redis:ZSCORE "{%{control.IP-Pool.Name}}:pool" %{reply.Framed-IP-Address}) - %(integer:%{Tmp-Date-0})}" < 20) {
+if ((%redis('ZSCORE', "{%{control.IP-Pool.Name}}:pool", "%{reply.Framed-IP-Address}") - %l) < 20) {
test_fail
}
-if ("%{expr:%(redis:ZSCORE "{%{control.IP-Pool.Name}}:pool" %{reply.Framed-IP-Address}) - %(integer:%{Tmp-Date-0})}" > 40) {
+if ((%redis('ZSCORE', "{%{control.IP-Pool.Name}}:pool", "%{reply.Framed-IP-Address}") - %l) > 40) {
test_fail
}
#
# Verify the IP hash has been set
#
-if !("%(redis:HGET {%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address} 'device')" == '00:11:22:33:44:55') {
+if !(%redis('HGET', "{%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address}, 'device'") == '00:11:22:33:44:55') {
test_fail
}
-if !("%(redis:HGET {%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address} gateway)" == '127.0.0.1') {
+if !(%redis('HGET', "{%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address}", 'gateway') == '127.0.0.1') {
test_fail
}
-if !("%(redis:HGET {%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address} range)" == '192.168.0.0') {
+if !(%redis('HGET', "{%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address}", 'range') == '192.168.0.0') {
test_fail
}
#
# Verify the lease has been associated with the device
#
-if !(&reply.Framed-IP-Address == "%(redis:GET {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID})") {
+if !(&reply.Framed-IP-Address == %redis('GET', "{%{control.IP-Pool.Name}}:device:%{Calling-Station-ID}")) {
test_fail
}
# The fudge factor is to allow for delays running ippool tool and script interpretation
# as we should be allocating the same lesase as before, but its TTL could be slightly lower.
#
-if ("%{expr:&Session-Timeout - &reply.Session-Timeout}" > 5) {
+if ((&Session-Timeout - &reply.Session-Timeout) > 5) {
test_fail
}
}
# 4. Verify the gateway was set
-if !("%(redis:HGET {%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address} gateway)" == '127.0.0.1') {
+if !(%redis('HGET', "{%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address}", "gateway") == '127.0.0.1') {
test_fail
}
}
# 8. Check ZSCORE reflects that
-&Tmp-Date-0 := "%l"
-
-if !("%{expr:%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) - %(integer:%{Tmp-Date-0})}" > 50) {
+if !((%redis('ZSCORE', "{%{control.IP-Pool.Name}}:pool", "%{reply.Framed-IP-Address}") - %l) > 50) {
test_fail
}
# 9.
-if !("%{expr:%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) - %(integer:%{Tmp-Date-0})}" < 70) {
+if !((%redis('ZSCORE', "{%{control.IP-Pool.Name}}:pool", "%{reply.Framed-IP-Address}") - %l) < 70) {
test_fail
}
# 10. Verify the lease is still associated with the device
-if !(&reply.Framed-IP-Address == "%(redis:GET {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID})") {
+if !(&reply.Framed-IP-Address == %redis('GET', "{%{control.IP-Pool.Name}}:device:%{Calling-Station-ID}")) {
test_fail
}
# 11. And that the device object will expire a suitable number of seconds into the future
-if !("%(redis:TTL {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID})" == 60) {
+if !(%redis("TTL", "{%{control.IP-Pool.Name}}:device:%{Calling-Station-ID}") == 60) {
test_fail
}
# 12. Verify the gateway was updated
-if !("%(redis:HGET {%{control.IP-Pool.Name}}:ip:%{Framed-IP-Address} gateway)" == '127.0.0.2') {
+if !(%redis('HGET', "{%{control.IP-Pool.Name}}:ip:%{Framed-IP-Address} gateway") == '127.0.0.2') {
test_fail
}
}
# 16. Verify the lease is still associated with the previous device
-if !(&reply.Framed-IP-Address == "%(redis:GET {%{control.IP-Pool.Name}}:device:00:11:22:33:44:55)") {
+if !(&reply.Framed-IP-Address == %redis('GET', "{%{control.IP-Pool.Name}}:device:00:11:22:33:44:55") {
test_fail
}