[Kea-users] free text parameter under each subnet

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

[Kea-users] free text parameter under each subnet

itay cohen
hello all
does some one know how to add a free text parameter like the example (not a remark) ?

               { "subnet": "10.101.0.0/16",
                        "id": 102,
                        "freetext":"internal server pool",
                        "pools": [ { "pool": "10.101.0.2 - 10.101.255.255" } ] ,
                        "relay": { "ip-address": "10.101.0.1" },
                        "option-data": [ { "name": "routers", "data": "10.101.0.1"  } ],
                        "renew-timer": 3600,
                        "rebind-timer": 3600,
                        "valid-lifetime": 3600
                },


thank you



_______________________________________________
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] free text parameter under each subnet

James Sumners

Unfortunately the parser doesn’t ignore unknown properties.




On August 17, 2017 at 2:14:55 PM, itay cohen ([hidden email]) wrote:

hello all
does some one know how to add a free text parameter like the example (not a remark) ?

               { "subnet": "10.101.0.0/16",
                        "id": 102,
                        "freetext":"internal server pool",
                        "pools": [ { "pool": "10.101.0.2 - 10.101.255.255" } ] ,
                        "relay": { "ip-address": "10.101.0.1" },
                        "option-data": [ { "name": "routers", "data": "10.101.0.1"  } ],
                        "renew-timer": 3600,
                        "rebind-timer": 3600,
                        "valid-lifetime": 3600
                },


thank you


_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users


_______________________________________________
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] free text parameter under each subnet

Francis Dupont
James Sumners writes:
> Unfortunately the parser doesn't ignore unknown properties.

=> not unfortunately: it is by design and I am sure you'd like the
parser to catch a trivial spelling error than to silently ignore it.

Regards

Francis Dupont <[hidden email]>

PS: as you expect to add a new subnet property you need to patch the
parser. Note in pools you have the user-context property which can be used
for the same goal and can be extended (i.e., post a request) to subnets
or other syntax elements (only host reservations will be complex because
of external host databases).
_______________________________________________
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] free text parameter under each subnet

James Sumners

That’s definitely a strong argument for a strict parser. Maybe adding support for a “comment” property would be a good compromise. The property could be any valued (i.e. string, object, array, whatever).

With such a property allowed it would be possible to write completely valid JSON such that editors and can work with it.




From: Francis Dupont [hidden email]
Date: August 18, 2017 at 8:11:00 AM
To: James Sumners [hidden email]
Cc: [hidden email] [hidden email], itay cohen [hidden email]
Subject:  Re: [Kea-users] free text parameter under each subnet

James Sumners writes:
> Unfortunately the parser doesn't ignore unknown properties.

=> not unfortunately: it is by design and I am sure you'd like the
parser to catch a trivial spelling error than to silently ignore it.

Regards

Francis Dupont <[hidden email]>

PS: as you expect to add a new subnet property you need to patch the
parser. Note in pools you have the user-context property which can be used
for the same goal and can be extended (i.e., post a request) to subnets
or other syntax elements (only host reservations will be complex because
of external host databases).


_______________________________________________
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] free text parameter under each subnet

Thomas Markwalder
One work around for this would be define a custom option:

"Dhcp4":
{
    :
  "option-def": [
        {
            "name": "newtextstring",
            "code": 222,
            "type": "string"
        } ]
   :
   :
   "subnet4": [{
        "subnet": "175.16.1.0/24",
        "pools": [ { "pool": "175.16.1.100 - 175.16.1.200" } ],
         "option-data": [
            {  "name": "newtextstring",  "data": "internal server pool" }
               :
            ]
        :
   
Maybe not that pretty but you could do it.  The option wouldn't get sent to clients unless they asked for it.  The bigger question is what you want to do with this value?

Regards,

Thomas Markwalder
ISC Software Engineering

On 8/18/17 9:02 AM, James Sumners wrote:

That’s definitely a strong argument for a strict parser. Maybe adding support for a “comment” property would be a good compromise. The property could be any valued (i.e. string, object, array, whatever).

With such a property allowed it would be possible to write completely valid JSON such that editors and can work with it.




From: Francis Dupont [hidden email]
Date: August 18, 2017 at 8:11:00 AM
To: James Sumners [hidden email]
Cc: [hidden email] [hidden email], itay cohen [hidden email]
Subject:  Re: [Kea-users] free text parameter under each subnet

James Sumners writes:
> Unfortunately the parser doesn't ignore unknown properties.

=> not unfortunately: it is by design and I am sure you'd like the
parser to catch a trivial spelling error than to silently ignore it.

Regards

Francis Dupont [hidden email]

PS: as you expect to add a new subnet property you need to patch the
parser. Note in pools you have the user-context property which can be used
for the same goal and can be extended (i.e., post a request) to subnets
or other syntax elements (only host reservations will be complex because
of external host databases).


_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users



_______________________________________________
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] free text parameter under each subnet

James Sumners

That isn’t really a work around. The issue is that a comment cannot be added in such a fashion that the configuration file is valid JSON from start to finish. The desire is to be able to add a property in any configuration object that is there for the configuration writer to read, not for the parser to care about.




From: Thomas Markwalder [hidden email]
Date: August 18, 2017 at 9:18:15 AM
To: [hidden email] [hidden email]
Subject:  Re: [Kea-users] free text parameter under each subnet

One work around for this would be define a custom option:

"Dhcp4":
{
    :
  "option-def": [
        {
            "name": "newtextstring",
            "code": 222,
            "type": "string"
        } ]
   :
   :
   "subnet4": [{
        "subnet": "175.16.1.0/24",
        "pools": [ { "pool": "175.16.1.100 - 175.16.1.200" } ],
         "option-data": [
            {  "name": "newtextstring",  "data": "internal server pool" }
               :
            ]
        :
   
Maybe not that pretty but you could do it.  The option wouldn't get sent to clients unless they asked for it.  The bigger question is what you want to do with this value?

Regards,

Thomas Markwalder
ISC Software Engineering

On 8/18/17 9:02 AM, James Sumners wrote:

That’s definitely a strong argument for a strict parser. Maybe adding support for a “comment” property would be a good compromise. The property could be any valued (i.e. string, object, array, whatever).

With such a property allowed it would be possible to write completely valid JSON such that editors and can work with it.




From: Francis Dupont [hidden email]
Date: August 18, 2017 at 8:11:00 AM
To: James Sumners [hidden email]
Cc: [hidden email] [hidden email], itay cohen [hidden email]
Subject:  Re: [Kea-users] free text parameter under each subnet

James Sumners writes:
> Unfortunately the parser doesn't ignore unknown properties.

=> not unfortunately: it is by design and I am sure you'd like the
parser to catch a trivial spelling error than to silently ignore it.

Regards

Francis Dupont [hidden email]

PS: as you expect to add a new subnet property you need to patch the
parser. Note in pools you have the user-context property which can be used
for the same goal and can be extended (i.e., post a request) to subnets
or other syntax elements (only host reservations will be complex because
of external host databases).


_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users


_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users


_______________________________________________
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] free text parameter under each subnet

Thomas Markwalder
Hi James:

Itay didn't really state why he wanted it but I can certainly see the utility of what you're describing.
Would you mind submitting a enhancement ticket for that?

Thanks,

Thomas


On 8/18/17 9:21 AM, James Sumners wrote:

That isn’t really a work around. The issue is that a comment cannot be added in such a fashion that the configuration file is valid JSON from start to finish. The desire is to be able to add a property in any configuration object that is there for the configuration writer to read, not for the parser to care about.




From: Thomas Markwalder [hidden email]
Date: August 18, 2017 at 9:18:15 AM
To: [hidden email] [hidden email]
Subject:  Re: [Kea-users] free text parameter under each subnet

One work around for this would be define a custom option:

"Dhcp4":
{
    :
  "option-def": [
        {
            "name": "newtextstring",
            "code": 222,
            "type": "string"
        } ]
   :
   :
   "subnet4": [{
        "subnet": "175.16.1.0/24",
        "pools": [ { "pool": "175.16.1.100 - 175.16.1.200" } ],
         "option-data": [
            {  "name": "newtextstring",  "data": "internal server pool" }
               :
            ]
        :
   
Maybe not that pretty but you could do it.  The option wouldn't get sent to clients unless they asked for it.  The bigger question is what you want to do with this value?

Regards,

Thomas Markwalder
ISC Software Engineering

On 8/18/17 9:02 AM, James Sumners wrote:

That’s definitely a strong argument for a strict parser. Maybe adding support for a “comment” property would be a good compromise. The property could be any valued (i.e. string, object, array, whatever).

With such a property allowed it would be possible to write completely valid JSON such that editors and can work with it.




From: Francis Dupont [hidden email]
Date: August 18, 2017 at 8:11:00 AM
To: James Sumners [hidden email]
Cc: [hidden email] [hidden email], itay cohen [hidden email]
Subject:  Re: [Kea-users] free text parameter under each subnet

James Sumners writes:
> Unfortunately the parser doesn't ignore unknown properties.

=> not unfortunately: it is by design and I am sure you'd like the
parser to catch a trivial spelling error than to silently ignore it.

Regards

Francis Dupont [hidden email]

PS: as you expect to add a new subnet property you need to patch the
parser. Note in pools you have the user-context property which can be used
for the same goal and can be extended (i.e., post a request) to subnets
or other syntax elements (only host reservations will be complex because
of external host databases).


_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users


_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users



_______________________________________________
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] free text parameter under each subnet

itay cohen
In reply to this post by Francis Dupont
actually user-context is perfect for me,
i tried the example in the admin guide,

but when i use it i get an error:
ERROR [kea-dhcp4.dhcp4/20619] DHCP4_INIT_FAIL failed to initialize Kea server: configuration error using file '/usr/local/etc/kea/kea.conf': /usr/local/etc/kea/kea.conf:126.4-17: got unexpected keyword "user-context" in subnet4 map.

                { "subnet": "10.0.0.0/24",
                        "id": 3001,
                        "pools": [ { "pool": "10.0.0.10 -  10.0.0.99" } ] ,
                        "user-context": { "color": "red" },
                        "relay": { "ip-address": "10.0.0.1" },
                        "option-data": [ { "name": "routers", "data": "10.0.0.1"  } ],
                        "renew-timer": 200,
                        "rebind-timer": 400,
                        "valid-lifetime": 600
                },

please advise,
thank you

On Fri, Aug 18, 2017 at 3:10 PM, Francis Dupont <[hidden email]> wrote:
James Sumners writes:
> Unfortunately the parser doesn't ignore unknown properties.

=> not unfortunately: it is by design and I am sure you'd like the
parser to catch a trivial spelling error than to silently ignore it.

Regards

Francis Dupont <[hidden email]>

PS: as you expect to add a new subnet property you need to patch the
parser. Note in pools you have the user-context property which can be used
for the same goal and can be extended (i.e., post a request) to subnets
or other syntax elements (only host reservations will be complex because
of external host databases).


_______________________________________________
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] free text parameter under each subnet

Thomas Markwalder
Hello Itay:

"user-context" is per pool not per subnet.   Our admin guide example is incorrect.  Try this:

"pools": [ {
                "pool": "10.0.0.10 -  10.0.0.99",
                "user-context": { "color": "red" }
               } ] ,
                     
Meanwhile, I'll create a ticket to update the doc.

Thanks,

Thomas

On 8/18/17 11:59 AM, itay cohen wrote:
actually user-context is perfect for me,
i tried the example in the admin guide,

but when i use it i get an error:
ERROR [kea-dhcp4.dhcp4/20619] DHCP4_INIT_FAIL failed to initialize Kea server: configuration error using file '/usr/local/etc/kea/kea.conf': /usr/local/etc/kea/kea.conf:126.4-17: got unexpected keyword "user-context" in subnet4 map.

                { "subnet": "10.0.0.0/24",
                        "id": 3001,
                        "pools": [ { "pool": "10.0.0.10 -  10.0.0.99" } ] ,
                        "user-context": { "color": "red" },
                        "relay": { "ip-address": "10.0.0.1" },
                        "option-data": [ { "name": "routers", "data": "10.0.0.1"  } ],
                        "renew-timer": 200,
                        "rebind-timer": 400,
                        "valid-lifetime": 600
                },

please advise,
thank you

On Fri, Aug 18, 2017 at 3:10 PM, Francis Dupont <[hidden email]> wrote:
James Sumners writes:
> Unfortunately the parser doesn't ignore unknown properties.

=> not unfortunately: it is by design and I am sure you'd like the
parser to catch a trivial spelling error than to silently ignore it.

Regards

Francis Dupont <[hidden email]>

PS: as you expect to add a new subnet property you need to patch the
parser. Note in pools you have the user-context property which can be used
for the same goal and can be extended (i.e., post a request) to subnets
or other syntax elements (only host reservations will be complex because
of external host databases).



_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users



_______________________________________________
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] free text parameter under each subnet

James Sumners
In reply to this post by Thomas Markwalder

http://kea.isc.org/ticket/5351#ticket




From: Thomas Markwalder [hidden email]
Date: August 18, 2017 at 9:59:38 AM
To: James Sumners [hidden email], [hidden email] [hidden email]
Subject:  Re: [Kea-users] free text parameter under each subnet

Hi James:

Itay didn't really state why he wanted it but I can certainly see the utility of what you're describing.
Would you mind submitting a enhancement ticket for that?

Thanks,

Thomas


On 8/18/17 9:21 AM, James Sumners wrote:

That isn’t really a work around. The issue is that a comment cannot be added in such a fashion that the configuration file is valid JSON from start to finish. The desire is to be able to add a property in any configuration object that is there for the configuration writer to read, not for the parser to care about.




From: Thomas Markwalder [hidden email]
Date: August 18, 2017 at 9:18:15 AM
To: [hidden email] [hidden email]
Subject:  Re: [Kea-users] free text parameter under each subnet

One work around for this would be define a custom option:

"Dhcp4":
{
    :
  "option-def": [
        {
            "name": "newtextstring",
            "code": 222,
            "type": "string"
        } ]
   :
   :
   "subnet4": [{
        "subnet": "175.16.1.0/24",
        "pools": [ { "pool": "175.16.1.100 - 175.16.1.200" } ],
         "option-data": [
            {  "name": "newtextstring",  "data": "internal server pool" }
               :
            ]
        :
   
Maybe not that pretty but you could do it.  The option wouldn't get sent to clients unless they asked for it.  The bigger question is what you want to do with this value?

Regards,

Thomas Markwalder
ISC Software Engineering

On 8/18/17 9:02 AM, James Sumners wrote:

That’s definitely a strong argument for a strict parser. Maybe adding support for a “comment” property would be a good compromise. The property could be any valued (i.e. string, object, array, whatever).

With such a property allowed it would be possible to write completely valid JSON such that editors and can work with it.




From: Francis Dupont [hidden email]
Date: August 18, 2017 at 8:11:00 AM
To: James Sumners [hidden email]
Cc: [hidden email] [hidden email], itay cohen [hidden email]
Subject:  Re: [Kea-users] free text parameter under each subnet

James Sumners writes:
> Unfortunately the parser doesn't ignore unknown properties.

=> not unfortunately: it is by design and I am sure you'd like the
parser to catch a trivial spelling error than to silently ignore it.

Regards

Francis Dupont [hidden email]

PS: as you expect to add a new subnet property you need to patch the
parser. Note in pools you have the user-context property which can be used
for the same goal and can be extended (i.e., post a request) to subnets
or other syntax elements (only host reservations will be complex because
of external host databases).


_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users


_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users



_______________________________________________
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] free text parameter under each subnet

Francis Dupont
In reply to this post by James Sumners
User contexts are strictly more powerful as they are part of objects so
can be retrieve by hooks. They just need to be more general, i.e.
current user-context support is still a (successful) experimentation.

Regards

Francis Dupont <[hidden email]>
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users