]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3435] some formatting in netconf
authorAndrei Pavel <andrei@isc.org>
Thu, 20 Jun 2024 18:29:24 +0000 (21:29 +0300)
committerAndrei Pavel <andrei@isc.org>
Thu, 20 Jun 2024 18:29:58 +0000 (21:29 +0300)
22 files changed:
src/bin/netconf/control_socket.h
src/bin/netconf/http_control_socket.cc
src/bin/netconf/netconf.cc
src/bin/netconf/netconf.h
src/bin/netconf/netconf_cfg_mgr.cc
src/bin/netconf/netconf_cfg_mgr.h
src/bin/netconf/netconf_config.cc
src/bin/netconf/netconf_config.h
src/bin/netconf/netconf_controller.h
src/bin/netconf/netconf_log.cc
src/bin/netconf/netconf_process.cc
src/bin/netconf/netconf_process.h
src/bin/netconf/parser_context_decl.h
src/bin/netconf/stdout_control_socket.h
src/bin/netconf/tests/control_socket_unittests.cc
src/bin/netconf/tests/get_config_unittest.cc
src/bin/netconf/tests/netconf_cfg_mgr_unittests.cc
src/bin/netconf/tests/netconf_controller_unittests.cc
src/bin/netconf/tests/netconf_process_unittests.cc
src/bin/netconf/tests/netconf_unittests.cc
src/bin/netconf/tests/parser_unittests.cc
src/bin/netconf/tests/run_unittests.cc

index 05cfe749750e94af94292dbf09cb70a72ceb829b..10bcafcc40acd3dfd961b7cb4d6c663f8f331ddb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -19,8 +19,9 @@ namespace netconf {
 /// @brief Exception thrown when the error during communication.
 class ControlSocketError : public isc::Exception {
 public:
-    ControlSocketError(const char* file, size_t line, const char* what) :
-        isc::Exception(file, line, what) { }
+    ControlSocketError(const char* file, size_t line, const char* what)
+        : isc::Exception(file, line, what) {
+    }
 };  // ControlSocketError
 
 /// @brief Base class for control socket communication.
@@ -38,7 +39,7 @@ public:
     ControlSocketBase(CfgControlSocketPtr ctrl_sock) : socket_cfg_(ctrl_sock) {
         if (!ctrl_sock) {
             isc_throw(ControlSocketError, "ControlSocket constructor called "
-                      "with a null configuration");
+                                          "with a null configuration");
         }
     }
 
index 12b240232fc63ed3c764bb84128f0c096db73019..f630383312de2f059c788910c9235d91e69e0fa2 100644 (file)
@@ -130,4 +130,3 @@ HttpControlSocket::sendCommand(ConstElementPtr command) {
 
 }  // namespace netconf
 }  // namespace isc
-
index d66c3139a2745b3dba0952845bba0f4dbfc90611..561cda9e5018f54c721f290683869ded2b7af91b 100644 (file)
@@ -142,7 +142,7 @@ public:
     }
 };  // NetconfAgentCallback
 
-}  //anonymous namespace
+}  // anonymous namespace
 
 namespace isc {
 namespace netconf {
@@ -254,15 +254,15 @@ NetconfAgent::initSysrepo() {
         startup_sess_ = Connection{}.sessionStart();
         startup_sess_->switchDatastore(Datastore::Startup);
     } catch (exception const& ex) {
-        isc_throw(Unexpected, "Can't establish a sysrepo session: "
-                  << ex.what());
+        isc_throw(Unexpected, "Can't establish a sysrepo session: " << ex.what());
     }
 
     // Retrieve names and revisions of installed modules from sysrepo.
     getModules();
 }
 
-void NetconfAgent::getModules() {
+void
+NetconfAgent::getModules() {
     vector<Module> modules;
     try {
         Context context(running_sess_->getContext());
@@ -274,8 +274,7 @@ void NetconfAgent::getModules() {
     for (Module const& module : modules) {
         string const name(module.name());
         if (!module.revision()) {
-            isc_throw(Unexpected,
-                      "could not retrieve module revision for module " << name);
+            isc_throw(Unexpected, "could not retrieve module revision for module " << name);
         }
         string const revision(*module.revision());
         modules_.emplace(name, revision);
@@ -464,8 +463,7 @@ NetconfAgent::subscribeToDataChanges(const CfgServersMapPair& service_pair) {
     } catch (exception const& ex) {
         ostringstream msg;
         msg << "module change subscribe failed with " << ex.what();
-        msg << "change subscription for model " << model <<
-            " failed with: " << ex.what();
+        msg << "change subscription for model " << model << " failed with: " << ex.what();
         LOG_ERROR(netconf_logger, NETCONF_SUBSCRIBE_CONFIG_FAILED)
             .arg(server)
             .arg(configuration->getModel())
@@ -754,7 +752,8 @@ NetconfAgent::announceShutdown() const {
     }
 }
 
-bool NetconfAgent::shouldShutdown() const {
+bool
+NetconfAgent::shouldShutdown() const {
     return boost::dynamic_pointer_cast<NetconfController>(NetconfController::instance())
         ->getNetconfProcess()
         ->shouldShutdown();
index bb37ea53088f8c26078a17ebaf1ab3fae1e701f0..e5b363e9286e917c7fad7cb9a22e6239edb5e4a7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 #include <netconf/stdout_control_socket.h>
 #include <netconf/unix_control_socket.h>
 
-#include <sysrepo-cpp/Session.hpp>
-
 #include <map>
 
+#include <sysrepo-cpp/Session.hpp>
+
 namespace isc {
 namespace netconf {
 
@@ -69,8 +69,7 @@ public:
     /// @param sess The sysrepo running datastore session.
     /// @param service_pair The service name and configuration pair.
     /// @return return code for sysrepo.
-    static sysrepo::ErrorCode
-    change(sysrepo::Session sess, const CfgServersMapPair& service_pair);
+    static sysrepo::ErrorCode change(sysrepo::Session sess, const CfgServersMapPair& service_pair);
 
     /// @brief Event::Done callback.
     ///
@@ -80,8 +79,7 @@ public:
     /// @param sess The sysrepo running datastore session.
     /// @param service_pair The service name and configuration pair.
     /// @return return code for sysrepo.
-    static sysrepo::ErrorCode
-    done(sysrepo::Session sess, const CfgServersMapPair& service_pair);
+    static sysrepo::ErrorCode done(sysrepo::Session sess, const CfgServersMapPair& service_pair);
 
     /// @brief Log changes.
     ///
index da7b97cd29a4720cc5a9c76942a37457cf642bad..14c5b082dca5a0344007df6749bb0f87a72d2a28 100644 (file)
@@ -135,11 +135,9 @@ NetconfCfgMgr::parse(isc::data::ConstElementPtr config_set,
     }
 
     if (check_only) {
-        answer = createAnswer(CONTROL_RESULT_SUCCESS,
-                              "Configuration check successful");
+        answer = createAnswer(CONTROL_RESULT_SUCCESS, "Configuration check successful");
     } else {
-        answer = createAnswer(CONTROL_RESULT_SUCCESS,
-                              "Configuration applied successfully.");
+        answer = createAnswer(CONTROL_RESULT_SUCCESS, "Configuration applied successfully.");
     }
 
     return (answer);
index d8c8b889c5affe23facaea6fbf378f0c4283fdf9..fd07bcac828425107a228719be7cf952a7e977fd 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -30,7 +30,6 @@ using NetconfConfigPtr = boost::shared_ptr<NetconfConfig>;
 /// It is derived from the context base class, ConfigBase.
 class NetconfConfig : public process::ConfigBase {
 public:
-
     /// @brief Default constructor
     NetconfConfig();
 
@@ -93,7 +92,6 @@ public:
     isc::data::ElementPtr toElement() const override final;
 
 private:
-
     /// @brief Private copy constructor
     ///
     /// It is private to forbid anyone outside of this class to make copies.
index eac9ce5cb0711cbced9db2e579600305e6d64e3f..d03b8129b38e933ca9520729f51796a970126751 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -7,9 +7,9 @@
 #include <config.h>
 
 #include <asiolink/io_error.h>
+#include <exceptions/exceptions.h>
 #include <netconf/netconf_cfg_mgr.h>
 #include <netconf/netconf_log.h>
-#include <exceptions/exceptions.h>
 
 #include <sstream>
 #include <string>
@@ -89,7 +89,7 @@ CfgServer::toText() const {
             s << "UNIX:'" << control_socket_->getName() << "'";
             break;
         case CfgControlSocket::Type::HTTP:
-          s << "HTTP:'" << control_socket_->getUrl().toText() << "'";
+            s << "HTTP:'" << control_socket_->getUrl().toText() << "'";
             break;
         case CfgControlSocket::Type::STDOUT:
             s << "STDOUT";
index b4f6339c8848c3eebaf5939148820c7bd7bd8cbe..d80dce2cc0746d4aa9968a49b1701ef5c0a3de56 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -14,8 +14,7 @@
 #include <exceptions/exceptions.h>
 #include <http/url.h>
 
-#include <stdint.h>
-
+#include <cstdint>
 #include <string>
 #include <unordered_map>
 
index ca1f72510b671983a648e269a66d233beed51982..0d5224de5750b038d35bab8cdec1740b3eea4020 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -20,7 +20,6 @@ namespace netconf {
 /// NetconfProcess.
 class NetconfController : public process::DControllerBase {
 public:
-
     /// @brief Static singleton instance method.
     ///
     /// This method returns the base class singleton instance member.
@@ -59,7 +58,6 @@ public:
     void processSignal(int signum) override final;
 
 private:
-
     /// @brief Creates an instance of the Netconf application process.
     ///
     /// This method is invoked during the process initialization step of
index 97079ea2e4d9d7dfbb8372d59e95262a89e6bb2a..01e5db25f5726a30bd254ee29c060772f0c35411 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -16,8 +16,7 @@ namespace netconf {
 
 extern const int NETCONF_DBG_TRACE = isc::log::DBGLVL_TRACE_BASIC;
 extern const int NETCONF_DBG_RESULTS = isc::log::DBGLVL_TRACE_BASIC_DATA;
-extern const int NETCONF_DBG_TRACE_DETAIL_DATA =
-    isc::log::DBGLVL_TRACE_DETAIL_DATA;
+extern const int NETCONF_DBG_TRACE_DETAIL_DATA = isc::log::DBGLVL_TRACE_DETAIL_DATA;
 
 const char* NETCONF_LOGGER_NAME = "netconf";
 
index c78f16e188aba0c4fc8dcb3830275dc8c0edb950..89a3f8e2a4a8579326e9c6fbb0447290487ae5b9 100644 (file)
@@ -57,8 +57,7 @@ NetconfProcess::run() {
         } catch (...) {
             // Ignore double errors
         }
-        isc_throw(DProcessBaseError,
-                  "Process run method failed: " << ex.what());
+        isc_throw(DProcessBaseError, "Process run method failed: " << ex.what());
     }
 
     LOG_DEBUG(netconf_logger, isc::log::DBGLVL_START_SHUT, NETCONF_RUN_EXIT);
@@ -95,8 +94,7 @@ NetconfProcess::configure(isc::data::ConstElementPtr config_set,
         IOServiceMgr::instance().pollIOServices();
     } catch (const std::exception& ex) {
         std::ostringstream err;
-        err << "Error initializing hooks: "
-            << ex.what();
+        err << "Error initializing hooks: " << ex.what();
         return (isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str()));
     }
 
index 0c8b6ce7029973e73b1803bd9f0a9f728937dcc3..dbf491a7739177859a8ee83ea4548884f8abf4a9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -79,14 +79,12 @@ public:
     /// of an integer status value (0 means successful, non-zero means failure),
     /// and a string explanation of the outcome.
     isc::data::ConstElementPtr
-    configure(isc::data::ConstElementPtr config_set,
-              bool check_only = false) override final;
+    configure(isc::data::ConstElementPtr config_set, bool check_only = false) override final;
 
     /// @brief Returns a pointer to the configuration manager.
     NetconfCfgMgrPtr getNetconfCfgMgr();
 
 private:
-
     /// @brief Polls all ready handlers and then runs one handler if none
     /// handlers have been executed as a result of polling.
     ///
index 43cb515c4a819572d779e7d00fc49a2000d8f6d6..f91833a7fd5ed5bf32cf09e2680a4c84d0c45b39 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -14,7 +14,7 @@ namespace netconf {
 
 class ParserContext;
 
-}  // namespace dhcp
+}  // namespace netconf
 }  // namespace isc
 
 #endif
index cd03cbea163f38d523dd61cb4d12ab8c05bb4909..ab43bce5fed1bf636d5f733b81b677f2f9bb8e25 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -11,6 +11,7 @@
 #define STDOUT_CONTROL_SOCKET_H
 
 #include <netconf/control_socket.h>
+
 #include <iostream>
 
 namespace isc {
index 5f211cf8e5ffcb601485a07054c769ad0facf8ae..d66dce3f8a245e048b84444d61a654c939e7e11d 100644 (file)
@@ -6,8 +6,6 @@
 
 #include <config.h>
 
-#include <gtest/gtest.h>
-
 #include <asiolink/asio_wrapper.h>
 #include <asiolink/interval_timer.h>
 #include <asiolink/io_service.h>
@@ -29,6 +27,8 @@
 #include <sstream>
 #include <thread>
 
+#include <gtest/gtest.h>
+
 using namespace std;
 using namespace isc;
 using namespace isc::netconf;
index 2eaa7b1d654c80606dff17281e66a79743ab45d1..98dc57a524324b259ecdc0007f527296efd47835 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -6,8 +6,6 @@
 
 #include <config.h>
 
-#include <gtest/gtest.h>
-
 #include <cc/command_interpreter.h>
 #include <cc/data.h>
 #include <netconf/netconf_cfg_mgr.h>
@@ -20,6 +18,8 @@
 #include <iostream>
 #include <string>
 
+#include <gtest/gtest.h>
+
 #include "test_data_files_config.h"
 #include "test_libraries.h"
 
index 2ca62dfbf4db21a00238c29ad7b4a4152995946e..20fdd9fb2a6e94f5cf8857d0084a4db3a43eabe1 100644 (file)
@@ -6,8 +6,6 @@
 
 #include <config.h>
 
-#include <gtest/gtest.h>
-
 #include <cc/command_interpreter.h>
 #include <exceptions/exceptions.h>
 #include <netconf/netconf_cfg_mgr.h>
@@ -19,6 +17,8 @@
 #include <testutils/test_to_element.h>
 #include <yang/yang_models.h>
 
+#include <gtest/gtest.h>
+
 using namespace std;
 using namespace isc;
 using namespace isc::netconf;
@@ -29,7 +29,7 @@ using namespace isc::http;
 using namespace isc::process;
 using namespace isc::yang;
 
-namespace  {
+namespace {
 
 /// @brief Almost regular netconf CfgMgr with internal parse method exposed.
 class NakedNetconfCfgMgr : public NetconfCfgMgr {
@@ -64,7 +64,6 @@ TEST(NetconfCfgMgr, getContext) {
 
 // Tests if context can store and retrieve managed server information.
 TEST(NetconfCfgMgr, contextServer) {
-
     NetconfConfig ctx;
 
     // Check managed server parameters.
@@ -377,7 +376,6 @@ TEST(NetconfParser, badSocketType) {
 /// @brief Class used for testing CfgMgr
 class NetconfParserTest : public isc::process::ConfigParseTest {
 public:
-
     /// @brief Tries to load input text as a configuration
     ///
     /// @param config text containing input configuration
index 774ee30506445f981a2478957403a79047614be6..457dc8b6bad43986561a6a5b137c79bfc97aed6d 100644 (file)
@@ -6,8 +6,6 @@
 
 #include <config.h>
 
-#include <gtest/gtest.h>
-
 #include <asiolink/testutils/timed_signal.h>
 #include <cc/data.h>
 #include <netconf/netconf_controller.h>
@@ -15,6 +13,8 @@
 #include <process/testutils/d_test_stubs.h>
 #include <testutils/gtest_utils.h>
 
+#include <gtest/gtest.h>
+
 using namespace isc::asiolink::test;
 using namespace isc::netconf;
 using namespace isc::data;
@@ -186,4 +186,4 @@ TEST_F(NetconfControllerTest, sigtermShutdown) {
     EXPECT_TRUE(elapsed_time.total_milliseconds() < 300);
 }
 
-}
+}  // namespace
index 7746806e8f31ac20e96a6d7b845d67d684cf6e6e..b6d8e391ba546f4afe2b3753f80ea6b59671639f 100644 (file)
@@ -6,8 +6,6 @@
 
 #include <config.h>
 
-#include <gtest/gtest.h>
-
 #include <asiolink/interval_timer.h>
 #include <asiolink/io_service.h>
 #include <netconf/netconf_cfg_mgr.h>
@@ -17,6 +15,8 @@
 
 #include <functional>
 
+#include <gtest/gtest.h>
+
 using namespace isc;
 using namespace isc::netconf;
 using namespace isc::asiolink;
@@ -84,4 +84,4 @@ TEST_F(NetconfProcessTest, shutdown) {
     getIOService()->stopAndPoll();
 }
 
-}
+}  // namespace
index 448453cd6362c82bedf7811899b8ba69ad2f9351..23da4c91b7e816ea24c0f833bdc3f248d3ac4664 100644 (file)
@@ -6,8 +6,6 @@
 
 #include <config.h>
 
-#include <gtest/gtest.h>
-
 #include <asiolink/asio_wrapper.h>
 #include <asiolink/interval_timer.h>
 #include <asiolink/io_service.h>
 #include <yang/yang_models.h>
 #include <yang/yang_revisions.h>
 
-#include <sysrepo-cpp/utils/exception.hpp>
-
 #include <chrono>
 #include <iostream>
 #include <sstream>
 #include <thread>
 #include <vector>
 
+#include <gtest/gtest.h>
+
+#include <sysrepo-cpp/utils/exception.hpp>
+
 using namespace std;
 using namespace isc;
 using namespace isc::netconf;
@@ -61,16 +61,16 @@ using ThreadPtr = shared_ptr<thread>;
 class NakedNetconfAgent : public NetconfAgent {
 public:
     /// Export protected methods and fields.
-    using NetconfAgent::keaConfig;
-    using NetconfAgent::initSysrepo;
     using NetconfAgent::checkModule;
     using NetconfAgent::checkModules;
-    using NetconfAgent::yangConfig;
-    using NetconfAgent::subscribeToDataChanges;
-    using NetconfAgent::startup_sess_;
-    using NetconfAgent::running_sess_;
+    using NetconfAgent::initSysrepo;
+    using NetconfAgent::keaConfig;
     using NetconfAgent::modules_;
+    using NetconfAgent::running_sess_;
+    using NetconfAgent::startup_sess_;
+    using NetconfAgent::subscribeToDataChanges;
     using NetconfAgent::subscriptions_;
+    using NetconfAgent::yangConfig;
 };  // NakedNetconfAgent
 
 /// @brief Type definition for the pointer to NakedNetconfAgent objects.
index 77fbcad1131c2ecd8ed269b78671a7f7ea9ac2dc..6f8b90cf6f9814c8a743435935e80504b0d36879 100644 (file)
@@ -6,8 +6,6 @@
 
 #include <config.h>
 
-#include <gtest/gtest.h>
-
 #include <cc/data.h>
 #include <cc/dhcp_config_error.h>
 #include <netconf/parser_context.h>
 #include <testutils/test_to_element.h>
 #include <testutils/user_context_utils.h>
 
-#include <iostream>
 #include <fstream>
+#include <iostream>
 #include <vector>
 
 #include <boost/algorithm/string.hpp>
 
+#include <gtest/gtest.h>
+
 using namespace isc::data;
 using namespace isc::test;
 using namespace std;
index 15391d2f7ddc07d27dd9d0273b7f02b0fee033f4..5ec7e6a50f57f3dc26a176bf6739d619eb236248 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -6,11 +6,11 @@
 
 #include <config.h>
 
-#include <gtest/gtest.h>
-
 #include <log/logger_support.h>
 #include <util/unittests/run_all.h>
 
+#include <gtest/gtest.h>
+
 int
 main(int argc, char* argv[]) {
     ::testing::InitGoogleTest(&argc, argv);