]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[392-search-of-reservations-by-hostname] Finished core stuff
authorFrancis Dupont <fdupont@isc.org>
Mon, 30 Sep 2019 14:06:03 +0000 (16:06 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 15 Oct 2019 09:45:32 +0000 (11:45 +0200)
doc/sphinx/api-files.txt
doc/sphinx/api/reservation-get-by-hostname.json [new file with mode: 0644]
doc/sphinx/arm/hooks.rst

index bb552ae516f3af583d9f0ec1918e01bb7cac028a..b358a0a93baf550026a89a31e33781b1c6ccf13b 100644 (file)
@@ -121,6 +121,7 @@ api/reservation-add.json
 api/reservation-del.json
 api/reservation-get.json
 api/reservation-get-all.json
+api/reservation-get-by-hostname.json
 api/reservation-get-page.json
 api/server-tag-get.json
 api/shutdown.json
diff --git a/doc/sphinx/api/reservation-get-by-hostname.json b/doc/sphinx/api/reservation-get-by-hostname.json
new file mode 100644 (file)
index 0000000..fb436c9
--- /dev/null
@@ -0,0 +1,24 @@
+{
+    "avail": "1.7.1",
+    "brief": [
+        "This command retrieves all host reservations for a specified hostname and optionally a specified subnet."
+    ],
+    "cmd-syntax": [
+        "{",
+        "    \"command\": \"reservation-get-by-hostname\",",
+        "    \"arguments\": {",
+        "        \"hostname\": <hostname>,",
+        "        \"subnet-id\": <integer>",
+        "    }",
+        "}"
+    ],
+    "hook": "host_cmds",
+    "name": "reservation-get-by-hostname",
+    "resp-comment": [
+        "The reservation-get-by-hostname command may result in large responses."
+    ],
+    "support": [
+        "kea-dhcp4",
+        "kea-dhcp6"
+    ]
+}
index d3da15ae37b251b4c8629f38f566700152bb8668..7e3cd5ee39c80f9a608dfe3f5407af739fa67e1e 100644 (file)
@@ -1184,12 +1184,14 @@ contract.
    This library may only be loaded by the ``kea-dhcp4`` or ``kea-dhcp6``
    process.
 
-Currently, five commands are supported: reservation-add (which adds a new
+Currently, six commands are supported: reservation-add (which adds a new
 host reservation), reservation-get (which returns an existing reservation
 if specified criteria are matched), reservation-get-all (which returns
 all reservations in a specified subnet), reservation-get-page (a variant
 of reservation-get-all which returns all reservations in a specified
-subnet by pages), and reservation-del (which attempts to delete a
+subnet by pages), reservation-get-by-hostname (which returns all reservations
+with a specified hostname and optionally in a subnet) since Kea version
+1.7.1, and reservation-del (which attempts to delete a
 reservation matching specified criteria). To use commands that change
 the reservation information (currently these are reservation-add and
 reservation-del, but this rule applies to other commands that may be
@@ -1229,7 +1231,9 @@ The subnet-id Parameter
 
 Prior to diving into the individual commands, it is worth discussing the
 parameter, ``subnet-id``. Currently this parameter is mandatory for all of the
-commands supplied by this library. In previous versions of Kea, reservations had
+commands supplied by this library at the exception of
+reservation-get-by-hostname where it is optional.
+In previous versions of Kea, reservations had
 to belong to a specific subnet; as of Kea 1.5.0, reservations may
 be specified globally. In other words, they are not specific to any
 subnet. When reservations are supplied via the configuration file, the
@@ -1627,6 +1631,70 @@ small deployments with few reservations, it is easier to use
    Currently ``reservation-get-page`` is not supported by the Cassandra
    host backend.
 
+.. _command-reservation-get-by-hostname:
+
+The reservation-get-by-hostname Command
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``reservation-get-by-hostname`` can be used to query the host database and
+retrieve all reservations with a specified hostname and optionally in
+a specified subnet. This command uses parameters providing the mandatory
+hostname and the optional subnet-id. Global host reservations
+can be retrieved by using a subnet-id value of zero (0).
+Hostname matching is case-insensitive. This command is available since
+Kea version 1.7.1.
+
+For instance, retrieving host reservations for "foobar" in the subnet 1:
+
+::
+
+   {
+       "command": "reservation-get-by-hostname",
+       "arguments": {
+           "hostname": "foobar.example.org",
+           "subnet-id": 1
+        }
+   }
+
+returns some IPv4 hosts:
+
+::
+
+   {
+       "arguments": {
+           "hosts": [
+               {
+                   "boot-file-name": "bootfile.efi",
+                   "client-classes": [ ],
+                   "hostname": "foobar.example.org",
+                   "hw-address": "01:02:03:04:05:06",
+                   "ip-address": "192.0.2.100",
+                   "next-server": "192.0.0.2",
+                   "option-data": [ ],
+                   "server-hostname": "server-hostname.example.org"
+               },
+               ...
+               {
+                   "boot-file-name": "bootfile.efi",
+                   "client-classes": [ ],
+                   "hostname": "foobar.example.org",
+                   "hw-address": "01:02:03:04:05:ff",
+                   "ip-address": "192.0.2.200",
+                   "next-server": "192.0.0.2",
+                   "option-data": [ ],
+                   "server-hostname": "server-hostname.example.org"
+               }
+           ]
+       },
+       "result": 0,
+       "text": "72 IPv4 host(s) found."
+   }
+
+The response returned by ``reservation-get-by-hostname`` can be long
+in particular when responses are not limited to a subnet.
+
+For a reference, see :ref:`command-reservation-get-by-hostname`.
+
 .. _command-reservation-del:
 
 The reservation-del Command