|
@@ -70,12 +70,12 @@ config="{
|
|
|
|
|
|
# This test checks that both DHCPv4 and DHCPv6 server can be started and
|
|
|
# shut down.
|
|
|
-start_both_servers_test() {
|
|
|
+start_both_servers_no_verbose_test() {
|
|
|
# Create configuration file for keactrl. This configuration enables
|
|
|
# both DHCPv4 and DHCPv6 server.
|
|
|
- keactrl_config="kea_config_file=${CFG_FILE}\nkea4=yes\nkea6=yes\n"
|
|
|
+ keactrl_config="kea_config_file=${CFG_FILE}\nkea4=yes\nkea6=yes\nkea_verbose=no\n"
|
|
|
|
|
|
- test_start "keactrl.start_both_servers_test"
|
|
|
+ test_start "keactrl.start_both_servers_no_verbose_test"
|
|
|
|
|
|
# Create configuration file for Kea and for keactrl.
|
|
|
create_config "${config}"
|
|
@@ -102,6 +102,105 @@ Expected wait_for_message return %d, returned %d."
|
|
|
"Timeout waiting for ${kea4_name} to start. \
|
|
|
Expected wait_for_message return %d, returned %d."
|
|
|
|
|
|
+ # Make sure that debug messages are not logged (non-verbose mode).
|
|
|
+ get_log_messages "DHCP6_START_INFO"
|
|
|
+ assert_eq 0 ${_GET_LOG_MESSAGES} \
|
|
|
+ "Expected get_log_messages return %d, returned %d."
|
|
|
+
|
|
|
+ # Make sure that debug messages are not logged (non-verbose mode).
|
|
|
+ get_log_messages "DHCP4_START_INFO"
|
|
|
+ assert_eq 0 ${_GET_LOG_MESSAGES} \
|
|
|
+ "Expected get_log_messages return %d, returned %d."
|
|
|
+
|
|
|
+ # Server may shut down imediatelly after configuration has competed.
|
|
|
+ # Give it some time to shutdown.
|
|
|
+ sleep 3
|
|
|
+
|
|
|
+ # Make sure that both servers are running.
|
|
|
+ get_pids ${kea4_name}
|
|
|
+ assert_eq 1 ${_GET_PIDS_NUM} \
|
|
|
+ "Expected %d ${kea4_name} process running, found %d processes running"
|
|
|
+
|
|
|
+ get_pids ${kea6_name}
|
|
|
+ assert_eq 1 ${_GET_PIDS_NUM} \
|
|
|
+ "Expected %d ${kea6_name} process running, found %d processes running"
|
|
|
+
|
|
|
+ # Use keactrl stop to shutdown the servers.
|
|
|
+ printf "Stopping Kea: ${keactrl} stop\n"
|
|
|
+ ${keactrl} stop
|
|
|
+ ret=${?}
|
|
|
+ assert_eq 0 ${ret} "Expected keactrl to return %d, returned value was %d."
|
|
|
+
|
|
|
+ # Wait up to 10s for the DHCPv6 server to stop.
|
|
|
+ wait_for_message 10 "DHCP6_SHUTDOWN" 1
|
|
|
+ assert_eq 1 ${_WAIT_FOR_MESSAGE} \
|
|
|
+ "Timeout waiting for ${kea6_name} to shutdown. \
|
|
|
+Expected wait_for_message return %d, returned %d."
|
|
|
+
|
|
|
+ # Wait up to 10s for the DHCPv4 server to stop.
|
|
|
+ wait_for_message 10 "DHCP4_SHUTDOWN" 1
|
|
|
+ assert_eq 1 ${_WAIT_FOR_MESSAGE} \
|
|
|
+ "Timeout waiting for ${kea4_name} to shutdown. \
|
|
|
+Expected wait_for_message return %d, returned %d."
|
|
|
+
|
|
|
+ # Make sure that the servers are down.
|
|
|
+ get_pids ${kea4_name}
|
|
|
+ assert_eq 0 ${_GET_PIDS_NUM} \
|
|
|
+ "Expected %d ${kea4_name} processes running, found %d processes running"
|
|
|
+
|
|
|
+ get_pids ${kea6_name}
|
|
|
+ assert_eq 0 ${_GET_PIDS_NUM} \
|
|
|
+ "Expected %d ${kea6_name} processes running, found %d processes running"
|
|
|
+
|
|
|
+ test_finish 0
|
|
|
+}
|
|
|
+
|
|
|
+# This test checks that both DHCPv4 and DHCPv6 server can be started in
|
|
|
+# a verbose mode.
|
|
|
+start_both_servers_verbose_test() {
|
|
|
+ # Create configuration file for keactrl. This configuration enables
|
|
|
+ # both DHCPv4 and DHCPv6 server.
|
|
|
+ keactrl_config="kea_config_file=${CFG_FILE}\nkea4=yes\nkea6=yes\nkea_verbose=yes\n"
|
|
|
+
|
|
|
+ test_start "keactrl.start_both_servers_verbose_test"
|
|
|
+
|
|
|
+ # Create configuration file for Kea and for keactrl.
|
|
|
+ create_config "${config}"
|
|
|
+ create_keactrl_config "${keactrl_config}"
|
|
|
+
|
|
|
+ # Set logging to a file.
|
|
|
+ set_logger
|
|
|
+
|
|
|
+ # Start servers using keactrl script.
|
|
|
+ printf "Starting Kea: ${keactrl} start\n"
|
|
|
+ ${keactrl} start
|
|
|
+ ret=${?}
|
|
|
+ assert_eq 0 ${ret} "Expected keactrl to return %d, returned value was %d"
|
|
|
+
|
|
|
+ # Wait up to 20s for the DHCPv6 server to configure.
|
|
|
+ wait_for_message 20 "DHCP6_CONFIG_COMPLETE" 1
|
|
|
+ assert_eq 1 ${_WAIT_FOR_MESSAGE} \
|
|
|
+ "Timeout waiting for ${kea6_name} to start. \
|
|
|
+Expected wait_for_message return %d, returned %d."
|
|
|
+
|
|
|
+ # Wait up to 20s for the DHCPv4 server to configure.
|
|
|
+ wait_for_message 20 "DHCP4_CONFIG_COMPLETE" 1
|
|
|
+ assert_eq 1 ${_WAIT_FOR_MESSAGE} \
|
|
|
+ "Timeout waiting for ${kea4_name} to start. \
|
|
|
+Expected wait_for_message return %d, returned %d."
|
|
|
+
|
|
|
+ # Check if the debug message is present, which should only be the case if
|
|
|
+ # the verbose mode is on.
|
|
|
+ get_log_messages "DHCP6_START_INFO" 1
|
|
|
+ assert_eq 1 ${_GET_LOG_MESSAGES} \
|
|
|
+ "Expected get_log_messages for DHCP6_START_INFO return %d, returned %d."
|
|
|
+
|
|
|
+ # Check if the debug message is present, which should only be the case if
|
|
|
+ # the verbose mode is on.
|
|
|
+ get_log_messages "DHCP4_START_INFO" 1
|
|
|
+ assert_eq 1 ${_GET_LOG_MESSAGES} \
|
|
|
+ "Expected get_log_messages for DHCP4_START_INFO return %d, returned %d."
|
|
|
+
|
|
|
# Server may shut down imediatelly after configuration has competed.
|
|
|
# Give it some time to shutdown.
|
|
|
sleep 3
|
|
@@ -142,15 +241,17 @@ Expected wait_for_message return %d, returned %d."
|
|
|
assert_eq 0 ${_GET_PIDS_NUM} \
|
|
|
"Expected %d ${kea6_name} processes running, found %d processes running"
|
|
|
|
|
|
+
|
|
|
test_finish 0
|
|
|
}
|
|
|
|
|
|
+
|
|
|
# This test checks that only DHCPv4 server can be started and that the DHCPv6
|
|
|
# server is not started.
|
|
|
start_v4_server_test() {
|
|
|
# Create configuration file for keactrl. This configuration enables
|
|
|
# DHCPv4 server but disables DHCPv6 server.
|
|
|
- keactrl_config="kea_config_file=${CFG_FILE}\nkea4=yes\nkea6=no\n"
|
|
|
+ keactrl_config="kea_config_file=${CFG_FILE}\nkea4=yes\nkea6=no\nkea_verbose=no\n"
|
|
|
|
|
|
test_start "keactrl.start_v4_server_test"
|
|
|
|
|
@@ -226,7 +327,7 @@ Expected wait_for_message return %d, returned %d."
|
|
|
start_v6_server_test() {
|
|
|
# Create configuration file for keactrl. This configuration enables
|
|
|
# DHCPv6 server but disables DHCPv4 server.
|
|
|
- keactrl_config="kea_config_file=${CFG_FILE}\nkea4=no\nkea6=yes\n"
|
|
|
+ keactrl_config="kea_config_file=${CFG_FILE}\nkea4=no\nkea6=yes\nkea_verbose=no\n"
|
|
|
|
|
|
test_start "keactrl.start_v6_server_test"
|
|
|
|
|
@@ -303,7 +404,7 @@ Expected wait_for_message return %d, returned %d."
|
|
|
late_start_v4_server_test() {
|
|
|
# Create configuration file for keactrl. This configuration enables
|
|
|
# DHCPv6 server but disables DHCPv4 server.
|
|
|
- keactrl_config="kea_config_file=${CFG_FILE}\nkea4=no\nkea6=yes\n"
|
|
|
+ keactrl_config="kea_config_file=${CFG_FILE}\nkea4=no\nkea6=yes\nkea_verbose=no\n"
|
|
|
|
|
|
test_start "keactrl.late_start_v4_server_test"
|
|
|
|
|
@@ -352,7 +453,7 @@ Expected wait_for_message return %d, returned %d."
|
|
|
Expected wait_for_message to return %d, returned %d."
|
|
|
|
|
|
# Update keactrl config to enable v4 server.
|
|
|
- keactrl_config="kea_config_file=${CFG_FILE}\nkea4=yes\nkea6=yes\n"
|
|
|
+ keactrl_config="kea_config_file=${CFG_FILE}\nkea4=yes\nkea6=yes\nkea_verbose=yes\n"
|
|
|
create_keactrl_config "${keactrl_config}"
|
|
|
|
|
|
# Start DHCPv4 server using keactrl script.
|
|
@@ -429,7 +530,7 @@ Expected wait_for_message return %d, returned %d."
|
|
|
late_start_v6_server_test() {
|
|
|
# Create configuration file for keactrl. This configuration enables
|
|
|
# DHCPv4 server but disables DHCPv6 server.
|
|
|
- keactrl_config="kea_config_file=${CFG_FILE}\nkea4=yes\nkea6=no\n"
|
|
|
+ keactrl_config="kea_config_file=${CFG_FILE}\nkea4=yes\nkea6=no\nkea_verbose=yes\n"
|
|
|
|
|
|
test_start "keactrl.late_start_v6_server_test"
|
|
|
|
|
@@ -478,7 +579,7 @@ Expected wait_for_message return %d, returned %d."
|
|
|
Expected wait_for_message to return %d, returned %d."
|
|
|
|
|
|
# Update keactrl config to enable v6 server.
|
|
|
- keactrl_config="kea_config_file=${CFG_FILE}\nkea4=yes\nkea6=yes\n"
|
|
|
+ keactrl_config="kea_config_file=${CFG_FILE}\nkea4=yes\nkea6=yes\nkea_verbose=no\n"
|
|
|
create_keactrl_config "${keactrl_config}"
|
|
|
|
|
|
# Start DHCPv6 server using keactrl script.
|
|
@@ -549,7 +650,8 @@ Expected wait_for_message return %d, returned %d."
|
|
|
test_finish 0
|
|
|
}
|
|
|
|
|
|
-start_both_servers_test
|
|
|
+start_both_servers_no_verbose_test
|
|
|
+start_both_servers_verbose_test
|
|
|
start_v4_server_test
|
|
|
start_v6_server_test
|
|
|
late_start_v4_server_test
|