[Kea-users] Example for ifelse in host reservation or class

Francis Dupont fdupont at isc.org
Tue Jul 20 14:45:02 UTC 2021


Veronique Lefebure writes:
> 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) " ] },

=> client-classes takes a list of class names, not an expression.
We need to create a new class e.g. Desktop using the test part as
its expression (i.e. substring(option[vendor-class-identifier].text, 0, 9)
== 'PXEClient'. The expression grammar can return a boolean or a string
so what you can do with an ifelse can be done with a class.

Regards

Francis Dupont <fdupont at isc.org>


More information about the Kea-users mailing list