<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
</div>
<b style="font-weight:normal">
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:#000000;background-color:#ffffff;font-weight:400">Hi Veronique,</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:#000000;background-color:#ffffff;font-weight:400"> "client-classes" within a reservation definition can only contain a list of classes:</span></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:#000000;background-color:#ffffff;font-weight:400">Can you explain what you are trying to achieve here? There may be another way of accomplishing
it.</span></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Arial;color:#000000;background-color:#ffffff;font-weight:400">Kind Regards Peter</span></p>
</b>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
>From "Kea Configuration File Syntax (BNF)":</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
reservation_client_classes ::= "client-classes" ":" list_strings
<div><br>
</div>
list_strings ::= "[" list_strings_content "]"<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
Sent from <a href="http://aka.ms/weboutlook">Outlook</a></div>
</div>
</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Kea-users <kea-users-bounces@lists.isc.org> on behalf of Veronique Lefebure <veronique.lefebure@cern.ch><br>
<b>Sent:</b> 20 July 2021 15:45<br>
<b>To:</b> Kea-users@lists.isc.org <Kea-users@lists.isc.org><br>
<b>Subject:</b> [Kea-users] Example for ifelse in host reservation or class</font>
<div> </div>
</div>
<div>
<p><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">Hi,</span></p>
<p><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">Is
there a way to use ifelse in a host reservation ?</span></p>
<p><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">We
would like something like </span></p>
<p><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">"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) " ] },</span></p>
<p><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">But
the above does not work: KEA interprets the whole string "</span><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none"><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">ifelse
( substring(option[vendor-class-identifier].text, 0, 9) == 'PXEClient' , 'Desktop', none)
</span>" as being the client-class name itself.</span></p>
<p><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">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.
</span></p>
<p><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">What
we need is the equivalent of what we have in DHCPD:</span></p>
<p><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">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
</span><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none"><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">xx:xx:xx:xx:xx:fa</span>;
option host-name "lab-client"; fixed-address </span><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none"><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">yy.yy.yy.121</span>;
} ....</span></p>
<p><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">}</span></p>
<p><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">Thanks,</span></p>
<p><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none">Veronique
</span></p>
<p><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none"></span></p>
<p><span style="color:rgb(51,51,51); font-family:Menlo,Monaco,Consolas,"Courier New",monospace; font-size:13px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:2; text-align:left; text-indent:0px; text-transform:none; white-space:pre-wrap; widows:2; word-spacing:0px; background-color:rgb(248,248,248); text-decoration-style:initial; text-decoration-color:initial; display:inline!important; float:none"></span></p>
</div>
</body>
</html>