[Kea-users] Combining class definitions with or/and operands

Marek Hajduczenia mxhajduczenia at gmail.com
Wed May 1 18:23:49 UTC 2024


Thank you, Darren

I logged this as an issue https://gitlab.isc.org/isc-projects/kea/-/issues/3369, since I cannot find any specific wording in the documentation indicating it is indeed an expected behavior. It might be a corner case, but it ought to be covered somewhere

Marek

-----Original Message-----
From: Kea-users <kea-users-bounces at lists.isc.org> On Behalf Of Darren Ankney
Sent: Wednesday, May 1, 2024 5:41 AM
To: Kea user's list <kea-users at lists.isc.org>
Subject: Re: [Kea-users] Combining class definitions with or/and operands

Hi Marek,

The "client-class" is meant to only contain one class and no logical operands.  I am not sure if that configuration should throw an error, however.  There may be other considerations (such as API use to add classes later) that prevent such checking of the name contained therein.

Thank you,
Darren Ankney

On Tue, Apr 30, 2024 at 8:45 PM <mxhajduczenia at gmail.com> wrote:
>
> Just a foreword, I am experimenting with the class definitions and 
> different test structures, since the examples provided in the official 
> documentation are very limited. Specifically, I created these match 
> conditions, and they seem to work just fine
>
>
>
>     "client-classes": [
>
>       {
>
>         "name": "CTS19-RPDs",
>
>            "test": "pkt4.mac == 0x0020a361415b or pkt4.mac == 0x001848fe8f35"
>
>       },
>
>       {
>
>         "name": "CTS17-RPDs",
>
>            "test": "(pkt4.mac == 0x0020a3283bfb) or (pkt4.mac == 0x0020a3263a4b) or (pkt4.mac == 0x0020a3263a6b) or (pkt4.mac == 0x0020a35a1b0b)"
>
>       },
>
>       {
>
>         "name": "CTS18-RPDs",
>
>            "test": "(pkt4.mac == 0x0020a325c53b) or (pkt4.mac == 0x0018480ae57d) or (pkt4.mac == 0x0020a32b08bb) or (pkt4.mac == 0x0020a328e02b) or (pkt4.mac == 0x0020a357fc6b) or (pkt4.mac == 0x0020a358a5bb) or (pkt4.mac == 0x0020a35eb56b) or (pkt4.mac == 0x0020a35ecadb) or (pkt4.mac == 0x0018480ae35f) or (pkt4.mac == 0x0018480ae903) or (pkt4.mac == 0x0020a35dfb3b) or (pkt4.mac == 0x0020a380378b) or (pkt4.mac == 0x0020a34f93cb)"
>
>       }
>
>     ],
>
>
>
> As you can see, the test structure seems to not care for brackets () or not, and does the matching well even with very long conditions.
>
>
>
> Where the question comes is with the “client-class” statement in individual pool / subnet definitions. In the following example, the client class statement contains an ‘or’ combination for three different classes defined before. It parses fine, but … it does not seem to work. All examples I can find show a single entry in the client-class, but I am wondering whether the example below is a mistake and the parser should throw an error or not. I do know I can create another class that combines three previous classes into one, but I find this cleaner to read, where the match in client-class is performed on and/or combined structure of different atomic classes.
>
>
>
>            {
>
>                 "id": 1,
>
>                 "subnet": "172.27.60.16/28",
>
>                 "relay": {
>
>                       "ip-addresses": [ "172.27.60.17" ]
>
>                 },
>
>                 "pools": [
>
>                       {
>
>                            "pool": "172.27.60.18 - 172.27.60.30",
>
>                            "client-class": "CTS19-RPDs or CTS18-RPDs or CTS17-RPDs"
>
>                       }
>
>                 ],
>
>                 "option-data": [
>
>                       {
>
>                            "space": "dhcp4",
>
>                            "name": "subnet-mask",
>
>                            "code": 1,
>
>                            "data": "255.255.255.240"
>
>                       },
>
>                       {
>
>                            "space": "dhcp4",
>
>                            "name": "routers",
>
>                            "code": 3,
>
>                            "data": "172.27.60.17"
>
>                       },
>
>                       {
>
>                            "space": "dhcp4",
>
>                            "name": "vendor-encapsulated-options",
>
>                            "code": 43,
>
>                            "csv-format": false,
>
>                            "data": "3d04ac1b3d04"
>
>                       }
>
>                 ]
>
>            },
>
>
>
> Is the above shown “client-class” match condition a valid example and should it work?
>
>
>
> Regards
>
>
>
> Marek
>
> --
> ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
>
> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
>
> Kea-users mailing list
> Kea-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users
--
ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.

To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.

Kea-users mailing list
Kea-users at lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users



More information about the Kea-users mailing list