- Which never-used pool address a new client gets: sequential (the lowest, as before), reverse or random, in the settings, a subnet or a single pool (FIRST-LAST:ORDER). When no never-used address is left, the one free the longest, whatever the order; returning clients keep theirs. - A subnet's pools are used in the order listed, or one at random weighted by its never-used addresses. Pools now keep the order they are given in (no more sorting by address). - CLI --address-order and --pool-order; --add-pool of an existing range changes its order in place. Web UI: per-pool order and a move-up button, pool and address order on the subnet and settings pages. - Kea's allocator: random is imported. Schema migration 5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 lines
631 B
Go
23 lines
631 B
Go
package model
|
|
|
|
import "testing"
|
|
|
|
func TestParsePoolOrder(t *testing.T) {
|
|
for in, want := range map[string]string{
|
|
"10.0.0.1-10.0.0.50": "10.0.0.1-10.0.0.50",
|
|
"10.0.0.1 - 10.0.0.50:Random": "10.0.0.1-10.0.0.50:random",
|
|
"10.0.0.0/26:reverse": "10.0.0.0-10.0.0.63:reverse",
|
|
"10.0.0.1-10.0.0.50:default": "10.0.0.1-10.0.0.50",
|
|
} {
|
|
p, err := ParsePool(in)
|
|
if err != nil || p.String() != want {
|
|
t.Errorf("%q: %v %v", in, p, err)
|
|
}
|
|
}
|
|
for _, in := range []string{"10.0.0.1-10.0.0.50:", "10.0.0.1-10.0.0.50:lowest"} {
|
|
if _, err := ParsePool(in); err == nil {
|
|
t.Errorf("%q accepted", in)
|
|
}
|
|
}
|
|
}
|