The following example will take an input string `"192.168.0.1"`, split
it on the `'.'` character, and then assign it to another attribute.
-The result will be four copies of the `Tmp-Integer-0` attribute, which
+The result will be four copies of the `NAS-Port` attribute, which
each carry one octet of the IP address.
.Example Creating multiple Attributes
----
-Tmp-Integer-0 := %str.split("192.168.0.1", '.')
+NAS-Port := %str.split("192.168.0.1", '.')
----
If you need to cast an entire list to a value, then the value being
<key-name>::
-The local variable where the key refereence is placed.
+The local variable where the key reference is placed.
For numerical data types, the key value starts off at zero (0), and
increases by one every round through the loop. For `string` data
.Example of modifying values
[source,unlang]
----
-Tmp-Integer-0 := { 1, 3, 5, 11 }
+NAS-Port := { 1, 3, 5, 11 }
-foreach self (Tmp-Integer-0) {
- self += 19
+foreach item (NAS-Port) {
+ item += 19
}
----
-Once the loop has finished , the `Tmp-Integer-0` attribute will have
+Once the loop has finished , the `NAS-Port` attribute will have
the following set of values.
[source,unlang]
----
-Tmp-Integer-0 := { 20, 22, 24, 30 }
+NAS-Port := { 20, 22, 24, 30 }
----
.Pseudocode for variable modification
[source,unlang]
----
string total
-Tmp-Integer-0 := { 1, 3, 5, 11 }
+NAS-Port := { 1, 3, 5, 11 }
-foreach string ref, uint32 self (Tmp-Integer-0) {
+foreach string ref, uint32 item (NAS-Port) {
total += ref
total += " = "
- total += (string) self
+ total += (string) item
total += ", "
}
----
When the loop is finished, the `total` variable will have the following value:
----
-"Tmp-Integer-0[0] = 1, "Tmp-Integer-0[1] = 3, "Tmp-Integer-0[2] = 5, "Tmp-Integer-0[3] = 11, "
+"NAS-Port[0] = 1, "NAS-Port[1] = 3, "NAS-Port[2] = 5, "NAS-Port[3] = 11, "
----
.Key variable with attribute index
[source,unlang]
----
string total
-Tmp-Integer-0 := { 1, 3, 5, 11 }
+NAS-Port := { 1, 3, 5, 11 }
-foreach uint32 index, uint32 self (Tmp-Integer-0) {
+foreach uint32 index, uint32 item (NAS-Port) {
...
}
----
This example can read the child attribute `Foo`, but cannot modify it.
-
-// Copyright (C) 2024 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
+// Copyright (C) 2026 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
// This documentation was developed by Network RADIUS SAS.
[source,unlang]
----
-control.Tmp-String-0 := { "aaa", "bb", "c" }
+Filter-Id := { "aaa", "bb", "c" }
reply += {
- Reply-Message = %str.concat(%{control.Tmp-String-0[*]}, ', ')
- Reply-Message = %str.concat(%{control.Tmp-String-0[*]}, ',')
+ Reply-Message = %str.concat(%{Filter-Id[*]}, ', ')
+ Reply-Message = %str.concat(%{Filter-Id[*]}, ',')
}
----
aaa,bb,c
```
-// Copyright (C) 2025 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
+// Copyright (C) 2026 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
// This documentation was developed by Network RADIUS SAS.