=== `Access-Request`: A device connects to the NAS with correct credentials
. FreeRADIUS receives an `Access-Request` from the NAS. After some
-processing (modules. `unlang`, etc.), the `Pool-Name` attribute is
+processing (modules. `unlang`, etc.), the `IP-Pool.Name` attribute is
added to the `control` list. This attribute indicates that the IP
address should be allocated from the named pool. This attribute can
be added from any module, database, `unlang`, etc.
. When the `sqlippool` module is eventually run, it looks for the
-`Pool-Name` attribute, and runs the various SQL queries in order to
+`IP-Pool.Name` attribute, and runs the various SQL queries in order to
perform IP address allocation. If the module is configured to place
address into the `Framed-IP-Address` attribute (as it is by default),
and that attribute already exists, the module does nothing, and
. The module then runs the `alloc_existing` query, which looks for
the IP address last assigned to the device from the pool indicated by
-`Pool-Name`. The device is identified using the `pool_key`
+`IP-Pool.Name`. The device is identified using the `pool_key`
configuration item (typically `NAS-Port`) and a NAS identifier (the
`NAS-IP-Address`).
. If no address was found using `alloc_existing`, the module then
runs the `alloc_find` query, which chooses a free IP address from
-the pool indicated by `Pool-Name`. If `alloc_find` does not return
+the pool indicated by `IP-Pool.Name`. If `alloc_find` does not return
an IP address, the `pool_check` query is run in order to determine
why the allocation failed. For example, either the requested pool is
empty (i.e. no free addresses), or it is non-existent. This
=== 7. Enable a pool user
-For a request to acquire an address from the pool you must set a `Pool-Name`
+For a request to acquire an address from the pool you must set a `IP-Pool.Name`
check attribute, either directly in the virtual server configuration or via a
data source such as `sql` (for example using the `radcheck` table).
-.Example of setting a Pool-Name attribute using the `radcheck` table
+.Example of setting a IP-Pool.Name attribute using the `radcheck` table
=============================================
[source,shell]
----
echo "INSERT INTO radcheck (username,attribute,op,value) \
- VALUES ('bob','Pool-Name',':=','internet');" \
+ VALUES ('bob','IP-Pool.Name',':=','internet');" \
| mysql radius
----
=============================================
-.Example of setting a Pool-Name attribute using in the server config
+.Example of setting a IP-Pool.Name attribute using in the server config
=============================================
.[raddb]/sites-enabled/default
send Access-Accept {
...
update control {
- &Pool-Name := 'internet'
+ &IP-Pool.Name := 'internet'
}
sqlippool
=============================================
-NOTE: Recall that if `sqlippool` is invoked without a `Pool-Name` check
+NOTE: Recall that if `sqlippool` is invoked without a `IP-Pool.Name` check
attribute then no action is taken. Also recall that if `sqlippool` is invoked
whilst the attribute configured in the `attribute_name` configuration item
(e.g. `Framed-IP-Address`) already exists then no action is taken.
$INCLUDE ${modconfdir}/sql/ippool-dhcp/mysql/queries.conf
# $INCLUDE ${modconfdir}/sql/ippool-dhcp/sqlite/queries.conf
sqlippool_log_exists = "DHCP: Existing IP: %{reply.${..attribute_name}} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
- sqlippool_log_success = "DHCP: Allocated IP: %{reply.${..attribute_name}} from %{control.Pool-Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
+ sqlippool_log_success = "DHCP: Allocated IP: %{reply.${..attribute_name}} from %{control.IP-Pool.Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
sqlippool_log_clear = "DHCP: Released IP %{${..attribute_name}} (did %{Called-Station-Id} cli %{Calling-Station-Id} user %{User-Name})"
- sqlippool_log_failed = "DHCP: IP Allocation FAILED from %{control.Pool-Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
- sqlippool_log_nopool = "DHCP: No Pool-Name defined (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
+ sqlippool_log_failed = "DHCP: IP Allocation FAILED from %{control.IP-Pool.Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
+ sqlippool_log_nopool = "DHCP: No IP-Pool.Name defined (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
}
```
```
redis_ippool {
- pool_name = &control.Pool-Name
+ pool_name = &control.IP-Pool.Name
offer_time = 30
lease_time = 3600
# wait_num = 10
pool_key = "%{NAS-Port}"
messages {
exists = "Existing IP: %{reply.${..attribute_name}} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
- success = "Allocated IP: %{reply.${..attribute_name}} from %{control.Pool-Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
+ success = "Allocated IP: %{reply.${..attribute_name}} from %{control.IP-Pool.Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
clear = "Released IP %{${..attribute_name}} (did %{Called-Station-Id} cli %{Calling-Station-Id} user %{User-Name})"
- failed = "IP Allocation FAILED from %{control.Pool-Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
- nopool = "No Pool-Name defined (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
+ failed = "IP Allocation FAILED from %{control.IP-Pool.Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
+ nopool = "No IP-Pool.Name defined (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
}
$INCLUDE ${modconfdir}/sql/ippool/${dialect}/queries.conf
}
Refresh leases when we see a start or alive. Return an address to
the IP Pool when we see a stop record.
-Ensure that &control.Pool-Name is set to determine which
+Ensure that &control.IP-Pool.Name is set to determine which
pool of IPs are used.
&DHCP-DHCP-Server-Identifier = 192.0.2.1
}
# update control {
-# &Pool-Name := "local"
+# &IP-Pool.Name := "local"
# }
# dhcp_sqlippool
ok
&DHCP-DHCP-Server-Identifier = 192.0.2.1
}
# update control {
-# &Pool-Name := "local"
+# &IP-Pool.Name := "local"
# }
# dhcp_sqlippool
ok
#
# pool_name:: Name of the pool from which leases are allocated.
#
- pool_name = &control.Pool-Name
+ pool_name = &control.IP-Pool.Name
#
# offer_time:: How long a lease is reserved for after making an offer.
messages {
exists = "Existing IP: %{reply.${..attribute_name}} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
- success = "Allocated IP: %{reply.${..attribute_name}} from %{control.Pool-Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
+ success = "Allocated IP: %{reply.${..attribute_name}} from %{control.IP-Pool.Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
clear = "Released IP %{${..attribute_name}} (did %{Called-Station-Id} cli %{Calling-Station-Id} user %{User-Name})"
- failed = "IP Allocation FAILED from %{control.Pool-Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
+ failed = "IP Allocation FAILED from %{control.IP-Pool.Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
- nopool = "No Pool-Name defined (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
+ nopool = "No IP-Pool.Name defined (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
}
#
pool_check = "\
SELECT id \
FROM ${ippool_table} \
- WHERE pool_name='%{control.${pool-name}}' \
+ WHERE pool_name='%{control.${IP-Pool.Name}}' \
LIMIT 1"
#
FROM (\
SELECT id \
FROM ${ippool_table} \
- WHERE pool_name = '%{control.Pool-Name}'\
+ WHERE pool_name = '%{control.IP-Pool.Name}'\
) WHERE ROWNUM = 1"
#
pool_check = "\
SELECT id \
FROM ${ippool_table} \
- WHERE pool_name='%{control.Pool-Name}' \
+ WHERE pool_name='%{control.IP-Pool.Name}' \
LIMIT 1"
#
#
# Return an address to the IP Pool when we see a stop record.
#
- # Ensure that &control.Pool-Name is set to determine which
+ # Ensure that &control.IP-Pool.Name is set to determine which
 # pool of IPs are used.
#
sqlippool
# Refresh leases when we see a start or alive. Return an address to
# the IP Pool when we see a stop record.
#
- # Ensure that &control.Pool-Name is set to determine which
+ # Ensure that &control.IP-Pool.Name is set to determine which
# pool of IPs are used.
#
# sqlippool
# Or, allocate IPs from the DHCP pool in SQL. You may need to
# set the pool name here if you haven't set it elsewhere.
# update control {
-# &Pool-Name := "local"
+# &IP-Pool.Name := "local"
# }
# dhcp_sqlippool
# Or, allocate IPs from the DHCP pool in SQL. You may need to
# set the pool name here if you haven't set it elsewhere.
# update control {
-# &Pool-Name := "local"
+# &IP-Pool.Name := "local"
# }
# dhcp_sqlippool
# If using IPs from a DHCP pool in SQL then you may need to set the
# pool name here if you haven't set it elsewhere and mark the IP as declined.
# update control {
-# &Pool-Name := "local"
+# &IP-Pool.Name := "local"
# }
# dhcp_sqlippool
# If using IPs from a DHCP pool in SQL then you may need to set the
# pool name here if you haven't set it elsewhere and release the IP.
# update control {
-# &Pool-Name := "local"
+# &IP-Pool.Name := "local"
# }
# dhcp_sqlippool
# This work is licensed under CC-BY version 4.0 https://creativecommons.org/licenses/by/4.0
# Version $Id$
#
-# Attributes used by ippool modules (5100-5199)
+# Attributes used by IP-Pool modules (5100-5199)
#
# $Id$
#
#
FLAGS internal
-ATTRIBUTE Pool-Name 5100 string
+ATTRIBUTE IP-Pool 5100 tlv
-ATTRIBUTE Pool-Action 5101 integer
-ATTRIBUTE Pool-Range 5102 string
+BEGIN-TLV IP-Pool
+ATTRIBUTE Name 1 string # Generic identifier for the IP pool to allocate from
+ATTRIBUTE Name-NA 2 string # DHCPv6 - Non-Temporary association pool
+ATTRIBUTE Name-PD 3 string # DHCPv6 - Prefix-deligation pool
+ATTRIBUTE Name-TA 4 string # DHCPv6 - Temporary association pool
+ATTRIBUTE Action 5 integer
-VALUE Pool-Action Allocate 1
+VALUE Action Allocate 1
# Renew == Update (they're the same action)
-VALUE Pool-Action Renew 2
-VALUE Pool-Action Update 2
-VALUE Pool-Action Release 3
-VALUE Pool-Action Bulk-Release 4
+VALUE Action Renew 2
+VALUE Action Update 2
+VALUE Action Release 3
+VALUE Action Bulk-Release 4
+
+ATTRIBUTE Range 6 string
+END-TLV IP-Pool
+
+
$INCLUDE cluster_reset.inc
update control {
- &Pool-Name := 'test_alloc'
+ &IP-Pool.Name := 'test_alloc'
}
#
# Add IP addresses
#
update request {
- &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.Pool-Name} 192.168.0.0`
+ &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`
}
#
&Tmp-Date-0 := "%l"
}
-if ("%{expr:%{redis:ZSCORE '{%{control.Pool-Name}%}:pool' '%{reply.Framed-IP-Address}'} - %{integer:&Tmp-Date-0}}" > 20) {
+if ("%{expr:%{redis:ZSCORE '{%{control.IP-Pool.Name}%}:pool' '%{reply.Framed-IP-Address}'} - %{integer:&Tmp-Date-0}}" > 20) {
test_pass
} else {
test_fail
}
-if ("%{expr:%{redis:ZSCORE '{%{control.Pool-Name}%}:pool' '%{reply.Framed-IP-Address}'} - %{integer:&Tmp-Date-0}}" < 40) {
+if ("%{expr:%{redis:ZSCORE '{%{control.IP-Pool.Name}%}:pool' '%{reply.Framed-IP-Address}'} - %{integer:&Tmp-Date-0}}" < 40) {
test_pass
} else {
test_fail
#
# Verify the IP hash has been set
#
-if ("%{redis:HGET '{%{control.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_pass
} else {
test_fail
}
-if ("%{redis:HGET {%{control.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_pass
} else {
test_fail
}
-if ("%{redis:HGET {%{control.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_pass
} else {
test_fail
#
# Verify the lease has been associated with the device
#
-if (&reply.Framed-IP-Address == "%{redis:GET '{%{control.Pool-Name}%}:device:%{Calling-Station-ID}'}") {
+if (&reply.Framed-IP-Address == "%{redis:GET '{%{control.IP-Pool.Name}%}:device:%{Calling-Station-ID}'}") {
test_pass
} else {
test_fail
# Add IP addresses
#
update request {
- &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.1.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.Pool-Name} 192.168.1.0`
+ &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`
}
#
redis_ippool {
device = &Calling-Station-ID
gateway = &NAS-IP-Address
- pool_name = &control.Pool-Name
+ pool_name = &control.IP-Pool.Name
offer_time = 30
lease_time = 60
$INCLUDE cluster_reset.inc
update control {
- &Pool-Name := 'test_delete'
+ &IP-Pool.Name := 'test_delete'
}
#
# Add IP addresses
#
update request {
- &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.Pool-Name} 192.168.0.0`
+ &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`
}
#
# Delete the IP address
#
update request {
- &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -d 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.Pool-Name} 192.168.0.0`
+ &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`
}
#
# Verify the association with the device has been removed
#
-if ("%{redis:EXISTS '{%{control.Pool-Name}%}:device:%{Calling-Station-ID}'}" == '0') {
+if ("%{redis:EXISTS '{%{control.IP-Pool.Name}%}:device:%{Calling-Station-ID}'}" == '0') {
test_pass
} else {
test_fail
#
# Verify the hash information is removed
#
-if ("%{redis:EXISTS '{%{control.Pool-Name}%}:ip:%{reply.Framed-IP-Address}'}" == '0') {
+if ("%{redis:EXISTS '{%{control.IP-Pool.Name}%}:ip:%{reply.Framed-IP-Address}'}" == '0') {
test_pass
} else {
test_fail
}
# Check the ZSCORE
-if ("%{redis:ZCOUNT '{%{control.Pool-Name}%}:pool' -inf +inf}" == 0) {
+if ("%{redis:ZCOUNT '{%{control.IP-Pool.Name}%}:pool' -inf +inf}" == 0) {
test_pass
} else {
test_fail
$INCLUDE cluster_reset.inc
update control {
- &Pool-Name := 'test_update'
+ &IP-Pool.Name := 'test_update'
}
#
# Add IP addresses
#
update request {
- &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.Pool-Name} 192.168.0.0`
+ &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`
}
#
# Verify the range was set OK
#
-if ("%{redis:HGET {%{control.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_pass
} else {
test_fail
# Modify the range
#
update request {
- &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -m 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.Pool-Name} 10.0.0.0`
+ &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`
}
#
# Check it was updated
#
-if ("%{redis:HGET {%{control.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_pass
} else {
test_fail
$INCLUDE cluster_reset.inc
update control {
- &Pool-Name := 'test_update'
+ &IP-Pool.Name := 'test_update'
}
#
# Add IP addresses
#
update request {
- &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.Pool-Name} 192.168.0.0`
+ &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`
}
#
# Release the IP address
#
update request {
- &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -r 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.Pool-Name} 192.168.0.0`
+ &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`
}
#
# Verify the association with the device has been removed
#
-if ("%{redis:EXISTS '{%{control.Pool-Name}%}:device:%{Calling-Station-ID}'}" == '0') {
+if ("%{redis:EXISTS '{%{control.IP-Pool.Name}%}:device:%{Calling-Station-ID}'}" == '0') {
test_pass
} else {
test_fail
#
# Verify the hash information is retained
#
-if ("%{redis:HGET '{%{control.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_pass
} else {
test_fail
}
-if ("%{redis:HGET {%{control.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_pass
} else {
test_fail
}
-if ("%{redis:HGET {%{control.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_pass
} else {
test_fail
}
# Check the ZSCORE
-if ("%{redis:ZSCORE '{%{control.Pool-Name}%}:pool' '%{reply.Framed-IP-Address}'}" == 0) {
+if ("%{redis:ZSCORE '{%{control.IP-Pool.Name}%}:pool' '%{reply.Framed-IP-Address}'}" == 0) {
test_pass
} else {
test_fail
$INCLUDE cluster_reset.inc
update control {
- &Pool-Name := 'test_update'
+ &IP-Pool.Name := 'test_update'
}
#
# Add IP addresses
#
update request {
- &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.Pool-Name} 192.168.0.0`
+ &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`
}
#
#
# Verify the association with the device has been removed
#
-if ("%{redis:EXISTS '{%{control.Pool-Name}%}:device:%{Calling-Station-ID}'}" == '0') {
+if ("%{redis:EXISTS '{%{control.IP-Pool.Name}%}:device:%{Calling-Station-ID}'}" == '0') {
test_pass
} else {
test_fail
#
# Verify the hash information is retained
#
-if ("%{redis:HGET '{%{control.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_pass
} else {
test_fail
}
-if ("%{redis:HGET {%{control.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_pass
} else {
test_fail
}
-if ("%{redis:HGET {%{control.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_pass
} else {
test_fail
&Tmp-Date-0 := "%l"
}
-if ("%{expr:%{redis:ZSCORE '{%{control.Pool-Name}%}:pool' '%{reply.Framed-IP-Address}'} - %{integer:&Tmp-Date-0}}" > 0) {
+if ("%{expr:%{redis:ZSCORE '{%{control.IP-Pool.Name}%}:pool' '%{reply.Framed-IP-Address}'} - %{integer:&Tmp-Date-0}}" > 0) {
test_pass
} else {
test_fail
}
-if ("%{expr:%{redis:ZSCORE '{%{control.Pool-Name}%}:pool' '%{reply.Framed-IP-Address}'} - %{integer:&Tmp-Date-0}}" < 10) {
+if ("%{expr:%{redis:ZSCORE '{%{control.IP-Pool.Name}%}:pool' '%{reply.Framed-IP-Address}'} - %{integer:&Tmp-Date-0}}" < 10) {
test_pass
} else {
test_fail
$INCLUDE cluster_reset.inc
update control {
- &Pool-Name := 'test_update'
+ &IP-Pool.Name := 'test_update'
}
#
# Add IP addresses
#
update request {
- &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.Pool-Name} 192.168.0.0`
+ &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`
}
# 1. Check allocation
}
# 4. Verify the gateway was set
-if ("%{redis:HGET {%{control.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_pass
} else {
test_fail
# 5. Add another IP addresses
update request {
- &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.1.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.Pool-Name} 192.168.1.0`
+ &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`
}
# 6. Verify that the lease time is extended
&Tmp-Date-0 := "%l"
}
-if ("%{expr:%{redis:ZSCORE '{%{control.Pool-Name}%}:pool' '%{reply.Framed-IP-Address}'} - %{integer:&Tmp-Date-0}}" > 50) {
+if ("%{expr:%{redis:ZSCORE '{%{control.IP-Pool.Name}%}:pool' '%{reply.Framed-IP-Address}'} - %{integer:&Tmp-Date-0}}" > 50) {
test_pass
} else {
test_fail
}
# 9.
-if ("%{expr:%{redis:ZSCORE '{%{control.Pool-Name}%}:pool' '%{reply.Framed-IP-Address}'} - %{integer:&Tmp-Date-0}}" < 70) {
+if ("%{expr:%{redis:ZSCORE '{%{control.IP-Pool.Name}%}:pool' '%{reply.Framed-IP-Address}'} - %{integer:&Tmp-Date-0}}" < 70) {
test_pass
} else {
test_fail
}
# 10. Verify the lease is still associated with the device
-if (&reply.Framed-IP-Address == "%{redis:GET '{%{control.Pool-Name}%}:device:%{Calling-Station-ID}'}") {
+if (&reply.Framed-IP-Address == "%{redis:GET '{%{control.IP-Pool.Name}%}:device:%{Calling-Station-ID}'}") {
test_pass
} else {
test_fail
}
# 11. And that the device object will expire a suitable number of seconds into the future
-if ("%{redis:TTL '{%{control.Pool-Name}%}:device:%{Calling-Station-ID}'}" == 60) {
+if ("%{redis:TTL '{%{control.IP-Pool.Name}%}:device:%{Calling-Station-ID}'}" == 60) {
test_pass
} else {
test_fail
}
# 12. Verify the gateway was updated
-if ("%{redis:HGET {%{control.Pool-Name}%}:ip:%{request.Framed-IP-Address} gateway}" == '127.0.0.2') {
+if ("%{redis:HGET {%{control.IP-Pool.Name}%}:ip:%{request.Framed-IP-Address} gateway}" == '127.0.0.2') {
test_pass
} else {
test_fail
}
# 16. Verify the lease is still associated with the previous device
-if (&reply.Framed-IP-Address == "%{redis:GET '{%{control.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_pass
} else {
test_fail
$INCLUDE cluster_reset.inc
update control {
- &Pool-Name := 'test_update'
+ &IP-Pool.Name := 'test_update'
}
#
# Add IP addresses
#
update request {
- &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.Pool-Name} 192.168.0.0`
+ &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`
}
# 1. Check allocation
}
# 4. Verify the gateway was set
-if ("%{redis:HGET {%{control.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_pass
} else {
test_fail