using namespace isc::http;
using namespace isc::http::test;
using namespace isc::test;
+using namespace isc::util::file;
using isc::yang::test::SysrepoSetup;
void SetUp() override {
SysrepoSetup::cleanSharedMemory();
removeUnixSocketFile();
+ setSocketTestPath();
}
void TearDown() override {
}
removeUnixSocketFile();
io_service_->stopAndPoll();
+ resetSocketPath();
}
/// @brief Returns socket file path.
return (socket_path);
}
+ /// @brief Sets the path in which the socket can be created.
+ ///
+ /// @param explicit_path path to use as the socket path.
+ void setSocketTestPath(const std::string explicit_path = string()) {
+ string path(UnixCommandConfig::getSocketPath(
+ true, (!explicit_path.empty() ? explicit_path : TEST_DATA_BUILDDIR)));
+ UnixCommandConfig::setSocketPathPerms(getPermissions(path));
+ }
+
+ /// @brief Resets the socket path to the default.
+ void resetSocketPath() {
+ UnixCommandConfig::getSocketPath(true);
+ UnixCommandConfig::setSocketPathPerms();
+ }
+
/// @brief Removes unix socket descriptor.
void removeUnixSocketFile() {
static_cast<void>(remove(unixSocketFilePath().c_str()));
#include <cc/command_interpreter.h>
#include <cc/data.h>
+#include <config/unix_command_config.h>
#include <netconf/netconf_cfg_mgr.h>
#include <netconf/parser_context.h>
#include <process/testutils/d_test_stubs.h>
using namespace isc::data;
using namespace isc::process;
using namespace isc::test;
+using namespace isc::util::file;
namespace {
srv_.reset(new NakedNetconfCfgMgr());
// Create fresh context.
resetConfiguration();
+ setSocketTestPath();
}
~NetconfGetCfgTest() {
resetConfiguration();
+ resetSocketPath();
}
/// @brief Parse and Execute configuration
EXPECT_TRUE(executeConfiguration(config, "reset config"));
}
+ /// @brief Sets the path in which the socket can be created.
+ ///
+ /// @param explicit_path path to use as the socket path.
+ void setSocketTestPath(const std::string explicit_path = string()) {
+ string path(UnixCommandConfig::getSocketPath(
+ true, (!explicit_path.empty() ? explicit_path : TEST_DATA_BUILDDIR)));
+ UnixCommandConfig::setSocketPathPerms(getPermissions(path));
+ }
+
+ /// @brief Resets the socket path to the default.
+ void resetSocketPath() {
+ UnixCommandConfig::getSocketPath(true);
+ UnixCommandConfig::setSocketPathPerms();
+ }
+
unique_ptr<NakedNetconfCfgMgr> srv_; ///< Netconf server under test
int rcode_; ///< Return code from element parsing
ConstElementPtr comment_; ///< Reason for parse fail
#include <asiolink/testutils/timed_signal.h>
#include <cc/data.h>
+#include <config/unix_command_config.h>
#include <netconf/netconf_controller.h>
#include <netconf/netconf_process.h>
#include <process/testutils/d_test_stubs.h>
#include <gtest/gtest.h>
using namespace isc::asiolink::test;
+using namespace isc::config;
using namespace isc::netconf;
using namespace isc::data;
using namespace isc::http;
/// @brief Constructor.
NetconfControllerTest()
: DControllerTest(NetconfController::instance) {
+ setSocketTestPath();
+ }
+
+ void TearDown() override {
+ resetSocketPath();
}
/// @brief Returns pointer to NetconfProcess instance.
}
return (p);
}
+
+ /// @brief Sets the path in which the socket can be created.
+ ///
+ /// @param explicit_path path to use as the socket path.
+ void setSocketTestPath(const std::string explicit_path = string()) {
+ string path(UnixCommandConfig::getSocketPath(
+ true, (!explicit_path.empty() ? explicit_path : TEST_DATA_BUILDDIR)));
+ UnixCommandConfig::setSocketPathPerms(getPermissions(path));
+ }
+
+ /// @brief Resets the socket path to the default.
+ void resetSocketPath() {
+ UnixCommandConfig::getSocketPath(true);
+ UnixCommandConfig::setSocketPathPerms();
+ }
}; // NetconfControllerTest
// Basic Controller instantiation testing.
removeUnixSocketFile();
io_service_.reset(new IOService());
agent_.reset(new NakedNetconfAgent());
+ setSocketTestPath();
}
void TearDown() override {
removeUnixSocketFile();
SysrepoSetup::cleanSharedMemory();
io_service_->stopAndPoll();
+ resetSocketPath();
}
/// @brief Returns socket file path.
static_cast<void>(remove(unixSocketFilePath().c_str()));
}
+ /// @brief Sets the path in which the socket can be created.
+ ///
+ /// @param explicit_path path to use as the socket path.
+ void setSocketTestPath(const std::string explicit_path = string()) {
+ string path(UnixCommandConfig::getSocketPath(
+ true, (!explicit_path.empty() ? explicit_path : TEST_DATA_BUILDDIR)));
+ UnixCommandConfig::setSocketPathPerms(getPermissions(path));
+ }
+
+ /// @brief Resets the socket path to the default.
+ void resetSocketPath() {
+ UnixCommandConfig::getSocketPath(true);
+ UnixCommandConfig::setSocketPathPerms();
+ }
+
/// @brief Create configuration of the control socket.
///
/// @return a pointer to a control socket configuration.