src/share/api/ha-sync-complete-notify.json
src/share/api/interface-list.json
src/share/api/interface-redetect.json
-src/share/api/interface-use.json
+src/share/api/interface-add.json
src/share/api/kea-lfc-start.json
src/share/api/lease4-add.json
src/share/api/lease4-del.json
after performing a re-detect procedure.
This command does not take any parameters."
-.. isccmd:: interface-use
-.. _command-interface-use:
+.. isccmd:: interface-add
+.. _command-interface-add:
-The ``interface-use`` Command
+The ``interface-add`` Command
-----------------------------
-The :isccmd:`interface-use` command updates the list of interfaces used
+The :isccmd:`interface-add` command updates the list of interfaces used
to process DHCP traffic.
The command takes as parameter the list of interfaces with respective
addresses (if specified) on which the server should start listening for
- :isccmd:`dhcp-enable`
- :isccmd:`interface-list`
- :isccmd:`interface-redetect`
-- :isccmd:`interface-use`
+- :isccmd:`interface-add`
- :isccmd:`leases-reclaim`
- :isccmd:`list-commands`
- :isccmd:`shutdown`
- :isccmd:`dhcp-enable`
- :isccmd:`interface-list`
- :isccmd:`interface-redetect`
-- :isccmd:`interface-use`
+- :isccmd:`interface-add`
- :isccmd:`leases-reclaim`
- :isccmd:`list-commands`
- :isccmd:`shutdown`
ConstElementPtr
ControlledDhcpv4Srv::commandInterfaceListHandler(const std::string&,
ConstElementPtr) {
+ // stop thread pool (if running)
+ MultiThreadingCriticalSection cs;
ElementPtr ifaces = Element::createMap();
- bool error = false;
std::string message;
+ bool error = false;
try {
ifaces->set("interfaces", IfaceMgr::instance().ifacesToElement());
} catch (const std::exception& ex) {
ConstElementPtr
ControlledDhcpv4Srv::commandInterfaceRedetectHandler(const std::string&,
ConstElementPtr args) {
- bool error = false;
+ // stop thread pool (if running)
+ MultiThreadingCriticalSection cs;
std::string message;
+ bool error = false;
try {
IfaceMgr::instance().detectIfaces(true);
} catch (const std::exception& ex) {
}
ConstElementPtr
-ControlledDhcpv4Srv::commandInterfaceUseHandler(const std::string&,
+ControlledDhcpv4Srv::commandInterfaceAddHandler(const std::string&,
ConstElementPtr args) {
- bool error = false;
+ // stop thread pool (if running)
+ MultiThreadingCriticalSection cs;
string message;
+ bool error = false;
ConstElementPtr ifaces_config;
if (!args) {
message = "Missing mandatory 'arguments' parameter.";
} else {
if (args->getType() != Element::map) {
- message = "arguments for the 'interface-use' command must be a map";
+ message = "arguments for the 'interface-add' command must be a map";
} else {
ifaces_config = args->get("interfaces");
if (!ifaces_config) {
if (!message.empty()) {
return (isc::config::createAnswer(CONTROL_RESULT_ERROR, message));
}
+ if (!ifaces_config->size()) {
+ return (isc::config::createAnswer(CONTROL_RESULT_SUCCESS, "Configuration successful."));
+ }
try {
+ ElementPtr mutable_cfg = boost::const_pointer_cast<Element>(args);
CfgIfacePtr running_cfg_iface = CfgMgr::instance().getCurrentCfg()->getCfgIface();
ElementPtr mutable_running_cfg = running_cfg_iface->toElement();
- merge(mutable_running_cfg, args);
+ auto const& element_empty = [](ElementPtr&) {
+ return (true);
+ };
+ auto const& element_match_any = [](ElementPtr&, ElementPtr&) -> bool {
+ return (true);
+ };
+ auto const& element_match = [](ElementPtr& left, ElementPtr& right) -> bool {
+ return (left->stringValue() == right->stringValue());
+ };
+ auto const& element_is_key = [](const std::string& key) -> bool {
+ return (key == "interfaces");
+ };
+ isc::data::HierarchyDescriptor hierarchy = {
+ { { "interfaces-config", { element_match_any, element_empty, element_is_key } } },
+ { { "interfaces", { element_match, element_empty, element_is_key } } }
+ };
+ mergeDiffAdd(mutable_running_cfg, mutable_cfg, hierarchy, "interfaces");
IfacesConfigParser parser(AF_INET, true);
CfgIfacePtr cfg_iface(new CfgIface());
parser.parseInterfacesList(cfg_iface, mutable_running_cfg->get("interfaces"));
CommandMgr::instance().registerCommand("interface-redetect",
std::bind(&ControlledDhcpv4Srv::commandInterfaceRedetectHandler, this, ph::_1, ph::_2));
- CommandMgr::instance().registerCommand("interface-use",
- std::bind(&ControlledDhcpv4Srv::commandInterfaceUseHandler, this, ph::_1, ph::_2));
+ CommandMgr::instance().registerCommand("interface-add",
+ std::bind(&ControlledDhcpv4Srv::commandInterfaceAddHandler, this, ph::_1, ph::_2));
CommandMgr::instance().registerCommand("kea-lfc-start",
std::bind(&ControlledDhcpv4Srv::commandLfcStartHandler, this, ph::_1, ph::_2));
CommandMgr::instance().deregisterCommand("dhcp-enable");
CommandMgr::instance().deregisterCommand("interface-list");
CommandMgr::instance().deregisterCommand("interface-redetect");
- CommandMgr::instance().deregisterCommand("interface-use");
+ CommandMgr::instance().deregisterCommand("interface-add");
CommandMgr::instance().deregisterCommand("kea-lfc-start");
CommandMgr::instance().deregisterCommand("leases-reclaim");
CommandMgr::instance().deregisterCommand("subnet4-select-test");
commandInterfaceRedetectHandler(const std::string& command,
isc::data::ConstElementPtr args);
- /// @brief Handler for processing 'interface-use' command
+ /// @brief Handler for processing 'interface-add' command
///
- /// This handler processes interface-use command.
+ /// This handler processes interface-add command.
///
/// @param command (parameter ignored)
/// @param args arguments for the command.
///
/// @return status of the command with the result
isc::data::ConstElementPtr
- commandInterfaceUseHandler(const std::string& command,
+ commandInterfaceAddHandler(const std::string& command,
isc::data::ConstElementPtr args);
/// @Brief handler for processing 'version-get' command
EXPECT_TRUE(command_list.find("\"config-write\"") != string::npos);
EXPECT_TRUE(command_list.find("\"interface-list\"") != string::npos);
EXPECT_TRUE(command_list.find("\"interface-redetect\"") != string::npos);
- EXPECT_TRUE(command_list.find("\"interface-use\"") != string::npos);
+ EXPECT_TRUE(command_list.find("\"interface-add\"") != string::npos);
EXPECT_TRUE(command_list.find("\"kea-lfc-start\"") != string::npos);
EXPECT_TRUE(command_list.find("\"leases-reclaim\"") != string::npos);
EXPECT_TRUE(command_list.find("\"subnet4-select-test\"") != string::npos);
checkListCommands(rsp, "config-write");
checkListCommands(rsp, "interface-list");
checkListCommands(rsp, "interface-redetect");
- checkListCommands(rsp, "interface-use");
+ checkListCommands(rsp, "interface-add");
checkListCommands(rsp, "kea-lfc-start");
checkListCommands(rsp, "list-commands");
checkListCommands(rsp, "leases-reclaim");
EXPECT_EQ(response, expected);
}
-// Tests if interface-use works properly.
-TEST_F(CtrlChannelDhcpv4SrvTest, interfaceUse) {
+// Tests if interface-add works properly.
+TEST_F(CtrlChannelDhcpv4SrvTest, interfaceAdd) {
interfaces_ = "";
IfacePtr eth0 = IfaceMgrTestConfig::createIface("eth0", ETH0_INDEX,
"11:22:33:44:55:66");
SKIP_IF(skipped_);
std::string response;
- std::string command = "{ \"command\": \"interface-use\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }";
+ std::string command = "{ \"command\": \"interface-add\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }";
sendUnixCommand(command, response);
EXPECT_EQ(response, "{ \"result\": 0, \"text\": \"Configuration successful.\" }");
// Tests if interface-redetect works properly.
void testInterfaceRedetect();
- // Tests if interface-use works properly.
- void testInterfaceUse();
+ // Tests if interface-add works properly.
+ void testInterfaceAdd();
// This test verifies that disable DHCP service command performs
// sanity check on parameters.
checkListCommands(rsp, "config-write");
checkListCommands(rsp, "interface-list");
checkListCommands(rsp, "interface-redetect");
- checkListCommands(rsp, "interface-use");
+ checkListCommands(rsp, "interface-add");
checkListCommands(rsp, "kea-lfc-start");
checkListCommands(rsp, "list-commands");
checkListCommands(rsp, "leases-reclaim");
testInterfaceRedetect();
}
-// Tests if interface-use works properly.
+// Tests if interface-add works properly.
void
-BaseCtrlChannelDhcpv4Test::testInterfaceUse() {
+BaseCtrlChannelDhcpv4Test::testInterfaceAdd() {
interfaces_ = "";
IfacePtr eth0 = IfaceMgrTestConfig::createIface("eth0", ETH0_INDEX,
"11:22:33:44:55:66");
IfaceMgr::instance().setPacketFilter(filter);
std::string response;
- std::string command = "{ \"command\": \"interface-use\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }";
+ std::string command = "{ \"command\": \"interface-add\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }";
sendHttpCommand(command, response);
EXPECT_EQ(response, "[ { \"result\": 0, \"text\": \"Configuration successful.\" } ]");
EXPECT_EQ(response, expected);
}
-TEST_F(HttpCtrlChannelDhcpv4Test, interfaceUse) {
- testInterfaceUse();
+TEST_F(HttpCtrlChannelDhcpv4Test, interfaceAdd) {
+ testInterfaceAdd();
}
-TEST_F(HttpsCtrlChannelDhcpv4Test, interfaceUse) {
- testInterfaceUse();
+TEST_F(HttpsCtrlChannelDhcpv4Test, interfaceAdd) {
+ testInterfaceAdd();
}
// This test verifies that disable DHCP service command performs
ConstElementPtr
ControlledDhcpv6Srv::commandInterfaceListHandler(const std::string&,
ConstElementPtr) {
+ // stop thread pool (if running)
+ MultiThreadingCriticalSection cs;
ElementPtr ifaces = Element::createMap();
- bool error = false;
std::string message;
+ bool error = false;
try {
ifaces->set("interfaces", IfaceMgr::instance().ifacesToElement());
} catch (const std::exception& ex) {
ConstElementPtr
ControlledDhcpv6Srv::commandInterfaceRedetectHandler(const std::string&,
ConstElementPtr args) {
- bool error = false;
+ // stop thread pool (if running)
+ MultiThreadingCriticalSection cs;
std::string message;
+ bool error = false;
try {
IfaceMgr::instance().detectIfaces(true);
} catch (const std::exception& ex) {
}
ConstElementPtr
-ControlledDhcpv6Srv::commandInterfaceUseHandler(const std::string&,
+ControlledDhcpv6Srv::commandInterfaceAddHandler(const std::string&,
ConstElementPtr args) {
- bool error = false;
+ // stop thread pool (if running)
+ MultiThreadingCriticalSection cs;
string message;
+ bool error = false;
ConstElementPtr ifaces_config;
if (!args) {
message = "Missing mandatory 'arguments' parameter.";
} else {
if (args->getType() != Element::map) {
- message = "arguments for the 'interface-use' command must be a map";
+ message = "arguments for the 'interface-add' command must be a map";
} else {
ifaces_config = args->get("interfaces");
if (!ifaces_config) {
if (!message.empty()) {
return (isc::config::createAnswer(CONTROL_RESULT_ERROR, message));
}
+ if (!ifaces_config->size()) {
+ return (isc::config::createAnswer(CONTROL_RESULT_SUCCESS, "Configuration successful."));
+ }
try {
+ ElementPtr mutable_cfg = boost::const_pointer_cast<Element>(args);
CfgIfacePtr running_cfg_iface = CfgMgr::instance().getCurrentCfg()->getCfgIface();
ElementPtr mutable_running_cfg = running_cfg_iface->toElement();
- merge(mutable_running_cfg, args);
+ auto const& element_empty = [](ElementPtr&) {
+ return (true);
+ };
+ auto const& element_match_any = [](ElementPtr&, ElementPtr&) -> bool {
+ return (true);
+ };
+ auto const& element_match = [](ElementPtr& left, ElementPtr& right) -> bool {
+ return (left->stringValue() == right->stringValue());
+ };
+ auto const& element_is_key = [](const std::string& key) -> bool {
+ return (key == "interfaces");
+ };
+ isc::data::HierarchyDescriptor hierarchy = {
+ { { "interfaces-config", { element_match_any, element_empty, element_is_key } } },
+ { { "interfaces", { element_match, element_empty, element_is_key } } }
+ };
+ mergeDiffAdd(mutable_running_cfg, mutable_cfg, hierarchy, "interfaces");
IfacesConfigParser parser(AF_INET6, true);
CfgIfacePtr cfg_iface(new CfgIface());
parser.parseInterfacesList(cfg_iface, mutable_running_cfg->get("interfaces"));
CommandMgr::instance().registerCommand("interface-redetect",
std::bind(&ControlledDhcpv6Srv::commandInterfaceRedetectHandler, this, ph::_1, ph::_2));
- CommandMgr::instance().registerCommand("interface-use",
- std::bind(&ControlledDhcpv6Srv::commandInterfaceUseHandler, this, ph::_1, ph::_2));
+ CommandMgr::instance().registerCommand("interface-add",
+ std::bind(&ControlledDhcpv6Srv::commandInterfaceAddHandler, this, ph::_1, ph::_2));
CommandMgr::instance().registerCommand("kea-lfc-start",
std::bind(&ControlledDhcpv6Srv::commandLfcStartHandler, this, ph::_1, ph::_2));
CommandMgr::instance().deregisterCommand("dhcp-enable");
CommandMgr::instance().deregisterCommand("interface-list");
CommandMgr::instance().deregisterCommand("interface-redetect");
- CommandMgr::instance().deregisterCommand("interface-use");
+ CommandMgr::instance().deregisterCommand("interface-add");
CommandMgr::instance().deregisterCommand("kea-lfc-start");
CommandMgr::instance().deregisterCommand("leases-reclaim");
CommandMgr::instance().deregisterCommand("subnet6-select-test");
commandInterfaceRedetectHandler(const std::string& command,
isc::data::ConstElementPtr args);
- /// @brief Handler for processing 'interface-use' command
+ /// @brief Handler for processing 'interface-add' command
///
- /// This handler processes interface-use command.
+ /// This handler processes interface-add command.
///
/// @param command (parameter ignored)
/// @param args arguments for the command.
///
/// @return status of the command with the result
isc::data::ConstElementPtr
- commandInterfaceUseHandler(const std::string& command,
+ commandInterfaceAddHandler(const std::string& command,
isc::data::ConstElementPtr args);
/// @Brief handler for processing 'version-get' command
EXPECT_TRUE(command_list.find("\"config-write\"") != string::npos);
EXPECT_TRUE(command_list.find("\"interface-list\"") != string::npos);
EXPECT_TRUE(command_list.find("\"interface-redetect\"") != string::npos);
- EXPECT_TRUE(command_list.find("\"interface-use\"") != string::npos);
+ EXPECT_TRUE(command_list.find("\"interface-add\"") != string::npos);
EXPECT_TRUE(command_list.find("\"kea-lfc-start\"") != string::npos);
EXPECT_TRUE(command_list.find("\"leases-reclaim\"") != string::npos);
EXPECT_TRUE(command_list.find("\"subnet6-select-test\"") != string::npos);
checkListCommands(rsp, "config-write");
checkListCommands(rsp, "interface-list");
checkListCommands(rsp, "interface-redetect");
- checkListCommands(rsp, "interface-use");
+ checkListCommands(rsp, "interface-add");
checkListCommands(rsp, "kea-lfc-start");
checkListCommands(rsp, "list-commands");
checkListCommands(rsp, "leases-reclaim");
EXPECT_EQ(response, expected);
}
-// Tests if interface-use works properly.
-TEST_F(CtrlChannelDhcpv6SrvTest, interfaceUse) {
+// Tests if interface-add works properly.
+TEST_F(CtrlChannelDhcpv6SrvTest, interfaceAdd) {
interfaces_ = "";
IfacePtr eth0 = IfaceMgrTestConfig::createIface("eth0", ETH0_INDEX,
"11:22:33:44:55:66");
SKIP_IF(skipped_);
std::string response;
- std::string command = "{ \"command\": \"interface-use\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }";
+ std::string command = "{ \"command\": \"interface-add\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }";
sendUnixCommand(command, response);
EXPECT_EQ(response, "{ \"result\": 0, \"text\": \"Configuration successful.\" }");
// Tests if interface-redetect works properly.
void testInterfaceRedetect();
- // Tests if interface-use works properly.
- void testInterfaceUse();
+ // Tests if interface-add works properly.
+ void testInterfaceAdd();
// This test verifies that disable DHCP service command performs
// sanity check on parameters.
checkListCommands(rsp, "config-write");
checkListCommands(rsp, "interface-list");
checkListCommands(rsp, "interface-redetect");
- checkListCommands(rsp, "interface-use");
+ checkListCommands(rsp, "interface-add");
checkListCommands(rsp, "kea-lfc-start");
checkListCommands(rsp, "list-commands");
checkListCommands(rsp, "leases-reclaim");
testInterfaceRedetect();
}
-// Tests if interface-use works properly.
+// Tests if interface-add works properly.
void
-BaseCtrlChannelDhcpv6Test::testInterfaceUse() {
+BaseCtrlChannelDhcpv6Test::testInterfaceAdd() {
interfaces_ = "";
IfacePtr eth0 = IfaceMgrTestConfig::createIface("eth0", ETH0_INDEX,
"11:22:33:44:55:66");
IfaceMgr::instance().setPacketFilter(filter);
std::string response;
- std::string command = "{ \"command\": \"interface-use\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }";
+ std::string command = "{ \"command\": \"interface-add\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }";
sendHttpCommand(command, response);
EXPECT_EQ(response, "[ { \"result\": 0, \"text\": \"Configuration successful.\" } ]");
EXPECT_EQ(response, expected);
}
-TEST_F(HttpCtrlChannelDhcpv6Test, interfaceUse) {
- testInterfaceUse();
+TEST_F(HttpCtrlChannelDhcpv6Test, interfaceAdd) {
+ testInterfaceAdd();
}
-TEST_F(HttpsCtrlChannelDhcpv6Test, interfaceUse) {
- testInterfaceUse();
+TEST_F(HttpsCtrlChannelDhcpv6Test, interfaceAdd) {
+ testInterfaceAdd();
}
// This test verifies that disable DHCP service command performs
"Failed to run: HTTP Error 401: Unauthorized"
shell_command_test "shell.authorized" \
"--auth-user pet --auth-password meow" "list-commands" "" \
- "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]"
+ "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]"
shell_command_test "shell.bad-auth-password-file" \
"--auth-user foo --auth-password-file foobar" "list-commands" "fail" \
"Failed to run: [Errno 2] No such file or directory: 'foobar'"
"Failed to run: HTTP Error 401: Unauthorized"
shell_command_test "shell.good-auth-password-file-content" \
"--auth-user pet --auth-password-file ${tmpfile_path}/auth_password_file" "list-commands" "" \
- "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]"
+ "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]"
shell_command_test "shell.flag-precedence" \
"--auth-user pet --auth-password meow --auth-password-file ${tmpfile_path}/auth_bad_password_file" "list-commands" "fail" \
"Failed to run: HTTP Error 401: Unauthorized"
"Failed to run: HTTP Error 401: Unauthorized"
shell_command_test "shell.authorized" \
"--auth-user pet --auth-password meow" "list-commands" "" \
- "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]"
+ "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]"
shell_command_test "shell.bad-auth-password-file" \
"--auth-user foo --auth-password-file foobar" "list-commands" "fail" \
"Failed to run: [Errno 2] No such file or directory: 'foobar'"
"Failed to run: HTTP Error 401: Unauthorized"
shell_command_test "shell.good-auth-password-file-content" \
"--auth-user pet --auth-password-file ${tmpfile_path}/auth_password_file" "list-commands" "" \
- "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]"
+ "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]"
shell_command_test "shell.flag-precedence" \
"--auth-user pet --auth-password meow --auth-password-file ${tmpfile_path}/auth_bad_password_file" "list-commands" "fail" \
"Failed to run: HTTP Error 401: Unauthorized"
}
shell_command_test "shell.list-commands" "list-commands" \
- "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" ""
+ "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" ""
shell_command_test "shell.bogus" "give-me-a-beer" \
"[ { \"result\": 2, \"text\": \"'give-me-a-beer' command not supported.\" } ]" ""
shell_command_test "shell.empty-config-test" "config-test" \
}
shell_command_test "shell.list-commands" "list-commands" \
- "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" ""
+ "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" ""
shell_command_test "shell.bogus" "give-me-a-beer" \
"[ { \"result\": 2, \"text\": \"'give-me-a-beer' command not supported.\" } ]" ""
shell_command_test "shell.empty-config-test" "config-test" \
}
list_commands_test "NoTLS" "${CONFIG_NONE}" "" \
-"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]"
+"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]"
list_commands_test "Encrypted" "${CONFIG_NOCR}" \
"--ca ${TEST_CA_DIR}/kea-ca.crt" \
-"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]"
+"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]"
list_commands_test "Authenticated" "${CONFIG}" \
"--ca ${TEST_CA_DIR}/kea-ca.crt --cert ${TEST_CA_DIR}/kea-client.crt --key ${TEST_CA_DIR}/kea-client.key" \
-"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]"
+"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]"
}
list_commands_test "NoTLS" "${CONFIG_NONE}" "" \
-"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]"
+"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]"
list_commands_test "Encrypted" "${CONFIG_NOCR}" \
"--ca ${TEST_CA_DIR}/kea-ca.crt" \
-"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]"
+"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]"
list_commands_test "Authenticated" "${CONFIG}" \
"--ca ${TEST_CA_DIR}/kea-ca.crt --cert ${TEST_CA_DIR}/kea-client.crt --key ${TEST_CA_DIR}/kea-client.key" \
-"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]"
+"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]"
// we only handle the relayed (unicast) traffic.
const bool can_use_bcast = use_bcast && (socket_type_ == SOCKET_RAW);
+ reconnect_ctl_->resetRetries();
+
openSocketsWithRetry(reconnect_ctl_, family, port, can_use_bcast);
}
],
"cmd-syntax": [
"{",
- " \"command\": \"interface-use\",",
+ " \"command\": \"interface-add\",",
" \"arguments\": {",
" \"interfaces\": [ \"eth0/10.10.1.1\", \"eth0/192.168.1.1\", \"eth1\"]",
" }",
"}"
],
- "description": "See <xref linkend=\"command-interface-use\"/>",
- "name": "interface-use",
+ "description": "See <xref linkend=\"command-interface-add\"/>",
+ "name": "interface-add",
"resp-syntax": [
"{",
" \"result\": 0,",