src/share/api/reservation-get-page.json
src/share/api/reservation-update.json
src/share/api/server-tag-get.json
-src/share/api/sflq-pool4-create.json
src/share/api/sflq-pool4-del.json
src/share/api/sflq-pool4-get-all.json
src/share/api/sflq-pool4-get-by-range.json
src/share/api/sflq-pool4-get-by-subnet.json
-src/share/api/sflq-pool6-create.json
+src/share/api/sflq-pool4-rebuild.json
src/share/api/sflq-pool6-del.json
src/share/api/sflq-pool6-get-all.json
src/share/api/sflq-pool6-get-by-range.json
src/share/api/sflq-pool6-get-by-subnet.json
+src/share/api/sflq-pool6-rebuild.json
src/share/api/shutdown.json
src/share/api/statistic-get.json
src/share/api/statistic-get-all.json
- :isccmd:`lease6-write` - writes the IPv6 memfile lease database into a file.
-- :iscmd:`sflq-pool4-create` - creates an IPv4 SFLQ pool in the lease back end.
+- :isccmd:`sflq-pool4-rebuild` - rebuilds an IPv4 SFLQ pool in the lease back end.
-- :iscmd:`sflq-pool6-create` - creates an IPv6 SFLQ pool in the lease back end.
+- :isccmd:`sflq-pool6-rebuild` - rebuilds an IPv6 SFLQ pool in the lease back end.
-- :iscmd:`sflq-pool4-get-all` - fetches all IPv4 SFLQ pools from the lease back end.
+- :isccmd:`sflq-pool4-get-all` - fetches all IPv4 SFLQ pools from the lease back end.
-- :iscmd:`sflq-pool6-get-all` - fetches all IPv6 SFLQ pools from the lease back end.
+- :isccmd:`sflq-pool6-get-all` - fetches all IPv6 SFLQ pools from the lease back end.
-- :iscmd:`sflq-pool4-get-by-subnet` - fetches all IPv4 SFLQ pools that belong to
+- :isccmd:`sflq-pool4-get-by-subnet` - fetches all IPv4 SFLQ pools that belong to
a subnet from the lease back end.
-- :iscmd:`sflq-pool6-get-by-subnet` - fetches all IPv6 SFLQ pools that belong to
+- :isccmd:`sflq-pool6-get-by-subnet` - fetches all IPv6 SFLQ pools that belong to
a subnet from the lease back end.
-- :iscmd:`sflq-pool4-get-by-range` - fetches all IPv4 SFLQ pools that overlap an
+- :isccmd:`sflq-pool4-get-by-range` - fetches all IPv4 SFLQ pools that overlap an
address range from the lease back end.
-- :iscmd:`sflq-pool6-get-by-range` - fetches all IPv6 SFLQ pools that overlap an
+- :isccmd:`sflq-pool6-get-by-range` - fetches all IPv6 SFLQ pools that overlap an
address range from the lease back end.
-- :iscmd:`sflq-pool4-del` - deletes an IPv4 SFLQ pool that matches an address
+- :isccmd:`sflq-pool4-del` - deletes an IPv4 SFLQ pool that matches an address
range from the lease back end.
-- :iscmd:`sflq-pool6-del` - deletes an IPv6 SFLQ pool that matches an address
+- :isccmd:`sflq-pool6-del` - deletes an IPv6 SFLQ pool that matches an address
range from the lease back end.
All commands use JSON syntax and can be issued either using the control
address or prefix range), must use SFLQ. If some servers do while others
do not, the SFLQ data can quickly become inaccurate. This can be remedied
by stopping any servers that are not using SFLQ for the pool(s) in question
-and recreating the pool(s) using the sflq-pool*-create commands, changing
+and rebuilding the pool(s) using the sflq-pool*-rebuild commands, changing
those servers to use SFLQ for the pool(s) and then restarting them.
The third use case is that of overlapping pools, (i.e. pools whose
from their address ranges could lead to inconsistent results and is generally
not recommended. Commands that fetch SFLQ pools may be safely used at anytime.
-.. isccmd:: sflq-pool4-create
-.. _command-sflq-pool4-create:
+.. isccmd:: sflq-pool4-rebuild
+.. _command-sflq-pool4-rebuild:
-.. isccmd:: sflq-pool6-create
-.. _command-sflq-pool6-create:
+.. isccmd:: sflq-pool6-rebuild
+.. _command-sflq-pool6-rebuild:
-The ``sflq-pool4-create``, ``sflq-pool6-create`` Commands
----------------------------------------------------------
+The ``sflq-pool4-rebuild``, ``sflq-pool6-rebuild`` Commands
+-----------------------------------------------------------
-:isccmd:`sflq-pool4-create` and :isccmd:`sflq-pool6-create` can be used to
-(re)create SFLQ pools and their free lease data. This is useful in cases
+:isccmd:`sflq-pool4-rebuild` and :isccmd:`sflq-pool6-rebuild` can be used to
+rebuild the free lease data for existing SFLQ pools. This is useful in cases
where one or more servers have been using other allocator schemes for
-the address ranges that include SFLQ pools. If the pool already exists,
-the call will simply return. The option ``recreate`` parameter, which
-defaults to false, can be used to force the pool to recreated.
+the address ranges that include SFLQ pools. Issuing the command will cause
+the lease back end to discard and then rebuild the free lease data for the
+given pool. Only a pool that exactly matches the start and end adddress
+given will rebuilt.
-An example :isccmd:`sflq-pool4-create` command for recreating an IPv4 SFLQ
+An example :isccmd:`sflq-pool4-rebuild` command for rebuiding an IPv4 SFLQ
Pool is shown below:
::
"command": "sflq-pool4-create",
"arguments": {
"start-address": "192.0.2.0",
- "end-address": "192.0.2.255",
- "subnet-id" : 100,
- "recreate": true
+ "end-address": "192.0.2.255"
}
}
-Of the parameters shown above, only ``recreate`` is optional.
-
-For IPv6 pools the parameter ``lease-type`` with a value of either "IA_NA"
-or "IA_PD" is required. An example :isccmd:`sflq-pool6-create` command for
-recreating an IPv6 SFLQ pool for an address pool is shown below:
+An example :isccmd:`sflq-pool6-rebuild` command for rebuilding an IPv6
+SFLQ pool for an address pool is shown below:
::
"command": "sflq-pool6-create",
"arguments": {
"start-address": "2001:db8:1::",
- "end-address": "2001:db8:1::FFFF",
- "subnet-id" : 100,
- "lease-type": "IA_NA",
- "recreate": true
- }
- }
-
-For IPv6 prefix delegation pools, the delegated prefix length must be
-specified as ``delegated-len`` which must be greater than 0 and less
-or equal to 128. An example :isccmd:`sflq-pool6-create` command for
-recreating an IPv6 SFLQ pool for a prefix delegation pool is shown below:
-
-::
-
- {
- "command": "sflq-pool6-create",
- "arguments": {
- "start-address": "3001:20::",
- "end-address": "3001:20:0:ff:ffff:ffff:ffff:ffff",
- "subnet-id" : 100,
- "lease-type": "IA_PD",
- "delegated-len": 64,
- "recreate": true
+ "end-address": "2001:db8:1::FFFF"
}
}
::
- { "result": 0, "text": "SFLQ pool created." }
-
-Example failure:
-
-::
-
- { "result": 1, "text": "missing 'lease-type' parameter" }
+ { "result": 0, "text": "SFLQ pool rebuilt." }
.. isccmd:: sflq-pool4-get-all
.. _command-sflq-pool4-get-all:
return(lease_cmds.leaseWriteHandler(handle));
}
-/// @brief This is a command callout for 'sflq-pool4-create' command.
+/// @brief This is a command callout for 'sflq-pool4-rebuild' command.
///
/// @param handle Callout handle used to retrieve a command and
/// provide a response.
/// @return 0 if this callout has been invoked successfully,
/// 1 otherwise.
-int sflq_pool4_create(CalloutHandle& handle) {
+int sflq_pool4_rebuild(CalloutHandle& handle) {
SflqCmds sflq_cmds;
- return(sflq_cmds.sflqPool4CreateHandler(handle));
+ return(sflq_cmds.sflqPool4RebuildHandler(handle));
}
/// @brief This is a command callout for 'sflq-pool4-get-all' command.
return(sflq_cmds.sflqPool4DelHandler(handle));
}
-/// @brief This is a command callout for 'sflq-pool6-create' command.
+/// @brief This is a command callout for 'sflq-pool6-rebuild' command.
///
/// @param handle Callout handle used to retrieve a command and
/// provide a response.
/// @return 0 if this callout has been invoked successfully,
/// 1 otherwise.
-int sflq_pool6_create(CalloutHandle& handle) {
+int sflq_pool6_rebuild(CalloutHandle& handle) {
SflqCmds sflq_cmds;
- return(sflq_cmds.sflqPool6CreateHandler(handle));
+ return(sflq_cmds.sflqPool6RebuildHandler(handle));
}
/// @brief This is a command callout for 'sflq-pool6-get-all' command.
handle.registerCommandCallout("lease6-resend-ddns", lease6_resend_ddns);
handle.registerCommandCallout("lease4-write", lease4_write);
handle.registerCommandCallout("lease6-write", lease6_write);
- handle.registerCommandCallout("sflq-pool4-create", sflq_pool4_create);
+ handle.registerCommandCallout("sflq-pool4-rebuild", sflq_pool4_rebuild);
handle.registerCommandCallout("sflq-pool4-get-all", sflq_pool4_get_all);
handle.registerCommandCallout("sflq-pool4-get-by-subnet", sflq_pool4_get_by_subnet);
handle.registerCommandCallout("sflq-pool4-get-by-range", sflq_pool4_get_by_range);
handle.registerCommandCallout("sflq-pool4-del", sflq_pool4_del);
- handle.registerCommandCallout("sflq-pool6-create", sflq_pool6_create);
+ handle.registerCommandCallout("sflq-pool6-rebuild", sflq_pool6_rebuild);
handle.registerCommandCallout("sflq-pool6-get-all", sflq_pool6_get_all);
handle.registerCommandCallout("sflq-pool6-get-by-subnet", sflq_pool6_get_by_subnet);
handle.registerCommandCallout("sflq-pool6-get-by-range", sflq_pool6_get_by_range);
extern const isc::log::MessageID LEASE_CMDS_WIPE4_FAILED = "LEASE_CMDS_WIPE4_FAILED";
extern const isc::log::MessageID LEASE_CMDS_WIPE6 = "LEASE_CMDS_WIPE6";
extern const isc::log::MessageID LEASE_CMDS_WIPE6_FAILED = "LEASE_CMDS_WIPE6_FAILED";
-extern const isc::log::MessageID SFLQ_POOL4_CREATE = "SFLQ_POOL4_CREATE";
-extern const isc::log::MessageID SFLQ_POOL4_CREATE_FAILED = "SFLQ_POOL4_CREATE_FAILED";
extern const isc::log::MessageID SFLQ_POOL4_DEL = "SFLQ_POOL4_DEL";
extern const isc::log::MessageID SFLQ_POOL4_DEL_FAILED = "SFLQ_POOL4_DEL_FAILED";
extern const isc::log::MessageID SFLQ_POOL4_GET_ALL = "SFLQ_POOL4_GET_ALL";
extern const isc::log::MessageID SFLQ_POOL4_GET_BY_RANGE_FAILED = "SFLQ_POOL4_GET_BY_RANGE_FAILED";
extern const isc::log::MessageID SFLQ_POOL4_GET_BY_SUBNET = "SFLQ_POOL4_GET_BY_SUBNET";
extern const isc::log::MessageID SFLQ_POOL4_GET_BY_SUBNET_FAILED = "SFLQ_POOL4_GET_BY_SUBNET_FAILED";
-extern const isc::log::MessageID SFLQ_POOL6_CREATE = "SFLQ_POOL6_CREATE";
-extern const isc::log::MessageID SFLQ_POOL6_CREATE_FAILED = "SFLQ_POOL6_CREATE_FAILED";
+extern const isc::log::MessageID SFLQ_POOL4_REBUILD = "SFLQ_POOL4_REBUILD";
+extern const isc::log::MessageID SFLQ_POOL4_REBUILD_FAILED = "SFLQ_POOL4_REBUILD_FAILED";
extern const isc::log::MessageID SFLQ_POOL6_DEL = "SFLQ_POOL6_DEL";
extern const isc::log::MessageID SFLQ_POOL6_DEL_FAILED = "SFLQ_POOL6_DEL_FAILED";
extern const isc::log::MessageID SFLQ_POOL6_GET_ALL = "SFLQ_POOL6_GET_ALL";
extern const isc::log::MessageID SFLQ_POOL6_GET_BY_RANGE_FAILED = "SFLQ_POOL6_GET_BY_RANGE_FAILED";
extern const isc::log::MessageID SFLQ_POOL6_GET_BY_SUBNET = "SFLQ_POOL6_GET_BY_SUBNET";
extern const isc::log::MessageID SFLQ_POOL6_GET_BY_SUBNET_FAILED = "SFLQ_POOL6_GET_BY_SUBNET_FAILED";
+extern const isc::log::MessageID SFLQ_POOL6_REBUILD = "SFLQ_POOL6_REBUILD";
+extern const isc::log::MessageID SFLQ_POOL6_REBUILD_FAILED = "SFLQ_POOL6_REBUILD_FAILED";
namespace {
"LEASE_CMDS_WIPE4_FAILED", "lease4-wipe command failed (parameters: %1, reason: %2)",
"LEASE_CMDS_WIPE6", "lease6-wipe command successful (parameters: %1)",
"LEASE_CMDS_WIPE6_FAILED", "lease6-wipe command failed (parameters: %1, reason: %2)",
- "SFLQ_POOL4_CREATE", "sflq-pool4-create command succeeded, (parameters: %1)",
- "SFLQ_POOL4_CREATE_FAILED", "sflq-pool4-create command failed, (parameters: %1, reason: %2)",
"SFLQ_POOL4_DEL", "sflq-pool4-del command succeeded, (parameters: %1) pools deleted: %2",
"SFLQ_POOL4_DEL_FAILED", "sflq-pool4-del command failed, (parameters: %1, reason: %2)",
"SFLQ_POOL4_GET_ALL", "sflq-pool4-get-all command succeeded, pools found: %1",
"SFLQ_POOL4_GET_BY_RANGE_FAILED", "sflq-pool4-get-by-range command failed, (parameters: %1, reason: %2)",
"SFLQ_POOL4_GET_BY_SUBNET", "sflq-pool4-get-by-subnet command succeeded, (parameters: %1) pools found: %2",
"SFLQ_POOL4_GET_BY_SUBNET_FAILED", "sflq-pool4-get-by-subnet command failed, (parameters: %1, reason: %2)",
- "SFLQ_POOL6_CREATE", "sflq-pool6-create command succeeded, (parameters: %1)",
- "SFLQ_POOL6_CREATE_FAILED", "sflq-pool6-create command failed, (parameters: %1, reason: %2)",
+ "SFLQ_POOL4_REBUILD", "sflq-pool4-rebuild command succeeded, (parameters: %1) pools rebuilt: %2",
+ "SFLQ_POOL4_REBUILD_FAILED", "sflq-pool4-rebuild command failed, (parameters: %1, reason: %2)",
"SFLQ_POOL6_DEL", "sflq-pool4-del command succeeded, (parameters: %1) pools deleted: %2",
"SFLQ_POOL6_DEL_FAILED", "sflq-pool4-del command failed, (parameters: %1, reason: %2)",
"SFLQ_POOL6_GET_ALL", "sflq-pool6-get-all command succeeded, pools found: %1",
"SFLQ_POOL6_GET_BY_RANGE_FAILED", "sflq-pool6-get-by-range command failed, (parameters: %1, reason: %2)",
"SFLQ_POOL6_GET_BY_SUBNET", "sflq-pool6-get-by-subnet command succeeded, (parameters: %1) pools found: %2",
"SFLQ_POOL6_GET_BY_SUBNET_FAILED", "sflq-pool6-get-by-subnet command failed, (parameters: %1, reason: %2)",
+ "SFLQ_POOL6_REBUILD", "sflq-pool6-rebuild command succeeded, (parameters: %1) pools rebuilt: %2",
+ "SFLQ_POOL6_REBUILD_FAILED", "sflq-pool6-rebuild command failed, (parameters: %1, reason: %2)",
NULL
};
extern const isc::log::MessageID LEASE_CMDS_WIPE4_FAILED;
extern const isc::log::MessageID LEASE_CMDS_WIPE6;
extern const isc::log::MessageID LEASE_CMDS_WIPE6_FAILED;
-extern const isc::log::MessageID SFLQ_POOL4_CREATE;
-extern const isc::log::MessageID SFLQ_POOL4_CREATE_FAILED;
extern const isc::log::MessageID SFLQ_POOL4_DEL;
extern const isc::log::MessageID SFLQ_POOL4_DEL_FAILED;
extern const isc::log::MessageID SFLQ_POOL4_GET_ALL;
extern const isc::log::MessageID SFLQ_POOL4_GET_BY_RANGE_FAILED;
extern const isc::log::MessageID SFLQ_POOL4_GET_BY_SUBNET;
extern const isc::log::MessageID SFLQ_POOL4_GET_BY_SUBNET_FAILED;
-extern const isc::log::MessageID SFLQ_POOL6_CREATE;
-extern const isc::log::MessageID SFLQ_POOL6_CREATE_FAILED;
+extern const isc::log::MessageID SFLQ_POOL4_REBUILD;
+extern const isc::log::MessageID SFLQ_POOL4_REBUILD_FAILED;
extern const isc::log::MessageID SFLQ_POOL6_DEL;
extern const isc::log::MessageID SFLQ_POOL6_DEL_FAILED;
extern const isc::log::MessageID SFLQ_POOL6_GET_ALL;
extern const isc::log::MessageID SFLQ_POOL6_GET_BY_RANGE_FAILED;
extern const isc::log::MessageID SFLQ_POOL6_GET_BY_SUBNET;
extern const isc::log::MessageID SFLQ_POOL6_GET_BY_SUBNET_FAILED;
+extern const isc::log::MessageID SFLQ_POOL6_REBUILD;
+extern const isc::log::MessageID SFLQ_POOL6_REBUILD_FAILED;
#endif // LEASE_CMDS_MESSAGES_H
The lease6-wipe command has failed. Both the reason as well as the
parameters passed are logged.
-% SFLQ_POOL4_CREATE sflq-pool4-create command succeeded, (parameters: %1)
+% SFLQ_POOL4_REBUILD sflq-pool4-rebuild command succeeded, (parameters: %1) pools rebuilt: %2
Logged at debug log level 20.
-The sflq-pool4-create command was successful.
+The sflq-pool4-rebuild command was successful.
-% SFLQ_POOL4_CREATE_FAILED sflq-pool4-create command failed, (parameters: %1, reason: %2)
-The sflq-pool4-create command has failed. Both the reason as well as the
+% SFLQ_POOL4_REBUILD_FAILED sflq-pool4-rebuild command failed, (parameters: %1, reason: %2)
+The sflq-pool4-rebuild command has failed. Both the reason as well as the
parameters passed are logged.
% SFLQ_POOL4_GET_ALL sflq-pool4-get-all command succeeded, pools found: %1
The sflq-pool4-del command has failed. Both the reason as well as the
parameters passed are logged.
-% SFLQ_POOL6_CREATE sflq-pool6-create command succeeded, (parameters: %1)
+% SFLQ_POOL6_REBUILD sflq-pool6-rebuild command succeeded, (parameters: %1) pools rebuilt: %2
Logged at debug log level 20.
-The sflq-pool6-create command was successful.
+The sflq-pool6-rebuild command was successful.
-% SFLQ_POOL6_CREATE_FAILED sflq-pool6-create command failed, (parameters: %1, reason: %2)
-The sflq-pool6-create command has failed. Both the reason as well as the
+% SFLQ_POOL6_REBUILD_FAILED sflq-pool6-rebuild command failed, (parameters: %1, reason: %2)
+The sflq-pool6-rebuild command has failed. Both the reason as well as the
parameters passed are logged.
% SFLQ_POOL6_GET_ALL sflq-pool6-get-all command succeeded, pools found: %1
Logged at debug log level 20.
-The sflq-pool6-create command was successful.
+The sflq-pool6-rebuild command was successful.
% SFLQ_POOL6_GET_ALL_FAILED sflq-pool6-get-all command failed, (parameters: %1, reason: %2)
The sflq-pool6-get-all command has failed. Both the reason as well as the
"lease4-update", "lease6-update",
"lease4-wipe", "lease6-wipe",
"lease4-resend-ddns", "lease6-resend-ddns",
- "sflq-pool4-create", "sflq-pool6-create",
+ "sflq-pool4-rebuild", "sflq-pool6-rebuild",
"sflq-pool4-get-all", "sflq-pool6-get-all",
"sflq-pool4-get-by-subnet", "sflq-pool6-get-by-subnet",
"sflq-pool4-get-by-range", "sflq-pool6-get-by-range",
/// Provides convenience methods for loading, testing the SLFQ commands.
class SflqCmdsTest : public LibLoadTest {
public:
- /// @brief Pointer to the lease manager
- isc::dhcp::LeaseMgr* lmptr_;
-
/// @brief Constructor
///
/// Sets the library filename and clears the lease manager pointer.
ASSERT_TRUE(LeaseMgrFactory::haveInstance());
ASSERT_EQ(LeaseMgrFactory::instance().getType(), "sflqtest");
- // initSubnet4();
SharedFlqAllocator::setInUse(false);
}
// a clang/boost bug
isc::dhcp::LeaseMgrFactory::destroy();
unloadLibs();
- lmptr_ = 0;
isc::util::file::PathChecker::enableEnforcement(true);
}
/// @brief Destructor
virtual ~SflqCmds4Test() {}
- /// @brief Exercises invalid parameter checks for sflq-pool4-create.
- void sflqPool4CreateBadParams();
+ /// @brief Exercises invalid parameter checks for sflq-pool4-rebuild.
+ void sflqPool4RebuildBadParams();
/// @brief Exercises invalid parameter checks for sflq-pool4-get-all.
void sflqPool4GetAllBadParams();
void testSflqCommands();
};
-void SflqCmds4Test::sflqPool4CreateBadParams() {
+void SflqCmds4Test::sflqPool4RebuildBadParams() {
std::list<BadParamScenario> scenarios = {
{
__LINE__,
)",
"missing 'end-address' parameter"
},
- {
- __LINE__,
- R"(
- "start-address" : "178.0.0.10",
- "end-address" : "178.0.0.20"
- )",
- "missing 'subnet-id' parameter"
- },
{
__LINE__,
R"(
"start-address" : "3001::",
- "end-address" : "178.0.0.20",
- "subnet-id" : 1
+ "end-address" : "178.0.0.20"
)",
"invalid V4 range - start_address 3001::, end_address 178.0.0.20,"
" must be V4 addresses where start_address <= end_address"
__LINE__,
R"(
"start-address" : "178.0.0.20",
- "end-address" : "178.0.0.10",
- "subnet-id" : 1
+ "end-address" : "178.0.0.10"
)",
"invalid V4 range - start_address 178.0.0.20, end_address 178.0.0.10,"
" must be V4 addresses where start_address <= end_address"
R"(
"start-address" : "178.0.0.10",
"end-address" : "178.0.0.20",
- "subnet-id" : "bogus"
- )",
- "'subnet-id' parameter is not an integer"
- },
- {
- __LINE__,
- R"(
- "start-address" : "178.0.0.10",
- "end-address" : "178.0.0.20",
- "subnet-id" : 0
- )",
- "'subnet-id' must be greater than zero"
- },
- {
- __LINE__,
- R"(
- "start-address" : "178.0.0.10",
- "end-address" : "178.0.0.20",
- "subnet-id" : 0,
- "recreate" : 1
- )",
- "'recreate' parameter is not a boolean"
- },
- {
- __LINE__,
- R"(
- "start-address" : "178.0.0.10",
- "end-address" : "178.0.0.20",
- "subnet-id" : 0,
- "recreate" : true,
"bogus" : "fluff"
)",
"spurious 'bogus' parameter"
oss << "Scenario at line: " << scenario.line_;
SCOPED_TRACE(oss.str());
std::ostringstream command;
- command << R"({ "command": "sflq-pool4-create", "arguments": {)"
+ command << R"({ "command": "sflq-pool4-rebuild", "arguments": {)"
<< scenario.args_ << "}}";
testCommand(command.str(), CONTROL_RESULT_ERROR, scenario.exp_rsp_);
// Now create the pools.
for ( auto const& test_pool : test_pools) {
- auto args = test_pool->toElement();
- // Take out what we don't need.
- args->remove("lease-type");
- args->remove("delegated-len");
- args->remove("created-ts");
- args->remove("modified-ts");
- args->remove("free-leases");
- // Add recreate flag.
- args->set("recreate", Element::create(false));
-
- // Initial create should work.
- command = buildCommand("sflq-pool4-create", args);
- testCommand(command, CONTROL_RESULT_SUCCESS, "SFLQ pool created.");
-
- // Trying again without recreate should say it already exists.
- testCommand(command, CONTROL_RESULT_SUCCESS, "SFLQ pool already exists.");
-
- // Recreating it should work.
- args->set("recreate", Element::create(true));
- command = buildCommand("sflq-pool4-create", args);
- testCommand(command, CONTROL_RESULT_SUCCESS, "SFLQ pool created.");
+ // Create the pool directly through lease manager.
+ bool created = false;
+ ASSERT_NO_THROW_LOG(created = LeaseMgrFactory::instance().sflqCreateFlqPool4(
+ test_pool->start_address_, test_pool->end_address_,
+ test_pool->subnet_id_, false));
+ ASSERT_TRUE(created);
+
+ // Rebuild should work.
+ auto args = Element::createMap();
+ args->set("start-address", Element::create(test_pool->start_address_.toText()));
+ args->set("end-address", Element::create(test_pool->end_address_.toText()));
+ command = buildCommand("sflq-pool4-rebuild", args);
+ testCommand(command, CONTROL_RESULT_SUCCESS, "SFLQ pool rebuilt.");
}
+
+ // Rebuild should fail without an exact match.
+ auto args = Element::createMap();
+ args->set("start-address", Element::create(test_pools[0]->start_address_.toText()));
+ args->set("end-address", Element::create(test_pools[2]->end_address_.toText()));
+ command = buildCommand("sflq-pool4-rebuild", args);
+ testCommand(command, CONTROL_RESULT_EMPTY, "SFLQ pool does not exist.");
+
// Fetching all pools should find all three.
command = buildCommand("sflq-pool4-get-all");
auto cmd_rsp = testCommand(command, CONTROL_RESULT_SUCCESS, "3 pool(s) found.");
// Fetch by subnet id for subnet_id = 1.
pool_infos.reset();
- auto args = Element::fromJSON("{\"subnet-id\": 1}");
+ args = Element::fromJSON("{\"subnet-id\": 1}");
command = buildCommand("sflq-pool4-get-by-subnet", args);
cmd_rsp = testCommand(command, CONTROL_RESULT_SUCCESS, "2 pool(s) found.");
pool_infos = extractPools(cmd_rsp);
}
}
-TEST_F(SflqCmds4Test, sflqPool4CreateBadParams) {
- sflqPool4CreateBadParams();
+TEST_F(SflqCmds4Test, sflqPool4RebuildBadParams) {
+ sflqPool4RebuildBadParams();
}
TEST_F(SflqCmds4Test, sflqPool4GetAllBadParams) {
/// @brief Destructor
virtual ~SflqCmds6Test() {}
- /// @brief Exercises invalid parameter checks for sflq-pool6-create.
- void sflqPool6CreateBadParams();
+ /// @brief Exercises invalid parameter checks for sflq-pool6-rebuild.
+ void sflqPool6RebuildBadParams();
/// @brief Exercises invalid parameter checks for sflq-pool6-get-all.
void sflqPool6GetAllBadParams();
void testSflqCommands(Lease::Type lease_type);
};
-void SflqCmds6Test::sflqPool6CreateBadParams() {
+void SflqCmds6Test::sflqPool6RebuildBadParams() {
std::list<BadParamScenario> scenarios = {
{
__LINE__,
__LINE__,
R"(
"start-address" : "3001::10",
- "end-address" : "3001::20"
- )",
- "missing 'subnet-id' parameter"
- },
- {
- __LINE__,
- R"(
- "start-address" : "3001::10",
- "end-address" : "3001::20",
- "subnet-id" : 1
- )",
- "missing 'lease-type' parameter"
- },
- {
- __LINE__,
- R"(
- "start-address" : "3001::10",
- "end-address" : "178.0.0.20",
- "subnet-id" : 1,
- "lease-type": "IA_NA"
+ "end-address" : "178.0.0.20"
)",
"invalid V6 range - start_address 3001::10, end_address 178.0.0.20,"
" must be V6 addresses where start_address <= end_address"
__LINE__,
R"(
"start-address" : "3001::20",
- "end-address" : "3001::10",
- "subnet-id" : 1,
- "lease-type": "IA_NA"
+ "end-address" : "3001::10"
)",
"invalid V6 range - start_address 3001::20, end_address 3001::10,"
" must be V6 addresses where start_address <= end_address"
R"(
"start-address" : "3001::10",
"end-address" : "3001::20",
- "subnet-id" : "bogus",
- "lease-type": "IA_NA"
- )",
- "'subnet-id' parameter is not an integer"
- },
- {
- __LINE__,
- R"(
- "start-address" : "3001::10",
- "end-address" : "3001::20",
- "subnet-id" : 0,
- "lease-type": "IA_NA"
- )",
- "'subnet-id' must be greater than zero"
- },
- {
- __LINE__,
- R"(
- "start-address" : "3001::10",
- "end-address" : "3001::20",
- "subnet-id" : 1,
- "lease-type": "bogus"
- )",
- "invalid V6 'lease-type': bogus, valid values are IA_NA and IA_PD"
- },
- {
- __LINE__,
- R"(
- "start-address" : "3001::10",
- "end-address" : "3001::20",
- "subnet-id" : 1,
- "lease-type": "IA_PD",
- "delegated-len": "bogus"
- )",
- "'delegated-len' parameter is not an integer"
- },
- {
- __LINE__,
- R"(
- "start-address" : "3001::10",
- "end-address" : "3001::20",
- "subnet-id" : 1,
- "lease-type": "IA_PD",
- "delegated-len": 0
- )",
- "'delegated-len' invalid: 0, it must be >= 1 and =< 128"
- },
- {
- __LINE__,
- R"(
- "start-address" : "3001::10",
- "end-address" : "3001::20",
- "subnet-id" : 1,
- "lease-type": "IA_PD",
- "delegated-len": 129
- )",
- "'delegated-len' invalid: 129, it must be >= 1 and =< 128"
- },
- {
- __LINE__,
- R"(
- "start-address" : "3001::10",
- "end-address" : "3001::20",
- "subnet-id" : 0,
- "lease-type": "IA_NA",
- "recreate" : 1
- )",
- "'recreate' parameter is not a boolean"
- },
- {
- __LINE__,
- R"(
- "start-address" : "3001::10",
- "end-address" : "3001::20",
- "subnet-id" : 0,
- "lease-type": "IA_NA",
- "recreate" : true,
"bogus" : "fluff"
)",
"spurious 'bogus' parameter"
- },
- {
- __LINE__,
- R"(
- "start-address" : "3001::10",
- "end-address" : "3001::20",
- "subnet-id" : 100,
- "lease-type": "IA_NA",
- "delegated-len": 56
- )",
- "'delegated-len' must only be 128 for IA_NA pools"
- },
- {
- __LINE__,
- R"(
- "start-address" : "3001::10",
- "end-address" : "3001::20",
- "subnet-id" : 100,
- "lease-type": "IA_PD"
- )",
- "'delegated-len' is required for IA_PD pools"
}
};
oss << "Scenario at line: " << scenario.line_;
SCOPED_TRACE(oss.str());
std::ostringstream command;
- command << R"({ "command": "sflq-pool6-create", "arguments": {)"
+ command << R"({ "command": "sflq-pool6-rebuild", "arguments": {)"
<< scenario.args_ << "}}";
testCommand(command.str(), CONTROL_RESULT_ERROR, scenario.exp_rsp_);
// Now create the pools.
for ( auto const& test_pool : test_pools) {
- auto args = test_pool->toElement();
- // Take out what we don't need.
- args->remove("created-ts");
- args->remove("modified-ts");
- args->remove("free-leases");
- // Add recreate flag.
- args->set("recreate", Element::create(false));
-
- // Initial create should work.
- command = buildCommand("sflq-pool6-create", args);
- testCommand(command, CONTROL_RESULT_SUCCESS, "SFLQ pool created.");
-
- // Trying again without recreate should say it already exists.
- testCommand(command, CONTROL_RESULT_SUCCESS, "SFLQ pool already exists.");
-
- // Recreating it should work.
- args->set("recreate", Element::create(true));
- command = buildCommand("sflq-pool6-create", args);
- testCommand(command, CONTROL_RESULT_SUCCESS, "SFLQ pool created.");
-
+ // Create the pool directly through lease manager.
+ bool created = false;
+ ASSERT_NO_THROW_LOG(created = LeaseMgrFactory::instance().sflqCreateFlqPool6(
+ test_pool->start_address_, test_pool->end_address_,
+ test_pool->lease_type_, test_pool->delegated_len_,
+ test_pool->subnet_id_, false));
+ ASSERT_TRUE(created);
+
+ // Rebuild should work.
+ auto args = Element::createMap();
+ args->set("start-address", Element::create(test_pool->start_address_.toText()));
+ args->set("end-address", Element::create(test_pool->end_address_.toText()));
+ command = buildCommand("sflq-pool6-rebuild", args);
+ testCommand(command, CONTROL_RESULT_SUCCESS, "SFLQ pool rebuilt.");
}
+ // Rebuild should fail without an exact match.
+ auto args = Element::createMap();
+ args->set("start-address", Element::create(test_pools[0]->start_address_.toText()));
+ args->set("end-address", Element::create(test_pools[2]->end_address_.toText()));
+ command = buildCommand("sflq-pool6-rebuild", args);
+ testCommand(command, CONTROL_RESULT_EMPTY, "SFLQ pool does not exist.");
+
// Fetching all pools should find all three.
command = buildCommand("sflq-pool6-get-all");
cmd_rsp = testCommand(command, CONTROL_RESULT_SUCCESS, "3 pool(s) found.");
// Fetch by subnet id for subnet_id = 1.
pool_infos.reset();
- auto args = Element::fromJSON("{\"subnet-id\": 1}");
+ args = Element::fromJSON("{\"subnet-id\": 1}");
command = buildCommand("sflq-pool6-get-by-subnet", args);
cmd_rsp = testCommand(command, CONTROL_RESULT_SUCCESS, "2 pool(s) found.");
pool_infos = extractPools(cmd_rsp);
}
}
-TEST_F(SflqCmds6Test, sflqPool6CreateBadParams) {
- sflqPool6CreateBadParams();
+TEST_F(SflqCmds6Test, sflqPool6RebuildBadParams) {
+ sflqPool6RebuildBadParams();
}
TEST_F(SflqCmds6Test, sflqPool6GetAllBadParams) {
namespace lease_cmds {
int
-SflqCmdsImpl::sflqPool4CreateHandler(CalloutHandle& handle) {
+SflqCmdsImpl::sflqPool4RebuildHandler(CalloutHandle& handle) {
static const data::SimpleKeywords keywords =
{
{ "start-address", Element::string },
{ "end-address", Element::string },
- { "subnet-id", Element::integer },
- { "recreate", Element::boolean }
};
static const data::SimpleRequiredKeywords required_keywords =
{
"start-address",
"end-address",
- "subnet-id",
};
stringstream resp;
IOAddress end_address(IOAddress::IPV4_ZERO_ADDRESS());
extractRange(cmd_args_, AF_INET, start_address, end_address);
- /// @todo Should we verify the subnet-id and/or check allocator for subnet?
- SubnetID subnet_id = SimpleParser::getInteger(cmd_args_, "subnet-id");
- if (subnet_id <= 0) {
- isc_throw(isc::BadValue, "'subnet-id' must be greater than zero");
+ // Fetch pools by range.
+ auto pools = LeaseMgrFactory::instance().sflqPool4Get(start_address, end_address);
+
+ // Since get can return more than one, look for an exact match.
+ bool rebuilt = false;
+ for (auto const& pool : *pools ) {
+ if (pool->start_address_ == start_address && pool->end_address_ == end_address) {
+ // Found a match, rebuild it.
+ // Invoke the pool create function inside a CriticalSection. Rebuilding
+ // large pools can take a long time.
+ MultiThreadingCriticalSection cs;
+ LeaseMgrFactory::instance().sflqCreateFlqPool4(start_address, end_address,
+ pool->subnet_id_, true);
+ rebuilt = true;
+ break;
+ }
}
- bool recreate = extractBool(cmd_args_, "recreate", false);
+ if (rebuilt){
+ auto response = createAnswer(CONTROL_RESULT_SUCCESS,
+ "SFLQ pool rebuilt.", cmd_args_);
+ setResponse(handle, response);
+ } else {
+ auto response = createAnswer(CONTROL_RESULT_EMPTY,
+ "SFLQ pool does not exist.", cmd_args_);
+ setResponse(handle, response);
+ }
- // Invoke the pool create function inside a CriticalSection.
- MultiThreadingCriticalSection cs;
- bool created = LeaseMgrFactory::instance().
- sflqCreateFlqPool4(start_address, end_address, subnet_id, recreate);
+ LOG_DEBUG(lease_cmds_logger, LEASE_CMDS_DBG_COMMAND_DATA, SFLQ_POOL4_REBUILD)
+ .arg(cmd_args_)
+ .arg(rebuilt ? 1 : 0);
- resp << (created ? "SFLQ pool created" : "SFLQ pool already exists") << ".";
} catch (const std::exception& ex) {
- LOG_ERROR(lease_cmds_logger, SFLQ_POOL4_CREATE_FAILED)
+ LOG_ERROR(lease_cmds_logger, SFLQ_POOL4_REBUILD_FAILED)
.arg(cmd_args_ ? cmd_args_->str() : "<no args>")
.arg(ex.what());
setErrorResponse(handle, ex.what());
return (1);
}
- LOG_DEBUG(lease_cmds_logger, LEASE_CMDS_DBG_COMMAND_DATA, SFLQ_POOL4_CREATE)
- .arg(cmd_args_->str());
-
- setSuccessResponse(handle, resp.str());
return (0);
}
}
int
-SflqCmdsImpl::sflqPool6CreateHandler(CalloutHandle& handle) {
+SflqCmdsImpl::sflqPool6RebuildHandler(CalloutHandle& handle) {
static const data::SimpleKeywords keywords =
{
{ "start-address", Element::string },
{ "end-address", Element::string },
- { "subnet-id", Element::integer },
- { "lease-type", Element::string },
- { "delegated-len", Element::integer },
- { "recreate", Element::boolean }
};
static const data::SimpleRequiredKeywords required_keywords =
{
"start-address",
"end-address",
- "subnet-id",
- "lease-type"
};
stringstream resp;
IOAddress end_address(IOAddress::IPV6_ZERO_ADDRESS());
extractRange(cmd_args_, AF_INET6, start_address, end_address);
- /// @todo Should we verify the subnet-id and/or check allocator for subnet?
- SubnetID subnet_id = SimpleParser::getInteger(cmd_args_, "subnet-id");
- if (subnet_id <= 0) {
- isc_throw(isc::BadValue, "'subnet-id' must be greater than zero");
+ // Fetch pools by range.
+ auto pools = LeaseMgrFactory::instance().sflqPool6Get(start_address, end_address);
+
+ // Since get can return more than one, look for an exact match.
+ bool rebuilt = false;
+ for (auto const& pool : *pools ) {
+ if (pool->start_address_ == start_address && pool->end_address_ == end_address) {
+ // Found a match, rebuild it.
+ // Invoke the pool create function inside a CriticalSection. Rebuilding
+ // large pools can take a long time.
+ MultiThreadingCriticalSection cs;
+ LeaseMgrFactory::instance().sflqCreateFlqPool6(start_address, end_address,
+ pool->lease_type_,
+ pool->delegated_len_,
+ pool->subnet_id_, true);
+ rebuilt = true;
+ break;
+ }
}
- auto lease_type = extractLeaseType(cmd_args_, AF_INET6);
- uint8_t delegated_len = extractDelegatedLen(cmd_args_, lease_type);
- bool recreate = extractBool(cmd_args_, "recreate", false);
-
- // Invoke the pool create function inside a CriticalSection.
- MultiThreadingCriticalSection cs;
- bool created = LeaseMgrFactory::instance().
- sflqCreateFlqPool6(start_address, end_address, lease_type,
- delegated_len, subnet_id, recreate);
+ if (rebuilt){
+ auto response = createAnswer(CONTROL_RESULT_SUCCESS,
+ "SFLQ pool rebuilt.", cmd_args_);
+ setResponse(handle, response);
+ } else {
+ auto response = createAnswer(CONTROL_RESULT_EMPTY,
+ "SFLQ pool does not exist.", cmd_args_);
+ setResponse(handle, response);
+ }
- resp << (created ? "SFLQ pool created" : "SFLQ pool already exists") << ".";
+ LOG_DEBUG(lease_cmds_logger, LEASE_CMDS_DBG_COMMAND_DATA, SFLQ_POOL6_REBUILD)
+ .arg(cmd_args_)
+ .arg(rebuilt ? 1 : 0);
} catch (const std::exception& ex) {
- LOG_ERROR(lease_cmds_logger, SFLQ_POOL6_CREATE_FAILED)
+ LOG_ERROR(lease_cmds_logger, SFLQ_POOL6_REBUILD_FAILED)
.arg(cmd_args_ ? cmd_args_->str() : "<no args>")
.arg(ex.what());
setErrorResponse(handle, ex.what());
return (1);
}
- LOG_DEBUG(lease_cmds_logger, LEASE_CMDS_DBG_COMMAND_DATA, SFLQ_POOL6_CREATE)
- .arg(cmd_args_->str());
-
- setSuccessResponse(handle, resp.str());
return (0);
}
<< tmp << ", valid values are IA_NA and IA_PD");
}
-uint8_t
-SflqCmdsImpl::extractDelegatedLen(ConstElementPtr& params,
- Lease::Type lease_type) {
- auto tmp = params->get("delegated-len");
- if (!tmp) {
- if (lease_type == Lease::TYPE_PD) {
- isc_throw(BadValue, "'delegated-len' is required for IA_PD pools");
- }
-
- return (128);
- }
-
- if (tmp->getType() != Element::integer) {
- isc_throw(BadValue, "'delegated-len' parameter is not integer.");
- }
-
- auto val = tmp->intValue();
- if (val <= 0 || val > 128) {
- isc_throw(BadValue, "'delegated-len' invalid: " << val
- << ", it must be >= 1 and =< 128");
- }
-
- if (lease_type == Lease::TYPE_NA && val != 128) {
- isc_throw(BadValue, "'delegated-len' must only be 128 for IA_NA pools");
- }
-
- return (val);
-}
-
SflqCmds::SflqCmds()
: sflq_impl_(new SflqCmdsImpl()) {
}
int
-SflqCmds::sflqPool4CreateHandler(CalloutHandle& handle) {
- return (sflq_impl_->sflqPool4CreateHandler(handle));
+SflqCmds::sflqPool4RebuildHandler(CalloutHandle& handle) {
+ return (sflq_impl_->sflqPool4RebuildHandler(handle));
}
int
}
int
-SflqCmds::sflqPool6CreateHandler(CalloutHandle& handle) {
- return (sflq_impl_->sflqPool6CreateHandler(handle));
+SflqCmds::sflqPool6RebuildHandler(CalloutHandle& handle) {
+ return (sflq_impl_->sflqPool6RebuildHandler(handle));
}
int
/// @brief Destructor.
virtual ~SflqCmdsImpl() {};
- /// @brief The 'sflq-pool4-create' command handler
+ /// @brief The 'sflq-pool4-rebuild' command handler
///
/// It extracts the command name and arguments from the given CalloutHandle,
/// attempts to process them, and then set's the handle's "response"
///
/// An example command with all supported arguments is shown below:
/// {
- /// "command": "sflq-pool4-create",
+ /// "command": "sflq-pool4-rebuild",
/// "arguments": {
/// "start-address": "192.0.2.0",
- /// "end-address": "192.0.2.255",
- /// "subnet-id": 77,
- /// "recreate": true
+ /// "end-address": "192.0.2.255"
/// }
/// }
///
- /// The 'recreate' parameter is optional, it defaults false.
- ///
/// @param handle Callout context - which is expected to contain the
/// the command JSON text in the "command" argument
/// @return result of the operation
- int sflqPool4CreateHandler(hooks::CalloutHandle& handle);
+ int sflqPool4RebuildHandler(hooks::CalloutHandle& handle);
/// @brief The 'sflq-pool4-get-all' command handler
///
/// @return result of the operation
int sflqPool4DelHandler(hooks::CalloutHandle& handle);
- /// @brief The 'sflq-pool6-create' command handler
+ /// @brief The 'sflq-pool6-rebuild' command handler
///
/// It extracts the command name and arguments from the given CalloutHandle,
/// attempts to process them, and then set's the handle's "response"
///
/// An example command with all supported arguments is shown below:
/// {
- /// "command": "sflq-pool6-create",
+ /// "command": "sflq-pool6-rebuild",
/// "arguments": {
/// "start-address": "3001::",
- /// "end-address": "3001::FF",
- /// "subnet-id": 77,
- /// "lease-type" : "IA_PD",
- /// "delegated_len: 64
- /// "recreate": true
+ /// "end-address": "3001::FF"
/// }
/// }
///
- /// The 'recreate' parameter is optional, it defaults false.
- ///
/// @param handle Callout context - which is expected to contain the
/// the command JSON text in the "command" argument
/// @return result of the operation
- int sflqPool6CreateHandler(hooks::CalloutHandle& handle);
+ int sflqPool6RebuildHandler(hooks::CalloutHandle& handle);
/// @brief The 'sflq-pool6-get-all' command handler
///
static bool extractBool(data::ConstElementPtr& params, const std::string& name,
bool default_value = false);
- /// @brief Extracts 'delegated-len' from given parameters map
- ///
- /// Extracts an integer element, 'delegate-len' from the given map
- /// if it is present and is >= 1 and <= 128. If it is not present
- /// it returns a value of 128.
- ///
- /// @param params Element map containing the command arguments.
- /// @param lease_type Lease::Type supplied with the arguments (IA_NA
- /// or IA_PD)
- ///
- /// @throw BadValue if the parameter is specified as anything other
- /// than an integer value >= 1 and <= 128.
- static uint8_t extractDelegatedLen(data::ConstElementPtr& params,
- dhcp::Lease::Type lease_type);
-
- /// @brief Extracts 'delegated-len' from given parameters map
+ /// @brief Extracts 'lease-type' from given parameters map
///
/// Extracts a string element, 'lease-type' from the given map
/// For v4 it can be either "V4" or "3", for V6 it can be "IA_NA"
/// It creates an instance of the @c SflqCmds
SflqCmds();
- /// @brief sflq-pool4-create handler.
+ /// @brief sflq-pool4-rebuild handler.
///
/// Invokes LeaseMgr::sflqCreateFlqPool4() after parsing the arguments.
/// @brief lease6-resend-ddns command handler
///
/// An example command with all supported arguments is shown below:
/// {
- /// "command": "sflq-pool4-create",
+ /// "command": "sflq-pool4-rebuild",
/// "arguments": {
/// "start-address": "192.0.2.0",
- /// "end-address": "192.0.2.255",
- /// "subnet-id": 77,
- /// "recreate": true
+ /// "end-address": "192.0.2.255"
/// }
/// }
///
- /// The 'recreate' parameter is optional, it defaults false.
- ///
/// @param handle Callout context - which is expected to contain the
/// the command JSON text in the "command" argument
/// @return result of the operation
- int sflqPool4CreateHandler(hooks::CalloutHandle& handle);
+ int sflqPool4RebuildHandler(hooks::CalloutHandle& handle);
/// @brief The 'sflq-pool4-get-all' command handler
///
/// @return result of the operation
int sflqPool4DelHandler(hooks::CalloutHandle& handle);
- /// @brief The 'sflq-pool6-create' command handler
+ /// @brief The 'sflq-pool6-rebuild' command handler
///
/// It extracts the command name and arguments from the given CalloutHandle,
/// attempts to process them, and then set's the handle's "response"
///
/// An example command with all supported arguments is shown below:
/// {
- /// "command": "sflq-pool6-create",
+ /// "command": "sflq-pool6-rebuild",
/// "arguments": {
/// "start-address": "3001::",
- /// "end-address": "3001::FF",
- /// "subnet-id": 77,
- /// "lease-type" : "IA_PD",
- /// "delegated_len: 64
- /// "recreate": true
+ /// "end-address": "3001::FF"
/// }
/// }
///
- /// The 'delegated-len' is optional, it defaults to 128.
- /// The 'recreate' parameter is optional, it defaults false.
- ///
/// @param handle Callout context - which is expected to contain the
/// the command JSON text in the "command" argument
/// @return result of the operation
- int sflqPool6CreateHandler(hooks::CalloutHandle& handle);
+ int sflqPool6RebuildHandler(hooks::CalloutHandle& handle);
/// @brief The 'sflq-pool6-get-all' command handler
///
ctx->conn_.selectQuery(stindex, where_bindings, out_bindings,
[&pools]
- (MySqlBindingCollection& out_bindings) {
+ (MySqlBindingCollection& result) {
SflqPoolInfoPtr info(new SflqPoolInfo());
// db pool id is 0, we skip it
- info->subnet_id_ = out_bindings[1]->getInteger<uint32_t>();
- auto lease_type_ = out_bindings[2]->getInteger<uint32_t>();
+ info->subnet_id_ = result[1]->getInteger<uint32_t>();
+ auto lease_type_ = result[2]->getInteger<uint32_t>();
switch(lease_type_) {
case Lease::TYPE_V4:
info->lease_type_ = Lease::TYPE_V4;
}
if (lease_type_ == Lease::TYPE_V4) {
- info->start_address_ = IOAddress(out_bindings[3]->getInteger<uint32_t>());
- info->end_address_ = IOAddress(out_bindings[4]->getInteger<uint32_t>());
+ info->start_address_ = IOAddress(result[3]->getInteger<uint32_t>());
+ info->end_address_ = IOAddress(result[4]->getInteger<uint32_t>());
} else {
- info->start_address_ = IOAddress(out_bindings[3]->getString());
- info->end_address_ = IOAddress(out_bindings[4]->getString());
+ info->start_address_ = IOAddress(result[3]->getString());
+ info->end_address_ = IOAddress(result[4]->getString());
}
- info->delegated_len_ = out_bindings[5]->getInteger<uint32_t>();
- info->created_ts_ = out_bindings[6]->getTimestamp();
- info->modified_ts_ = out_bindings[7]->getTimestamp();
- info->free_leases_ = out_bindings[8]->getInteger<uint64_t>();
+ info->delegated_len_ = result[5]->getInteger<uint32_t>();
+ info->created_ts_ = result[6]->getTimestamp();
+ info->modified_ts_ = result[7]->getTimestamp();
+ info->free_leases_ = result[8]->getInteger<uint64_t>();
pools->push_back(info);
});
"access": "write",
"avail": "3.1.9",
"brief": [
- "This command instructs the lease back end to create a v4 SFLQ pool and its free lease data."
+ "This command instructs the lease back rebuild the free lease data for a v4 SFLQ pool."
],
"cmd-syntax": [
"{",
" \"command\": \"sflq-pool4-create\",",
" \"arguments\": {",
" \"start-address\": \"1.2.3.4\",",
- " \"end-address\": \"1.2.3.4\",",
- " \"subnet-id\": 123,",
- " \"recreate\" : false",
+ " \"end-address\": \"1.2.3.4\"",
" }",
"}"
],
- "description": "See <xref linkend=\"command-sflq-pool4-create\"/>",
+ "description": "See <xref linkend=\"command-sflq-pool4-rebuild\"/>",
"hook": "lease_cmds",
- "name": "sflq-pool4-create",
+ "name": "sflq-pool4-rebuild",
"resp-syntax": [
"{",
" \"result\": 0,",
- " \"text\": \"SFLQ pool created.\"",
+ " \"text\": \"SFLQ pool rebuilt.\"",
"}"
],
"support": [
+++ /dev/null
-{
- "access": "write",
- "avail": "3.1.9",
- "brief": [
- "This command instructs the lease back end to create a v6 SFLQ pool and its free lease data."
- ],
- "cmd-syntax": [
- "{",
- " \"command\": \"sflq-pool6-create\",",
- " \"arguments\": {",
- " \"start-address\": \"2001:db8:1::\",",
- " \"end-address\": \"2001:db8:1::ffff\",",
- " \"lease-type\": \"IA_PD\"," ,
- " \"delegated-len\": 120,",
- " \"recreate\" : false",
- " }",
- "}"
- ],
- "description": "See <xref linkend=\"command-sflq-pool6-create\"/>",
- "hook": "lease_cmds",
- "name": "sflq-pool6-create",
- "resp-syntax": [
- "{",
- " \"result\": 0,",
- " \"text\": \"SFLQ pool created.\"",
- "}"
- ],
- "support": [
- "kea-dhcp4",
- "kea-dhcp6"
- ]
-}
--- /dev/null
+{
+ "access": "write",
+ "avail": "3.1.9",
+ "brief": [
+ "This command instructs the lease back end rebuild the free lease data for a v6 SFLQ pool."
+ ],
+ "cmd-syntax": [
+ "{",
+ " \"command\": \"sflq-pool6-rebuild\",",
+ " \"arguments\": {",
+ " \"start-address\": \"2001:db8:1::\",",
+ " \"end-address\": \"2001:db8:1::ffff\"",
+ " }",
+ "}"
+ ],
+ "description": "See <xref linkend=\"command-sflq-pool6-rebuild\"/>",
+ "hook": "lease_cmds",
+ "name": "sflq-pool6-rebuild",
+ "resp-syntax": [
+ "{",
+ " \"result\": 0,",
+ " \"text\": \"SFLQ pool rebuilt.\"",
+ "}"
+ ],
+ "support": [
+ "kea-dhcp4",
+ "kea-dhcp6"
+ ]
+}