]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3106] Renamed startService to startServices
authorMarcin Siodelski <marcin@isc.org>
Sun, 15 Oct 2023 13:40:23 +0000 (15:40 +0200)
committerMarcin Siodelski <marcin@isc.org>
Wed, 29 Nov 2023 19:58:55 +0000 (20:58 +0100)
src/hooks/dhcp/high_availability/ha_callouts.cc
src/hooks/dhcp/high_availability/ha_impl.cc
src/hooks/dhcp/high_availability/ha_impl.h
src/hooks/dhcp/high_availability/tests/ha_impl_unittest.cc

index f0932212524a3dd8df94d94313cd4ee766f08444..6e2bf27b1aa0f461883bad3c5b4954a0a48c9d68 100644 (file)
@@ -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)
index 410772fb5fb19f39a6ba23346635675f9b32a86e..7ab7701fe26bcac6c8e06651f61049cdc8babb11 100644 (file)
@@ -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.
index cb5bcf7882d1f39605fd1e71057150dbfce36edf..a4c360d3b7eb07df9b677dc2191055f5496bb73d 100644 (file)
@@ -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();
index c2b5d5f0d1a2184deca66e7b5c34d291476478ad..3798e02aca74853e4017ee7c51f2038a64cb552f 100644 (file)
@@ -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(
         "{"