<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Thanks, this might work.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Just for the record, if the identifier is a 62 char string. Would it be an issue? Is there any limitations? </p>
</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>Fra:</b> Marcin Siodelski <marcin@isc.org><br>
<b>Sendt:</b> 13. april 2018 17:04:41<br>
<b>Til:</b> Frode Sætre; kea-users@lists.isc.org<br>
<b>Emne:</b> Re: [Kea-users] Circuit-ID</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On 02.02.2018 09:25, Frode Sætre wrote:<br>
> <br>
> We want to identify leases with circuit ID, how can we get the circuit<br>
> ID with the lease4-get?<br>
> <br>
> <br>
> <br>
> Vennlig hilsen / Best regards<br>
> <br>
> <br>
> Frode Sætre<br>
> <br>
> <br>
> <br>
<br>
Frode,<br>
<br>
I realize that this is quite an old thread, but from our most recent<br>
correspondence via Kea dev I know that this issue still hasn't been<br>
resolved.<br>
<br>
We have created Kea ticket for you <a href="https://kea.isc.org/ticket/5592">https://kea.isc.org/ticket/5592</a>. This<br>
ticket is currently out of scope for the upcoming release as this is<br>
really a broader problem of how to easily associate any custom data with<br>
a lease, without having to update lease database schema every time we<br>
add a new parameter.<br>
<br>
As of today, the circuit id is not stored in the lease database and<br>
therefore there is no way to query for leases by circuit id, with one<br>
exception I discuss below.<br>
<br>
The only way to achieve what you want is to use 'flex-id' hook library<br>
which is available as part of our premium offering:<br>
<br>
<a href="https://www.isc.org/kea/">https://www.isc.org/kea/</a><br>
<br>
This library allows for specifying a custom expression which constitutes<br>
flexible identifier by which static host reservations can be identified.<br>
In particular, you may define an expression which uses circuit-id from<br>
the received DHCP query as an identifier to lookup host reservations for<br>
the client which sent this query.<br>
<br>
This library has one more feature which is going to be useful for your<br>
case. Setting "replace-client-id" to true in the library configuration<br>
will cause the library to replace client identifier option sent by the<br>
client with your custom identifier, e.g. circuit-id and store it in the<br>
lease database instead of the client identifier when the lease is<br>
allocated. The value of the circuit-id will be prefixed with hexadecimal<br>
"00". Assuming that the circuit-id value is "54:64:45:66". If the<br>
"replace-client-id" is set to true, the lease will be stored and the<br>
client-id value stored in the lease database will be "00:54:64:45:66".<br>
<br>
Now, you can query for this lease in the following way:<br>
<br>
{<br>
"command": "lease4-get",<br>
"arguments": {<br>
"identifier-type": "client-id",<br>
"identifier": "00:54:64:45:66",<br>
"subnet-id": 44<br>
}<br>
}<br>
<br>
Note that the identifier type is "client-id", but the value you put<br>
under "identifier" is your circuit-id prefixed with 00.<br>
<br>
This exact case is described in the Kea User's Guide:<br>
<br>
<a href="https://jenkins.isc.org/job/Kea_doc/guide/kea-guide.html#flex-id">https://jenkins.isc.org/job/Kea_doc/guide/kea-guide.html#flex-id</a><br>
<br>
<br>
This is the expression you may use for your custom identifier:<br>
<br>
"identifier-expression": "relay4[1].hex"<br>
<br>
which creates it from the relay agent sub option 1.<br>
<br>
<br>
Hope that helps,<br>
<br>
Marcin Siodelski<br>
ISC<br>
</div>
</span></font></div>
</body>
</html>