--- /dev/null
+#
+# Input packet
+#
+Packet-Type = Access-Request
+User-Name = 'john'
+User-Password = 'testing123'
+NAS-IP-Address = 127.0.0.1
+Calling-Station-Id = aa:bb:cc:dd:ee:ff
+
+#
+# Expected answer
+#
+Packet-Type == Access-Accept
--- /dev/null
+#
+# Test static IP allocation using redis_ippool
+#
+$INCLUDE cluster_reset.inc
+
+&control.IP-Pool.Name := 'test_static'
+
+#
+# Add a dynamic IP addresses
+#
+&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0`
+
+#
+# Add a static IP assigned to the calling station in the request
+#
+&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -A 192.168.0.10/32 -O aa:bb:cc:dd:ee:ff $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0`
+
+#
+# Check allocation
+#
+redis_ippool {
+ invalid = 1
+}
+if (!updated) {
+ test_fail
+}
+
+if (!(&reply.Framed-IP-Address == 192.168.0.10)) {
+ test_fail
+}
+
+#
+# Check the expiry attribute is present and correct - although the allocation is static
+# we report the expiry as if it were dynamic e.g. to drive DHCP renewals
+#
+if (!(&reply.Session-Timeout == 30)) {
+ test_fail
+}
+
+#
+# Check that renewal does not mess with static IP
+#
+&Framed-IP-Address := &reply.Framed-IP-Address
+&control.IP-Pool.Action := Renew
+
+redis_ippool {
+ invalid = 1
+}
+
+#
+# Verify no expiry has been set on device
+#
+if ("%(redis:TTL {%{control.IP-Pool.Name}}:device:%{Calling-Station-Id})" != '-1') {
+ test_fail
+}
+
+#
+# And that the expected expiry is now set
+#
+if (!(&reply.Session-Timeout == 60)) {
+ test_fail
+}
+
+#
+# Check that releasing does not mess with static IP
+#
+&control.IP-Pool.Action := Release
+
+redis_ippool {
+ invalid = 1
+}
+if (!(updated)) {
+ test_fail
+}
+
+#
+# Verify the association with the device remains
+#
+if ("%(redis:EXISTS {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID})" == '0') {
+ test_fail
+}
+
+#
+# Verify the hash information is retained
+#
+if ("%(redis:EXISTS {%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address})" == '0') {
+ test_fail
+}
+
+# Check the ZSCORE
+&Tmp-Date-0 := "%l"
+if ("%(redis:ZSCORE {%{control.IP-Pool.Name}%}:pool %{reply.Framed-IP-Address})" <= %(integer:%{Tmp-Date-0})) {
+ test_fail
+}
+
+&reply := {}
+
+test_pass
--- /dev/null
+#
+# Test static IP allocation not given to dynamic users
+#
+$INCLUDE cluster_reset.inc
+
+&control.IP-Pool.Name := 'test_static_dynamic'
+
+#
+# Add a static IP assigned to a calling station not in the request
+#
+&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -A 192.168.0.10/32 -O aa:bb:cc:dd:ee:ff $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0`
+
+#
+# Check allocation fails - pool only contains an address assigned to another owner
+#
+redis_ippool {
+ invalid = 1
+}
+if (!notfound) {
+ test_fail
+}
+
+#
+# Add a dynamic IP addresses
+#
+&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0`
+
+#
+# Check allocation
+#
+redis_ippool {
+ invalid = 1
+}
+if (!updated) {
+ test_fail
+}
+
+if (!(&reply.Framed-IP-Address == 192.168.0.1)) {
+ test_fail
+}
+
+&reply := {}
+
+test_pass