mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-01 06:25:34 +00:00
[#2601] remove std:: prefix from .cc files
This commit is contained in:
committed by
Razvan Becheriu
parent
6437f37711
commit
d6f69df968
@@ -73,7 +73,7 @@ HttpControlSocket::sendCommand(ConstElementPtr command) {
|
|||||||
request->setBodyAsJson(command);
|
request->setBodyAsJson(command);
|
||||||
try {
|
try {
|
||||||
request->finalize();
|
request->finalize();
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
isc_throw(ControlSocketError, "failed to create request: "
|
isc_throw(ControlSocketError, "failed to create request: "
|
||||||
<< ex.what());
|
<< ex.what());
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ HttpControlSocket::sendCommand(ConstElementPtr command) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return (response->getBodyAsJson());
|
return (response->getBodyAsJson());
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
isc_throw(ControlSocketError, "unparsable response: " << ex.what());
|
isc_throw(ControlSocketError, "unparsable response: " << ex.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
using namespace isc::netconf;
|
using namespace isc::netconf;
|
||||||
using namespace isc::process;
|
using namespace isc::process;
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
int ret = EXIT_SUCCESS;
|
int ret = EXIT_SUCCESS;
|
||||||
|
|
||||||
@@ -27,21 +29,21 @@ int main(int argc, char* argv[]) {
|
|||||||
// 'false' value disables test mode.
|
// 'false' value disables test mode.
|
||||||
controller->launch(argc, argv, false);
|
controller->launch(argc, argv, false);
|
||||||
} catch (const VersionMessage& ex) {
|
} catch (const VersionMessage& ex) {
|
||||||
std::string msg(ex.what());
|
string msg(ex.what());
|
||||||
if (!msg.empty()) {
|
if (!msg.empty()) {
|
||||||
std::cout << msg << std::endl;
|
cout << msg << endl;
|
||||||
}
|
}
|
||||||
} catch (const InvalidUsage& ex) {
|
} catch (const InvalidUsage& ex) {
|
||||||
std::string msg(ex.what());
|
string msg(ex.what());
|
||||||
if (!msg.empty()) {
|
if (!msg.empty()) {
|
||||||
std::cerr << msg << std::endl;
|
cerr << msg << endl;
|
||||||
}
|
}
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
std::cerr << "Service failed: " << ex.what() << std::endl;
|
cerr << "Service failed: " << ex.what() << endl;
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
std::cerr << "Service failed" << std::endl;
|
cerr << "Service failed" << endl;
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -197,7 +197,7 @@ NetconfAgent::keaConfig(const CfgServersMapPair& service_pair) {
|
|||||||
ControlSocketBasePtr comm;
|
ControlSocketBasePtr comm;
|
||||||
try {
|
try {
|
||||||
comm = controlSocketFactory(ctrl_sock);
|
comm = controlSocketFactory(ctrl_sock);
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
msg << "createControlSocket failed with " << ex.what();
|
msg << "createControlSocket failed with " << ex.what();
|
||||||
LOG_ERROR(netconf_logger, NETCONF_GET_CONFIG_FAILED)
|
LOG_ERROR(netconf_logger, NETCONF_GET_CONFIG_FAILED)
|
||||||
@@ -213,7 +213,7 @@ NetconfAgent::keaConfig(const CfgServersMapPair& service_pair) {
|
|||||||
try {
|
try {
|
||||||
answer = comm->configGet(server);
|
answer = comm->configGet(server);
|
||||||
config = parseAnswer(rcode, answer);
|
config = parseAnswer(rcode, answer);
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
msg << "config-get command failed with " << ex.what();
|
msg << "config-get command failed with " << ex.what();
|
||||||
LOG_ERROR(netconf_logger, NETCONF_GET_CONFIG_FAILED)
|
LOG_ERROR(netconf_logger, NETCONF_GET_CONFIG_FAILED)
|
||||||
@@ -248,7 +248,7 @@ NetconfAgent::initSysrepo() {
|
|||||||
running_sess_->switchDatastore(Datastore::Running);
|
running_sess_->switchDatastore(Datastore::Running);
|
||||||
startup_sess_ = Connection{}.sessionStart();
|
startup_sess_ = Connection{}.sessionStart();
|
||||||
startup_sess_->switchDatastore(Datastore::Startup);
|
startup_sess_->switchDatastore(Datastore::Startup);
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
isc_throw(Unexpected, "Can't establish a sysrepo session: "
|
isc_throw(Unexpected, "Can't establish a sysrepo session: "
|
||||||
<< ex.what());
|
<< ex.what());
|
||||||
}
|
}
|
||||||
@@ -374,7 +374,7 @@ NetconfAgent::yangConfig(const CfgServersMapPair& service_pair) {
|
|||||||
.arg(server)
|
.arg(server)
|
||||||
.arg(prettyPrint(config));
|
.arg(prettyPrint(config));
|
||||||
}
|
}
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
msg << "get YANG configuration for " << server
|
msg << "get YANG configuration for " << server
|
||||||
<< " failed with " << ex.what();
|
<< " failed with " << ex.what();
|
||||||
@@ -386,7 +386,7 @@ NetconfAgent::yangConfig(const CfgServersMapPair& service_pair) {
|
|||||||
ControlSocketBasePtr comm;
|
ControlSocketBasePtr comm;
|
||||||
try {
|
try {
|
||||||
comm = controlSocketFactory(ctrl_sock);
|
comm = controlSocketFactory(ctrl_sock);
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
msg << "control socket creation failed with " << ex.what();
|
msg << "control socket creation failed with " << ex.what();
|
||||||
LOG_ERROR(netconf_logger, NETCONF_SET_CONFIG_FAILED)
|
LOG_ERROR(netconf_logger, NETCONF_SET_CONFIG_FAILED)
|
||||||
@@ -399,7 +399,7 @@ NetconfAgent::yangConfig(const CfgServersMapPair& service_pair) {
|
|||||||
try {
|
try {
|
||||||
answer = comm->configSet(config, server);
|
answer = comm->configSet(config, server);
|
||||||
parseAnswer(rcode, answer);
|
parseAnswer(rcode, answer);
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
msg << "config-set command failed with " << ex.what();
|
msg << "config-set command failed with " << ex.what();
|
||||||
LOG_ERROR(netconf_logger, NETCONF_SET_CONFIG_FAILED)
|
LOG_ERROR(netconf_logger, NETCONF_SET_CONFIG_FAILED)
|
||||||
@@ -448,9 +448,9 @@ NetconfAgent::subscribeToDataChanges(const CfgServersMapPair& service_pair) {
|
|||||||
options = options | SubscribeOptions::DoneOnly;
|
options = options | SubscribeOptions::DoneOnly;
|
||||||
}
|
}
|
||||||
Subscription subscription(
|
Subscription subscription(
|
||||||
running_sess_->onModuleChange(model, callback, std::nullopt, 0, options));
|
running_sess_->onModuleChange(model, callback, nullopt, 0, options));
|
||||||
subscriptions_.emplace(server, forward<Subscription>(subscription));
|
subscriptions_.emplace(server, forward<Subscription>(subscription));
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
msg << "module change subscribe failed with " << ex.what();
|
msg << "module change subscribe failed with " << ex.what();
|
||||||
msg << "change subscription for model " << model <<
|
msg << "change subscription for model " << model <<
|
||||||
@@ -490,7 +490,7 @@ NetconfAgent::subscribeToNotifications(const CfgServersMapPair& service_pair) {
|
|||||||
try {
|
try {
|
||||||
Subscription subscription(running_sess_->onNotification(model, callback));
|
Subscription subscription(running_sess_->onNotification(model, callback));
|
||||||
subscriptions_.emplace(server, forward<Subscription>(subscription));
|
subscriptions_.emplace(server, forward<Subscription>(subscription));
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
msg << "event notification subscription for model " << model <<
|
msg << "event notification subscription for model " << model <<
|
||||||
" failed with: " << ex.what();
|
" failed with: " << ex.what();
|
||||||
@@ -540,7 +540,7 @@ NetconfAgent::change(Session sess, const CfgServersMapPair& service_pair) {
|
|||||||
.arg(server)
|
.arg(server)
|
||||||
.arg(prettyPrint(config));
|
.arg(prettyPrint(config));
|
||||||
}
|
}
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
msg << "get YANG configuration for " << server
|
msg << "get YANG configuration for " << server
|
||||||
<< " failed with " << ex.what();
|
<< " failed with " << ex.what();
|
||||||
@@ -552,7 +552,7 @@ NetconfAgent::change(Session sess, const CfgServersMapPair& service_pair) {
|
|||||||
ControlSocketBasePtr comm;
|
ControlSocketBasePtr comm;
|
||||||
try {
|
try {
|
||||||
comm = controlSocketFactory(ctrl_sock);
|
comm = controlSocketFactory(ctrl_sock);
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
msg << "createControlSocket failed with " << ex.what();
|
msg << "createControlSocket failed with " << ex.what();
|
||||||
LOG_ERROR(netconf_logger, NETCONF_VALIDATE_CONFIG_FAILED)
|
LOG_ERROR(netconf_logger, NETCONF_VALIDATE_CONFIG_FAILED)
|
||||||
@@ -565,7 +565,7 @@ NetconfAgent::change(Session sess, const CfgServersMapPair& service_pair) {
|
|||||||
try {
|
try {
|
||||||
answer = comm->configTest(config, server);
|
answer = comm->configTest(config, server);
|
||||||
parseAnswer(rcode, answer);
|
parseAnswer(rcode, answer);
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
stringstream msg;
|
stringstream msg;
|
||||||
msg << "configTest failed with " << ex.what();
|
msg << "configTest failed with " << ex.what();
|
||||||
LOG_ERROR(netconf_logger, NETCONF_VALIDATE_CONFIG_FAILED)
|
LOG_ERROR(netconf_logger, NETCONF_VALIDATE_CONFIG_FAILED)
|
||||||
@@ -626,7 +626,7 @@ NetconfAgent::done(Session sess, const CfgServersMapPair& service_pair) {
|
|||||||
.arg(server)
|
.arg(server)
|
||||||
.arg(prettyPrint(config));
|
.arg(prettyPrint(config));
|
||||||
}
|
}
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
msg << "get YANG configuration for " << server
|
msg << "get YANG configuration for " << server
|
||||||
<< " failed with " << ex.what();
|
<< " failed with " << ex.what();
|
||||||
@@ -641,7 +641,7 @@ NetconfAgent::done(Session sess, const CfgServersMapPair& service_pair) {
|
|||||||
ControlSocketBasePtr comm;
|
ControlSocketBasePtr comm;
|
||||||
try {
|
try {
|
||||||
comm = controlSocketFactory(ctrl_sock);
|
comm = controlSocketFactory(ctrl_sock);
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
msg << "createControlSocket failed with " << ex.what();
|
msg << "createControlSocket failed with " << ex.what();
|
||||||
LOG_ERROR(netconf_logger, NETCONF_UPDATE_CONFIG_FAILED)
|
LOG_ERROR(netconf_logger, NETCONF_UPDATE_CONFIG_FAILED)
|
||||||
@@ -656,7 +656,7 @@ NetconfAgent::done(Session sess, const CfgServersMapPair& service_pair) {
|
|||||||
try {
|
try {
|
||||||
answer = comm->configSet(config, server);
|
answer = comm->configSet(config, server);
|
||||||
parseAnswer(rcode, answer);
|
parseAnswer(rcode, answer);
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
stringstream msg;
|
stringstream msg;
|
||||||
msg << "configSet failed with " << ex.what();
|
msg << "configSet failed with " << ex.what();
|
||||||
LOG_ERROR(netconf_logger, NETCONF_UPDATE_CONFIG_FAILED)
|
LOG_ERROR(netconf_logger, NETCONF_UPDATE_CONFIG_FAILED)
|
||||||
@@ -683,7 +683,7 @@ void
|
|||||||
NetconfAgent::logChanges(Session sess, string_view const& model) {
|
NetconfAgent::logChanges(Session sess, string_view const& model) {
|
||||||
ostringstream stream;
|
ostringstream stream;
|
||||||
stream << "/" << model << ":*//.";
|
stream << "/" << model << ":*//.";
|
||||||
std::string const xpath(stream.str());
|
string const xpath(stream.str());
|
||||||
ChangeCollection const changes(sess.getChanges(xpath));
|
ChangeCollection const changes(sess.getChanges(xpath));
|
||||||
for (Change const& change : changes) {
|
for (Change const& change : changes) {
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
|
@@ -21,6 +21,8 @@ using namespace isc::dhcp;
|
|||||||
using namespace isc::process;
|
using namespace isc::process;
|
||||||
using namespace isc::data;
|
using namespace isc::data;
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
namespace isc {
|
namespace isc {
|
||||||
namespace netconf {
|
namespace netconf {
|
||||||
|
|
||||||
@@ -41,7 +43,7 @@ NetconfConfig::extractConfiguredGlobals(ConstElementPtr config) {
|
|||||||
"extractConfiguredGlobals must be given a map element");
|
"extractConfiguredGlobals must be given a map element");
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::map<std::string, ConstElementPtr>& values = config->mapValue();
|
const map<string, ConstElementPtr>& values = config->mapValue();
|
||||||
for (auto value = values.begin(); value != values.end(); ++value) {
|
for (auto value = values.begin(); value != values.end(); ++value) {
|
||||||
if (value->second->getType() != Element::list &&
|
if (value->second->getType() != Element::list &&
|
||||||
value->second->getType() != Element::map) {
|
value->second->getType() != Element::map) {
|
||||||
@@ -54,13 +56,13 @@ NetconfCfgMgr::NetconfCfgMgr()
|
|||||||
: DCfgMgrBase(ConfigPtr(new NetconfConfig())) {
|
: DCfgMgrBase(ConfigPtr(new NetconfConfig())) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
string
|
||||||
NetconfCfgMgr::getConfigSummary(const uint32_t /*selection*/) {
|
NetconfCfgMgr::getConfigSummary(const uint32_t /*selection*/) {
|
||||||
|
|
||||||
NetconfConfigPtr ctx = getNetconfConfig();
|
NetconfConfigPtr ctx = getNetconfConfig();
|
||||||
|
|
||||||
// No globals to print.
|
// No globals to print.
|
||||||
std::ostringstream s;
|
ostringstream s;
|
||||||
|
|
||||||
// Then print managed servers.
|
// Then print managed servers.
|
||||||
for (auto serv : *ctx->getCfgServersMap()) {
|
for (auto serv : *ctx->getCfgServersMap()) {
|
||||||
@@ -109,7 +111,7 @@ NetconfCfgMgr::parse(isc::data::ConstElementPtr config_set,
|
|||||||
|
|
||||||
// And parse the configuration.
|
// And parse the configuration.
|
||||||
ConstElementPtr answer;
|
ConstElementPtr answer;
|
||||||
std::string excuse;
|
string excuse;
|
||||||
try {
|
try {
|
||||||
// Do the actual parsing
|
// Do the actual parsing
|
||||||
NetconfSimpleParser parser;
|
NetconfSimpleParser parser;
|
||||||
@@ -165,9 +167,9 @@ NetconfConfig::toElement() const {
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::list<std::string>>
|
list<list<string>>
|
||||||
NetconfCfgMgr::jsonPathsToRedact() const {
|
NetconfCfgMgr::jsonPathsToRedact() const {
|
||||||
static std::list<std::list<std::string>> const list({
|
static list<list<string>> const list({
|
||||||
{"hooks-libraries", "[]", "parameters", "*"},
|
{"hooks-libraries", "[]", "parameters", "*"},
|
||||||
});
|
});
|
||||||
return list;
|
return list;
|
||||||
|
@@ -141,7 +141,7 @@ ControlSocketConfigParser::parse(ConstElementPtr ctrl_sock_config) {
|
|||||||
CfgControlSocket::Type type;
|
CfgControlSocket::Type type;
|
||||||
try {
|
try {
|
||||||
type = CfgControlSocket::stringToType(type_str);
|
type = CfgControlSocket::stringToType(type_str);
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
isc_throw(ConfigError, ex.what() << " '" << type_str << "' ("
|
isc_throw(ConfigError, ex.what() << " '" << type_str << "' ("
|
||||||
<< getPosition("socket-type", ctrl_sock_config) << ")");
|
<< getPosition("socket-type", ctrl_sock_config) << ")");
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ ControlSocketConfigParser::parse(ConstElementPtr ctrl_sock_config) {
|
|||||||
// Create the control socket.
|
// Create the control socket.
|
||||||
try {
|
try {
|
||||||
result.reset(new CfgControlSocket(type, name, url));
|
result.reset(new CfgControlSocket(type, name, url));
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
isc_throw(ConfigError, ex.what() << " ("
|
isc_throw(ConfigError, ex.what() << " ("
|
||||||
<< ctrl_sock_config->getPosition() << ")");
|
<< ctrl_sock_config->getPosition() << ")");
|
||||||
}
|
}
|
||||||
@@ -185,7 +185,7 @@ ServerConfigParser::parse(ConstElementPtr server_config) {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
result.reset(new CfgServer(model, ctrl_sock));
|
result.reset(new CfgServer(model, ctrl_sock));
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
isc_throw(ConfigError, ex.what() << " ("
|
isc_throw(ConfigError, ex.what() << " ("
|
||||||
<< server_config->getPosition() << ")");
|
<< server_config->getPosition() << ")");
|
||||||
}
|
}
|
||||||
|
@@ -54,7 +54,7 @@ NetconfController::createProcess() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isc::data::ConstElementPtr
|
isc::data::ConstElementPtr
|
||||||
NetconfController::parseFile(const std::string& name) {
|
NetconfController::parseFile(string const& name) {
|
||||||
ParserContext parser;
|
ParserContext parser;
|
||||||
return (parser.parseFile(name, ParserContext::PARSER_NETCONF));
|
return (parser.parseFile(name, ParserContext::PARSER_NETCONF));
|
||||||
}
|
}
|
||||||
|
@@ -228,7 +228,7 @@ namespace isc { namespace netconf {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case symbol_kind::S_STRING: // "constant string"
|
case symbol_kind::S_STRING: // "constant string"
|
||||||
value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (that.value));
|
value.YY_MOVE_OR_COPY< string > (YY_MOVE (that.value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -265,7 +265,7 @@ namespace isc { namespace netconf {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case symbol_kind::S_STRING: // "constant string"
|
case symbol_kind::S_STRING: // "constant string"
|
||||||
value.move< std::string > (YY_MOVE (that.value));
|
value.move< string > (YY_MOVE (that.value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -302,7 +302,7 @@ namespace isc { namespace netconf {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case symbol_kind::S_STRING: // "constant string"
|
case symbol_kind::S_STRING: // "constant string"
|
||||||
value.copy< std::string > (that.value);
|
value.copy< string > (that.value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -338,7 +338,7 @@ namespace isc { namespace netconf {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case symbol_kind::S_STRING: // "constant string"
|
case symbol_kind::S_STRING: // "constant string"
|
||||||
value.move< std::string > (that.value);
|
value.move< string > (that.value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -379,7 +379,7 @@ namespace isc { namespace netconf {
|
|||||||
{
|
{
|
||||||
case symbol_kind::S_STRING: // "constant string"
|
case symbol_kind::S_STRING: // "constant string"
|
||||||
#line 110 "netconf_parser.yy"
|
#line 110 "netconf_parser.yy"
|
||||||
{ yyoutput << yysym.value.template as < std::string > (); }
|
{ yyoutput << yysym.value.template as < string > (); }
|
||||||
#line 384 "netconf_parser.cc"
|
#line 384 "netconf_parser.cc"
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -665,7 +665,7 @@ namespace isc { namespace netconf {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case symbol_kind::S_STRING: // "constant string"
|
case symbol_kind::S_STRING: // "constant string"
|
||||||
yylhs.value.emplace< std::string > ();
|
yylhs.value.emplace< string > ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -753,7 +753,7 @@ namespace isc { namespace netconf {
|
|||||||
|
|
||||||
case 14: // value: "constant string"
|
case 14: // value: "constant string"
|
||||||
#line 151 "netconf_parser.yy"
|
#line 151 "netconf_parser.yy"
|
||||||
{ yylhs.value.as < ElementPtr > () = ElementPtr(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location))); }
|
{ yylhs.value.as < ElementPtr > () = ElementPtr(new StringElement(yystack_[0].value.as < string > (), ctx.loc2pos(yystack_[0].location))); }
|
||||||
#line 758 "netconf_parser.cc"
|
#line 758 "netconf_parser.cc"
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -806,8 +806,8 @@ namespace isc { namespace netconf {
|
|||||||
#line 183 "netconf_parser.yy"
|
#line 183 "netconf_parser.yy"
|
||||||
{
|
{
|
||||||
// map containing a single entry
|
// map containing a single entry
|
||||||
ctx.unique(yystack_[2].value.as < std::string > (), ctx.loc2pos(yystack_[2].location));
|
ctx.unique(yystack_[2].value.as < string > (), ctx.loc2pos(yystack_[2].location));
|
||||||
ctx.stack_.back()->set(yystack_[2].value.as < std::string > (), yystack_[0].value.as < ElementPtr > ());
|
ctx.stack_.back()->set(yystack_[2].value.as < string > (), yystack_[0].value.as < ElementPtr > ());
|
||||||
}
|
}
|
||||||
#line 813 "netconf_parser.cc"
|
#line 813 "netconf_parser.cc"
|
||||||
break;
|
break;
|
||||||
@@ -817,8 +817,8 @@ namespace isc { namespace netconf {
|
|||||||
{
|
{
|
||||||
// map consisting of a shorter map followed by
|
// map consisting of a shorter map followed by
|
||||||
// comma and string:value
|
// comma and string:value
|
||||||
ctx.unique(yystack_[2].value.as < std::string > (), ctx.loc2pos(yystack_[2].location));
|
ctx.unique(yystack_[2].value.as < string > (), ctx.loc2pos(yystack_[2].location));
|
||||||
ctx.stack_.back()->set(yystack_[2].value.as < std::string > (), yystack_[0].value.as < ElementPtr > ());
|
ctx.stack_.back()->set(yystack_[2].value.as < string > (), yystack_[0].value.as < ElementPtr > ());
|
||||||
}
|
}
|
||||||
#line 824 "netconf_parser.cc"
|
#line 824 "netconf_parser.cc"
|
||||||
break;
|
break;
|
||||||
@@ -876,8 +876,8 @@ namespace isc { namespace netconf {
|
|||||||
case 33: // unknown_map_entry: "constant string" ":"
|
case 33: // unknown_map_entry: "constant string" ":"
|
||||||
#line 229 "netconf_parser.yy"
|
#line 229 "netconf_parser.yy"
|
||||||
{
|
{
|
||||||
const std::string& where = ctx.contextName();
|
const string& where = ctx.contextName();
|
||||||
const std::string& keyword = yystack_[1].value.as < std::string > ();
|
const string& keyword = yystack_[1].value.as < string > ();
|
||||||
error(yystack_[1].location,
|
error(yystack_[1].location,
|
||||||
"got unexpected keyword \"" + keyword + "\" in " + where + " map.");
|
"got unexpected keyword \"" + keyword + "\" in " + where + " map.");
|
||||||
}
|
}
|
||||||
@@ -999,7 +999,7 @@ namespace isc { namespace netconf {
|
|||||||
if (old) {
|
if (old) {
|
||||||
// Check if it was a comment or a duplicate
|
// Check if it was a comment or a duplicate
|
||||||
if ((old->size() != 1) || !old->contains("comment")) {
|
if ((old->size() != 1) || !old->contains("comment")) {
|
||||||
std::stringstream msg;
|
stringstream msg;
|
||||||
msg << "duplicate user-context entries (previous at "
|
msg << "duplicate user-context entries (previous at "
|
||||||
<< old->getPosition().str() << ")";
|
<< old->getPosition().str() << ")";
|
||||||
error(yystack_[3].location, msg.str());
|
error(yystack_[3].location, msg.str());
|
||||||
@@ -1028,7 +1028,7 @@ namespace isc { namespace netconf {
|
|||||||
{
|
{
|
||||||
ElementPtr parent = ctx.stack_.back();
|
ElementPtr parent = ctx.stack_.back();
|
||||||
ElementPtr user_context(new MapElement(ctx.loc2pos(yystack_[3].location)));
|
ElementPtr user_context(new MapElement(ctx.loc2pos(yystack_[3].location)));
|
||||||
ElementPtr comment(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
|
ElementPtr comment(new StringElement(yystack_[0].value.as < string > (), ctx.loc2pos(yystack_[0].location)));
|
||||||
user_context->set("comment", comment);
|
user_context->set("comment", comment);
|
||||||
|
|
||||||
// Handle already existing user context
|
// Handle already existing user context
|
||||||
@@ -1036,7 +1036,7 @@ namespace isc { namespace netconf {
|
|||||||
if (old) {
|
if (old) {
|
||||||
// Check for duplicate comment
|
// Check for duplicate comment
|
||||||
if (old->contains("comment")) {
|
if (old->contains("comment")) {
|
||||||
std::stringstream msg;
|
stringstream msg;
|
||||||
msg << "duplicate user-context/comment entries (previous at "
|
msg << "duplicate user-context/comment entries (previous at "
|
||||||
<< old->getPosition().str() << ")";
|
<< old->getPosition().str() << ")";
|
||||||
error(yystack_[3].location, msg.str());
|
error(yystack_[3].location, msg.str());
|
||||||
@@ -1119,7 +1119,7 @@ namespace isc { namespace netconf {
|
|||||||
case 77: // library: "library" $@13 ":" "constant string"
|
case 77: // library: "library" $@13 ":" "constant string"
|
||||||
#line 415 "netconf_parser.yy"
|
#line 415 "netconf_parser.yy"
|
||||||
{
|
{
|
||||||
ElementPtr lib(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
|
ElementPtr lib(new StringElement(yystack_[0].value.as < string > (), ctx.loc2pos(yystack_[0].location)));
|
||||||
ctx.stack_.back()->set("library", lib);
|
ctx.stack_.back()->set("library", lib);
|
||||||
ctx.leave();
|
ctx.leave();
|
||||||
}
|
}
|
||||||
@@ -1277,7 +1277,7 @@ namespace isc { namespace netconf {
|
|||||||
case 112: // model: "model" $@20 ":" "constant string"
|
case 112: // model: "model" $@20 ":" "constant string"
|
||||||
#line 535 "netconf_parser.yy"
|
#line 535 "netconf_parser.yy"
|
||||||
{
|
{
|
||||||
ElementPtr model(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
|
ElementPtr model(new StringElement(yystack_[0].value.as < string > (), ctx.loc2pos(yystack_[0].location)));
|
||||||
ctx.stack_.back()->set("model", model);
|
ctx.stack_.back()->set("model", model);
|
||||||
ctx.leave();
|
ctx.leave();
|
||||||
}
|
}
|
||||||
@@ -1361,7 +1361,7 @@ namespace isc { namespace netconf {
|
|||||||
case 130: // socket_name: "socket-name" $@23 ":" "constant string"
|
case 130: // socket_name: "socket-name" $@23 ":" "constant string"
|
||||||
#line 586 "netconf_parser.yy"
|
#line 586 "netconf_parser.yy"
|
||||||
{
|
{
|
||||||
ElementPtr name(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
|
ElementPtr name(new StringElement(yystack_[0].value.as < string > (), ctx.loc2pos(yystack_[0].location)));
|
||||||
ctx.stack_.back()->set("socket-name", name);
|
ctx.stack_.back()->set("socket-name", name);
|
||||||
ctx.leave();
|
ctx.leave();
|
||||||
}
|
}
|
||||||
@@ -1380,7 +1380,7 @@ namespace isc { namespace netconf {
|
|||||||
case 132: // socket_url: "socket-url" $@24 ":" "constant string"
|
case 132: // socket_url: "socket-url" $@24 ":" "constant string"
|
||||||
#line 596 "netconf_parser.yy"
|
#line 596 "netconf_parser.yy"
|
||||||
{
|
{
|
||||||
ElementPtr url(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
|
ElementPtr url(new StringElement(yystack_[0].value.as < string > (), ctx.loc2pos(yystack_[0].location)));
|
||||||
ctx.stack_.back()->set("socket-url", url);
|
ctx.stack_.back()->set("socket-url", url);
|
||||||
ctx.leave();
|
ctx.leave();
|
||||||
}
|
}
|
||||||
@@ -1454,7 +1454,7 @@ namespace isc { namespace netconf {
|
|||||||
case 151: // name: "name" $@27 ":" "constant string"
|
case 151: // name: "name" $@27 ":" "constant string"
|
||||||
#line 654 "netconf_parser.yy"
|
#line 654 "netconf_parser.yy"
|
||||||
{
|
{
|
||||||
ElementPtr name(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
|
ElementPtr name(new StringElement(yystack_[0].value.as < string > (), ctx.loc2pos(yystack_[0].location)));
|
||||||
ctx.stack_.back()->set("name", name);
|
ctx.stack_.back()->set("name", name);
|
||||||
ctx.leave();
|
ctx.leave();
|
||||||
}
|
}
|
||||||
@@ -1483,7 +1483,7 @@ namespace isc { namespace netconf {
|
|||||||
case 154: // severity: "severity" $@28 ":" "constant string"
|
case 154: // severity: "severity" $@28 ":" "constant string"
|
||||||
#line 669 "netconf_parser.yy"
|
#line 669 "netconf_parser.yy"
|
||||||
{
|
{
|
||||||
ElementPtr sev(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
|
ElementPtr sev(new StringElement(yystack_[0].value.as < string > (), ctx.loc2pos(yystack_[0].location)));
|
||||||
ctx.stack_.back()->set("severity", sev);
|
ctx.stack_.back()->set("severity", sev);
|
||||||
ctx.leave();
|
ctx.leave();
|
||||||
}
|
}
|
||||||
@@ -1557,7 +1557,7 @@ namespace isc { namespace netconf {
|
|||||||
case 171: // output: "output" $@31 ":" "constant string"
|
case 171: // output: "output" $@31 ":" "constant string"
|
||||||
#line 718 "netconf_parser.yy"
|
#line 718 "netconf_parser.yy"
|
||||||
{
|
{
|
||||||
ElementPtr sev(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
|
ElementPtr sev(new StringElement(yystack_[0].value.as < string > (), ctx.loc2pos(yystack_[0].location)));
|
||||||
ctx.stack_.back()->set("output", sev);
|
ctx.stack_.back()->set("output", sev);
|
||||||
ctx.leave();
|
ctx.leave();
|
||||||
}
|
}
|
||||||
@@ -1606,7 +1606,7 @@ namespace isc { namespace netconf {
|
|||||||
case 176: // pattern: "pattern" $@32 ":" "constant string"
|
case 176: // pattern: "pattern" $@32 ":" "constant string"
|
||||||
#line 745 "netconf_parser.yy"
|
#line 745 "netconf_parser.yy"
|
||||||
{
|
{
|
||||||
ElementPtr sev(new StringElement(yystack_[0].value.as < std::string > (), ctx.loc2pos(yystack_[0].location)));
|
ElementPtr sev(new StringElement(yystack_[0].value.as < string > (), ctx.loc2pos(yystack_[0].location)));
|
||||||
ctx.stack_.back()->set("pattern", sev);
|
ctx.stack_.back()->set("pattern", sev);
|
||||||
ctx.leave();
|
ctx.leave();
|
||||||
}
|
}
|
||||||
@@ -2306,7 +2306,6 @@ namespace isc { namespace netconf {
|
|||||||
|
|
||||||
void
|
void
|
||||||
isc::netconf::NetconfParser::error(const location_type& loc,
|
isc::netconf::NetconfParser::error(const location_type& loc,
|
||||||
const std::string& what)
|
const string& what) {
|
||||||
{
|
|
||||||
ctx.error(loc, what);
|
ctx.error(loc, what);
|
||||||
}
|
}
|
||||||
|
@@ -442,7 +442,7 @@ namespace isc { namespace netconf {
|
|||||||
char dummy4[sizeof (int64_t)];
|
char dummy4[sizeof (int64_t)];
|
||||||
|
|
||||||
// "constant string"
|
// "constant string"
|
||||||
char dummy5[sizeof (std::string)];
|
char dummy5[sizeof (string)];
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The size of the largest semantic type.
|
/// The size of the largest semantic type.
|
||||||
@@ -763,7 +763,7 @@ namespace isc { namespace netconf {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case symbol_kind::S_STRING: // "constant string"
|
case symbol_kind::S_STRING: // "constant string"
|
||||||
value.move< std::string > (std::move (that.value));
|
value.move< string > (std::move (that.value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -846,13 +846,13 @@ namespace isc { namespace netconf {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
basic_symbol (typename Base::kind_type t, std::string&& v, location_type&& l)
|
basic_symbol (typename Base::kind_type t, string&& v, location_type&& l)
|
||||||
: Base (t)
|
: Base (t)
|
||||||
, value (std::move (v))
|
, value (std::move (v))
|
||||||
, location (std::move (l))
|
, location (std::move (l))
|
||||||
{}
|
{}
|
||||||
#else
|
#else
|
||||||
basic_symbol (typename Base::kind_type t, const std::string& v, const location_type& l)
|
basic_symbol (typename Base::kind_type t, const string& v, const location_type& l)
|
||||||
: Base (t)
|
: Base (t)
|
||||||
, value (v)
|
, value (v)
|
||||||
, location (l)
|
, location (l)
|
||||||
@@ -902,7 +902,7 @@ switch (yykind)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case symbol_kind::S_STRING: // "constant string"
|
case symbol_kind::S_STRING: // "constant string"
|
||||||
value.template destroy< std::string > ();
|
value.template destroy< string > ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -1043,10 +1043,10 @@ switch (yykind)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
symbol_type (int tok, std::string v, location_type l)
|
symbol_type (int tok, string v, location_type l)
|
||||||
: super_type (token_kind_type (tok), std::move (v), std::move (l))
|
: super_type (token_kind_type (tok), std::move (v), std::move (l))
|
||||||
#else
|
#else
|
||||||
symbol_type (int tok, const std::string& v, const location_type& l)
|
symbol_type (int tok, const string& v, const location_type& l)
|
||||||
: super_type (token_kind_type (tok), v, l)
|
: super_type (token_kind_type (tok), v, l)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -1780,14 +1780,14 @@ switch (yykind)
|
|||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
static
|
static
|
||||||
symbol_type
|
symbol_type
|
||||||
make_STRING (std::string v, location_type l)
|
make_STRING (string v, location_type l)
|
||||||
{
|
{
|
||||||
return symbol_type (token::TOKEN_STRING, std::move (v), std::move (l));
|
return symbol_type (token::TOKEN_STRING, std::move (v), std::move (l));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static
|
static
|
||||||
symbol_type
|
symbol_type
|
||||||
make_STRING (const std::string& v, const location_type& l)
|
make_STRING (const string& v, const location_type& l)
|
||||||
{
|
{
|
||||||
return symbol_type (token::TOKEN_STRING, v, l);
|
return symbol_type (token::TOKEN_STRING, v, l);
|
||||||
}
|
}
|
||||||
@@ -2259,7 +2259,7 @@ switch (yykind)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case symbol_kind::S_STRING: // "constant string"
|
case symbol_kind::S_STRING: // "constant string"
|
||||||
value.copy< std::string > (YY_MOVE (that.value));
|
value.copy< string > (YY_MOVE (that.value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -2312,7 +2312,7 @@ switch (yykind)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case symbol_kind::S_STRING: // "constant string"
|
case symbol_kind::S_STRING: // "constant string"
|
||||||
value.move< std::string > (YY_MOVE (s.value));
|
value.move< string > (YY_MOVE (s.value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@@ -98,7 +98,7 @@ using namespace std;
|
|||||||
START_SUB_NETCONF
|
START_SUB_NETCONF
|
||||||
;
|
;
|
||||||
|
|
||||||
%token <std::string> STRING "constant string"
|
%token <string> STRING "constant string"
|
||||||
%token <int64_t> INTEGER "integer"
|
%token <int64_t> INTEGER "integer"
|
||||||
%token <double> FLOAT "floating point"
|
%token <double> FLOAT "floating point"
|
||||||
%token <bool> BOOLEAN "boolean"
|
%token <bool> BOOLEAN "boolean"
|
||||||
@@ -227,8 +227,8 @@ not_empty_list: value {
|
|||||||
// if you want to have a nice expression printed when unknown (mistyped?)
|
// if you want to have a nice expression printed when unknown (mistyped?)
|
||||||
// parameter is found.
|
// parameter is found.
|
||||||
unknown_map_entry: STRING COLON {
|
unknown_map_entry: STRING COLON {
|
||||||
const std::string& where = ctx.contextName();
|
const string& where = ctx.contextName();
|
||||||
const std::string& keyword = $1;
|
const string& keyword = $1;
|
||||||
error(@1,
|
error(@1,
|
||||||
"got unexpected keyword \"" + keyword + "\" in " + where + " map.");
|
"got unexpected keyword \"" + keyword + "\" in " + where + " map.");
|
||||||
};
|
};
|
||||||
@@ -325,7 +325,7 @@ user_context: USER_CONTEXT {
|
|||||||
if (old) {
|
if (old) {
|
||||||
// Check if it was a comment or a duplicate
|
// Check if it was a comment or a duplicate
|
||||||
if ((old->size() != 1) || !old->contains("comment")) {
|
if ((old->size() != 1) || !old->contains("comment")) {
|
||||||
std::stringstream msg;
|
stringstream msg;
|
||||||
msg << "duplicate user-context entries (previous at "
|
msg << "duplicate user-context entries (previous at "
|
||||||
<< old->getPosition().str() << ")";
|
<< old->getPosition().str() << ")";
|
||||||
error(@1, msg.str());
|
error(@1, msg.str());
|
||||||
@@ -352,7 +352,7 @@ comment: COMMENT {
|
|||||||
if (old) {
|
if (old) {
|
||||||
// Check for duplicate comment
|
// Check for duplicate comment
|
||||||
if (old->contains("comment")) {
|
if (old->contains("comment")) {
|
||||||
std::stringstream msg;
|
stringstream msg;
|
||||||
msg << "duplicate user-context/comment entries (previous at "
|
msg << "duplicate user-context/comment entries (previous at "
|
||||||
<< old->getPosition().str() << ")";
|
<< old->getPosition().str() << ")";
|
||||||
error(@1, msg.str());
|
error(@1, msg.str());
|
||||||
@@ -752,7 +752,6 @@ pattern: PATTERN {
|
|||||||
|
|
||||||
void
|
void
|
||||||
isc::netconf::NetconfParser::error(const location_type& loc,
|
isc::netconf::NetconfParser::error(const location_type& loc,
|
||||||
const std::string& what)
|
const string& what) {
|
||||||
{
|
|
||||||
ctx.error(loc, what);
|
ctx.error(loc, what);
|
||||||
}
|
}
|
||||||
|
@@ -29,14 +29,14 @@ ParserContext::~ParserContext()
|
|||||||
}
|
}
|
||||||
|
|
||||||
isc::data::ElementPtr
|
isc::data::ElementPtr
|
||||||
ParserContext::parseString(const std::string& str, ParserType parser_type)
|
ParserContext::parseString(string const& str, ParserType parser_type)
|
||||||
{
|
{
|
||||||
scanStringBegin(str, parser_type);
|
scanStringBegin(str, parser_type);
|
||||||
return (parseCommon());
|
return (parseCommon());
|
||||||
}
|
}
|
||||||
|
|
||||||
isc::data::ElementPtr
|
isc::data::ElementPtr
|
||||||
ParserContext::parseFile(const std::string& filename, ParserType parser_type) {
|
ParserContext::parseFile(string const& filename, ParserType parser_type) {
|
||||||
FILE* f = fopen(filename.c_str(), "r");
|
FILE* f = fopen(filename.c_str(), "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
isc_throw(ParseError, "Unable to open file " << filename);
|
isc_throw(ParseError, "Unable to open file " << filename);
|
||||||
@@ -72,7 +72,7 @@ ParserContext::parseCommon() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
ParserContext::error(const isc::netconf::location& loc,
|
ParserContext::error(const isc::netconf::location& loc,
|
||||||
const std::string& what,
|
string const& what,
|
||||||
size_t pos)
|
size_t pos)
|
||||||
{
|
{
|
||||||
if (pos == 0) {
|
if (pos == 0) {
|
||||||
@@ -83,13 +83,13 @@ ParserContext::error(const isc::netconf::location& loc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ParserContext::error(const std::string& what)
|
ParserContext::error(string const& what)
|
||||||
{
|
{
|
||||||
isc_throw(ParseError, what);
|
isc_throw(ParseError, what);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ParserContext::fatal(const std::string& what)
|
ParserContext::fatal(string const& what)
|
||||||
{
|
{
|
||||||
isc_throw(ParseError, what);
|
isc_throw(ParseError, what);
|
||||||
}
|
}
|
||||||
@@ -97,14 +97,14 @@ ParserContext::fatal(const std::string& what)
|
|||||||
isc::data::Element::Position
|
isc::data::Element::Position
|
||||||
ParserContext::loc2pos(isc::netconf::location& loc)
|
ParserContext::loc2pos(isc::netconf::location& loc)
|
||||||
{
|
{
|
||||||
const std::string& file = *loc.begin.filename;
|
string const& file = *loc.begin.filename;
|
||||||
const uint32_t line = loc.begin.line;
|
const uint32_t line = loc.begin.line;
|
||||||
const uint32_t pos = loc.begin.column;
|
const uint32_t pos = loc.begin.column;
|
||||||
return (isc::data::Element::Position(file, line, pos));
|
return (isc::data::Element::Position(file, line, pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ParserContext::require(const std::string& name,
|
ParserContext::require(string const& name,
|
||||||
isc::data::Element::Position open_loc,
|
isc::data::Element::Position open_loc,
|
||||||
isc::data::Element::Position close_loc)
|
isc::data::Element::Position close_loc)
|
||||||
{
|
{
|
||||||
@@ -119,7 +119,7 @@ ParserContext::require(const std::string& name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ParserContext::unique(const std::string& name,
|
ParserContext::unique(string const& name,
|
||||||
isc::data::Element::Position loc)
|
isc::data::Element::Position loc)
|
||||||
{
|
{
|
||||||
ConstElementPtr value = stack_.back()->get(name);
|
ConstElementPtr value = stack_.back()->get(name);
|
||||||
@@ -153,7 +153,7 @@ ParserContext::leave()
|
|||||||
cstack_.pop_back();
|
cstack_.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string
|
string const
|
||||||
ParserContext::contextName()
|
ParserContext::contextName()
|
||||||
{
|
{
|
||||||
switch (ctx_) {
|
switch (ctx_) {
|
||||||
@@ -184,8 +184,8 @@ ParserContext::contextName()
|
|||||||
|
|
||||||
void
|
void
|
||||||
ParserContext::warning(const isc::netconf::location& loc,
|
ParserContext::warning(const isc::netconf::location& loc,
|
||||||
const std::string& what) {
|
string const& what) {
|
||||||
std::ostringstream msg;
|
ostringstream msg;
|
||||||
msg << loc << ": " << what;
|
msg << loc << ": " << what;
|
||||||
LOG_WARN(netconf_logger, NETCONF_CONFIG_SYNTAX_WARNING)
|
LOG_WARN(netconf_logger, NETCONF_CONFIG_SYNTAX_WARNING)
|
||||||
.arg(msg.str());
|
.arg(msg.str());
|
||||||
|
@@ -846,7 +846,7 @@ TEST_F(HttpControlSocketTest, partial) {
|
|||||||
ConstElementPtr json = Element::fromJSON("{ \"want-partial\": true }");
|
ConstElementPtr json = Element::fromJSON("{ \"want-partial\": true }");
|
||||||
|
|
||||||
// Warn this makes time.
|
// Warn this makes time.
|
||||||
cout << "this test waits for 2 seconds" << endl;
|
cout << "Waiting 2s..." << endl;
|
||||||
|
|
||||||
// Try configSet: it should get a communication error,
|
// Try configSet: it should get a communication error,
|
||||||
try {
|
try {
|
||||||
|
@@ -908,7 +908,7 @@ TEST(ParserTest, duplicateMapEntries) {
|
|||||||
};
|
};
|
||||||
size_t cnt = 0;
|
size_t cnt = 0;
|
||||||
test(sample_json, sample_json, cnt);
|
test(sample_json, sample_json, cnt);
|
||||||
cout << "checked " << cnt << " duplicated map entries\n";
|
cout << "Checked " << cnt << " duplicated map entries.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Test fixture for trailing commas.
|
/// @brief Test fixture for trailing commas.
|
||||||
|
@@ -88,7 +88,7 @@ UnixControlSocket::sendCommand(ConstElementPtr command) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return (received_feed->toElement());
|
return (received_feed->toElement());
|
||||||
} catch (const std::exception& ex) {
|
} catch (exception const& ex) {
|
||||||
isc_throw(ControlSocketError, "unparsable response: " << ex.what());
|
isc_throw(ControlSocketError, "unparsable response: " << ex.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -48,7 +48,7 @@ AdaptorOption::collect(ConstElementPtr option, OptionCodes& codes) {
|
|||||||
ConstElementPtr code = option->get("code");
|
ConstElementPtr code = option->get("code");
|
||||||
string index = space->stringValue() + "@" + name->stringValue();
|
string index = space->stringValue() + "@" + name->stringValue();
|
||||||
uint16_t val = static_cast<uint16_t>(code->intValue());
|
uint16_t val = static_cast<uint16_t>(code->intValue());
|
||||||
codes.insert(std::pair<string, uint16_t>(index, val));
|
codes.insert(pair<string, uint16_t>(index, val));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ AdaptorOption::initCodesInternal(OptionCodes& codes, const string& space,
|
|||||||
size_t params_size) {
|
size_t params_size) {
|
||||||
for (size_t i = 0; i < params_size; ++i) {
|
for (size_t i = 0; i < params_size; ++i) {
|
||||||
string index = space + "@" + params[i].name;
|
string index = space + "@" + params[i].name;
|
||||||
codes.insert(std::pair<string, uint16_t>(index, params[i].code));
|
codes.insert(pair<string, uint16_t>(index, params[i].code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -326,7 +326,7 @@ TEST_F(ConfigTestKeaV4, examples4) {
|
|||||||
for (string file : examples) {
|
for (string file : examples) {
|
||||||
resetSession();
|
resetSession();
|
||||||
string path = string(CFG_EXAMPLES) + "/kea4/" + file;
|
string path = string(CFG_EXAMPLES) + "/kea4/" + file;
|
||||||
cout << "Testing file " << path << endl;
|
SCOPED_TRACE("\n* Tested file: " + path);
|
||||||
ConstElementPtr json;
|
ConstElementPtr json;
|
||||||
ASSERT_NO_THROW_LOG(json = loadFile(path));
|
ASSERT_NO_THROW_LOG(json = loadFile(path));
|
||||||
json = isc::test::moveComments(json);
|
json = isc::test::moveComments(json);
|
||||||
@@ -368,7 +368,7 @@ TEST_F(ConfigTestKeaV6, examples6) {
|
|||||||
for (string file : examples) {
|
for (string file : examples) {
|
||||||
resetSession();
|
resetSession();
|
||||||
string path = string(CFG_EXAMPLES) + "/kea6/" + file;
|
string path = string(CFG_EXAMPLES) + "/kea6/" + file;
|
||||||
cout << "Testing file " << path << endl;
|
SCOPED_TRACE("\n* Tested file: " + path);
|
||||||
ConstElementPtr json;
|
ConstElementPtr json;
|
||||||
ASSERT_NO_THROW_LOG(json = loadFile(path));
|
ASSERT_NO_THROW_LOG(json = loadFile(path));
|
||||||
json = isc::test::moveComments(json);
|
json = isc::test::moveComments(json);
|
||||||
|
@@ -123,7 +123,7 @@ TranslatorBasic::decode64(string const& input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TranslatorBasic::deleteItem(const std::string& xpath) {
|
TranslatorBasic::deleteItem(string const& xpath) {
|
||||||
/// @todo: Remove this if convenient. It is not strictly required and only done to detect
|
/// @todo: Remove this if convenient. It is not strictly required and only done to detect
|
||||||
/// missing schema nodes and throw an exception to keep old behavior.
|
/// missing schema nodes and throw an exception to keep old behavior.
|
||||||
try {
|
try {
|
||||||
@@ -328,7 +328,7 @@ TranslatorBasic::translateToYang(ConstElementPtr const& element,
|
|||||||
// A null ElementPtr is how we signal that this item requires no value.
|
// A null ElementPtr is how we signal that this item requires no value.
|
||||||
// Useful when setting YANG lists which is the only way to set their
|
// Useful when setting YANG lists which is the only way to set their
|
||||||
// keys in sysrepo since setting the key itself results in an error.
|
// keys in sysrepo since setting the key itself results in an error.
|
||||||
return std::nullopt;
|
return nullopt;
|
||||||
} else if (element->getType() == Element::map) {
|
} else if (element->getType() == Element::map) {
|
||||||
/// @todo: implement
|
/// @todo: implement
|
||||||
isc_throw(NotImplemented, "TranslatorBasic::value(): map element");
|
isc_throw(NotImplemented, "TranslatorBasic::value(): map element");
|
||||||
|
@@ -161,7 +161,7 @@ TranslatorDatabases::getDatabasesFromAbsoluteXpath(string const& xpath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ElementPtr
|
ElementPtr
|
||||||
TranslatorDatabases::getDatabasesKea(DataNode const& data_node, std::string const& xpath) {
|
TranslatorDatabases::getDatabasesKea(DataNode const& data_node, string const& xpath) {
|
||||||
return getList<TranslatorDatabase>(data_node, xpath, *this,
|
return getList<TranslatorDatabase>(data_node, xpath, *this,
|
||||||
&TranslatorDatabase::getDatabase);
|
&TranslatorDatabase::getDatabase);
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ TranslatorHost::getHost(DataNode const& data_node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ElementPtr
|
ElementPtr
|
||||||
TranslatorHost::getHostFromAbsoluteXpath(std::string const& xpath) {
|
TranslatorHost::getHostFromAbsoluteXpath(string const& xpath) {
|
||||||
try {
|
try {
|
||||||
return getHost(findXPath(xpath));
|
return getHost(findXPath(xpath));
|
||||||
} catch(NetconfError const&) {
|
} catch(NetconfError const&) {
|
||||||
@@ -141,7 +141,7 @@ TranslatorHosts::getHosts(DataNode const& data_node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ElementPtr
|
ElementPtr
|
||||||
TranslatorHosts::getHostsFromAbsoluteXpath(std::string const& xpath) {
|
TranslatorHosts::getHostsFromAbsoluteXpath(string const& xpath) {
|
||||||
try {
|
try {
|
||||||
return getHosts(findXPath(xpath));
|
return getHosts(findXPath(xpath));
|
||||||
} catch(NetconfError const&) {
|
} catch(NetconfError const&) {
|
||||||
|
@@ -62,7 +62,7 @@ TranslatorSharedNetwork::getSharedNetworkFromAbsoluteXpath(string const& xpath)
|
|||||||
|
|
||||||
ElementPtr
|
ElementPtr
|
||||||
TranslatorSharedNetwork::getSharedNetworkKea(DataNode const& data_node,
|
TranslatorSharedNetwork::getSharedNetworkKea(DataNode const& data_node,
|
||||||
const std::string& subsel) {
|
string const& subsel) {
|
||||||
ElementPtr result = Element::createMap();
|
ElementPtr result = Element::createMap();
|
||||||
|
|
||||||
getMandatoryLeaf(result, data_node, "name");
|
getMandatoryLeaf(result, data_node, "name");
|
||||||
@@ -157,7 +157,7 @@ TranslatorSharedNetwork::setSharedNetwork(string const& xpath,
|
|||||||
void
|
void
|
||||||
TranslatorSharedNetwork::setSharedNetworkKea(string const& xpath,
|
TranslatorSharedNetwork::setSharedNetworkKea(string const& xpath,
|
||||||
ConstElementPtr elem,
|
ConstElementPtr elem,
|
||||||
const std::string& subsel) {
|
string const& subsel) {
|
||||||
// Skip key "name".
|
// Skip key "name".
|
||||||
|
|
||||||
checkAndSetLeaf(elem, xpath, "cache-max-age", LeafBaseType::Uint32);
|
checkAndSetLeaf(elem, xpath, "cache-max-age", LeafBaseType::Uint32);
|
||||||
|
@@ -375,7 +375,7 @@ TranslatorSubnets::getSubnetsFromAbsoluteXpath(string const& xpath) {
|
|||||||
|
|
||||||
ElementPtr
|
ElementPtr
|
||||||
TranslatorSubnets::getSubnetsCommon(DataNode const& data_node,
|
TranslatorSubnets::getSubnetsCommon(DataNode const& data_node,
|
||||||
const std::string& subsel) {
|
string const& subsel) {
|
||||||
return getList<TranslatorSubnet>(data_node, subsel, *this,
|
return getList<TranslatorSubnet>(data_node, subsel, *this,
|
||||||
&TranslatorSubnet::getSubnet);
|
&TranslatorSubnet::getSubnet);
|
||||||
}
|
}
|
||||||
@@ -417,7 +417,7 @@ TranslatorSubnets::setSubnetsIetf6(string const& xpath, ConstElementPtr elem) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
TranslatorSubnets::setSubnetsKea(string const& xpath, ConstElementPtr elem,
|
TranslatorSubnets::setSubnetsKea(string const& xpath, ConstElementPtr elem,
|
||||||
const std::string& subsel) {
|
string const& subsel) {
|
||||||
for (size_t i = 0; i < elem->size(); ++i) {
|
for (size_t i = 0; i < elem->size(); ++i) {
|
||||||
ConstElementPtr subnet = elem->get(i);
|
ConstElementPtr subnet = elem->get(i);
|
||||||
if (!subnet->contains("id")) {
|
if (!subnet->contains("id")) {
|
||||||
|
Reference in New Issue
Block a user