ok
&request <= {
- &Tmp-String-0 = "%(base64.encode:%{Tmp-String-0})"
- &Tmp-String-1 = "%(base64.encode:%{Tmp-Octets-0})"
- &Tmp-String-2 = "%(base64.encode:%{Tmp-IP-Address-0})"
- &Tmp-String-4 = "%(base64.encode:%{Tmp-Integer-0})"
- &Tmp-String-6 = "%(base64.encode:%{Tmp-Cast-Ifid})"
- &Tmp-String-7 = "%(base64.encode:%{Tmp-Cast-IPv6Addr})"
- &Tmp-String-8 = "%(base64.encode:%{Tmp-Cast-IPv6Prefix})"
- &Tmp-String-9 = "%(base64.encode:%{Tmp-Cast-Byte})"
+ &Tmp-String-0 = %base64.encode(%{Tmp-String-0})
+ &Tmp-String-1 = %base64.encode(%{Tmp-Octets-0})
+ &Tmp-String-2 = %base64.encode(%{Tmp-IP-Address-0})
+ &Tmp-String-4 = %base64.encode(%{Tmp-Integer-0})
+ &Tmp-String-6 = %base64.encode(%{Tmp-Cast-Ifid})
+ &Tmp-String-7 = %base64.encode(%{Tmp-Cast-IPv6Addr})
+ &Tmp-String-8 = %base64.encode(%{Tmp-Cast-IPv6Prefix})
+ &Tmp-String-9 = %base64.encode(%{Tmp-Cast-Byte})
}
# String - bin 0x39383730
}
&request <= {
- &Tmp-String-0 = "%(base64.encode:%{Tmp-Cast-Short})"
- &Tmp-String-1 = "%(base64.encode:%{Tmp-Cast-Ether})"
- &Tmp-String-2 = "%(base64.encode:%{Tmp-Cast-Integer64})"
- &Tmp-String-3 = "%(base64.encode:%{Tmp-Cast-IPv4Prefix})"
+ &Tmp-String-0 = %base64.encode(%{Tmp-Cast-Short})
+ &Tmp-String-1 = %base64.encode(%{Tmp-Cast-Ether})
+ &Tmp-String-2 = %base64.encode(%{Tmp-Cast-Integer64})
+ &Tmp-String-3 = %base64.encode(%{Tmp-Cast-IPv4Prefix})
}
# short - bin 0x373b
}
&request <= {
- &Tmp-Octets-0 = "%(base64.decode:Zm9v)"
- &Tmp-Octets-1 = "%(base64.decode:AIAAAAAAAAAAAAAAAAA5ODc5)"
+ &Tmp-Octets-0 = %base64.decode(Zm9v)
+ &Tmp-Octets-1 = %base64.decode(AIAAAAAAAAAAAAAAAAA5ODc5)
}
if (!(&Tmp-Octets-0 == "foo")) {
# Regression tests
&request -= &Tmp-Octets-0[*]
-&Tmp-Octets-0 := %(base64.decode:5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK)
+&Tmp-Octets-0 := %base64.decode(5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK)
if (!(&Tmp-Octets-0 == 0xe5136a365f2260b6e409cec9851f1ab384ed0c3097ea8b6eb96b5c8daf2b213532c7dceb9c749ef6d4c71a628a)) {
test_fail
}
&request -= &Tmp-Octets-0[*]
-&Tmp-Octets-0 = "%(base64.decode:eHfXPKZ+2iv9cnMV1MOmE/moYYA1Uk5xTmw4aVlMYmtDYzdKaFI4YXM0VHRERENYNm90dXVXdGNqYThySVRVeXg5enJuSFNlOXRUSEdtS0s=)"
+&Tmp-Octets-0 = %base64.decode(eHfXPKZ+2iv9cnMV1MOmE/moYYA1Uk5xTmw4aVlMYmtDYzdKaFI4YXM0VHRERENYNm90dXVXdGNqYThySVRVeXg5enJuSFNlOXRUSEdtS0s=)
if (!(&Tmp-Octets-0 == 0x7877d73ca67eda2bfd727315d4c3a613f9a8618035524e714e6c3869594c626b4363374a685238617334547444444358366f7475755774636a6138724954557978397a726e48536539745448476d4b4b)) {
test_fail
ok # separate updates
&control += {
- &Tmp-String-1 = "%(concat:%{control.[*]} ', ')"
+ &Tmp-String-1 = %concat(%{control.[*]}, ', ')
}
"%{control.Tmp-String-1}"
}
&control += {
- &Tmp-String-2 = "%(concat:%{control.Tmp-String-0[*]} ', ')"
+ &Tmp-String-2 = %concat(%{control.Tmp-String-0[*]}, ', ')
}
if (!(&control.Tmp-String-2 == "ab c, de fg")) {
# Empty separator
&control += {
- &Tmp-String-3 = "%(concat:%{control.Tmp-String-0[*]})"
+ &Tmp-String-3 = %concat(%{control.Tmp-String-0[*]})
}
if (!(&control.Tmp-String-3 == "ab cde fg")) {
# Single character separator
&control += {
- &Tmp-String-4 = "%(concat:%{control.Tmp-String-0[*]} ,)"
+ &Tmp-String-4 = %concat(%{control.Tmp-String-0[*]}, ',')
}
if (!(&control.Tmp-String-4 == "ab c,de fg")) {
# Multi character separator not delimited
&control += {
- &Tmp-String-5 = "%(concat:%{control.Tmp-String-0[*]} |-)"
+ &Tmp-String-5 = %concat(%{control.Tmp-String-0[*]}, '|-')
}
if !(&control.Tmp-String-5 == "ab c|-de fg") {
&Tmp-Integer-0 := 1506101100
# Convert to string representation
-&Tmp-String-0 := %(date:%{Tmp-Integer-0})
+&Tmp-String-0 := %date(%{Tmp-Integer-0})
# Some systems report GMT some UTC...
if (!(&Tmp-String-0 == "Fri 22 Sep 17:25:00 GMT 2017")) && (!(&Tmp-String-0 == "Fri 22 Sep 17:25:00 UTC 2017")) {
}
# Convert string to integer
-&Tmp-Integer-1 := %(integer:%(date:%{Tmp-String-0}))
+&Tmp-Integer-1 := %integer(%date(%{Tmp-String-0}))
if (!(&Tmp-Integer-1 == &Tmp-Integer-0)) {
test_fail
}
# Compare two methods of reading request timestamp in local timezone
-&Tmp-String-0 := %(localdate:request)
-&Tmp-String-1 := "%S"
+&Tmp-String-0 := %localdate(request)
+&Tmp-String-1 := %S
if (!(&Tmp-String-0 == &Tmp-String-1)) {
test_fail
# Convert different string format
&Tmp-String-2 := "2017-09-22 17:25:00"
-&Tmp-Integer-2 := %(integer:%(sqldate:%{Tmp-String-2}))
+&Tmp-Integer-2 := %integer(%sqldate(%{Tmp-String-2}))
if (!(&Tmp-Integer-2 == &Tmp-Integer-0)) {
test_fail
# Use a date attribute
&Tmp-Date-0 := 1659985459
-&Tmp-String-2 := "%(sqldate:%{Tmp-Date-0})"
+&Tmp-String-2 := %sqldate(%{Tmp-Date-0})
if !(&Tmp-String-2 == '2022-08-08 19:04:19') {
test_fail
# Invalid format
&Tmp-String-3 := '201-32-22 17:25:00'
-&Tmp-String-4 := %(sqldate:%{Tmp-String-3})
+&Tmp-String-4 := %sqldate(%{Tmp-String-3})
# This shouldn't exist, as the RHS above is NULL, and therefore the assignment will fail
if (&Tmp-String-4) {
# Invalid type
&NAS-IP-Address := "192.168.1.1"
-&Tmp-String-5 := %(date:%{NAS-IP-Address})
+&Tmp-String-5 := %date(%{NAS-IP-Address})
if (&Tmp-String-5) {
test_fail
# PRE: if
#
-&Tmp-Integer-0 := "%(debug:4)"
+&Tmp-Integer-0 := "%debug(4)"
# Check debug level is now 4
-if (!("%(debug:3)" == 4)) {
+if (!(%debug(3) == 4)) {
test_fail
}
# Call with NULL arg, should report current level
-if (!("%(debug:%{Tmp-String-8})" == 3)) {
+if (!(%debug(%{Tmp-String-8}) == 3)) {
test_fail
}
# ...and again
-if (!("%(debug:%{Tmp-String-8})" == 3)) {
+if (!(%debug(%{Tmp-String-8}) == 3)) {
test_fail
}
# ...and again
-if (!("%(debug:)" == 3)) {
+if (!(%debug() == 3)) {
test_fail
}
# ...and again
-if (!("%(debug:)" == 3)) {
+if (!(%debug() == 3)) {
test_fail
}
#
# Mark it as immutable. The value shouldn't change.
#
-%(immutable:&request.NAS-Port[*])
+%immutable(&request.NAS-Port[*])
if !(&NAS-Port == 1813) {
test_fail
}
&Tmp-Cast-IPv4Prefix = 57.56.55.62/32
}
-if (!(%(length:%{Tmp-String-0}) == 260)) {
+if (!(%length(%{Tmp-String-0}) == 260)) {
test_fail
}
&request += {
- &Tmp-uint64-0 = "%(length:%{Tmp-String-2})" # Tmp-Integer-0 is defined and used below for Tmp-Integer-4
- &Tmp-Integer-1 = "%(length:%{Tmp-Octets-0})"
- &Tmp-Integer-2 = "%(length:%{Tmp-IP-Address-0})"
- &Tmp-Integer-3 = "%(length:\"hello, world\")"
- &Tmp-Integer-4 = "%(length:%{Tmp-Integer-0})"
- &Tmp-Integer-6 = "%(length:%{Tmp-Cast-Ifid})"
- &Tmp-Integer-7 = "%(length:%{Tmp-Cast-IPv6Addr})"
- &Tmp-Integer-8 = "%(length:%{Tmp-Cast-IPv6Prefix})"
- &Tmp-Integer-9 = "%(length:%{Tmp-Cast-Byte})"
+ &Tmp-uint64-0 = %length(%{Tmp-String-2}) # Tmp-Integer-0 is defined and used below for Tmp-Integer-4
+ &Tmp-Integer-1 = %length(%{Tmp-Octets-0})
+ &Tmp-Integer-2 = %length(%{Tmp-IP-Address-0})
+ &Tmp-Integer-3 = %length('hello, world')
+ &Tmp-Integer-4 = %length(%{Tmp-Integer-0})
+ &Tmp-Integer-6 = %length(%{Tmp-Cast-Ifid})
+ &Tmp-Integer-7 = %length(%{Tmp-Cast-IPv6Addr})
+ &Tmp-Integer-8 = %length(%{Tmp-Cast-IPv6Prefix})
+ &Tmp-Integer-9 = %length(%{Tmp-Cast-Byte})
}
# String - bin 0x39383730
test_fail
}
-&Tmp-Integer-0 := "%(length:%{Tmp-Cast-Short})"
-&Tmp-Integer-1 := "%(length:%{Tmp-Cast-Ether})"
-&Tmp-Integer-2 := "%(length:%{Tmp-Cast-Integer64})"
-&Tmp-Integer-3 := "%(length:%{Tmp-Cast-IPv4Prefix})"
+&Tmp-Integer-0 := %length(%{Tmp-Cast-Short})
+&Tmp-Integer-1 := %length(%{Tmp-Cast-Ether})
+&Tmp-Integer-2 := %length(%{Tmp-Cast-Integer64})
+&Tmp-Integer-3 := %length(%{Tmp-Cast-IPv4Prefix})
# short - bin 0x373b
if (!(&Tmp-Integer-0 == 2)) {
}
&request += {
- &Tmp-Octets-0 = %(mschap:Challenge)
- &Tmp-Octets-1 = %(mschap:NT-Response)
- &Tmp-String-0 = "%(mschap:NT-Domain)"
- &Tmp-String-1 = "%(mschap:User-Name)"
+ &Tmp-Octets-0 = %mschap(Challenge)
+ &Tmp-Octets-1 = %mschap(NT-Response)
+ &Tmp-String-0 = %mschap(NT-Domain)
+ &Tmp-String-1 = %mschap(User-Name)
}
if !(&Tmp-Octets-0 == 0xe96e4fff2955c4f1) {
&request.Vendor-Specific.Microsoft.CHAP-Response := 0x00006937d7935bb28a4c1dafe6a193bdea7a853a74d8bcf6db158860bbaac0cd3960b4ce5dc6f0f7a462b897ef530484e80f
-&Tmp-Octets-0 := "%(mschap:LM-Response)"
+&Tmp-Octets-0 := %mschap(LM-Response)
if !(&Tmp-Octets-0 == 0x6937d7935bb28a4c1dafe6a193bdea7a853a74d8bcf6db15) {
test_fail
}
# Hashing
-&Tmp-Octets-0 := %(mschap:NT-Hash testing_123)
-&Tmp-Octets-1 := %(mschap:LM-Hash testing_123)
+&Tmp-Octets-0 := %mschap(NT-Hash, 'testing_123')
+&Tmp-Octets-1 := %mschap(LM-Hash, 'testing_123')
if !(&Tmp-Octets-0 == 0xfa782604f85eb3564f555648341b53e4) {
test_fail
&Vendor-Specific.Microsoft.CHAP-Challenge := 0x04408dc2a98dae1ce351dfc53f57d08e
&Vendor-Specific.Microsoft.CHAP2-Response := 0x00010e93cfbfcef8d5b6af42d2b2ca5b43180000000000000000bc068d1e8c54de5e9db78e6736d686eb88a999dd7fa239b200
-&Tmp-Octets-0 := %(mschap:Challenge)
-&Tmp-Octets-1 := %(mschap:NT-Response)
+&Tmp-Octets-0 := %mschap(Challenge)
+&Tmp-Octets-1 := %mschap(NT-Response)
if !(&Tmp-Octets-0 == 0xad18b6b8e1478b4c) {
test_fail
# Invalid
&Vendor-Specific.Microsoft.CHAP-Challenge := 0xf0eac4151d5346662ba8c5e428
-&Tmp-String-0 := "%(mschap:Challenge)"
+&Tmp-String-0 := %mschap(Challenge)
-if !(&Tmp-String-0 == "") {
+if (&Tmp-String-0) {
test_fail
}