From: Marcin Siodelski Date: Sun, 15 Oct 2023 13:40:23 +0000 (+0200) Subject: [#3106] Renamed startService to startServices X-Git-Tag: Kea-2.5.5~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64350a679a41a1882cbf9aee808d4c627e283de1;p=thirdparty%2Fkea.git [#3106] Renamed startService to startServices --- diff --git a/src/hooks/dhcp/high_availability/ha_callouts.cc b/src/hooks/dhcp/high_availability/ha_callouts.cc index f093221252..6e2bf27b1a 100644 --- a/src/hooks/dhcp/high_availability/ha_callouts.cc +++ b/src/hooks/dhcp/high_availability/ha_callouts.cc @@ -57,7 +57,7 @@ int dhcp4_srv_configured(CalloutHandle& handle) { } isc::dhcp::NetworkStatePtr network_state; handle.getArgument("network_state", network_state); - impl->startService(io_service, network_state, HAServerType::DHCPv4); + impl->startServices(io_service, network_state, HAServerType::DHCPv4); } catch (const std::exception& ex) { LOG_ERROR(ha_logger, HA_DHCP4_START_SERVICE_FAILED) @@ -131,7 +131,7 @@ int dhcp6_srv_configured(CalloutHandle& handle) { } isc::dhcp::NetworkStatePtr network_state; handle.getArgument("network_state", network_state); - impl->startService(io_service, network_state, HAServerType::DHCPv6); + impl->startServices(io_service, network_state, HAServerType::DHCPv6); } catch (const std::exception& ex) { LOG_ERROR(ha_logger, HA_DHCP6_START_SERVICE_FAILED) diff --git a/src/hooks/dhcp/high_availability/ha_impl.cc b/src/hooks/dhcp/high_availability/ha_impl.cc index 410772fb5f..7ab7701fe2 100644 --- a/src/hooks/dhcp/high_availability/ha_impl.cc +++ b/src/hooks/dhcp/high_availability/ha_impl.cc @@ -37,9 +37,9 @@ HAImpl::configure(const ConstElementPtr& input_config) { } void -HAImpl::startService(const IOServicePtr& io_service, - const NetworkStatePtr& network_state, - const HAServerType& server_type) { +HAImpl::startServices(const IOServicePtr& io_service, + const NetworkStatePtr& network_state, + const HAServerType& server_type) { auto configs = config_->getAll(); for (auto id = 0; id < configs.size(); ++id) { // Create the HA service and crank up the state machine. diff --git a/src/hooks/dhcp/high_availability/ha_impl.h b/src/hooks/dhcp/high_availability/ha_impl.h index cb5bcf7882..a4c360d3b7 100644 --- a/src/hooks/dhcp/high_availability/ha_impl.h +++ b/src/hooks/dhcp/high_availability/ha_impl.h @@ -40,7 +40,7 @@ public: /// @throw ConfigError when configuration fails. void configure(const data::ConstElementPtr& input_config); - /// @brief Creates high availability service using current configuration. + /// @brief Creates high availability services using current configuration. /// /// The caller must ensure that the HA configuration is valid before /// calling this function. @@ -50,9 +50,9 @@ public: /// DHCP service (enabled/disabled). /// @param server_type DHCP server type for which the HA service should /// be created. - void startService(const asiolink::IOServicePtr& io_service, - const dhcp::NetworkStatePtr& network_state, - const HAServerType& server_type); + void startServices(const asiolink::IOServicePtr& io_service, + const dhcp::NetworkStatePtr& network_state, + const HAServerType& server_type); /// @brief Destructor. ~HAImpl(); diff --git a/src/hooks/dhcp/high_availability/tests/ha_impl_unittest.cc b/src/hooks/dhcp/high_availability/tests/ha_impl_unittest.cc index c2b5d5f0d1..3798e02aca 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_impl_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_impl_unittest.cc @@ -82,8 +82,8 @@ public: // Starting the service is required prior to running any callouts. NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv4)); - ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state, - HAServerType::DHCPv4)); + ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state, + HAServerType::DHCPv4)); ConstElementPtr command = Element::fromJSON(ha_sync_command); @@ -101,7 +101,7 @@ public: }; // Tests that HAService object is created for DHCPv4 service. -TEST_F(HAImplTest, startService) { +TEST_F(HAImplTest, startServices) { // Valid configuration must be provided prior to starting the service. TestHAImpl ha_impl; ASSERT_NO_THROW(ha_impl.configure(createValidJsonConfiguration())); @@ -110,8 +110,8 @@ TEST_F(HAImplTest, startService) { NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv4)); // Start the service for DHCPv4 server. - ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state, - HAServerType::DHCPv4)); + ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state, + HAServerType::DHCPv4)); // Make sure that the HA service has been created for the requested // server type. @@ -120,7 +120,7 @@ TEST_F(HAImplTest, startService) { } // Tests that HAService object is created for DHCPv6 service. -TEST_F(HAImplTest, startService6) { +TEST_F(HAImplTest, startServices6) { // Valid configuration must be provided prior to starting the service. TestHAImpl ha_impl; ASSERT_NO_THROW(ha_impl.configure(createValidJsonConfiguration())); @@ -129,8 +129,8 @@ TEST_F(HAImplTest, startService6) { NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv6)); // Start the service for DHCPv4 server. - ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state, - HAServerType::DHCPv6)); + ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state, + HAServerType::DHCPv6)); // Make sure that the HA service has been created for the requested // server type. @@ -150,8 +150,8 @@ TEST_F(HAImplTest, buffer4Receive) { // Starting the service is required prior to running any callouts. NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv4)); - ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state, - HAServerType::DHCPv4)); + ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state, + HAServerType::DHCPv4)); // Initially the HA service is in the waiting state and serves no scopes. // We need to explicitly enable the scope to be served. @@ -258,8 +258,8 @@ TEST_F(HAImplTest, buffer6Receive) { // Starting the service is required prior to running any callouts. NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv6)); - ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state, - HAServerType::DHCPv6)); + ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state, + HAServerType::DHCPv6)); // Initially the HA service is in the waiting state and serves no scopes. // We need to explicitly enable the scope to be served. @@ -342,8 +342,8 @@ TEST_F(HAImplTest, leases4Committed) { // Starting the service is required prior to running any callouts. NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv4)); - ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state, - HAServerType::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 @@ -428,8 +428,8 @@ TEST_F(HAImplTest, leases6Committed) { // Starting the service is required prior to running any callouts. NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv6)); - ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state, - HAServerType::DHCPv6)); + ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state, + HAServerType::DHCPv6)); // 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 @@ -580,8 +580,8 @@ TEST_F(HAImplTest, continueHandler) { // Starting the service is required prior to running any callouts. NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv4)); - ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state, - HAServerType::DHCPv4)); + ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state, + HAServerType::DHCPv4)); ConstElementPtr command = Element::fromJSON("{ \"command\": \"ha-continue\" }"); @@ -604,8 +604,8 @@ TEST_F(HAImplTest, statusGet) { // Starting the service is required prior to running any callouts. NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv4)); - ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state, - HAServerType::DHCPv4)); + ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state, + HAServerType::DHCPv4)); std::string name = "status-get"; ConstElementPtr response = @@ -664,8 +664,8 @@ TEST_F(HAImplTest, statusGetBackupServer) { // Starting the service is required prior to running any callouts. NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv4)); - ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state, - HAServerType::DHCPv4)); + ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state, + HAServerType::DHCPv4)); std::string name = "status-get"; ConstElementPtr response = @@ -712,8 +712,8 @@ TEST_F(HAImplTest, statusGetPassiveBackup) { // Starting the service is required prior to running any callouts. NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv4)); - ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state, - HAServerType::DHCPv4)); + ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state, + HAServerType::DHCPv4)); std::string name = "status-get"; ConstElementPtr response = @@ -759,8 +759,8 @@ TEST_F(HAImplTest, maintenanceNotify) { // Starting the service is required prior to running any callouts. NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv4)); - ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state, - HAServerType::DHCPv4)); + ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state, + HAServerType::DHCPv4)); ConstElementPtr command = Element::fromJSON( "{" @@ -790,8 +790,8 @@ TEST_F(HAImplTest, haReset) { // Starting the service is required prior to running any callouts. NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv4)); - ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state, - HAServerType::DHCPv4)); + ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state, + HAServerType::DHCPv4)); ConstElementPtr command = Element::fromJSON( "{"