[Kea-users] Example for ifelse in host reservation or class
Peter Davies
peter.watson.davies at outlook.com
Tue Jul 20 14:29:02 UTC 2021
Hi Veronique,
"client-classes" within a reservation definition can only contain a list of classes:
Can you explain what you are trying to achieve here? There may be another way of accomplishing it.
Kind Regards Peter
>From "Kea Configuration File Syntax (BNF)":
reservation_client_classes ::= "client-classes" ":" list_strings
list_strings ::= "[" list_strings_content "]"
Sent from Outlook<http://aka.ms/weboutlook>
________________________________
From: Kea-users <kea-users-bounces at lists.isc.org> on behalf of Veronique Lefebure <veronique.lefebure at cern.ch>
Sent: 20 July 2021 15:45
To: Kea-users at lists.isc.org <Kea-users at lists.isc.org>
Subject: [Kea-users] Example for ifelse in host reservation or class
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/1318bbc8/attachment-0001.htm>
More information about the Kea-users
mailing list