Commit e80018d0 authored by Francis Dupont's avatar Francis Dupont

[393-global-search-through-leases-by-mac-or-hostname-w-o-specifying-a-subnet-i...

[393-global-search-through-leases-by-mac-or-hostname-w-o-specifying-a-subnet-id] Added new command docs
parent 53d0bd53
......@@ -26,6 +26,9 @@ api/ha-sync.json
api/lease4-add.json
api/lease4-del.json
api/lease4-get-all.json
api/lease4-get-by-client-id.json
api/lease4-get-by-hostname.json
api/lease4-get-by-hw-address.json
api/lease4-get.json
api/lease4-update.json
api/lease4-wipe.json
......@@ -33,6 +36,8 @@ api/lease6-add.json
api/lease6-bulk-apply.json
api/lease6-del.json
api/lease6-get-all.json
api/lease6-get-by-duid.json
api/lease6-get-by-hostname.json
api/lease6-get.json
api/lease6-update.json
api/lease6-wipe.json
......
{
"avail": "1.7.1",
"brief": [
"This command retrieves all IPv4 leases with the specified client id."
],
"cmd-syntax": [
"{",
" \"command\": \"lease4-get-by-client-id\",",
" \"arguments\": {",
" \"client-id\": \"42:42:42:42:42:42:42:42\"",
" }",
"}"
],
"description": "See <xref linkend=\"command-lease4-get-by-client-id\"/>",
"hook": "lease_cmds",
"name": "lease4-get-by-client-id",
"support": [
"kea-dhcp4"
]
}
{
"avail": "1.7.1",
"brief": [
"This command retrieves all IPv4 leases with the specified hostname."
],
"cmd-syntax": [
"{",
" \"command\": \"lease4-get-by-hostname\",",
" \"arguments\": {",
" \"hostname\": \"myhost.example.com.\"",
" }",
"}"
],
"description": "See <xref linkend=\"command-lease4-get-by-hostname\"/>",
"hook": "lease_cmds",
"name": "lease4-get-by-hostname",
"support": [
"kea-dhcp4"
]
}
{
"avail": "1.7.1",
"brief": [
"This command retrieves all IPv4 leases with the specified hardware address."
],
"cmd-syntax": [
"{",
" \"command\": \"lease4-get-by-hw-address\",",
" \"arguments\": {",
" \"hw-address\": \"08:08:08:08:08:08\"",
" }",
"}"
],
"description": "See <xref linkend=\"command-lease4-get-by-hw-address\"/>",
"hook": "lease_cmds",
"name": "lease4-get-by-hw-address",
"support": [
"kea-dhcp4"
]
}
{
"avail": "1.7.1",
"brief": [
"This command retrieves all IPv6 leases with the specified hardware address."
],
"cmd-syntax": [
"{",
" \"command\": \"lease6-get-by-duid\",",
" \"arguments\": {",
" \"duid\": \"1a:1b:1c:1d:1e:1f:20:21:22:23:24\"",
" }",
"}"
],
"description": "See <xref linkend=\"command-lease6-get-by-duid\"/>",
"hook": "lease_cmds",
"name": "lease6-get-by-duid",
"support": [
"kea-dhcp6"
]
}
{
"avail": "1.7.1",
"brief": [
"This command retrieves all IPv6 leases with the specified hostname."
],
"cmd-syntax": [
"{",
" \"command\": \"lease6-get-by-hostname\",",
" \"arguments\": {",
" \"hostname\": \"myhost.example.com.\"",
" }",
"}"
],
"description": "See <xref linkend=\"command-lease6-get-by-hostname\"/>",
"hook": "lease_cmds",
"name": "lease6-get-by-hostname",
"support": [
"kea-dhcp6"
]
}
......@@ -59,6 +59,20 @@ This library provides the following commands:
of all IPv6 leases in the database. By iterating through the pages it
is possible to retrieve all the leases.
- ``lease4-get-by-hw-address`` - return all IPv4 leases with the specified
hardware address.
- ``lease4-get-by-client-id`` - return all IPv4 leases with the specified
client id.
- ``lease6-get-by-duid`` - returns all IPv6 leases with the specified duid.
- ``lease4-get-by-hostname`` - return all IPv4 leases with the specified
hostname.
- ``lease6-get-by-hostname`` - return all IPv6 leases with the specified
hostname.
- ``lease4-del`` - deletes an IPv4 lease with the specified parameters.
- ``lease6-del`` - deletes an IPv6 lease with the specified parameters.
......@@ -686,6 +700,50 @@ The client may assume that it has reached the last page when the
includes the case when the ``count`` is equal to 0, meaning that no
leases were found.
.. _command-lease4-get-by-hw-address:
.. _command-lease4-get-by-client-id:
.. _command-lease6-get-by-duid:
.. _command-lease4-get-by-hostname:
.. _command-lease6-get-by-hostname:
The lease4-get-by-*, lease6-get-by-* Commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``leaseX-get-by-Y`` can be used to query the lease database and
retrieve all existing leases with a specified hardware address (IPv4
only), client id IPv4 only), duid (IPv6 only) identifiers or hostname.
An example ``lease4-get-by-hw-address`` command for getting IPv4 leases
with a given hardware address is:
::
{
"command": "lease4-get-by-hw-address",
"arguments": {
"hw-address": "08:08:08:08:08:08"
}
}
An example of the ``lease6-get-by-hostname`` is:
::
{
"command": "lease6-get-by-hostname",
"arguments": {
"hostname": "myhost.example.org"
}
}
The by key is the only parameter. The returned response contains a detailed
list of leases in the same format than ``leaseX-get-all``. This list can be
empty and usually is never large.
.. _command-lease4-del:
.. _command-lease6-del:
......
......@@ -800,9 +800,8 @@ LeaseCmdsImpl::leaseGetByHwAddressHandler(CalloutHandle& handle) {
extractCommand(handle);
// arguments must always be present
if (!cmd_args_) {
isc_throw(BadValue, "no parameters specified for the " << cmd_name_
<< " command");
if (!cmd_args_ || (cmd_args_->getType() != Element::map)) {
isc_throw(BadValue, "Command arguments missing or a not a map.");
}
// the hw-address parameter is mandatory.
......@@ -851,9 +850,8 @@ LeaseCmdsImpl::leaseGetByClientIdHandler(CalloutHandle& handle) {
extractCommand(handle);
// arguments must always be present
if (!cmd_args_) {
isc_throw(BadValue, "no parameters specified for the " << cmd_name_
<< " command");
if (!cmd_args_ || (cmd_args_->getType() != Element::map)) {
isc_throw(BadValue, "Command arguments missing or a not a map.");
}
// the client-id parameter is mandatory.
......@@ -902,9 +900,8 @@ LeaseCmdsImpl::leaseGetByDuidHandler(CalloutHandle& handle) {
extractCommand(handle);
// arguments must always be present
if (!cmd_args_) {
isc_throw(BadValue, "no parameters specified for the " << cmd_name_
<< " command");
if (!cmd_args_ || (cmd_args_->getType() != Element::map)) {
isc_throw(BadValue, "Command arguments missing or a not a map.");
}
// the duid parameter is mandatory.
......@@ -955,9 +952,8 @@ LeaseCmdsImpl::leaseGetByHostnameHandler(CalloutHandle& handle) {
v4 = (cmd_name_ == "lease4-get-by-hostname");
// arguments must always be present
if (!cmd_args_) {
isc_throw(BadValue, "no parameters specified for the " << cmd_name_
<< " command");
if (!cmd_args_ || (cmd_args_->getType() != Element::map)) {
isc_throw(BadValue, "Command arguments missing or a not a map.");
}
// the hostname parameter is mandatory.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment