Skip to content

Commit 4a1c295

Browse files
committed
[#3435] some formatting in netconf
1 parent 2b55f11 commit 4a1c295

22 files changed

+67
-83
lines changed

src/bin/netconf/control_socket.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -19,8 +19,9 @@ namespace netconf {
1919
/// @brief Exception thrown when the error during communication.
2020
class ControlSocketError : public isc::Exception {
2121
public:
22-
ControlSocketError(const char* file, size_t line, const char* what) :
23-
isc::Exception(file, line, what) { }
22+
ControlSocketError(const char* file, size_t line, const char* what)
23+
: isc::Exception(file, line, what) {
24+
}
2425
}; // ControlSocketError
2526

2627
/// @brief Base class for control socket communication.
@@ -38,7 +39,7 @@ class ControlSocketBase {
3839
ControlSocketBase(CfgControlSocketPtr ctrl_sock) : socket_cfg_(ctrl_sock) {
3940
if (!ctrl_sock) {
4041
isc_throw(ControlSocketError, "ControlSocket constructor called "
41-
"with a null configuration");
42+
"with a null configuration");
4243
}
4344
}
4445

src/bin/netconf/http_control_socket.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,3 @@ HttpControlSocket::sendCommand(ConstElementPtr command) {
130130

131131
} // namespace netconf
132132
} // namespace isc
133-

src/bin/netconf/netconf.cc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class NetconfAgentCallback {
142142
}
143143
}; // NetconfAgentCallback
144144

145-
} //anonymous namespace
145+
} // anonymous namespace
146146

147147
namespace isc {
148148
namespace netconf {
@@ -254,15 +254,15 @@ NetconfAgent::initSysrepo() {
254254
startup_sess_ = Connection{}.sessionStart();
255255
startup_sess_->switchDatastore(Datastore::Startup);
256256
} catch (exception const& ex) {
257-
isc_throw(Unexpected, "Can't establish a sysrepo session: "
258-
<< ex.what());
257+
isc_throw(Unexpected, "Can't establish a sysrepo session: " << ex.what());
259258
}
260259

261260
// Retrieve names and revisions of installed modules from sysrepo.
262261
getModules();
263262
}
264263

265-
void NetconfAgent::getModules() {
264+
void
265+
NetconfAgent::getModules() {
266266
vector<Module> modules;
267267
try {
268268
Context context(running_sess_->getContext());
@@ -274,8 +274,7 @@ void NetconfAgent::getModules() {
274274
for (Module const& module : modules) {
275275
string const name(module.name());
276276
if (!module.revision()) {
277-
isc_throw(Unexpected,
278-
"could not retrieve module revision for module " << name);
277+
isc_throw(Unexpected, "could not retrieve module revision for module " << name);
279278
}
280279
string const revision(*module.revision());
281280
modules_.emplace(name, revision);
@@ -464,8 +463,7 @@ NetconfAgent::subscribeToDataChanges(const CfgServersMapPair& service_pair) {
464463
} catch (exception const& ex) {
465464
ostringstream msg;
466465
msg << "module change subscribe failed with " << ex.what();
467-
msg << "change subscription for model " << model <<
468-
" failed with: " << ex.what();
466+
msg << "change subscription for model " << model << " failed with: " << ex.what();
469467
LOG_ERROR(netconf_logger, NETCONF_SUBSCRIBE_CONFIG_FAILED)
470468
.arg(server)
471469
.arg(configuration->getModel())
@@ -754,7 +752,8 @@ NetconfAgent::announceShutdown() const {
754752
}
755753
}
756754

757-
bool NetconfAgent::shouldShutdown() const {
755+
bool
756+
NetconfAgent::shouldShutdown() const {
758757
return boost::dynamic_pointer_cast<NetconfController>(NetconfController::instance())
759758
->getNetconfProcess()
760759
->shouldShutdown();

src/bin/netconf/netconf.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -15,10 +15,10 @@
1515
#include <netconf/stdout_control_socket.h>
1616
#include <netconf/unix_control_socket.h>
1717

18-
#include <sysrepo-cpp/Session.hpp>
19-
2018
#include <map>
2119

20+
#include <sysrepo-cpp/Session.hpp>
21+
2222
namespace isc {
2323
namespace netconf {
2424

@@ -69,8 +69,7 @@ class NetconfAgent {
6969
/// @param sess The sysrepo running datastore session.
7070
/// @param service_pair The service name and configuration pair.
7171
/// @return return code for sysrepo.
72-
static sysrepo::ErrorCode
73-
change(sysrepo::Session sess, const CfgServersMapPair& service_pair);
72+
static sysrepo::ErrorCode change(sysrepo::Session sess, const CfgServersMapPair& service_pair);
7473

7574
/// @brief Event::Done callback.
7675
///
@@ -80,8 +79,7 @@ class NetconfAgent {
8079
/// @param sess The sysrepo running datastore session.
8180
/// @param service_pair The service name and configuration pair.
8281
/// @return return code for sysrepo.
83-
static sysrepo::ErrorCode
84-
done(sysrepo::Session sess, const CfgServersMapPair& service_pair);
82+
static sysrepo::ErrorCode done(sysrepo::Session sess, const CfgServersMapPair& service_pair);
8583

8684
/// @brief Log changes.
8785
///

src/bin/netconf/netconf_cfg_mgr.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,9 @@ NetconfCfgMgr::parse(isc::data::ConstElementPtr config_set,
135135
}
136136

137137
if (check_only) {
138-
answer = createAnswer(CONTROL_RESULT_SUCCESS,
139-
"Configuration check successful");
138+
answer = createAnswer(CONTROL_RESULT_SUCCESS, "Configuration check successful");
140139
} else {
141-
answer = createAnswer(CONTROL_RESULT_SUCCESS,
142-
"Configuration applied successfully.");
140+
answer = createAnswer(CONTROL_RESULT_SUCCESS, "Configuration applied successfully.");
143141
}
144142

145143
return (answer);

src/bin/netconf/netconf_cfg_mgr.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// 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>;
3030
/// It is derived from the context base class, ConfigBase.
3131
class NetconfConfig : public process::ConfigBase {
3232
public:
33-
3433
/// @brief Default constructor
3534
NetconfConfig();
3635

@@ -93,7 +92,6 @@ class NetconfConfig : public process::ConfigBase {
9392
isc::data::ElementPtr toElement() const override final;
9493

9594
private:
96-
9795
/// @brief Private copy constructor
9896
///
9997
/// It is private to forbid anyone outside of this class to make copies.

src/bin/netconf/netconf_config.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -7,9 +7,9 @@
77
#include <config.h>
88

99
#include <asiolink/io_error.h>
10+
#include <exceptions/exceptions.h>
1011
#include <netconf/netconf_cfg_mgr.h>
1112
#include <netconf/netconf_log.h>
12-
#include <exceptions/exceptions.h>
1313

1414
#include <sstream>
1515
#include <string>
@@ -89,7 +89,7 @@ CfgServer::toText() const {
8989
s << "UNIX:'" << control_socket_->getName() << "'";
9090
break;
9191
case CfgControlSocket::Type::HTTP:
92-
s << "HTTP:'" << control_socket_->getUrl().toText() << "'";
92+
s << "HTTP:'" << control_socket_->getUrl().toText() << "'";
9393
break;
9494
case CfgControlSocket::Type::STDOUT:
9595
s << "STDOUT";

src/bin/netconf/netconf_config.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -14,8 +14,7 @@
1414
#include <exceptions/exceptions.h>
1515
#include <http/url.h>
1616

17-
#include <stdint.h>
18-
17+
#include <cstdint>
1918
#include <string>
2019
#include <unordered_map>
2120

src/bin/netconf/netconf_controller.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -20,7 +20,6 @@ namespace netconf {
2020
/// NetconfProcess.
2121
class NetconfController : public process::DControllerBase {
2222
public:
23-
2423
/// @brief Static singleton instance method.
2524
///
2625
/// This method returns the base class singleton instance member.
@@ -59,7 +58,6 @@ class NetconfController : public process::DControllerBase {
5958
void processSignal(int signum) override final;
6059

6160
private:
62-
6361
/// @brief Creates an instance of the Netconf application process.
6462
///
6563
/// This method is invoked during the process initialization step of

src/bin/netconf/netconf_log.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -16,8 +16,7 @@ namespace netconf {
1616

1717
extern const int NETCONF_DBG_TRACE = isc::log::DBGLVL_TRACE_BASIC;
1818
extern const int NETCONF_DBG_RESULTS = isc::log::DBGLVL_TRACE_BASIC_DATA;
19-
extern const int NETCONF_DBG_TRACE_DETAIL_DATA =
20-
isc::log::DBGLVL_TRACE_DETAIL_DATA;
19+
extern const int NETCONF_DBG_TRACE_DETAIL_DATA = isc::log::DBGLVL_TRACE_DETAIL_DATA;
2120

2221
const char* NETCONF_LOGGER_NAME = "netconf";
2322

0 commit comments

Comments
 (0)