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
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
--- /dev/null
+{
+ "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"
+ ]
+}
--- /dev/null
+{
+ "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"
+ ]
+}
--- /dev/null
+{
+ "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"
+ ]
+}
--- /dev/null
+{
+ "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"
+ ]
+}
--- /dev/null
+{
+ "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"
+ ]
+}
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.
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:
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.
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.
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.
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.