<para>
The <xref linkend="lease-cmds"/> section describes commands used to retrieve,
update and delete leases using various identifiers, e.g. "hw-address",
- "client-id". The lease_cmds library doesn't navtively support querying for
+ "client-id". The lease_cmds library doesn't natively support querying for
leases by flexible identifier. However, when "replace-client-id" is set to
true, it makes it possible to query for leases using a value derived from
the flexible identifier. In the DHCPv4 case, the query will look similar to this:
<section>
<title>reservation-add command</title>
<para>
- <command>reservation-add</command> allows insertion of a new host. It
+ <command>reservation-add</command> allows for the insertion of a new host. It
takes a set of arguments that vary depending on the nature of the host
reservation. Any parameters allowed in the configuration file that
pertain to host reservation are permitted here. For details regarding
<title>lease4-add, lease6-add commands</title>
<para>
<command>lease4-add</command> and <command>lease6-add</command>
- commands allow for creation of a new lease. Typically Kea creates a lease
+ commands allow for the creation of a new lease. Typically Kea creates a lease
on its own, when it first sees a new device. However, sometimes it may
be convenient to create the lease administratively. The
<command>lease4-add</command> command requires at least three
used when the address (either IPv4 or IPv6) is known, but the details
of the lease aren't. One common use case of this type of query is to
find out whether a given address is being used or not. The second
- query uses identifiers. Currently supported identifiers for are:
+ query uses identifiers. Currently supported identifiers for leases are:
"hw-address" (IPv4 only), "client-id" (IPv4 only) and "duid" (IPv6 only).
</para>
<para><command>leaseX-del</command> returns a result that
indicates a outcome of the operation. It has one of the
- following values: 0 (success), 1 (error) or 2 (empty). The
+ following values: 0 (success), 1 (error) or 3 (empty). The
empty result means that a query has been completed properly,
but the object (a lease in this case) has not been found.
</para>
checkLease4(lease, "192.0.2.1", 44, "08:08:08:08:08:08", false);
}
+// Checks that lease6-get rejects queries by client-id.
+TEST_F(LeaseCmdsTest, Lease6GetByClientIdInvalidType) {
+
+ // Initialize lease manager (true = v6, true = add a lease)
+ initLeaseMgr(true, true);
+
+ // client-id query is allowed in v4 only.
+ string cmd =
+ "{\n"
+ " \"command\": \"lease6-get\",\n"
+ " \"arguments\": {"
+ " \"identifier-type\": \"client-id\","
+ " \"identifier\": \"01:02:03:04\","
+ " \"subnet-id\": 44"
+ " }\n"
+ "}";
+ string exp_rsp = "Query by client-id is not allowed in v6.";
+ ConstElementPtr rsp = testCommand(cmd, CONTROL_RESULT_ERROR, exp_rsp);
+}
+
// Checks that lease6-get(subnet-id, addr) can handle a situation when
// the query is correctly formed, but the lease is not there.
TEST_F(LeaseCmdsTest, Lease6GetByDuidNotFound) {