Re: [Kea-users] Problems adding the premium package hooks libraries

2018-02-27 Thread Tomek Mrugalski
On 02/20/18 21:37, Dylan Masson wrote:
> Greetings, My company has recently purchased the premium package for 
> Kea 1.3.0, and I have not been able to locate the hooks libraries,
> so that I can add their path to my config file. Does anyone have the 
> names of the hooks libraries files? If I know the proper names, I
> can dig them out myself. The one from the example config in the docs 
> doesn’t exist, so I assume that it would be something like the 
> libdhcp_host_cmds.so, but that is in a dot-named directory, so I 
> would guess that it isn’t the one.
Hi Dylan,

It was brought to my attention that your issue with the hook libraries
installation hasn't been resolved yet. Please accept my apologies. 
The last message in this thread was from Francis, one of ISC engineers.
We assumed the lack of response from you meant the problem has been
resolved. We stand corrected.

There are couple steps needed to use the premium hook libraries.

Apologies for the list being lengthy and covering steps that seem
obvious, but I wanted to make sure the description is as complete
as possible.

1. You need to extract the tarball into premium/ directory of the kea
sources. Since configure detected premium package, you did this
correctly.

2. Rerun configure. You showed the output of configure script that
showed premium package, so that's done as well.

3. Rebuild and install. I assume you did build (make) and install
(sudo make install) the libraries, right? The exact installation
location depends whether you specified --prefix parameter for
configure script. If you haven't, the default is /usr/local/lib/hooks/.
You can verify the libraries are installed properly with this command:

$ ls -l /usr/local/lib/hooks/*.so

You should see 

/usr/local/lib/hooks/libdhcp_flex_id.so
/usr/local/lib/hooks/libdhcp_host_cmds.so
/usr/local/lib/hooks/libdhcp_lease_cmds.so
/usr/local/lib/hooks/libdhcp_legal_log.so

4. Edit your config file to load the libraries you want to use. Please
keep in mind that while host_cmds and legal_log can in general run
without any parameters, the flex_id library has one mandatory parameter
called identifier-expression. If you simply add all three library, this
one will fail to load.

When loading a library, Kea will log the following messages:

INFO  [kea-dhcp4.host_cmds_hooks/19862] HOST_CMDS_INIT_OK loading Host Commands 
hooks library successful
INFO  [kea-dhcp4.hooks/19862] HOOKS_LIBRARY_LOADED hooks library 
/usr/local/lib/hooks/libdhcp_host_cmds.so successfully loaded

I edited my config file to match exactly what you specified in your
e-mail and got an error:
ERROR [kea-dhcp4.flex-id/19862] FLEX_ID_EXPRESSION_NOT_DEFINED Expression 
(identifier-expression) is not defined.
ERROR [kea-dhcp4.hooks/19862] HOOKS_LOAD_ERROR 'load' function in hook library 
/usr/local/lib/hooks/libdhcp_flex_id.so returned error 1

Ten the following errors are printed:

ERROR [kea-dhcp4.dhcp4/20144] DHCP4_PARSER_COMMIT_FAIL parser failed to commit 
changes: One or more hook libraries failed to load
ERROR [kea-dhcp4.dhcp4/20144] DHCP4_CONFIG_LOAD_FAIL configuration error using 
file: /tmp/hooks.json, reason: One or more hook libraries failed to load
ERROR [kea-dhcp4.dhcp4/20144] DHCP4_INIT_FAIL failed to initialize Kea server: 
configuration error using file '/tmp/hooks.json': One or more hook libraries 
failed to load

That's because of the aforementioned identifier-expression being
mandatory parameter is not specified in your config file. If you don't 
know what identifier-expression to use, you likely don't need flex-id yet.

Another problem in the config file you showed in your mail from Feb. 21st
is that you have trailing comas aftee each library name. with the
parameters commented out and a coma in previous line, the config file
is not a valid JSON and Kea would refuse to load it.

Are you sure this is the config file you're trying to load? Kea should
refuse it. Maybe Kea starts with a different config and you're simply
editing wrong file?

Can you confirm that your log file indeed has lines with
HOST_CMDS_INIT_OK and HOOKS_LIBRARY_LOADED? Please keep in mind that
both of those are printed on INFO level, so unless you have very quiet
logging setup, you should see them. If in doubt, simply comment out
all logging in your config file, so Kea will fall back to its default
logging level, which is to print INFO messages on the standard output.
You should see those logs in your console.

5. If the library is indeed loaded and you still don't see the commands,
there is something weird. It's hard for me to speculate what's going
on in here, but here are couple ideas. Are you sure you have only one
Kea instance running? Perhaps you have one installed from your Linux
distro and another one compiled from sources? Those two would use
different locations of the config file. Perhaps your ctrl-agent
connected to the wrong instance?

You should also verify that the config file you are editing has
control socket specified. It's an entry 

Re: [Kea-users] Problems adding the premium package hooks libraries

2018-02-21 Thread Francis Dupont
Dylan Masson writes:
> Thanks. I have added all of the .so files from that dir, including the
> libdhcp_host_cmds.so file, and "reservation-add" is
> still not showing.

> {
>   "library": "/usr/local/lib/hooks/libdhcp_flex_id.so",

=> you should include only needed hooks. Some, for instance flex-id,
require a parameter so can fail to initialize.

> And I am getting the statistics commands, but not the reservation ones:

=> you should get it: one of the unit tests of the host cmds hook
explicitely checks the result of list-commands (I know because I
copied this code).  Now it is not a system test... I'll check when
I'll get some free time (tomorrow? surely before Monday if it is not
solved before).

Regards

Francis Dupont 
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


Re: [Kea-users] Problems adding the premium package hooks libraries

2018-02-21 Thread Dylan Masson
Thanks. I have added all of the .so files from that dir, including the 
libdhcp_host_cmds.so file, and “reservation-add” is still not showing.

I definitely built with the premium package:

 Kea source configure results:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Package:
  Name:kea
  Version: 1.3.0
  Extended version:1.3.0 (tarball)
  OS Family:   Linux
  Using GNU sed:   yes
  Premium package: yes

The libraries re in the config:

"hooks-libraries": [
  {
  "library": "/usr/local/lib/hooks/libdhcp_host_cmds.so",
//  "parameters": {
//  "param1": "foo"
//  }
  },
{
  "library": "/usr/local/lib/hooks/libdhcp_lease_cmds.so",
//  "parameters": {
//  "param1": "foo"
//  }
  },
{
  "library": "/usr/local/lib/hooks/libdhcp_flex_id.so",
//  "parameters": {
//  "param1": "foo"
//  }
  },
{
  "library": "/usr/local/lib/hooks/libdhcp_legal_log.so",
//  "parameters": {
//  "param1": "foo"
//  }
  }
]

And I am getting the statistics commands, but not the reservation ones:

# curl -X POST -H "Content-Type: application/json" -d '{ "command": 
"list-commands", "service": [ "dhcp4" ]  }' http://127.0.0.1:8080/
[ { "arguments": [ "build-report", "config-get", "config-reload", "config-set", 
"config-test", "config-write", "leases-reclaim", "libreload", "list-commands", 
"shutdown", "statistic-get", "statistic-get-all", "statistic-remove", 
"statistic-remove-all", "statistic-reset", "statistic-reset-all", "version-get" 
], "result": 0 } ][


Any other suggestions?

Thanks,
Dyl


> On Feb 21, 2018, at 3:56 AM, Marcin Siodelski  wrote:
> 
> libdhcp_host_cmds.so

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


Re: [Kea-users] Problems adding the premium package hooks libraries

2018-02-20 Thread Francis Dupont
I am working on a new hook so I have a build where "make install" works well.
Note I kept the default prefix "/usr/local", this gives:

% ls /usr/local/lib/hooks
libdhcp_flex_id.a   libdhcp_host_cache.alibdhcp_legal_log.a
libdhcp_flex_id.la  libdhcp_host_cache.la   libdhcp_legal_log.la
libdhcp_flex_id.so  libdhcp_host_cache.so   libdhcp_legal_log.so
libdhcp_ha.alibdhcp_host_cmds.a libdhcp_subnet_cmds.a
libdhcp_ha.la   libdhcp_host_cmds.lalibdhcp_subnet_cmds.la
libdhcp_ha.so   libdhcp_host_cmds.solibdhcp_subnet_cmds.so

Regards

Francis Dupont 

PS: of course only the *.so are useful. If you find it is inconvenient
to get also the .a and .la, please open a (Kea trac) ticket or (better)
push a request on github fixing the install of the lease cmds hook
(the user chk hook is not installed).
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


Re: [Kea-users] Problems adding the premium package hooks libraries

2018-02-20 Thread Marcin Siodelski
Hello Dyl,

The hooks libraries should be located in the Kea installation directory
under lib/hooks.

Marcin Siodelski
ISC


On 20.02.2018 21:37, Dylan Masson wrote:
>  Greetings,
>  My company has recently purchased the premium package for Kea 1.3.0, and I 
> have not been able to locate the hooks libraries, so that I can add their 
> path to my config file. Does anyone have the names of the hooks libraries 
> files? If I know the proper names, I can dig them out myself. The one from 
> the example config in the docs doesn’t exist, so I assume that it would be 
> something like the libdhcp_host_cmds.so, but that is in a dot-named 
> directory, so I would guess that it isn’t the one.
> 
> Thanks,
> Dyl
> ___
> Kea-users mailing list
> Kea-users@lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users
> 

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