[Kea-users] Circuit-ID

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Kea-users] Circuit-ID

Frode Sætre


We want to identify leases with circuit ID, how can we get the circuit ID with the lease4-get?



Vennlig hilsen / Best regards


Frode Sætre


_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Circuit-ID

Marcin Siodelski
On 02.02.2018 09:25, Frode Sætre wrote:

>
> We want to identify leases with circuit ID, how can we get the circuit
> ID with the lease4-get?
>
>
>
> Vennlig hilsen / Best regards
>
>
> Frode Sætre
>
>
>

Frode,

I realize that this is quite an old thread, but from our most recent
correspondence via Kea dev I know that this issue still hasn't been
resolved.

We have created Kea ticket for you https://kea.isc.org/ticket/5592. This
ticket is currently out of scope for the upcoming release as this is
really a broader problem of how to easily associate any custom data with
a lease, without having to update lease database schema every time we
add a new parameter.

As of today, the circuit id is not stored in the lease database and
therefore there is no way to query for leases by circuit id, with one
exception I discuss below.

The only way to achieve what you want is to use 'flex-id' hook library
which is available as part of our premium offering:

https://www.isc.org/kea/

This library allows for specifying a custom expression which constitutes
flexible identifier by which static host reservations can be identified.
In particular, you may define an expression which uses circuit-id from
the received DHCP query as an identifier to lookup host reservations for
the client which sent this query.

This library has one more feature which is going to be useful for your
case. Setting "replace-client-id" to true in the library configuration
will cause the library to replace client identifier option sent by the
client with your custom identifier, e.g. circuit-id and store it in the
lease database instead of the client identifier when the lease is
allocated. The value of the circuit-id will be prefixed with hexadecimal
"00". Assuming that the circuit-id value is "54:64:45:66". If the
"replace-client-id" is set to true, the lease will be stored and the
client-id value stored in the lease database will be "00:54:64:45:66".

Now, you can query for this lease in the following way:

{
    "command": "lease4-get",
    "arguments": {
        "identifier-type": "client-id",
        "identifier": "00:54:64:45:66",
        "subnet-id": 44
    }
}

Note that the identifier type is "client-id", but the value you put
under "identifier" is your circuit-id prefixed with 00.

This exact case is described in the Kea User's Guide:

https://jenkins.isc.org/job/Kea_doc/guide/kea-guide.html#flex-id


This is the expression you may use for your custom identifier:

"identifier-expression": "relay4[1].hex"

which creates it from the relay agent sub option 1.


Hope that helps,

Marcin Siodelski
ISC
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Circuit-ID

Frode Sætre

Hi,


Thanks, this might work.


Just for the record, if the identifier is a 62 char string. Would it be an issue? Is there any limitations? 


Fra: Marcin Siodelski <[hidden email]>
Sendt: 13. april 2018 17:04:41
Til: Frode Sætre; [hidden email]
Emne: Re: [Kea-users] Circuit-ID
 
On 02.02.2018 09:25, Frode Sætre wrote:
>
> We want to identify leases with circuit ID, how can we get the circuit
> ID with the lease4-get?
>
>
>
> Vennlig hilsen / Best regards
>
>
> Frode Sætre
>
>
>

Frode,

I realize that this is quite an old thread, but from our most recent
correspondence via Kea dev I know that this issue still hasn't been
resolved.

We have created Kea ticket for you https://kea.isc.org/ticket/5592. This
ticket is currently out of scope for the upcoming release as this is
really a broader problem of how to easily associate any custom data with
a lease, without having to update lease database schema every time we
add a new parameter.

As of today, the circuit id is not stored in the lease database and
therefore there is no way to query for leases by circuit id, with one
exception I discuss below.

The only way to achieve what you want is to use 'flex-id' hook library
which is available as part of our premium offering:

https://www.isc.org/kea/

This library allows for specifying a custom expression which constitutes
flexible identifier by which static host reservations can be identified.
In particular, you may define an expression which uses circuit-id from
the received DHCP query as an identifier to lookup host reservations for
the client which sent this query.

This library has one more feature which is going to be useful for your
case. Setting "replace-client-id" to true in the library configuration
will cause the library to replace client identifier option sent by the
client with your custom identifier, e.g. circuit-id and store it in the
lease database instead of the client identifier when the lease is
allocated. The value of the circuit-id will be prefixed with hexadecimal
"00". Assuming that the circuit-id value is "54:64:45:66". If the
"replace-client-id" is set to true, the lease will be stored and the
client-id value stored in the lease database will be "00:54:64:45:66".

Now, you can query for this lease in the following way:

{
    "command": "lease4-get",
    "arguments": {
        "identifier-type": "client-id",
        "identifier": "00:54:64:45:66",
        "subnet-id": 44
    }
}

Note that the identifier type is "client-id", but the value you put
under "identifier" is your circuit-id prefixed with 00.

This exact case is described in the Kea User's Guide:

https://jenkins.isc.org/job/Kea_doc/guide/kea-guide.html#flex-id


This is the expression you may use for your custom identifier:

"identifier-expression": "relay4[1].hex"

which creates it from the relay agent sub option 1.


Hope that helps,

Marcin Siodelski
ISC

_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Circuit-ID

Frode Sætre
In reply to this post by Marcin Siodelski

Also the documentation states;

"replace-client-id": "true"

Which gave me following error:

FLEX_ID_REPLACE_CLIENT_ID_JSON_TYPE the replace-client-id is string but expected boolean value.


By changing it to true without "", it worked. 




Fra: Marcin Siodelski <[hidden email]>
Sendt: 13. april 2018 17:04:41
Til: Frode Sætre; [hidden email]
Emne: Re: [Kea-users] Circuit-ID
 
On 02.02.2018 09:25, Frode Sætre wrote:
>
> We want to identify leases with circuit ID, how can we get the circuit
> ID with the lease4-get?
>
>
>
> Vennlig hilsen / Best regards
>
>
> Frode Sætre
>
>
>

Frode,

I realize that this is quite an old thread, but from our most recent
correspondence via Kea dev I know that this issue still hasn't been
resolved.

We have created Kea ticket for you https://kea.isc.org/ticket/5592. This
ticket is currently out of scope for the upcoming release as this is
really a broader problem of how to easily associate any custom data with
a lease, without having to update lease database schema every time we
add a new parameter.

As of today, the circuit id is not stored in the lease database and
therefore there is no way to query for leases by circuit id, with one
exception I discuss below.

The only way to achieve what you want is to use 'flex-id' hook library
which is available as part of our premium offering:

https://www.isc.org/kea/

This library allows for specifying a custom expression which constitutes
flexible identifier by which static host reservations can be identified.
In particular, you may define an expression which uses circuit-id from
the received DHCP query as an identifier to lookup host reservations for
the client which sent this query.

This library has one more feature which is going to be useful for your
case. Setting "replace-client-id" to true in the library configuration
will cause the library to replace client identifier option sent by the
client with your custom identifier, e.g. circuit-id and store it in the
lease database instead of the client identifier when the lease is
allocated. The value of the circuit-id will be prefixed with hexadecimal
"00". Assuming that the circuit-id value is "54:64:45:66". If the
"replace-client-id" is set to true, the lease will be stored and the
client-id value stored in the lease database will be "00:54:64:45:66".

Now, you can query for this lease in the following way:

{
    "command": "lease4-get",
    "arguments": {
        "identifier-type": "client-id",
        "identifier": "00:54:64:45:66",
        "subnet-id": 44
    }
}

Note that the identifier type is "client-id", but the value you put
under "identifier" is your circuit-id prefixed with 00.

This exact case is described in the Kea User's Guide:

https://jenkins.isc.org/job/Kea_doc/guide/kea-guide.html#flex-id


This is the expression you may use for your custom identifier:

"identifier-expression": "relay4[1].hex"

which creates it from the relay agent sub option 1.


Hope that helps,

Marcin Siodelski
ISC

_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Circuit-ID

Francis Dupont
It is a common mistake with JSON: true is the true boolean,
"true" is a string holding 't', 'r', 'u' and 'e' characters.
When we switched to a flex/bison parser we constrainted JSON input to
follow the standard. For instance if you try True it will fail with
a message explaining there is only one spelling: true.
Note the parser is typed so when you put a string at the place of a
boolean it fails. More, keywords (e.g., "subnet4") are known and
recognized according to the context so most typing errors are caught
during parsing...

Thanks

Francis Dupont <[hidden email]>

PS: if you can a cryptic error message please signal it so we can
improve it.
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Circuit-ID

Francis Dupont
Oops, I messed the PS. Here is the corrected version.
> PS: if you get a cryptic error message please signal it so we can
> improve it.

BTW the last ticket (5600) is a perfect example of that...
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users