Commit d35e226d authored by Francis Dupont's avatar Francis Dupont

[186-add-kea-netconf-daemon-to-keactrl] Checkpoint (works without netconf, need more with netconf)

parent 538ffa0e
......@@ -3,5 +3,6 @@
/kea-dhcp6.conf
/kea-dhcp-ddns.conf
/kea-ctrl-agent.conf
/kea-netconf.conf
/keactrl.conf
/keactrl.8
......@@ -6,7 +6,7 @@ SUBDIRS = . tests
# setting KEACTRL_CONF environment variable.
sbin_SCRIPTS = keactrl
KEA_CONFIGFILES = kea-dhcp4.conf kea-dhcp6.conf kea-dhcp-ddns.conf \
kea-ctrl-agent.conf
kea-ctrl-agent.conf kea-netconf.conf
CONFIGFILES = keactrl.conf $(KEA_CONFIGFILES)
man_MANS = keactrl.8
......@@ -14,7 +14,8 @@ DISTCLEANFILES = keactrl keactrl.conf $(man_MANS)
CLEANFILES = $(KEA_CONFIGFILES)
EXTRA_DIST = keactrl.in keactrl.conf.in kea-dhcp4.conf.pre \
kea-dhcp6.conf.pre kea-dhcp-ddns.conf.pre \
kea-ctrl-agent.conf.pre $(man_MANS) keactrl.xml
kea-ctrl-agent.conf.pre kea-netconf.conf.pre \
$(man_MANS) keactrl.xml
# *.conf files are not really sources used for building other targets, but we need
# these files to be generated before make install is called.
......@@ -50,6 +51,10 @@ kea-ctrl-agent.conf: kea-ctrl-agent.conf.pre
$(top_builddir)/tools/path_replacer.sh \
$(top_srcdir)/src/bin/keactrl/kea-ctrl-agent.conf.pre $@
kea-netconf.conf: kea-netconf.conf.pre
$(top_builddir)/tools/path_replacer.sh \
$(top_srcdir)/src/bin/keactrl/kea-netconf.conf.pre $@
if INSTALL_CONFIGURATIONS
# Since Kea 1.3.0 release we have 4 different Kea configuration files
......
// This is a basic configuration for the Kea Netconf agent.
//
// This is just a very basic configuration. Kea comes with large suite (over 30)
// of configuration examples and extensive Kea User's Guide. Please refer to
// those materials to get better understanding of what this software is able to
// do. Comments in this configuration file sometimes refer to sections for more
// details. These are section numbers in Kea User's Guide. The version matching
// your software should come with your Kea package, but it is also available
// in ISC's Knowledgebase (https://kb.isc.org/docs/kea-administrator-reference-manual; the direct link for
// the stable version is https://jenkins.isc.org/job/Kea_doc/guide/kea-guide.html).
//
// This configuration file contains only Netconf's configuration.
// If configurations for other Kea services are also included in this file they
// are ignored by the Netconf agent.
{
// This is a basic configuration for the Kea Netconf.
"Netconf": {
"boot-update": true,
"subscribe-changes": true,
"validate-changes": true,
// Specify services the Netconf agent manages including files
// should connect to forward commands to the DHCPv4 and DHCPv6
// server via unix domain socket.
"managed-servers":
{
"dhcp4": {
"control-socket": {
"socket-type": "unix",
"socket-name": "/tmp/kea-dhcp4-ctrl.sock"
}
},
"dhcp6": {
"control-socket": {
"socket-type": "unix",
"socket-name": "/tmp/kea-dhcp6-ctrl.sock"
}
}
},
// Specify hooks libraries that are attached to the Netconf agent.
// Note currently there is no defined hook points to attach to.
// This is currently commented out because it has to point to the
// existing hooks library. Otherwise the Netconf agent will fail to start.
"hooks-libraries": [
// {
// "library": "/opt/local/netconf-commands.so",
// "parameters": {
// "param1": "foo"
// }
// }
]
},
// Logging configuration starts here. Kea uses different loggers to log various
// activities. For details (e.g. names of loggers), see Chapter 18.
"Logging":
{
"loggers": [
{
// This specifies the logging for Netconf daemon.
"name": "kea-netconf",
"output_options": [
{
// Specifies the output file. There are several special values
// supported:
// - stdout (prints on standard output)
// - stderr (prints on standard error)
// - syslog (logs to syslog)
// - syslog:name (logs to syslog using specified name)
// Any other value is considered a name of a time
"output": "@localstatedir@/log/kea-netconf.log"
// This governs whether the log output is flushed to disk after
// every write.
// "flush": false,
// This specifies the maximum size of the file before it is
// rotated.
// "maxsize": 1048576,
// This specifies the maximum number of rotated files to keep.
// "maxver": 8
}
],
// This specifies the severity of log messages to keep. Supported values
// are: FATAL, ERROR, WARN, INFO, DEBUG
"severity": "INFO",
// If DEBUG level is specified, this value is used. 0 is least verbose,
// 99 is most verbose. Be cautious, Kea can generate lots and lots
// of logs if told to do so.
"debuglevel": 0
}
]
}
}
......@@ -2,6 +2,8 @@
# the startup, shutdown, reconfiguration and gathering the status
# of the Kea's processes.
# Note that control agent must be launched after servers and netconf last.
# prefix holds the location where the Kea is installed.
prefix=@prefix@
......@@ -10,6 +12,7 @@ kea_dhcp4_config_file=@sysconfdir@/@PACKAGE@/kea-dhcp4.conf
kea_dhcp6_config_file=@sysconfdir@/@PACKAGE@/kea-dhcp6.conf
kea_dhcp_ddns_config_file=@sysconfdir@/@PACKAGE@/kea-dhcp-ddns.conf
kea_ctrl_agent_config_file=@sysconfdir@/@PACKAGE@/kea-ctrl-agent.conf
kea_netconf_config_file=@sysconfdir@/@PACKAGE@/kea-netconf.conf
# Location of Kea binaries.
exec_prefix=@exec_prefix@
......@@ -17,6 +20,7 @@ dhcp4_srv=@sbindir@/kea-dhcp4
dhcp6_srv=@sbindir@/kea-dhcp6
dhcp_ddns_srv=@sbindir@/kea-dhcp-ddns
ctrl_agent_srv=@sbindir@/kea-ctrl-agent
netconf_srv=@sbindir@/kea-netconf
# Start DHCPv4 server?
dhcp4=yes
......@@ -30,5 +34,8 @@ dhcp_ddns=no
# Start Control Agent?
ctrl_agent=yes
# Start Netconf?
netconf=no
# Be verbose?
kea_verbose=no
......@@ -11,6 +11,8 @@
# as well as for running tests.
VERSION=@PACKAGE_VERSION@
@HAVE_SYSREPO_FALSE@have_netconf=0
@HAVE_SYSREPO_TRUE@have_netconf=1
### Logging functions ###
......@@ -81,6 +83,9 @@ get_pid_from_file() {
kea-ctrl-agent)
kea_config_file=${kea_ctrl_agent_config_file}
;;
kea-netconf)
kea_config_file=${kea_netconf_config_file}
;;
esac
# Extract the name portion of the config file
......@@ -253,7 +258,7 @@ check_kea_conf() {
# and be set to yes, e.g. ${dhcp4} should be equal to yes if server name
# is dhcp4
run_conditional() {
local server=${1} # Server name: dhcp4, dhcp6, dhcp_ddns, ctrl_agent
local server=${1} # Server name: dhcp4, dhcp6, dhcp_ddns, ctrl_agent, netconf
local command="${2}" # Command to execute
local check_file_cfg=${3} # Check if server enabled in the configuration file
......@@ -266,6 +271,12 @@ run_conditional() {
return
fi
fi
# Return for for netconf when not available.
if [ ${server} = "netconf" ]; then
if [ ${have_netconf} -eq 0 ]; then
return
fi
fi
# Get the configuration value of the keactrl which indicates whether
# the server should be enabled or not. Variables that hold these values
......@@ -395,12 +406,21 @@ if [ -z ${ctrl_agent_srv} ]; then
exit 1
fi
# Get location of the Netconf binary.
if [ ${have_netconf} -eq 1 ]; then
if [ -z ${netconf_srv} ]; then
log_error "netconf_srv parameter not specified"
exit 1
fi
fi
# dhcp4 and dhcp6 (=yes) indicate if we should start DHCPv4 and DHCPv6 server
# respectively.
dhcp4=$( printf "%s" ${dhcp4} | tr [:upper:] [:lower:] )
dhcp6=$( printf "%s" ${dhcp6} | tr [:upper:] [:lower:] )
dhcp_ddns=$( printf "%s" ${dhcp_ddns} | tr [:upper:] [:lower:] )
ctrl_agent=$( printf "%s" ${ctrl_agent} | tr [:upper:] [:lower:] )
netconf=$( printf "%s" ${netconf} | tr [:upper:] [:lower:] )
case ${command} in
......@@ -419,6 +439,8 @@ case ${command} in
${args}" 1
run_conditional "ctrl_agent" "start_server ${ctrl_agent_srv} -c ${kea_ctrl_agent_config_file} \
${args}" 1
run_conditional "netconf" "start_server ${netconf_srv} -c ${kea_netconf_config_file} \
${args}" 1
exit 0 ;;
......@@ -429,6 +451,7 @@ ${args}" 1
run_conditional "dhcp6" "stop_server ${dhcp6_srv}" 0
run_conditional "dhcp_ddns" "stop_server ${dhcp_ddns_srv}" 0
run_conditional "ctrl_agent" "stop_server ${ctrl_agent_srv}" 0
run_conditional "netconf" "stop_server ${netconf_srv}" 0
exit 0 ;;
......@@ -439,6 +462,7 @@ ${args}" 1
run_conditional "dhcp6" "reload_server ${dhcp6_srv}" 0
run_conditional "dhcp_ddns" "reload_server ${dhcp_ddns_srv}" 0
run_conditional "ctrl_agent" "reload_server ${ctrl_agent_srv}" 0
run_conditional "netconf" "reload_server ${netconf_srv}" 0
exit 0 ;;
......@@ -470,16 +494,32 @@ ${args}" 1
agent_status="active"
fi
printf "Control Agent: %s\n" ${agent_status}
if [ ${have_netconf} -eq 1 ]; then
netconf_status="inactive"
check_running $(basename ${netconf_srv})
if [ ${_running} -eq 1 ]; then
netconf_status="active"
fi
printf "Netconf agent: %s\n" ${netconf_status}
fi
printf "Kea DHCPv4 configuration file: %s\n" ${kea_dhcp4_config_file}
printf "Kea DHCPv6 configuration file: %s\n" ${kea_dhcp6_config_file}
printf "Kea DHCP DDNS configuration file: %s\n" ${kea_dhcp_ddns_config_file}
printf "Kea Control Agent configuration file: %s\n" ${kea_ctrl_agent_config_file}
if [ ${have_netconf} -eq 1 ]; then
printf "Kea Netconf configuration file: %s\n" ${kea_netconf_config_file}
fi
printf "keactrl configuration file: %s\n" ${keactrl_conf}
check_kea_conf ${kea_dhcp4_config_file}
check_kea_conf ${kea_dhcp6_config_file}
check_kea_conf ${kea_dhcp_ddns_config_file}
check_kea_conf ${kea_ctrl_agent_config_file}
if [ ${have_netconf} -eq 1 ]; then
check_kea_conf ${kea_netconf_config_file}
fi
exit 0 ;;
......@@ -489,6 +529,7 @@ ${args}" 1
run_conditional "dhcp6" "print_version kea-dhcp6 ${dhcp6_srv}" 0
run_conditional "dhcp_ddns" "print_version kea-dhcp-ddns ${dhcp_ddns_srv}" 0
run_conditional "ctrl_agent" "print_version kea-ctrl-agent ${ctrl_agent_srv}" 0
run_conditional "netconf" "print_version kea-netconf ${netconf_srv}" 0
exit 0 ;;
......
......@@ -55,10 +55,10 @@
<para>
keactrl is a shell script which controls the startup, shutdown
and reconfiguration of the Kea servers (<command>kea-dhcp4</command>,
<command>kea-dhcp6</command>, <command>kea-dhcp-ddns</command> and
<command>kea-ctrl-agent</command>). It also provides the means for
checking the current status of the servers and determining the
configuration files in use.
<command>kea-dhcp6</command>, <command>kea-dhcp-ddns</command>,
<command>kea-ctrl-agent</command> and <command>kea-netconf</command>).
It also provides the means for checking the current status of
the servers and determining the configuration files in use.
</para>
</refsect1>
......@@ -170,10 +170,18 @@
</listitem>
</varlistentry>
<varlistentry>
<term>netconf</term>
<listitem>
<para>Netconf agent (<command>kea-netconf</command>).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>all</term>
<listitem>
<para>All servers (default).</para>
<para>All servers (default) including Netconf if
it was configured to be built.</para>
</listitem>
</varlistentry>
......@@ -252,6 +260,11 @@
<manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>kea-netconf</refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>kea-admin</refentrytitle>
<manvolnum>8</manvolnum>
......
......@@ -12,13 +12,23 @@
# Set location of the keactrl.
keactrl=@abs_top_builddir@/src/bin/keactrl/keactrl
# Set the have_netconf flag to know if netconf is available.
@HAVE_SYSREPO_FALSE@have_netconf=0
@HAVE_SYSREPO_TRUE@have_netconf=1
# Name of the configuration file without its extension.
CFG_FILE_NAME="test_config"
# A name of the configuration file to be used by Kea.
CFG_FILE=@abs_top_builddir@/src/bin/keactrl/tests/${CFG_FILE_NAME}.json
# Names for Netconf ("Netconf" object is not recognized)
NETCONF_CFG_FILE_NAME="netconf_test_config"
NETCONF_CFG_FILE=@abs_top_builddir@/src/bin/keactrl/tests/${NETCONF_CFG_FILE_NAME}.json
# Configuration files for all deamons.
CFG_FILES="kea_dhcp4_config_file=${CFG_FILE}\nkea_dhcp6_config_file=${CFG_FILE}\n\
kea_dhcp_ddns_config_file=${CFG_FILE}\nkea_ctrl_agent_config_file=${CFG_FILE}"
CFG_FILES="kea_dhcp4_config_file=${CFG_FILE}\n\
kea_dhcp6_config_file=${CFG_FILE}\n\
kea_dhcp_ddns_config_file=${CFG_FILE}\n\
kea_ctrl_agent_config_file=${CFG_FILE}\n\
kea_netconf_config_file=${NETCONF_CFG_FILE}"
# A name of the keactrl config file
KEACTRL_CFG_FILE=@abs_top_builddir@/src/bin/keactrl/tests/keactrl_test.conf
# Path to the Kea log file.
......@@ -29,6 +39,7 @@ kea4_name="${wildcard_name}dhcp4"
kea6_name="${wildcard_name}dhcp6"
d2_name="${wildcard_name}dhcp-ddns"
agent_name="${wildcard_name}ctrl-agent"
netconf_name="${wildcard_name}netconf"
# Kea configuration
config="{
\"Dhcp4\":
......@@ -129,24 +140,47 @@ config="{
}
}"
# Netconf configuration
netconf_config="{
\"Netconf\": {
},
\"Logging\":
{
\"loggers\": [
{
\"name\": \"kea-netconf\",
\"output_options\": [
{
\"output\": \"$LOG_FILE\"
}
],
\"severity\": \"INFO\"
}
]
}
}"
# Fixed part of the keactrl configuration file.
keactrl_fixed_config="dhcp4_srv=${KEACTRL_BUILD_DIR}/src/bin/dhcp4/kea-dhcp4\n\
dhcp6_srv=${KEACTRL_BUILD_DIR}/src/bin/dhcp6/kea-dhcp6\n\
dhcp_ddns_srv=${KEACTRL_BUILD_DIR}/src/bin/d2/kea-dhcp-ddns\n\
ctrl_agent_srv=${KEACTRL_BUILD_DIR}/src/bin/agent/kea-ctrl-agent\n"
ctrl_agent_srv=${KEACTRL_BUILD_DIR}/src/bin/agent/kea-ctrl-agent\n\
netconf_srv=${KEACTRL_BUILD_DIR}/src/bin/netconf/kea-netconf\n"
# This test checks that DHCPv4, DHCPv6 and D2 server can be started and
# shut down.
# This test checks that DHCPv4, DHCPv6, D2, CA and Netconf server can
# be started and shut down.
start_all_servers_no_verbose_test() {
# Create configuration file for keactrl. This configuration enables
# DHCPv4, DHCPv6, D2 and CA.
# DHCPv4, DHCPv6, D2, CA and netconf.
keactrl_config="${CFG_FILES}\ndhcp4=yes\ndhcp6=yes\n\
dhcp_ddns=yes\nctrl_agent=yes\nkea_verbose=no\n${keactrl_fixed_config}"
dhcp_ddns=yes\nctrl_agent=yes\nnetconf=yes\n\
kea_verbose=no\n${keactrl_fixed_config}"
test_start "keactrl.start_all_servers_no_verbose_test"
# Create configuration file for Kea and for keactrl.
create_config "${config}"
create_netconf_config "${netconf_config}"
create_keactrl_config "${keactrl_config}"
# Set logging to a file.
......@@ -173,7 +207,8 @@ Expected wait_for_message return %d, returned %d."
"Timeout waiting for ${kea4_name} to start. \
Expected wait_for_message return %d, returned %d."
# Wait for D2 and CA to configure.
# Wait for D2, CA and Netconf to configure.
### 2 or 3
wait_for_message 20 "DCTL_CONFIG_COMPLETE" 2
assert_eq 1 ${_WAIT_FOR_MESSAGE} \
"Timeout waiting for CPL daemons to start. \
......@@ -189,6 +224,13 @@ Expected wait_for_message return %d, returned %d."
"Timeout waiting for ${agent_name} to start. \
Expected wait_for_message return %d, returned %d."
if [ ${have_netconf} -eq 1 ]; then
wait_for_message 20 "NETCONF_STARTED" 1
assert_eq 1 ${_WAIT_FOR_MESSAGE} \
"Timeout waiting for${netconf_name} to start. \
Expected wait_for_message return %d, returned %d."
fi
# Make sure that debug messages are logged for neither
# server (non-verbose mode).
get_log_messages "DHCP6_START_INFO"
......@@ -224,6 +266,12 @@ Expected wait_for_message return %d, returned %d."
assert_eq 1 ${_GET_PIDS_NUM} \
"Expected %d ${agent_name} process running, found %d processes running"
if [ ${have_netconf} -eq 1 ]; then
get_pid ${netconf_name}
assert_eq 1 ${_GET_PIDS_NUM} \
"Expected %d ${netconf_name} process running, found %d processes running"
fi
# Use keactrl stop to shutdown the servers.
printf "Stopping Kea: ${keactrl} stop -c ${KEACTRL_CFG_FILE}\n"
${keactrl} stop -c ${KEACTRL_CFG_FILE}
......@@ -242,7 +290,7 @@ Expected wait_for_message return %d, returned %d."
"Timeout waiting for ${kea4_name} to shutdown. \
Expected wait_for_message return %d, returned %d."
# Wait up to 10s for the D2 and CA to stop.
# Wait up to 10s for the D2, CA and Netconf to stop.
wait_for_message 10 "DCTL_SHUTDOWN" 2
assert_eq 1 ${_WAIT_FOR_MESSAGE} \
"Timeout waiting for ${d2_name} to shutdown. \
......@@ -262,12 +310,14 @@ start_all_servers_verbose_test() {
# Create configuration file for keactrl. This configuration enables
# all servers.
keactrl_config="${CFG_FILES}\ndhcp4=yes\ndhcp6=yes\n\
dhcp_ddns=yes\nctrl_agent=yes\nkea_verbose=yes\n${keactrl_fixed_config}"
dhcp_ddns=yes\nctrl_agent=yes\netconf=yes\n\
kea_verbose=yes\n${keactrl_fixed_config}"
test_start "keactrl.start_all_servers_verbose_test"
# Create configuration file for Kea and for keactrl.
create_config "${config}"
create_netconf_config "${netconf_config}"
create_keactrl_config "${keactrl_config}"
# Set logging to a file.
......@@ -306,6 +356,13 @@ Expected wait_for_message return %d, returned %d."
"Timeout waiting for ${agent_name} to start. \
Expected wait_for_message return %d, returned %d."
if [ ${have_netconf} -eq 1 ]; then
wait_for_message 20 "NETCONF_STARTED" 1
assert_eq 1 ${_WAIT_FOR_MESSAGE} \
"Timeout waiting for${netconf_name} to start. \
Expected wait_for_message return %d, returned %d."
fi
# Check if the debug messages are present, which should only be
# the case if the verbose mode is on.
get_log_messages "DHCP6_START_INFO" 1
......@@ -341,6 +398,12 @@ Expected wait_for_message return %d, returned %d."
assert_eq 1 ${_GET_PIDS_NUM} \
"Expected %d ${agent_name} process running, found %d processes running"
if [ ${have_netconf} -eq 1 ]; then
get_pid ${netconf_name}
assert_eq 1 ${_GET_PIDS_NUM} \
"Expected %d ${netconf_name} process running, found %d processes running"
fi
# Use keactrl stop to shutdown the servers.
printf "Stopping Kea: ${keactrl} stop -c ${KEACTRL_CFG_FILE}\n"
${keactrl} stop -c ${KEACTRL_CFG_FILE}
......@@ -359,7 +422,7 @@ Expected wait_for_message return %d, returned %d."
"Timeout waiting for ${kea4_name} to shutdown. \
Expected wait_for_message return %d, returned %d."
# Wait up to 10s for the D2 and CA to stop.
# Wait up to 10s for the D2, CA and Netconf to stop.
wait_for_message 10 "DCTL_SHUTDOWN" 2
assert_eq 1 ${_WAIT_FOR_MESSAGE} \
"Timeout waiting for ${d2_name} and ${agent_name} to shutdown. \
......@@ -380,12 +443,14 @@ start_v4_server_test() {
# Create configuration file for keactrl. This configuration enables
# DHCPv4 server but disables other servers.
keactrl_config="${CFG_FILES}\ndhcp4=yes\ndhcp6=no\n\
dhcp_ddns=no\nctrl_agent=no\nkea_verbose=no\n${keactrl_fixed_config}"
dhcp_ddns=no\nctrl_agent=no\nnetconf=no\n\
kea_verbose=no\n${keactrl_fixed_config}"
test_start "keactrl.start_v4_server_test"
# Create configuration file for Kea and for keactrl.
create_config "${config}"
create_netconf_config "${netconf_config}"
create_keactrl_config "${keactrl_config}"
# Set logging to a file.
......@@ -427,6 +492,13 @@ Expected wait_for_message return %d, returned %d."
assert_eq 0 ${_GET_PIDS_NUM} \
"Expected %d ${agent_name} process running, found %d processes running"
# Make sure that Netconf agent is not running.
if [ ${have_netconf} -eq 1 ]; then
get_pid ${netconf_name}
assert_eq 0 ${_GET_PIDS_NUM} \
"Expected %d ${netconf_name} process running, found %d processes running"
fi
# Make sure that the status command returns appropriate status.
printf "Getting status of Kea modules: %s\n" "${keactrl} status \
-c ${KEACTRL_CFG_FILE}"
......@@ -441,6 +513,10 @@ Expected wait_for_message return %d, returned %d."
"Expected keactrl status command return %s"
assert_string_contains "Control Agent: inactive" "${output}" \
"Expected keactrl status command return %s"
if [ ${have_netconf} -eq 1 ]; then
assert_string_contains "Netconf agent: inactive" "${output}" \
"Expected keactrl status command return %s"
fi
# Use keactrl stop to shutdown the servers.
printf "Stopping Kea: ${keactrl} stop -c ${KEACTRL_CFG_FILE}\n"
......@@ -468,12 +544,14 @@ start_v6_server_test() {
# Create configuration file for keactrl. This configuration enables
# DHCPv6 server but disables other servers..
keactrl_config="${CFG_FILES}\ndhcp4=no\ndhcp6=yes\n\
dhcp_ddns=no\nctrl_agent=no\nkea_verbose=no\n${keactrl_fixed_config}"
dhcp_ddns=no\nctrl_agent=no\nnetconf=no\n\
kea_verbose=no\n${keactrl_fixed_config}"
test_start "keactrl.start_v6_server_test"
# Create configuration file for Kea and for keactrl.
create_config "${config}"
create_netconf_config "${netconf_config}"
create_keactrl_config "${keactrl_config}"
# Set logging to a file.
......@@ -515,6 +593,13 @@ Expected wait_for_message return %d, returned %d."
assert_eq 0 ${_GET_PIDS_NUM} \
"Expected %d ${agent_name} process running, found %d processes running"
# Make sure that Netconf agent is not running.
if [ ${have_netconf} -eq 1 ]; then
get_pid ${netconf_name}
assert_eq 0 ${_GET_PIDS_NUM} \
"Expected %d ${netconf_name} process running, found %d processes running"
fi
# Make sure that the status command returns appropriate status.
printf "Getting status of Kea modules: %s\n" "${keactrl} status -c ${KEACTRL_CFG_FILE}"
output=$( ${keactrl} status -c ${KEACTRL_CFG_FILE} )
......@@ -528,6 +613,10 @@ Expected wait_for_message return %d, returned %d."
"Expected keactrl status command return %s"
assert_string_contains "Control Agent: inactive" "${output}" \
"Expected keactrl status command return %s"
if [ ${have_netconf} -eq 1 ]; then
assert_string_contains "Netconf agent: inactive" "${output}" \
"Expected keactrl status command return %s"
fi
# Use keactrl stop to shutdown the servers.
printf "Stopping Kea: ${keactrl} stop -c ${KEACTRL_CFG_FILE}\n"
......@@ -556,12 +645,14 @@ late_start_v4_server_test() {
# Create configuration file for keactrl. This configuration enables
# DHCPv6 server but disables other servers.
keactrl_config="${CFG_FILES}\ndhcp4=no\ndhcp6=yes\n\
dhcp_ddns=no\nctrl_agent=no\nkea_verbose=no\n${keactrl_fixed_config}"
dhcp_ddns=no\nctrl_agent=no\nnetconf=no\n\
kea_verbose=no\n${keactrl_fixed_config}"
test_start "keactrl.late_start_v4_server_test"
# Create configuration file for Kea and for keactrl.
create_config "${config}"
create_netconf_config "${netconf_config}"
create_keactrl_config "${keactrl_config}"
# Set logging to a file.
......@@ -603,6 +694,13 @@ Expected wait_for_message return %d, returned %d."
assert_eq 0 ${_GET_PIDS_NUM} \
"Expected %d ${agent_name} process running, found %d processes running"
# Make sure that Netconf agent is not running.
if [ ${have_netconf} -eq 1 ]; then
get_pid ${netconf_name}
assert_eq 0 ${_GET_PIDS_NUM} \
"Expected %d ${netconf_name} process running, found %d processes running"
fi
# Trigger reconfiguration, make sure that the DHCPv6 server reconfigured.
printf "Reconfiguring the DHCPv6 server: ${keactrl} reload -c ${KEACTRL_CFG_FILE}\n"
${keactrl} reload -c ${KEACTRL_CFG_FILE}
......@@ -616,7 +714,8 @@ Expected wait_for_message to return %d, returned %d."
# Update keactrl config to enable other servers.
keactrl_config="${CFG_FILES}\ndhcp4=yes\ndhcp6=yes\n\
dhcp_ddns=yes\nctrl_agent=yes\nkea_verbose=yes\n${keactrl_fixed_config}"
dhcp_ddns=yes\nctrl_agent=yes\nnetconf=yes\n\
kea_verbose=yes\n${keactrl_fixed_confi