[Kea-users] Example for ifelse in host reservation or class
Veronique Lefebure
veronique.lefebure at cern.ch
Tue Jul 20 13:45:17 UTC 2021
Hi,
Is there a way to use ifelse in a host reservation ?
We would like something like
"reservations": [ { "hw-address": "xx:xx:xx:xx:xx:fa", "ip-address":
"yy.yy.yy.121", "hostname": "lab-client", "client-classes": [ " ifelse (
substring(option[vendor-class-identifier].text, 0, 9) == 'PXEClient' ,
'Desktop', none) " ] },
But the above does not work: KEA interprets the whole string "ifelse (
substring(option[vendor-class-identifier].text, 0, 9) == 'PXEClient' ,
'Desktop', none) " as being the client-class name itself.
Alternatively we could use "ifelse" in the client-class definition but
none of the combinations we have tried works: we always get a syntax
error reported by the validation of the json configuration file.
What we need is the equivalent of what we have in DHCPD:
group { # Desktop Clients if substring (option vendor-class-identifier,
0, 9) = "PXEClient" { option vendor-class-identifier "PXEClient"; option
dhcp-server-identifier aims.xxx; next-server aims.xxx; } host client1 {
hardware ethernet xx:xx:xx:xx:xx:fa; option host-name "lab-client";
fixed-address yy.yy.yy.121; } ....
}
Thanks,
Veronique
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20210720/8ce3ffbf/attachment.htm>
More information about the Kea-users
mailing list