Commit cf8d1122 authored by Francis Dupont's avatar Francis Dupont

[5145b] Rebased keeping host_parser in hooks

parent 99705e8b
...@@ -24,7 +24,7 @@ CtrlAgentCfgContext::CtrlAgentCfgContext() ...@@ -24,7 +24,7 @@ CtrlAgentCfgContext::CtrlAgentCfgContext()
CtrlAgentCfgContext::CtrlAgentCfgContext(const CtrlAgentCfgContext& orig) CtrlAgentCfgContext::CtrlAgentCfgContext(const CtrlAgentCfgContext& orig)
: DCfgContextBase(),http_host_(orig.http_host_), http_port_(orig.http_port_), : DCfgContextBase(),http_host_(orig.http_host_), http_port_(orig.http_port_),
libraries_(orig.libraries_) { hooks_config_(orig.hooks_config_) {
// We're copying pointers here only. The underlying data will be shared by // We're copying pointers here only. The underlying data will be shared by
// old and new context. That's how shared pointers work and I see no reason // old and new context. That's how shared pointers work and I see no reason
...@@ -74,7 +74,7 @@ CtrlAgentCfgMgr::getConfigSummary(const uint32_t /*selection*/) { ...@@ -74,7 +74,7 @@ CtrlAgentCfgMgr::getConfigSummary(const uint32_t /*selection*/) {
} }
// Finally, print the hook libraries names // Finally, print the hook libraries names
const hooks::HookLibsCollection libs = ctx->getLibraries(); const isc::hooks::HookLibsCollection libs = ctx->getHooksConfig().get();
s << ", " << libs.size() << " lib(s):"; s << ", " << libs.size() << " lib(s):";
for (auto lib = libs.begin(); lib != libs.end(); ++lib) { for (auto lib = libs.begin(); lib != libs.end(); ++lib) {
s << lib->first << " "; s << lib->first << " ";
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
#define CTRL_AGENT_CFG_MGR_H #define CTRL_AGENT_CFG_MGR_H
#include <cc/data.h> #include <cc/data.h>
#include <hooks/hooks_config.h>
#include <process/d_cfg_mgr.h> #include <process/d_cfg_mgr.h>
#include <boost/pointer_cast.hpp> #include <boost/pointer_cast.hpp>
#include <hooks/libinfo.h>
namespace isc { namespace isc {
namespace agent { namespace agent {
...@@ -61,7 +61,7 @@ public: ...@@ -61,7 +61,7 @@ public:
/// ///
/// @param type type of the server being controlled /// @param type type of the server being controlled
/// @return pointer to the Element that holds control-socket map (or NULL) /// @return pointer to the Element that holds control-socket map (or NULL)
const data::ConstElementPtr getControlSocketInfo(ServerType type) const; const isc::data::ConstElementPtr getControlSocketInfo(ServerType type) const;
/// @brief Sets information about the control socket /// @brief Sets information about the control socket
/// ///
...@@ -102,20 +102,20 @@ public: ...@@ -102,20 +102,20 @@ public:
return (http_port_); return (http_port_);
} }
/// @brief Returns a list of hook libraries /// @brief Returns non-const reference to configured hooks libraries.
/// @return a list of hook libraries ///
const hooks::HookLibsCollection& getLibraries() const { /// @return non-const reference to configured hooks libraries.
return (libraries_); isc::hooks::HooksConfig& getHooksConfig() {
return (hooks_config_);
} }
/// @brief Sets the list of hook libraries /// @brief Returns const reference to configured hooks libraries.
/// ///
/// @params libs a coolection of libraries to remember. /// @return const reference to configured hooks libraries.
void setLibraries(const hooks::HookLibsCollection& libs) { const isc::hooks::HooksConfig& getHooksConfig() const {
libraries_ = libs; return (hooks_config_);
} }
private: private:
/// @brief Private copy constructor /// @brief Private copy constructor
...@@ -132,7 +132,7 @@ private: ...@@ -132,7 +132,7 @@ private:
CtrlAgentCfgContext& operator=(const CtrlAgentCfgContext& rhs); CtrlAgentCfgContext& operator=(const CtrlAgentCfgContext& rhs);
/// Socket information will be stored here (for all supported servers) /// Socket information will be stored here (for all supported servers)
data::ConstElementPtr ctrl_sockets_[MAX_TYPE_SUPPORTED + 1]; isc::data::ConstElementPtr ctrl_sockets_[MAX_TYPE_SUPPORTED + 1];
/// Hostname the CA should listen on. /// Hostname the CA should listen on.
std::string http_host_; std::string http_host_;
...@@ -140,8 +140,8 @@ private: ...@@ -140,8 +140,8 @@ private:
/// TCP port the CA should listen on. /// TCP port the CA should listen on.
uint16_t http_port_; uint16_t http_port_;
/// List of hook libraries. /// @brief Configured hooks libraries.
hooks::HookLibsCollection libraries_; isc::hooks::HooksConfig hooks_config_;
}; };
/// @brief Ctrl Agent Configuration Manager. /// @brief Ctrl Agent Configuration Manager.
......
...@@ -107,22 +107,21 @@ AgentSimpleParser::parse(const CtrlAgentCfgContextPtr& ctx, ...@@ -107,22 +107,21 @@ AgentSimpleParser::parse(const CtrlAgentCfgContextPtr& ctx,
} }
// Finally, let's get the hook libs! // Finally, let's get the hook libs!
hooks::HooksLibrariesParser hooks_parser;
using namespace isc::hooks;
HooksConfig& libraries = ctx->getHooksConfig();
ConstElementPtr hooks = config->get("hooks-libraries"); ConstElementPtr hooks = config->get("hooks-libraries");
if (hooks) { if (hooks) {
hooks_parser.parse(hooks); HooksLibrariesParser hooks_parser;
hooks_parser.verifyLibraries(); hooks_parser.parse(libraries, hooks);
libraries.verifyLibraries(hooks->getPosition());
hooks::HookLibsCollection libs;
hooks_parser.getLibraries(libs);
ctx->setLibraries(libs);
} }
if (!check_only) { if (!check_only) {
// This occurs last as if it succeeds, there is no easy way // This occurs last as if it succeeds, there is no easy way
// revert it. As a result, the failure to commit a subsequent // revert it. As a result, the failure to commit a subsequent
// change causes problems when trying to roll back. // change causes problems when trying to roll back.
hooks_parser.loadLibraries(); libraries.loadLibraries();
} }
} }
......
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
#include <process/testutils/d_test_stubs.h> #include <process/testutils/d_test_stubs.h>
#include <process/d_cfg_mgr.h> #include <process/d_cfg_mgr.h>
#include <agent/tests/test_libraries.h> #include <agent/tests/test_libraries.h>
#include <hooks/libinfo.h>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <gtest/gtest.h> #include <gtest/gtest.h>
using namespace isc::agent; using namespace isc::agent;
using namespace isc::data; using namespace isc::data;
using namespace isc::dhcp;
using namespace isc::hooks; using namespace isc::hooks;
using namespace isc::process; using namespace isc::process;
...@@ -123,11 +123,10 @@ TEST(CtrlAgentCfgMgr, contextSocketInfoCopy) { ...@@ -123,11 +123,10 @@ TEST(CtrlAgentCfgMgr, contextSocketInfoCopy) {
EXPECT_NO_THROW(ctx.setHttpPort(12345)); EXPECT_NO_THROW(ctx.setHttpPort(12345));
EXPECT_NO_THROW(ctx.setHttpHost("bellatrix")); EXPECT_NO_THROW(ctx.setHttpHost("bellatrix"));
HookLibsCollection libs; HooksConfig& libs = ctx.getHooksConfig();
string exp_name("testlib1.so"); string exp_name("testlib1.so");
ConstElementPtr exp_param(new StringElement("myparam")); ConstElementPtr exp_param(new StringElement("myparam"));
libs.push_back(make_pair(exp_name, exp_param)); libs.add(exp_name, exp_param);
ctx.setLibraries(libs);
// Make a copy. // Make a copy.
DCfgContextBasePtr copy_base(ctx.clone()); DCfgContextBasePtr copy_base(ctx.clone());
...@@ -147,7 +146,7 @@ TEST(CtrlAgentCfgMgr, contextSocketInfoCopy) { ...@@ -147,7 +146,7 @@ TEST(CtrlAgentCfgMgr, contextSocketInfoCopy) {
EXPECT_EQ(socket3->str(), copy->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6)->str()); EXPECT_EQ(socket3->str(), copy->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6)->str());
// Check hook libs // Check hook libs
HookLibsCollection libs2 = copy->getLibraries(); const HookLibsCollection& libs2 = copy->getHooksConfig().get();
ASSERT_EQ(1, libs2.size()); ASSERT_EQ(1, libs2.size());
EXPECT_EQ(exp_name, libs2[0].first); EXPECT_EQ(exp_name, libs2[0].first);
ASSERT_TRUE(libs2[0].second); ASSERT_TRUE(libs2[0].second);
...@@ -160,19 +159,18 @@ TEST(CtrlAgentCfgMgr, contextHookParams) { ...@@ -160,19 +159,18 @@ TEST(CtrlAgentCfgMgr, contextHookParams) {
CtrlAgentCfgContext ctx; CtrlAgentCfgContext ctx;
// By default there should be no hooks. // By default there should be no hooks.
HookLibsCollection libs = ctx.getLibraries(); HooksConfig& libs = ctx.getHooksConfig();
EXPECT_TRUE(libs.empty()); EXPECT_TRUE(libs.get().empty());
libs.push_back(std::make_pair("libone.so", ConstElementPtr())); libs.add("libone.so", ConstElementPtr());
libs.push_back(std::make_pair("libtwo.so", Element::fromJSON("{\"foo\": true}"))); libs.add("libtwo.so", Element::fromJSON("{\"foo\": true}"));
libs.push_back(std::make_pair("libthree.so", Element::fromJSON("{\"bar\": 42}"))); libs.add("libthree.so", Element::fromJSON("{\"bar\": 42}"));
ctx.setLibraries(libs); const HooksConfig& stored_libs = ctx.getHooksConfig();
EXPECT_EQ(3, stored_libs.get().size());
HookLibsCollection stored_libs = ctx.getLibraries(); // @todo add a == operator to HooksConfig
EXPECT_EQ(3, stored_libs.size()); EXPECT_EQ(libs.get(), stored_libs.get());
EXPECT_EQ(libs, stored_libs);
} }
/// Control Agent configurations used in tests. /// Control Agent configurations used in tests.
...@@ -389,7 +387,7 @@ TEST_F(AgentParserTest, configParseHooks) { ...@@ -389,7 +387,7 @@ TEST_F(AgentParserTest, configParseHooks) {
// The context now should have the library specified. // The context now should have the library specified.
CtrlAgentCfgContextPtr ctx = cfg_mgr_.getCtrlAgentCfgContext(); CtrlAgentCfgContextPtr ctx = cfg_mgr_.getCtrlAgentCfgContext();
HookLibsCollection libs = ctx->getLibraries(); const HookLibsCollection libs = ctx->getHooksConfig().get();
ASSERT_EQ(1, libs.size()); ASSERT_EQ(1, libs.size());
EXPECT_EQ(string(BASIC_CALLOUT_LIBRARY), libs[0].first); EXPECT_EQ(string(BASIC_CALLOUT_LIBRARY), libs[0].first);
ASSERT_TRUE(libs[0].second); ASSERT_TRUE(libs[0].second);
......
...@@ -42,6 +42,7 @@ using namespace isc; ...@@ -42,6 +42,7 @@ using namespace isc;
using namespace isc::dhcp; using namespace isc::dhcp;
using namespace isc::data; using namespace isc::data;
using namespace isc::asiolink; using namespace isc::asiolink;
using namespace isc::hooks;
namespace { namespace {
...@@ -431,11 +432,6 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set, ...@@ -431,11 +432,6 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set,
// for option definitions. This is equivalent to commiting empty container. // for option definitions. This is equivalent to commiting empty container.
LibDHCP::setRuntimeOptionDefs(OptionDefSpaceContainer()); LibDHCP::setRuntimeOptionDefs(OptionDefSpaceContainer());
// Some of the parsers alter the state of the system in a way that can't
// easily be undone. (Or alter it in a way such that undoing the change has
// the same risk of failure as doing the change.)
hooks::HooksLibrariesParser hooks_parser;
// Answer will hold the result. // Answer will hold the result.
ConstElementPtr answer; ConstElementPtr answer;
// Rollback informs whether error occurred and original data // Rollback informs whether error occurred and original data
...@@ -515,8 +511,10 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set, ...@@ -515,8 +511,10 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set,
} }
if (config_pair.first == "hooks-libraries") { if (config_pair.first == "hooks-libraries") {
hooks_parser.parse(config_pair.second); HooksLibrariesParser hooks_parser;
hooks_parser.verifyLibraries(); HooksConfig& libraries = srv_cfg->getHooksConfig();
hooks_parser.parse(libraries, config_pair.second);
libraries.verifyLibraries(config_pair.second->getPosition());
continue; continue;
} }
...@@ -637,7 +635,9 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set, ...@@ -637,7 +635,9 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set,
// This occurs last as if it succeeds, there is no easy way // This occurs last as if it succeeds, there is no easy way
// revert it. As a result, the failure to commit a subsequent // revert it. As a result, the failure to commit a subsequent
// change causes problems when trying to roll back. // change causes problems when trying to roll back.
hooks_parser.loadLibraries(); const HooksConfig& libraries =
CfgMgr::instance().getStagingCfg()->getHooksConfig();
libraries.loadLibraries();
} }
catch (const isc::Exception& ex) { catch (const isc::Exception& ex) {
LOG_ERROR(dhcp4_logger, DHCP4_PARSER_COMMIT_FAIL).arg(ex.what()); LOG_ERROR(dhcp4_logger, DHCP4_PARSER_COMMIT_FAIL).arg(ex.what());
......
...@@ -54,6 +54,7 @@ using namespace isc; ...@@ -54,6 +54,7 @@ using namespace isc;
using namespace isc::data; using namespace isc::data;
using namespace isc::dhcp; using namespace isc::dhcp;
using namespace isc::asiolink; using namespace isc::asiolink;
using namespace isc::hooks;
namespace { namespace {
...@@ -638,11 +639,6 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set, ...@@ -638,11 +639,6 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set,
// for option definitions. This is equivalent to commiting empty container. // for option definitions. This is equivalent to commiting empty container.
LibDHCP::setRuntimeOptionDefs(OptionDefSpaceContainer()); LibDHCP::setRuntimeOptionDefs(OptionDefSpaceContainer());
// Some of the parsers alter state of the system that can't easily
// be undone. (Or alter it in a way such that undoing the change
// has the same risk of failure as doing the change.)
hooks::HooksLibrariesParser hooks_parser;
// This is a way to convert ConstElementPtr to ElementPtr. // This is a way to convert ConstElementPtr to ElementPtr.
// We need a config that can be edited, because we will insert // We need a config that can be edited, because we will insert
// default values and will insert derived values as well. // default values and will insert derived values as well.
...@@ -738,8 +734,10 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set, ...@@ -738,8 +734,10 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set,
} }
if (config_pair.first == "hooks-libraries") { if (config_pair.first == "hooks-libraries") {
hooks_parser.parse(config_pair.second); HooksLibrariesParser hooks_parser;
hooks_parser.verifyLibraries(); HooksConfig& libraries = srv_config->getHooksConfig();
hooks_parser.parse(libraries, config_pair.second);
libraries.verifyLibraries(config_pair.second->getPosition());
continue; continue;
} }
...@@ -860,7 +858,9 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set, ...@@ -860,7 +858,9 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set,
// This occurs last as if it succeeds, there is no easy way to // This occurs last as if it succeeds, there is no easy way to
// revert it. As a result, the failure to commit a subsequent // revert it. As a result, the failure to commit a subsequent
// change causes problems when trying to roll back. // change causes problems when trying to roll back.
hooks_parser.loadLibraries(); const HooksConfig& libraries =
CfgMgr::instance().getStagingCfg()->getHooksConfig();
libraries.loadLibraries();
} }
catch (const isc::Exception& ex) { catch (const isc::Exception& ex) {
LOG_ERROR(dhcp6_logger, DHCP6_PARSER_COMMIT_FAIL).arg(ex.what()); LOG_ERROR(dhcp6_logger, DHCP6_PARSER_COMMIT_FAIL).arg(ex.what());
......
# The following build order must be maintained. # The following build order must be maintained.
SUBDIRS = exceptions util log cryptolink dns cc hooks asiolink testutils dhcp config \ SUBDIRS = exceptions util log cryptolink dns cc asiolink testutils hooks dhcp config \
stats asiodns dhcp_ddns eval dhcpsrv cfgrpt process http stats asiodns dhcp_ddns eval dhcpsrv cfgrpt process http
...@@ -110,6 +110,14 @@ SrvConfig::copy(SrvConfig& new_config) const { ...@@ -110,6 +110,14 @@ SrvConfig::copy(SrvConfig& new_config) const {
new_config.class_dictionary_.reset(new ClientClassDictionary(*class_dictionary_)); new_config.class_dictionary_.reset(new ClientClassDictionary(*class_dictionary_));
// Replace the D2 client configuration // Replace the D2 client configuration
new_config.setD2ClientConfig(getD2ClientConfig()); new_config.setD2ClientConfig(getD2ClientConfig());
// Replace configured hooks libraries.
new_config.hooks_config_.clear();
using namespace isc::hooks;
for (HookLibsCollection::const_iterator it =
hooks_config_.get().begin();
it != hooks_config_.get().end(); ++it) {
new_config.hooks_config_.add(it->first, it->second);
}
} }
void void
...@@ -151,11 +159,49 @@ SrvConfig::equals(const SrvConfig& other) const { ...@@ -151,11 +159,49 @@ SrvConfig::equals(const SrvConfig& other) const {
} }
} }
// Logging information is equal between objects, so check other values. // Logging information is equal between objects, so check other values.
return ((*cfg_iface_ == *other.cfg_iface_) && if ((*cfg_iface_ != *other.cfg_iface_) ||
(*cfg_option_def_ == *other.cfg_option_def_) && (*cfg_option_def_ != *other.cfg_option_def_) ||
(*cfg_option_ == *other.cfg_option_) && (*cfg_option_ != *other.cfg_option_) ||
(*class_dictionary_ == *other.class_dictionary_) && (*class_dictionary_ != *other.class_dictionary_) ||
(*d2_client_config_ == *other.d2_client_config_)); (*d2_client_config_ != *other.d2_client_config_)) {
return (false);
}
// Now only configured hooks libraries can differ.
// If number of configured hooks libraries are different, then
// configurations aren't equal.
if (hooks_config_.get().size() != other.hooks_config_.get().size()) {
return (false);
}
// Pass through all configured hooks libraries.
using namespace isc::hooks;
for (isc::hooks::HookLibsCollection::const_iterator this_it =
hooks_config_.get().begin();
this_it != hooks_config_.get().end(); ++this_it) {
bool match = false;
for (isc::hooks::HookLibsCollection::const_iterator other_it =
other.hooks_config_.get().begin();
other_it != other.hooks_config_.get().end(); ++other_it) {
if (this_it->first != other_it->first) {
continue;
}
if (isNull(this_it->second) && isNull(other_it->second)) {
match = true;
break;
}
if (isNull(this_it->second) || isNull(other_it->second)) {
continue;
}
if (this_it->second->equals(*other_it->second)) {
match = true;
break;
}
}
// No match found for the particular hooks library so return false.
if (!match) {
return (false);
}
}
return (true);
} }
void void
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <dhcpsrv/client_class_def.h> #include <dhcpsrv/client_class_def.h>
#include <dhcpsrv/d2_client_cfg.h> #include <dhcpsrv/d2_client_cfg.h>
#include <dhcpsrv/logging_info.h> #include <dhcpsrv/logging_info.h>
#include <hooks/hooks_config.h>
#include <cc/data.h> #include <cc/data.h>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <vector> #include <vector>
...@@ -365,6 +366,20 @@ public: ...@@ -365,6 +366,20 @@ public:
class_dictionary_ = dictionary; class_dictionary_ = dictionary;
} }
/// @brief Returns non-const reference to configured hooks libraries.
///
/// @return non-const reference to configured hooks libraries.
isc::hooks::HooksConfig& getHooksConfig() {
return (hooks_config_);
}
/// @brief Returns const reference to configured hooks libraries.
///
/// @return const reference to configured hooks libraries.
const isc::hooks::HooksConfig& getHooksConfig() const {
return (hooks_config_);
}
/// @brief Copies the current configuration to a new configuration. /// @brief Copies the current configuration to a new configuration.
/// ///
/// This method copies the parameters stored in the configuration to /// This method copies the parameters stored in the configuration to
...@@ -593,6 +608,9 @@ private: ...@@ -593,6 +608,9 @@ private:
/// @brief Pointer to the dictionary of global client class definitions /// @brief Pointer to the dictionary of global client class definitions
ClientClassDictionaryPtr class_dictionary_; ClientClassDictionaryPtr class_dictionary_;
/// @brief Configured hooks libraries.
isc::hooks::HooksConfig hooks_config_;
/// @brief Decline Period time /// @brief Decline Period time
/// ///
/// This timer specifies decline probation period, the time after a declined /// This timer specifies decline probation period, the time after a declined
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
#include <dhcpsrv/subnet.h> #include <dhcpsrv/subnet.h>
#include <dhcpsrv/cfg_mac_source.h> #include <dhcpsrv/cfg_mac_source.h>
#include <dhcpsrv/parsers/dhcp_parsers.h> #include <dhcpsrv/parsers/dhcp_parsers.h>
#include <hooks/hooks_parser.h>
#include <dhcpsrv/tests/test_libraries.h> #include <dhcpsrv/tests/test_libraries.h>
#include <dhcpsrv/testutils/config_result_check.h> #include <dhcpsrv/testutils/config_result_check.h>
#include <exceptions/exceptions.h> #include <exceptions/exceptions.h>
#include <hooks/hooks_parser.h>
#include <hooks/hooks_manager.h> #include <hooks/hooks_manager.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
...@@ -377,10 +377,12 @@ public: ...@@ -377,10 +377,12 @@ public:
} }
if (config_pair.first == "hooks-libraries") { if (config_pair.first == "hooks-libraries") {
hooks_libraries_parser_.reset(new HooksLibrariesParser()); HooksLibrariesParser hook_parser;
hooks_libraries_parser_->parse(config_pair.second); HooksConfig& libraries =
hooks_libraries_parser_->verifyLibraries(); CfgMgr::instance().getStagingCfg()->getHooksConfig();
hooks_libraries_parser_->loadLibraries(); hook_parser.parse(libraries, config_pair.second);
libraries.verifyLibraries(config_pair.second->getPosition());
libraries.loadLibraries();
continue; continue;
} }
} }
...@@ -610,10 +612,10 @@ public: ...@@ -610,10 +612,10 @@ public:
CfgMgr::instance().setD2ClientConfig(tmp); CfgMgr::instance().setD2ClientConfig(tmp);
} }
/// @brief Parsers used in the parsing of the configuration /// Allows the tests to interrogate the state of the libraries (if required).
/// const isc::hooks::HookLibsCollection& getLibraries() {
/// Allows the tests to interrogate the state of the parsers (if required). return (CfgMgr::instance().getStagingCfg()->getHooksConfig().get());
boost::shared_ptr<HooksLibrariesParser> hooks_libraries_parser_; }
/// @brief specifies IP protocol family (AF_INET or AF_INET6) /// @brief specifies IP protocol family (AF_INET or AF_INET6)
uint16_t family_; uint16_t family_;
...@@ -1306,8 +1308,7 @@ TEST_F(ParseConfigTest, noHooksLibraries) { ...@@ -1306,8 +1308,7 @@ TEST_F(ParseConfigTest, noHooksLibraries) {
ASSERT_TRUE(rcode == 0) << error_text_; ASSERT_TRUE(rcode == 0) << error_text_;
// Check that the parser recorded nothing. // Check that the parser recorded nothing.
isc::hooks::HookLibsCollection libraries; isc::hooks::HookLibsCollection libraries = getLibraries();
hooks_libraries_parser_->getLibraries(libraries);
EXPECT_TRUE(libraries.empty()); EXPECT_TRUE(libraries.empty());
// Check that there are still no libraries loaded. // Check that there are still no libraries loaded.
...@@ -1329,8 +1330,7 @@ TEST_F(ParseConfigTest, oneHooksLibrary) { ...@@ -1329,8 +1330,7 @@ TEST_F(ParseConfigTest, oneHooksLibrary) {
ASSERT_TRUE(rcode == 0) << error_text_; ASSERT_TRUE(rcode == 0) << error_text_;
// Check that the parser recorded a single library.