2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[#1403] ha-sync-complete-notify command created

Implemented creator for the ha-sync-complete-notify command.
This commit is contained in:
Marcin Siodelski
2021-07-29 20:13:12 +02:00
parent 9db90fd68c
commit 8045b5157a
3 changed files with 29 additions and 0 deletions

View File

@@ -221,6 +221,13 @@ CommandCreator::createMaintenanceNotify(const bool cancel, const HAServerType& s
return (command);
}
ConstElementPtr
CommandCreator::createSyncCompleteNotify(const HAServerType& server_type) {
auto command = config::createCommand("ha-sync-complete-notify");
insertService(command, server_type);
return (command);
}
void
CommandCreator::insertLeaseExpireTime(ElementPtr& lease) {
if ((lease->getType() != Element::map) ||

View File

@@ -165,6 +165,13 @@ public:
static data::ConstElementPtr
createMaintenanceNotify(const bool cancel, const HAServerType& server_type);
/// @brief Creates ha-sync-complete-notify command.
///
/// @param server_type type of the DHCP server, i.e. v4 or v6.
/// @return Pointer to the JSON representation of the command.
static data::ConstElementPtr
createSyncCompleteNotify(const HAServerType& server_type);
private:
/// @brief Replaces "cltt" with "expire" value within the lease.

View File

@@ -500,4 +500,19 @@ TEST(CommandCreatorTest, createMaintenanceNotify6) {
EXPECT_FALSE(cancel->boolValue());
}
// This test verifies that the ha-sync-complete-notify command sent to a
// DHCPv4 server is correct.
TEST(CommandCreatorTest, createSyncCompleteNotify4) {
ConstElementPtr command = CommandCreator::createSyncCompleteNotify(HAServerType::DHCPv4);
ASSERT_NO_FATAL_FAILURE(testCommandBasics(command, "ha-sync-complete-notify", "dhcp4"));
}
// This test verifies that the ha-sync-complete-notify command sent to a
// DHCPv4 server is correct.
TEST(CommandCreatorTest, createSyncCompleteNotify6) {
ConstElementPtr command = CommandCreator::createSyncCompleteNotify(HAServerType::DHCPv6);
ConstElementPtr arguments;
ASSERT_NO_FATAL_FAILURE(testCommandBasics(command, "ha-sync-complete-notify", "dhcp6"));
}
}