From: Nick Porter Date: Fri, 5 Jan 2024 11:09:20 +0000 (+0000) Subject: Remove Tmp- variables from redis ippool tests X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a83803fd278000afd35dfaf5bd09e69eec17df22;p=thirdparty%2Ffreeradius-server.git Remove Tmp- variables from redis ippool tests --- diff --git a/src/tests/modules/redis_ippool/alloc.unlang b/src/tests/modules/redis_ippool/alloc.unlang index a5e19feedd8..5505546b49f 100644 --- a/src/tests/modules/redis_ippool/alloc.unlang +++ b/src/tests/modules/redis_ippool/alloc.unlang @@ -8,7 +8,7 @@ $INCLUDE cluster_reset.inc # # Add 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` +%exec(./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 @@ -75,7 +75,7 @@ if !(&reply.Session-Timeout == 30) { # # Add IP addresses # -&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.1.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.1.0` +%exec(./build/bin/local/rlm_redis_ippool_tool, -a, 192.168.1.1/32, $ENV{REDIS_IPPOOL_TEST_SERVER}:30001, %{control.IP-Pool.Name}, 192.168.1.0) # # Check we get the same lease, with the same lease time diff --git a/src/tests/modules/redis_ippool/pool_tool_delete.unlang b/src/tests/modules/redis_ippool/pool_tool_delete.unlang index ebc65fd6351..313e0f8e5fc 100644 --- a/src/tests/modules/redis_ippool/pool_tool_delete.unlang +++ b/src/tests/modules/redis_ippool/pool_tool_delete.unlang @@ -8,7 +8,7 @@ $INCLUDE cluster_reset.inc # # Add 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` +%exec(./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 @@ -27,24 +27,24 @@ if !(&reply.Framed-IP-Address == 192.168.0.1) { # # Delete the IP address # -&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -d 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` +%exec(./build/bin/local/rlm_redis_ippool_tool, -d, 192.168.0.1/32, $ENV{REDIS_IPPOOL_TEST_SERVER}:30001, %{control.IP-Pool.Name}, 192.168.0.0) # # Verify the association with the device has been removed # -if !("%(redis:EXISTS {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID})" == '0') { +if !(%redis(EXISTS, {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID}) == '0') { test_fail } # # Verify the hash information is removed # -if !("%(redis:EXISTS {%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address})" == '0') { +if !(%redis(EXISTS, {%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address}) == '0') { test_fail } # Check the ZSCORE -if !("%(redis:ZCOUNT {%{control.IP-Pool.Name}%}:pool -inf +inf)" == 0) { +if !(%redis(ZCOUNT, {%{control.IP-Pool.Name}%}:pool, -inf, +inf) == 0) { test_fail } diff --git a/src/tests/modules/redis_ippool/pool_tool_modify.unlang b/src/tests/modules/redis_ippool/pool_tool_modify.unlang index 629f5d6517f..8df47d93b1a 100644 --- a/src/tests/modules/redis_ippool/pool_tool_modify.unlang +++ b/src/tests/modules/redis_ippool/pool_tool_modify.unlang @@ -8,24 +8,24 @@ $INCLUDE cluster_reset.inc # # Add 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` +%exec(./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) # # Verify the range was set OK # -if !("%(redis:HGET {%{control.IP-Pool.Name}}:ip:192.168.0.1 range)" == '192.168.0.0') { +if !(%redis(HGET, {%{control.IP-Pool.Name}}:ip:192.168.0.1, range) == '192.168.0.0') { test_fail } # # Modify the range # -&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -m 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 10.0.0.0` +%exec(./build/bin/local/rlm_redis_ippool_tool, -m, 192.168.0.1/32, $ENV{REDIS_IPPOOL_TEST_SERVER}:30001, %{control.IP-Pool.Name}, 10.0.0.0) # # Check it was updated # -if !("%(redis:HGET {%{control.IP-Pool.Name}}:ip:192.168.0.1 range)" == '10.0.0.0') { +if !(%redis(HGET, {%{control.IP-Pool.Name}}:ip:192.168.0.1, range) == '10.0.0.0') { test_fail } diff --git a/src/tests/modules/redis_ippool/pool_tool_release.unlang b/src/tests/modules/redis_ippool/pool_tool_release.unlang index af455202560..1be1b98e8a1 100644 --- a/src/tests/modules/redis_ippool/pool_tool_release.unlang +++ b/src/tests/modules/redis_ippool/pool_tool_release.unlang @@ -8,7 +8,7 @@ $INCLUDE cluster_reset.inc # # Add 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` +%exec(./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 @@ -27,32 +27,32 @@ if !(&reply.Framed-IP-Address == 192.168.0.1) { # # Release the IP address # -&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -r 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` +%exec(./build/bin/local/rlm_redis_ippool_tool, -r, 192.168.0.1/32, $ENV{REDIS_IPPOOL_TEST_SERVER}:30001, %{control.IP-Pool.Name}, 192.168.0.0) # # Verify the association with the device has been removed # -if !("%(redis:EXISTS {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID})" == '0') { +if !(%redis(EXISTS, {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID}) == '0') { test_fail } # # Verify the hash information is retained # -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 } # Check the ZSCORE -if !("%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address})" == 0) { +if !(%redis(ZSCORE, {%{control.IP-Pool.Name}}:pool, %{reply.Framed-IP-Address}) == 0) { test_fail } diff --git a/src/tests/modules/redis_ippool/pool_tool_static.unlang b/src/tests/modules/redis_ippool/pool_tool_static.unlang index ad067e1b2a0..5e5a36f2d6a 100644 --- a/src/tests/modules/redis_ippool/pool_tool_static.unlang +++ b/src/tests/modules/redis_ippool/pool_tool_static.unlang @@ -1,6 +1,7 @@ # # Test static IP allocation using redis_ippool # +uint64 zscore $INCLUDE cluster_reset.inc &control.IP-Pool.Name := 'test_tool_static' @@ -8,12 +9,12 @@ $INCLUDE cluster_reset.inc # # 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` +%exec(./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` +%exec(./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 @@ -32,37 +33,37 @@ if !(&reply.Framed-IP-Address == 192.168.0.10) { # # Fetch the ZSCORE now on the address # -&Tmp-uint64-0 := %(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) +&zscore := %redis(ZSCORE, {%{control.IP-Pool.Name}}:pool, %{reply.Framed-IP-Address}) # # Attempt to re-assign static lease # -&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` +%exec(./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 the ZSCORE hasn't changed # -if !(%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) == %{Tmp-uint64-0}) { +if !(%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) == %{zscore}) { test_fail } # # Remove the static assignment - leaves the lease with its remaining time to expire # -&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -U 192.168.0.10/32 -O aa:bb:cc:dd:ee:ff $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name}` +%exec(./build/bin/local/rlm_redis_ippool_tool, -U, 192.168.0.10/32, -O, aa:bb:cc:dd:ee:ff, $ENV{REDIS_IPPOOL_TEST_SERVER}:30001, %{control.IP-Pool.Name}) # # Attempt to assign the address to another device - should fail # -&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -A 192.168.0.10/32 -O aa:bb:cc:dd:ee:00 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` +%exec(./build/bin/local/rlm_redis_ippool_tool, -A, 192.168.0.10/32, -O, aa:bb:cc:dd:ee:00, $ENV{REDIS_IPPOOL_TEST_SERVER}:30001, %{control.IP-Pool.Name}, 192.168.0.0) # # Check the original device is still assigned to the address # -if !(%(redis:HGET {%{control.IP-Pool.Name}}:ip:192.168.0.10 'device') == 'aa:bb:cc:dd:ee:ff') { +if !(%redis(HGET, {%{control.IP-Pool.Name}}:ip:192.168.0.10, 'device') == 'aa:bb:cc:dd:ee:ff') { test_fail } -if !(%(redis:GET {%{control.IP-Pool.Name}}:device:aa:bb:cc:dd:ee:ff) == '192.168.0.10') { +if !(%redis(GET, {%{control.IP-Pool.Name}}:device:aa:bb:cc:dd:ee:ff) == '192.168.0.10') { test_fail } @@ -85,39 +86,39 @@ if !(&reply.Framed-IP-Address == 192.168.0.1) { # # Attempt to statically assign this to another device # -&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -A 192.168.0.1/32 -O aa:bb:cc:dd:ee:00 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` +%exec(./build/bin/local/rlm_redis_ippool_tool, -A, 192.168.0.1/32, -O, aa:bb:cc:dd:ee:00, $ENV{REDIS_IPPOOL_TEST_SERVER}:30001, %{control.IP-Pool.Name}, 192.168.0.0) # # Check the original device is still assigned to the address and the lease is dynamic # -if !(%(redis:HGET {%{control.IP-Pool.Name}}:ip:192.168.0.1 'device') == %{Calling-Station-Id}) { +if !(%redis(HGET, {%{control.IP-Pool.Name}}:ip:192.168.0.1, 'device') == %{Calling-Station-Id}) { test_fail } -if !(%(redis:GET {%{control.IP-Pool.Name}}:device:11:22:33:44:55:66) == '192.168.0.1') { +if !(%redis(GET, {%{control.IP-Pool.Name}}:device:11:22:33:44:55:66) == '192.168.0.1') { test_fail } -&Tmp-uint64-1 := %(redis:ZSCORE {%{control.IP-Pool.Name}}:pool 192.168.0.1) -if !(&Tmp-uint64-1 < (uint64)0x10000000000000) { +&zscore := %(redis:ZSCORE {%{control.IP-Pool.Name}}:pool 192.168.0.1) +if !(&zscore < (uint64)0x10000000000000) { test_fail } # # Now assign it as a static lease for the current device # -&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -A 192.168.0.1/32 -O %{Calling-Station-Id} $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` +%exec(./build/bin/local/rlm_redis_ippool_tool, -A, 192.168.0.1/32, -O, %{Calling-Station-Id}, $ENV{REDIS_IPPOOL_TEST_SERVER}:30001, %{control.IP-Pool.Name}, 192.168.0.0) # # Check that the ZSCORE is maintained, simply with the static bit set # -if !(%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool 192.168.0.1) == (&Tmp-uint64-1 + %(cast:uint64 0x10000000000000))) { +if !(%redis(ZSCORE, {%{control.IP-Pool.Name}}:pool, 192.168.0.1) == (&zscore + %(cast:uint64 0x10000000000000))) { test_fail } # # And that the expiry is now removed on the device # -if ("%(redis:TTL {%{control.IP-Pool.Name}}:device:%{Calling-Station-Id})" != '-1') { +if (%redis(TTL, {%{control.IP-Pool.Name}}:device:%{Calling-Station-Id}) != '-1') { test_fail } diff --git a/src/tests/modules/redis_ippool/release.unlang b/src/tests/modules/redis_ippool/release.unlang index 97fc1204d60..f24112deb45 100644 --- a/src/tests/modules/redis_ippool/release.unlang +++ b/src/tests/modules/redis_ippool/release.unlang @@ -8,7 +8,7 @@ $INCLUDE cluster_reset.inc # # Add 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` +%exec(./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 @@ -39,31 +39,31 @@ if (!(updated)) { # # Verify the association with the device has been removed # -if (!("%(redis:EXISTS {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID})" == '0')) { +if (!(%redis(EXISTS, {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID}) == '0')) { test_fail } # # Verify the hash information is retained # -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 } # Check the ZSCORE - releasing an address sets the ZSCORE to now - 1 -if (%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) > %c) { +if (%redis(ZSCORE, {%{control.IP-Pool.Name}}:pool, %{reply.Framed-IP-Address}) > %c) { test_fail } -if ((%c - %(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) > 10)) { +if ((%c - %redis(ZSCORE, {%{control.IP-Pool.Name}}:pool, %{reply.Framed-IP-Address}) > 10)) { test_fail } diff --git a/src/tests/modules/redis_ippool/static.unlang b/src/tests/modules/redis_ippool/static.unlang index a23a0a7f136..9ff478f44d0 100644 --- a/src/tests/modules/redis_ippool/static.unlang +++ b/src/tests/modules/redis_ippool/static.unlang @@ -8,12 +8,12 @@ $INCLUDE cluster_reset.inc # # 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` +%exec(./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` +%exec(./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 @@ -49,7 +49,7 @@ redis_ippool.renew { # # Verify no expiry has been set on device # -if ("%(redis:TTL {%{control.IP-Pool.Name}}:device:%{Calling-Station-Id})" != '-1') { +if (%redis(TTL, {%{control.IP-Pool.Name}}:device:%{Calling-Station-Id}) != '-1') { test_fail } @@ -73,19 +73,19 @@ if (!(updated)) { # # Verify the association with the device remains # -if ("%(redis:EXISTS {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID})" == '0') { +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') { +if (%redis(EXISTS, {%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address}) == '0') { test_fail } # Check the ZSCORE -if ("%(redis:ZSCORE {%{control.IP-Pool.Name}%}:pool %{reply.Framed-IP-Address})" <= %l) { +if (%redis(ZSCORE, {%{control.IP-Pool.Name}%}:pool, %{reply.Framed-IP-Address}) <= %l) { test_fail } diff --git a/src/tests/modules/redis_ippool/static_dynamic.unlang b/src/tests/modules/redis_ippool/static_dynamic.unlang index 116827a8fc1..a2e1817765e 100644 --- a/src/tests/modules/redis_ippool/static_dynamic.unlang +++ b/src/tests/modules/redis_ippool/static_dynamic.unlang @@ -8,7 +8,7 @@ $INCLUDE cluster_reset.inc # # 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` +%exec(./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 @@ -23,7 +23,7 @@ if (!notfound) { # # 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` +%exec(./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 diff --git a/src/tests/modules/redis_ippool/static_unassign.unlang b/src/tests/modules/redis_ippool/static_unassign.unlang index d511dcc262b..a3ea7dac2e3 100644 --- a/src/tests/modules/redis_ippool/static_unassign.unlang +++ b/src/tests/modules/redis_ippool/static_unassign.unlang @@ -8,12 +8,12 @@ $INCLUDE cluster_reset.inc # # 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` +%exec(./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` +%exec(./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 @@ -40,12 +40,12 @@ if (!(&reply.Session-Timeout == 30)) { # # Un-assign static allocation # -&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -U 192.168.0.10/32 -O aa:bb:cc:dd:ee:ff $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name}` +%exec(./build/bin/local/rlm_redis_ippool_tool, -U, 192.168.0.10/32, -O, aa:bb:cc:dd:ee:ff, $ENV{REDIS_IPPOOL_TEST_SERVER}:30001, %{control.IP-Pool.Name}) # # Check ZSCORE is now < 2^52 - the "static bit" # -if (%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) >= %(cast:uint64 0x10000000000000)) { +if (%redis(ZSCORE, {%{control.IP-Pool.Name}}:pool, %{reply.Framed-IP-Address}) >= %(cast:uint64 0x10000000000000)) { test_fail } @@ -54,7 +54,7 @@ if (%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) >= # This is based on the initial lease duration given (of 30 sec) but will have reduced # due to elapsed time since the allocation. # -if ("%(redis:TTL {%{control.IP-Pool.Name}}:device:%{Calling-Station-Id})" < 20) { +if (%redis(TTL, {%{control.IP-Pool.Name}}:device:%{Calling-Station-Id}) < 20) { test_fail } @@ -80,19 +80,19 @@ if (!updated) { # # Verify the association with the device is removed # -if ("%(redis:EXISTS {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID})" != '0') { +if (%redis(EXISTS, {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID}) != '0') { test_fail } # Check the ZSCORE -if ("%(redis:ZSCORE {%{control.IP-Pool.Name}%}:pool %{reply.Framed-IP-Address})" > %l) { +if (%redis(ZSCORE, {%{control.IP-Pool.Name}%}:pool, %{reply.Framed-IP-Address}) > %l) { test_fail } # # Delete original dynamic address - so only the previously static one remains # -&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -d 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name}` +%exec(./build/bin/local/rlm_redis_ippool_tool, -d, 192.168.0.1/32, $ENV{REDIS_IPPOOL_TEST_SERVER}:30001, %{control.IP-Pool.Name}) # # Perform IP allocation for alternative device @@ -117,7 +117,7 @@ if !(&reply.Framed-IP-Address == '192.168.0.10') { # # Verify the IP hash has been set to point to the new device # -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 } diff --git a/src/tests/modules/redis_ippool/update.unlang b/src/tests/modules/redis_ippool/update.unlang index ad593047e98..428c6c6545f 100644 --- a/src/tests/modules/redis_ippool/update.unlang +++ b/src/tests/modules/redis_ippool/update.unlang @@ -8,7 +8,7 @@ $INCLUDE cluster_reset.inc # # Add 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` +%exec(./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) # 1. Check allocation redis_ippool @@ -27,12 +27,12 @@ if !(&reply.Session-Timeout == 30) { } # 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 } # 5. Add another IP addresses -&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.1.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.1.0` +%exec(./build/bin/local/rlm_redis_ippool_tool, -a, 192.168.1.1/32, $ENV{REDIS_IPPOOL_TEST_SERVER}:30001, %{control.IP-Pool.Name}, 192.168.1.0) # 6. Verify that the lease time is extended &Framed-IP-Address := &reply.Framed-IP-Address @@ -49,27 +49,27 @@ if !(&reply.Session-Timeout == 60) { } # 8. Check ZSCORE reflects that -if !((%redis('ZSCORE', "{%{control.IP-Pool.Name}}:pool", "%{reply.Framed-IP-Address}") - %l) > 50) { +if !((%redis(ZSCORE, {%{control.IP-Pool.Name}}:pool, %{reply.Framed-IP-Address}) - %l) > 50) { test_fail } # 9. -if !((%redis('ZSCORE', "{%{control.IP-Pool.Name}}:pool", "%{reply.Framed-IP-Address}") - %l) < 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 } @@ -101,7 +101,7 @@ if (!invalid) { } # 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 } diff --git a/src/tests/modules/redis_ippool/update_alloc.unlang b/src/tests/modules/redis_ippool/update_alloc.unlang index c076631bccf..e7b2e5fe9da 100644 --- a/src/tests/modules/redis_ippool/update_alloc.unlang +++ b/src/tests/modules/redis_ippool/update_alloc.unlang @@ -8,7 +8,7 @@ $INCLUDE cluster_reset.inc # # Add 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` +%exec(./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) # 1. Check allocation redis_ippool @@ -30,7 +30,7 @@ if !(&reply.Session-Timeout == 60) { } # 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 }