// Perform synchronous leases update.
std::string status_message;
int sync_status = synchronize(status_message,
- config_->getFailoverPeerConfig()->getName(),
+ config_->getFailoverPeerConfig(),
dhcp_disable_timeout);
// If the leases synchronization was successful, let's transition
void
HAService::asyncDisableDHCPService(HttpClient& http_client,
- const std::string& server_name,
+ const HAConfig::PeerConfigPtr& remote_config,
const unsigned int max_period,
PostRequestCallback post_request_action) {
- HAConfig::PeerConfigPtr remote_config = config_->getPeerConfig(server_name);
-
// Create HTTP/1.1 request including our command.
PostHttpRequestJsonPtr request = boost::make_shared<PostHttpRequestJson>
(HttpRequest::Method::HTTP_POST, "/", HttpVersion::HTTP_11(),
void
HAService::asyncEnableDHCPService(HttpClient& http_client,
- const std::string& server_name,
+ const HAConfig::PeerConfigPtr& remote_config,
PostRequestCallback post_request_action) {
- HAConfig::PeerConfigPtr remote_config = config_->getPeerConfig(server_name);
-
// Create HTTP/1.1 request including our command.
PostHttpRequestJsonPtr request = boost::make_shared<PostHttpRequestJson>
(HttpRequest::Method::HTTP_POST, "/", HttpVersion::HTTP_11(),
}
lease_sync_filter_.apply();
- asyncSyncLeases(*client_, config_->getFailoverPeerConfig()->getName(),
+ asyncSyncLeases(*client_, config_->getFailoverPeerConfig(),
dhcp_disable_timeout, LeasePtr(), null_action);
}
void
HAService::asyncSyncLeases(http::HttpClient& http_client,
- const std::string& server_name,
+ const HAConfig::PeerConfigPtr& remote_config,
const unsigned int max_period,
const dhcp::LeasePtr& last_lease,
PostSyncCallback post_sync_action,
// to allocate new leases while we fetch from it. The DHCP service will
// be disabled for a certain amount of time and will be automatically
// re-enabled if we die during the synchronization.
- asyncDisableDHCPService(http_client, server_name, max_period,
- [this, &http_client, server_name, max_period, last_lease,
+ asyncDisableDHCPService(http_client, remote_config, max_period,
+ [this, &http_client, remote_config, max_period, last_lease,
post_sync_action, dhcp_disabled]
(const bool success, const std::string& error_message, const int) {
if (success) {
// The last argument indicates that disabling the DHCP
// service on the partner server was successful.
- asyncSyncLeasesInternal(http_client, server_name, max_period,
+ asyncSyncLeasesInternal(http_client, remote_config, max_period,
last_lease, post_sync_action, true);
} else {
void
HAService::asyncSyncLeasesInternal(http::HttpClient& http_client,
- const std::string& server_name,
+ const HAConfig::PeerConfigPtr& remote_config,
const unsigned int max_period,
const dhcp::LeasePtr& last_lease,
PostSyncCallback post_sync_action,
const bool dhcp_disabled) {
-
- HAConfig::PeerConfigPtr partner_config = config_->getPeerConfig(server_name);
-
// Create HTTP/1.1 request including our command.
PostHttpRequestJsonPtr request = boost::make_shared<PostHttpRequestJson>
(HttpRequest::Method::HTTP_POST, "/", HttpVersion::HTTP_11(),
- HostHttpHeader(partner_config->getUrl().getStrippedHostname()));
- partner_config->addBasicAuthHttpHeader(request);
+ HostHttpHeader(remote_config->getUrl().getStrippedHostname()));
+ remote_config->addBasicAuthHttpHeader(request);
if (server_type_ == HAServerType::DHCPv4) {
request->setBodyAsJson(CommandCreator::createLease4GetPage(
boost::dynamic_pointer_cast<Lease4>(last_lease), config_->getSyncPageLimit()));
HttpResponseJsonPtr response = boost::make_shared<HttpResponseJson>();
// Schedule asynchronous HTTP request.
- http_client.asyncSendRequest(partner_config->getUrl(),
- partner_config->getTlsContext(),
+ http_client.asyncSendRequest(remote_config->getUrl(),
+ remote_config->getTlsContext(),
request, response,
- [this, partner_config, post_sync_action, &http_client, server_name,
- max_period, dhcp_disabled]
+ [this, remote_config, post_sync_action, &http_client, max_period, dhcp_disabled]
(const boost::system::error_code& ec,
const HttpResponsePtr& response,
const std::string& error_str) {
error_message = (ec ? ec.message() : error_str);
LOG_ERROR(ha_logger, HA_LEASES_SYNC_COMMUNICATIONS_FAILED)
.arg(config_->getThisServerName())
- .arg(partner_config->getLogLabel())
+ .arg(remote_config->getLogLabel())
.arg(error_message);
} else {
LOG_INFO(ha_logger, HA_LEASES_SYNC_LEASE_PAGE_RECEIVED)
.arg(config_->getThisServerName())
.arg(leases_element.size())
- .arg(server_name);
+ .arg(remote_config->getLogLabel());
// Count actually applied leases.
uint64_t applied_lease_count = 0;
error_message = ex.what();
LOG_ERROR(ha_logger, HA_LEASES_SYNC_FAILED)
.arg(config_->getThisServerName())
- .arg(partner_config->getLogLabel())
+ .arg(remote_config->getLogLabel())
.arg(error_message);
}
}
} else if (last_lease) {
// This indicates that there are more leases to be fetched.
// Therefore, we have to send another leaseX-get-page command.
- asyncSyncLeases(http_client, server_name, max_period, last_lease,
+ asyncSyncLeases(http_client, remote_config, max_period, last_lease,
post_sync_action, dhcp_disabled);
return;
}
ConstElementPtr
HAService::processSynchronize(const std::string& server_name,
const unsigned int max_period) {
+ HAConfig::PeerConfigPtr remote_config;
+ try {
+ remote_config = config_->getPeerConfig(server_name);
+ } catch (const std::exception& ex) {
+ return (createAnswer(CONTROL_RESULT_ERROR, ex.what()));
+ }
+ // We must not synchronize with self.
+ if (remote_config->getName() == config_->getThisServerName()) {
+ return (createAnswer(CONTROL_RESULT_ERROR, "'" + remote_config->getName()
+ + "' points to local server but should point to a partner"));
+ }
std::string answer_message;
- int sync_status = synchronize(answer_message, server_name, max_period);
+ int sync_status = synchronize(answer_message, remote_config, max_period);
return (createAnswer(sync_status, answer_message));
}
int
-HAService::synchronize(std::string& status_message, const std::string& server_name,
+HAService::synchronize(std::string& status_message,
+ const HAConfig::PeerConfigPtr& remote_config,
const unsigned int max_period) {
lease_sync_filter_.apply();
IOServicePtr io_service(new IOService());
HttpClient client(io_service, false);
- asyncSyncLeases(client, server_name, max_period, Lease4Ptr(),
+ asyncSyncLeases(client, remote_config, max_period, Lease4Ptr(),
[&](const bool success, const std::string& error_message,
const bool dhcp_disabled) {
// If there was a fatal error while fetching the leases, let's
// try to send the ha-sync-complete-notify command to the
// partner.
if (success) {
- asyncSyncCompleteNotify(client, server_name,
+ asyncSyncCompleteNotify(client, remote_config,
[&](const bool success,
const std::string& error_message,
const int rcode) {
// runs an older Kea version. In that case, send the dhcp-enable
// command as in previous Kea version.
if (rcode == CONTROL_RESULT_COMMAND_UNSUPPORTED) {
- asyncEnableDHCPService(client, server_name,
+ asyncEnableDHCPService(client, remote_config,
[&](const bool success,
const std::string& error_message,
const int) {
// re-enable the DHCP service. Note, that we don't send the
// ha-sync-complete-notify command in this case. It is only sent in
// the case when synchronization ends successfully.
- asyncEnableDHCPService(client, server_name,
+ asyncEnableDHCPService(client, remote_config,
[&](const bool success,
const std::string& error_message,
const int) {
LOG_INFO(ha_logger, HA_SYNC_START)
.arg(config_->getThisServerName())
- .arg(server_name);
+ .arg(remote_config->getLogLabel());
// Measure duration of the synchronization.
Stopwatch stopwatch;
LOG_ERROR(ha_logger, HA_SYNC_FAILED)
.arg(config_->getThisServerName())
- .arg(server_name)
+ .arg(remote_config->getLogLabel())
.arg(status_message);
return (CONTROL_RESULT_ERROR);
LOG_INFO(ha_logger, HA_SYNC_SUCCESSFUL)
.arg(config_->getThisServerName())
- .arg(server_name)
+ .arg(remote_config->getLogLabel())
.arg(stopwatch.logFormatLastDuration());
return (CONTROL_RESULT_SUCCESS);
void
HAService::asyncSyncCompleteNotify(HttpClient& http_client,
- const std::string& server_name,
+ const HAConfig::PeerConfigPtr& remote_config,
PostRequestCallback post_request_action) {
- HAConfig::PeerConfigPtr remote_config = config_->getPeerConfig(server_name);
-
// Create HTTP/1.1 request including our command.
PostHttpRequestJsonPtr request = boost::make_shared<PostHttpRequestJson>
(HttpRequest::Method::HTTP_POST, "/", HttpVersion::HTTP_11(),
///
/// @param http_client reference to the client to be used to communicate
/// with the other server.
- /// @param server_name name of the server to which the command should be
- /// sent.
+ /// @param remote_config config of the partner to which the command should
+ /// be sent.
/// @param max_period maximum number of seconds for which the DHCP service
/// should be disabled.
/// @param post_request_action pointer to the function to be executed when
/// the request is completed.
void asyncDisableDHCPService(http::HttpClient& http_client,
- const std::string& server_name,
+ const HAConfig::PeerConfigPtr& remote_config,
const unsigned int max_period,
PostRequestCallback post_request_action);
///
/// @param http_client reference to the client to be used to communicate
/// with the other server.
- /// @param server_name name of the server to which the command should be
- /// sent.
+ /// @param remote_config config of the partner to which the command should
+ /// be sent.
/// @param post_request_action pointer to the function to be executed when
/// the request is completed.
void asyncEnableDHCPService(http::HttpClient& http_client,
- const std::string& server_name,
+ const HAConfig::PeerConfigPtr& remote_config,
PostRequestCallback post_request_action);
/// @brief Disables local DHCP service.
///
/// @param http_client reference to the client to be used to communicate
/// with the other server.
- /// @param server_name name of the server to fetch leases from.
+ /// @param remote_config config of the partner to fetch leases from.
/// @param max_period maximum number of seconds to disable DHCP service
/// @param last_lease Pointer to the last lease returned on the previous
/// page of leases. This lease is used to set the value of the "from"
/// @c post_sync_action to indicate whether the DHCP service has to
/// be enabled after the leases synchronization.
void asyncSyncLeases(http::HttpClient& http_client,
- const std::string& server_name,
+ const HAConfig::PeerConfigPtr& remote_config,
const unsigned int max_period,
const dhcp::LeasePtr& last_lease,
PostSyncCallback post_sync_action,
///
/// @param http_client reference to the client to be used to communicate
/// with the other server.
- /// @param server_name name of the server to fetch leases from.
+ /// @param remote_config config of the partner to fetch leases from.
/// @param max_period maximum number of seconds to disable DHCP service
/// @param last_lease Pointer to the last lease returned on the previous
/// page of leases. This lease is used to set the value of the "from"
/// @c post_sync_action to indicate whether the DHCP service has to
/// be enabled after the leases synchronization.
void asyncSyncLeasesInternal(http::HttpClient& http_client,
- const std::string& server_name,
+ const HAConfig::PeerConfigPtr& remote_config,
const unsigned int max_period,
const dhcp::LeasePtr& last_lease,
PostSyncCallback post_sync_action,
/// invokes IOService::run().
///
/// @param [out] status_message status message in textual form.
- /// @param server_name name of the server to fetch leases from.
+ /// @param remote_config config of the server to fetch leases from.
/// @param max_period maximum number of seconds to disable DHCP service
/// of the peer. This value is used in dhcp-disable command issued to
/// the peer before the lease4-get-page command.
///
/// @return Synchronization result according to the status codes returned
/// in responses to control commands.
- int synchronize(std::string& status_message, const std::string& server_name,
+ int synchronize(std::string& status_message,
+ const HAConfig::PeerConfigPtr& remote_config,
const unsigned int max_period);
/// @brief Sends lease updates from backlog to partner asynchronously.
///
/// @param http_client reference to the client to be used to communicate
/// with the other server.
- /// @param server_name name of the server to which the command should be
- /// sent.
+ /// @param remote_config config of the partner to which the command should
+ /// be sent.
/// @param post_request_action pointer to the function to be executed when
/// the request is completed.
void asyncSyncCompleteNotify(http::HttpClient& http_client,
- const std::string& server_name,
+ const HAConfig::PeerConfigPtr& remote_config,
PostRequestCallback post_request_action);
public:
///
/// This variant of the method uses default HTTP client for communication.
///
- /// @param server_name name of the server to which the command should be
+ /// @param remote_config config of the server to which the command should be
/// sent.
/// @param max_period maximum number of seconds for which the DHCP service
/// should be disabled.
/// @param post_request_action pointer to the function to be executed when
/// the request is completed.
- void asyncDisableDHCPService(const std::string& server_name,
+ void asyncDisableDHCPService(const HAConfig::PeerConfigPtr& remote_config,
const unsigned int max_period,
const PostRequestCallback& post_request_action) {
- HAService::asyncDisableDHCPService(*client_, server_name, max_period,
+ HAService::asyncDisableDHCPService(*client_, remote_config, max_period,
post_request_action);
}
///
/// This variant of the method uses default HTTP client for communication.
///
- /// @param server_name name of the server to which the command should be
+ /// @param remote_config config of the server to which the command should be
/// sent.
/// @param post_request_action pointer to the function to be executed when
/// the request is completed.
- void asyncEnableDHCPService(const std::string& server_name,
+ void asyncEnableDHCPService(const HAConfig::PeerConfigPtr& remote_config,
const PostRequestCallback& post_request_action) {
- HAService::asyncEnableDHCPService(*client_, server_name, post_request_action);
+ HAService::asyncEnableDHCPService(*client_, remote_config, post_request_action);
}
using HAService::asyncSendHeartbeat;
///
/// This variant of the method uses default HTTP client for communication.
///
- /// @param server_name name of the server to which the command should be
+ /// @param remote_config config of the server to which the command should be
/// sent.
/// @param max_period maximum number of seconds for which the DHCP service
/// should be disabled.
/// @param post_request_action pointer to the function to be executed when
/// the request is completed.
- void asyncDisableDHCPService(const std::string& server_name,
+ void asyncDisableDHCPService(const HAConfig::PeerConfigPtr& remote_config,
const unsigned int max_period,
const PostRequestCallback& post_request_action) {
- HAService::asyncDisableDHCPService(*client_, server_name, max_period,
+ HAService::asyncDisableDHCPService(*client_, remote_config, max_period,
post_request_action);
}
///
/// This variant of the method uses default HTTP client for communication.
///
- /// @param server_name name of the server to which the command should be
+ /// @param remote_config config of the server to which the command should be
/// sent.
/// @param post_request_action pointer to the function to be executed when
/// the request is completed.
- void asyncEnableDHCPService(const std::string& server_name,
+ void asyncEnableDHCPService(const HAConfig::PeerConfigPtr& remote_config,
const PostRequestCallback& post_request_action) {
- HAService::asyncEnableDHCPService(*client_, server_name, post_request_action);
+ HAService::asyncEnableDHCPService(*client_, remote_config, post_request_action);
}
using HAService::asyncSendHeartbeat;
/// leases in the lease database.
///
/// @param config_storage test HA configuration.
+ /// @param server_name name of the partner server.
/// @param [out] rsp pointer to the object where response will be stored.
- void runProcessSynchronize4(HAConfigPtr config_storage, ConstElementPtr& rsp) {
+ void runProcessSynchronize4(HAConfigPtr config_storage, std::string server_name, ConstElementPtr& rsp) {
// Create lease manager.
ASSERT_NO_THROW(LeaseMgrFactory::create("universe=4 type=memfile persist=false"));
auto thread = runIOServiceInThread();
// Process ha-sync command.
- ASSERT_NO_THROW(rsp = service.processSynchronize("server2", 20));
+ ASSERT_NO_THROW(rsp = service.processSynchronize(server_name, 20));
// Stop the IO service. This should cause the thread to terminate.
io_service_->stop();
/// leases in the lease database.
///
/// @param config_storage test HA configuration.
+ /// @param server_name name of the partner server.
/// @param [out] rsp pointer to the object where response will be stored.
- void runProcessSynchronize6(HAConfigPtr config_storage, ConstElementPtr& rsp) {
+ void runProcessSynchronize6(HAConfigPtr config_storage, std::string server_name, ConstElementPtr& rsp) {
// Create lease manager.
ASSERT_NO_THROW(LeaseMgrFactory::create("universe=6 type=memfile persist=false"));
auto thread = runIOServiceInThread();
// Process ha-sync command.
- ASSERT_NO_THROW(rsp = service.processSynchronize("server2", 20));
+ ASSERT_NO_THROW(rsp = service.processSynchronize(server_name, 20));
// Stop the IO service. This should cause the thread to terminate.
io_service_->stop();
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize4(config_storage, rsp);
+ runProcessSynchronize4(config_storage, "server2", rsp);
// The response should indicate success.
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize4(config_storage, rsp);
+ runProcessSynchronize4(config_storage, "server2", rsp);
// The response should indicate success.
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize4(config_storage, rsp);
+ runProcessSynchronize4(config_storage, "server2", rsp);
// The response should indicate success.
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize4(config_storage, rsp);
+ runProcessSynchronize4(config_storage, "server2", rsp);
// The response should indicate an error
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize4(config_storage, rsp);
+ runProcessSynchronize4(config_storage, "server2", rsp);
// The response should indicate an error
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize4(config_storage, rsp);
+ runProcessSynchronize4(config_storage, "server2", rsp);
// The response should indicate an error
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize4(config_storage, rsp);
+ runProcessSynchronize4(config_storage, "server2", rsp);
// The response should indicate an error
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize4(config_storage, rsp);
+ runProcessSynchronize4(config_storage, "server2", rsp);
// The response should indicate an error
ASSERT_TRUE(rsp);
EXPECT_FALSE(factory2_->getResponseCreator()->findRequest("dhcp-enable",""));
}
+// This test verifies that an error is reported when server-name parameter
+// points to a non-existing server.
+TEST_F(HAServiceTest, processSynchronize4InvalidServerName) {
+ // Create HA configuration for 3 servers. This server is
+ // server 1.
+ HAConfigPtr config_storage = createValidConfiguration();
+ setBasicAuth(config_storage);
+
+ // Run HAService::processSynchronize and gather a response.
+ ConstElementPtr rsp;
+ runProcessSynchronize4(config_storage, "server8", rsp);
+
+ // The response should indicate an error
+ ASSERT_TRUE(rsp);
+ checkAnswer(rsp, CONTROL_RESULT_ERROR);
+
+ // This server should issue no command because we expect that
+ // it returns after checking that the specified server doesn't exist.
+ EXPECT_FALSE(factory2_->getResponseCreator()->findRequest("dhcp-disable", ""));
+}
+
// This test verifies that the ha-sync command is processed successfully for the
// DHCPv6 server.
TEST_F(HAServiceTest, processSynchronize6) {
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize6(config_storage, rsp);
+ runProcessSynchronize6(config_storage, "server2", rsp);
// The response should indicate success.
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize6(config_storage, rsp);
+ runProcessSynchronize6(config_storage, "server2", rsp);
// The response should indicate success.
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize6(config_storage, rsp);
+ runProcessSynchronize6(config_storage, "server2", rsp);
// The response should indicate success.
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize6(config_storage, rsp);
+ runProcessSynchronize6(config_storage, "server2", rsp);
// The response should indicate an error
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize6(config_storage, rsp);
+ runProcessSynchronize6(config_storage, "server2", rsp);
// The response should indicate an error
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize6(config_storage, rsp);
+ runProcessSynchronize6(config_storage, "server2", rsp);
// The response should indicate an error
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize6(config_storage, rsp);
+ runProcessSynchronize6(config_storage, "server2", rsp);
// The response should indicate an error
ASSERT_TRUE(rsp);
// Run HAService::processSynchronize and gather a response.
ConstElementPtr rsp;
- runProcessSynchronize6(config_storage, rsp);
+ runProcessSynchronize6(config_storage, "server2", rsp);
// The response should indicate an error
ASSERT_TRUE(rsp);
EXPECT_FALSE(factory2_->getResponseCreator()->findRequest("dhcp-enable",""));
}
+// This test verifies that an error is reported when server-name parameter
+// points to a local server.
+TEST_F(HAServiceTest, processSynchronize6LocalServer) {
+ // Create HA configuration for 3 servers. This server is
+ // server 1.
+ HAConfigPtr config_storage = createValidConfiguration();
+ setBasicAuth(config_storage);
+
+ // Run HAService::processSynchronize and gather a response.
+ ConstElementPtr rsp;
+ runProcessSynchronize6(config_storage, "server1", rsp);
+
+ // The response should indicate an error
+ ASSERT_TRUE(rsp);
+ checkAnswer(rsp, CONTROL_RESULT_ERROR);
+
+ // This server should issue no command because we expect that
+ // it returns after checking that the specified server doesn't exist.
+ EXPECT_FALSE(factory2_->getResponseCreator()->findRequest("dhcp-disable", ""));
+}
+
// This test verifies that the DHCPv4 service can be disabled on the remote server.
TEST_F(HAServiceTest, asyncDisableDHCPService4) {
// Create HA configuration.
// Send dhcp-disable command with max-period of 10 seconds.
// When the transaction is finished, the IO service gets stopped.
- ASSERT_NO_THROW(service.asyncDisableDHCPService("server3", 10,
+ ASSERT_NO_THROW(service.asyncDisableDHCPService(config_storage->getPeerConfig("server3"), 10,
[this](const bool success,
const std::string& error_message,
const int) {
// Send dhcp-disable command with max-period of 10 seconds.
// When the transaction is finished, the IO service gets stopped.
- ASSERT_NO_THROW(service.asyncDisableDHCPService("server3", 10,
+ ASSERT_NO_THROW(service.asyncDisableDHCPService(config_storage->getPeerConfig("server3"), 10,
[this](const bool success,
const std::string& error_message,
const int) {
// Send dhcp-disable command with max-period of 10 seconds.
// When the transaction is finished, the IO service gets stopped.
- ASSERT_NO_THROW(service.asyncDisableDHCPService("server2", 10,
+ ASSERT_NO_THROW(service.asyncDisableDHCPService(config_storage->getPeerConfig("server2"), 10,
[this](const bool success,
const std::string& error_message,
const int) {
// Send dhcp-disable command with max-period of 10 seconds.
// When the transaction is finished, the IO service gets stopped.
- ASSERT_NO_THROW(service.asyncDisableDHCPService("server3", 10,
+ ASSERT_NO_THROW(service.asyncDisableDHCPService(config_storage->getPeerConfig("server3"), 10,
[this](const bool success,
const std::string& error_message,
const int) {
// Send dhcp-disable command with max-period of 10 seconds.
// When the transaction is finished, the IO service gets stopped.
- ASSERT_NO_THROW(service.asyncDisableDHCPService("server3", 10,
+ ASSERT_NO_THROW(service.asyncDisableDHCPService(config_storage->getPeerConfig("server3"), 10,
[this](const bool success,
const std::string& error_message,
const int) {
// Send dhcp-enable command. When the transaction is finished,
// the IO service gets stopped.
- ASSERT_NO_THROW(service.asyncEnableDHCPService("server2",
+ ASSERT_NO_THROW(service.asyncEnableDHCPService(config_storage->getPeerConfig("server2"),
[this](const bool success,
const std::string& error_message,
const int) {
// Send dhcp-enable command. When the transaction is finished,
// the IO service gets stopped.
- ASSERT_NO_THROW(service.asyncEnableDHCPService("server2",
+ ASSERT_NO_THROW(service.asyncEnableDHCPService(config_storage->getPeerConfig("server2"),
[this](const bool success,
const std::string& error_message,
const int) {
// Send dhcp-enable command. When the transaction is finished,
// the IO service gets stopped.
- ASSERT_NO_THROW(service.asyncEnableDHCPService("server2",
+ ASSERT_NO_THROW(service.asyncEnableDHCPService(config_storage->getPeerConfig("server2"),
[this](const bool success,
const std::string& error_message,
const int) {
// Send dhcp-enable command. When the transaction is finished,
// the IO service gets stopped.
- ASSERT_NO_THROW(service.asyncEnableDHCPService("server2",
+ ASSERT_NO_THROW(service.asyncEnableDHCPService(config_storage->getPeerConfig("server2"),
[this](const bool success,
const std::string& error_message,
const int) {
// Send dhcp-enable command. When the transaction is finished,
// the IO service gets stopped.
- ASSERT_NO_THROW(service.asyncEnableDHCPService("server2",
+ ASSERT_NO_THROW(service.asyncEnableDHCPService(config_storage->getPeerConfig("server2"),
[this](const bool success,
const std::string& error_message,
const int) {