Kea 1.5 implemented YANG/NETCONF support with a stand-alone daemon called kea-netconf. It is an optional component that uses Sysrepo.
To compile Kea with this, please download Kea 1.5 or later and compile it :
autreconf -i
./configure --with-sysrepo=...
make -jX
sudo make install
There's a script in tools/sysrepo_config that may help you setting up paths to the Sysrepo project.
To get the latest Kea sources, go to https://gitlab.isc.org/isc-projects/kea
This file contains instruction how to set up an environment that allows doing experiments with Sysrepo plugin that is able to receive configuration from Sysrepo and send it to Kea.
- Download experimental Kea code that has set-config method implemented.
git clone https://github.com/isc-projects/kea-yang
autoreconf -i
./configure
make
Refer to Kea User's Guide to details.
- Run Kea with a config file. You may use one of the examples from kea-configs/kea-cfg* as a template. One item necessary for Sysrepo integration to work is to have control socket defined. For example:
"control-socket": {
"socket-type": "unix",
"socket-name": "/tmp/kea-dhcp6-ctrl.sock"
},
This is the location where Kea will create its unix domain socket and will await commands. This has to match to whatever is specified in sysrepo-plugin-kea.
- Run Kea with:
cd src/bin/dhcp6
./kea-dhcp6 -c your-kea-config-file.json
-
Install sysrepo Refer to sysrepo documentation for details.
-
Update paths See plugin-kea.c. Edit KEA_CONTROL_SOCKET to match whatever you configured in socket-name in step 2. Edit KEA_CONTROL_CLIENT to point to ctrl-client-cli binary. (obsolete: cmake should do this) 3. Build client aka ctrl-channel-cli:
cd kea-client
make
- Build sysrepo-plugin-kea
mkdir build
cmake ..
make
- Copy libplugin-kea.ko to /usr/local/lib/sysrepo/plugins
cp ~/devel/sysrepo-plugin-kea/build/libplugin-kea.so /usr/local/lib/sysrepo/plugins
- List all yang modules
sysrepoctl -l
- Install Kea YANG module into the sysrepo
sysrepoctl --install [email protected]
- Verify it's actually installed
sysrepoctl -l
- Set the configuration. There are three ways to do it: 8.1: Manually (see step 11) 8.2: Run basic_config is a tool that sets first two leafs in the model. ./basic_config 8.3: There is an example in kea-configs/kea-cfg1-basic.xml. It can be loaded with:
sysrepocfg --import=kea-cfg1-basic.xml --datastore=startup ietf-kea-dhcpv6
- Start sysrepo daemon
sysrepo -l 4 -d
(-l 4 is logging level 4, the most verbose, -d means it stays in the foreground, so you can see what's going on)
- Start sysrepo-plugind - daemon that loads plugins from /usr/local/lib/sysrepo/plugins
sysrepo-plugind -l 4 -d
(make sure it prints that the plugin-kea is loaded) The callback installed with sr_module_change_subscribe should be called. This call back should apply configuration to Kea.
At this stage the sysrepo-plugind should print out messages from libplugin-kea that retrieves the configuration and sends it over the unix socket to Kea.
Kea should print out messages about receiving set-config command:
2016-07-17 15:36:56.699 INFO [kea-dhcp6.commands/14236] COMMAND_RECEIVED Received command 'set-config'
The following steps are not needed to have the whole setup operational. They're useful to conduct certain additional tasks.
- Configuration can be inspected and edited with with:
sysrepocfg --editor=emacs --datastore=running ietf-kea-dhcpv6
If the configuration changes, the plugin should be notified. The callback should get the new configuration and send it to Kea.
- Export current model configuration to a file:
sysrepocfg --export=/tmp/backup.json --format=json --datastore=startup ietf-kea-dhcpv6
Tools that may be useful to look at: Yang Explorer - GUI tool for browsing and editing YANG, requires flash and it's tricky to set up.