// If the hook library is configured to not send lease updates to the
// partner, there is nothing to do because this whole callout is
// currently about sending lease updates.
- if (!config_->amSendingLeaseUpdates()) {
+ if (!config_->get()->amSendingLeaseUpdates()) {
// No need to log it, because it was already logged when configuration
// was applied.
callout_handle.setArgument("peers_to_update", peers_to_update);
// Asynchronously send the lease update. In some cases no updates will be sent,
// e.g. when this server is in the partner-down state and there are no backup
// servers.
- peers_to_update = service_->asyncSendSingleLeaseUpdate(query4, lease4, 0);
+ peers_to_update = services_->get()->asyncSendSingleLeaseUpdate(query4, lease4, 0);
callout_handle.setArgument("peers_to_update", peers_to_update);
}
TEST_F(HAImplTest, lease4ServerDecline) {
// Create implementation object and configure it.
TestHAImpl ha_impl;
- ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state,
- HAServerType::DHCPv4));
+ ASSERT_NO_THROW(ha_impl.configure(createValidJsonConfiguration()));
+
+ // Starting the service is required prior to running any callouts.
+ NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv4));
+ ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state,
+ HAServerType::DHCPv4));
// Make sure we wait for the acks from the backup server to be able to
// test the case of sending lease updates even though the service is
// in the state in which the lease updates are normally not sent.
- ha_impl.config_->setWaitBackupAck(true);
+ ha_impl.config_->get()->setWaitBackupAck(true);
// Create callout handle to be used for passing arguments to the
// callout.
// Set initial status.
callout_handle->setStatus(CalloutHandle::NEXT_STEP_CONTINUE);
- ha_impl.config_->setSendLeaseUpdates(false);
+ ha_impl.config_->get()->setSendLeaseUpdates(false);
// Run the callout.
ASSERT_NO_THROW(ha_impl.lease4ServerDecline(*callout_handle));
EXPECT_EQ(peers_to_update, 0);
// Enable updates and retry.
- ha_impl.config_->setSendLeaseUpdates(true);
+ ha_impl.config_->get()->setSendLeaseUpdates(true);
callout_handle->setArgument("lease4", lease4);
// Run the callout again.