purpose, be it lease or hosts information. This arrangement gives the most
flexibility. Kea can be used to keep leases and host reservations
separately, but can also point to the same database. Currently the
- supported hosts database types are MySQL, PostgreSQL and CQL (Cassandra).</para>
- supported hosts database types are MySQL and PostgreSQL. The Cassandra
- backend does not support host reservations yet.</para>
++ supported hosts database types are MySQL, PostgreSQL and Cassandra.</para>
<para>Please note that usage of hosts storage is optional. A user can define
all host reservations in the configuration file. That is the recommended way
with classification using expressions.</para>
</section>
- <section id="reservations4-mysql-pgsql">
- <title>Storing Host Reservations in MySQL or PostgreSQL</title>
+ <section id="reservations4-mysql-pgsql-cql">
- <title>Storing Host Reservations in MySQL, PostgreSQL or CQL (Cassandra)</title>
++ <title>Storing Host Reservations in MySQL, PostgreSQL or Cassandra</title>
<para>
- It is possible to store host reservations in MySQL or PostgreSQL. See <xref
- linkend="hosts6-storage" /> for information on how to configure Kea to use
- reservations stored in MySQL or PostgreSQL. Kea provides dedicated hook for
+ It is possible to store host reservations in MySQL, PostgreSQL or Cassandra. See
- <xref linkend="hosts4-storage"/> for information on how to configure Kea to use
- reservations stored in MySQL, PostgreSQL or Cassandra. Kea does not provide any dedicated
- tools for managing reservations in a database. The Kea wiki <ulink
- url="http://kea.isc.org/wiki/HostReservationsHowTo" /> provides detailed
- information and examples of how reservations can be inserted into the
- database.
++ <xref linkend="hosts6-storage" /> for information on how to configure Kea to use
++ reservations stored in MySQL, PostgreSQL or Cassandra. Kea provides dedicated hook for
+ managing reservations in a database, section <xref linkend="host-cmds" /> provide
+ detailed information.
</para>
- <note><simpara>In Kea 1.1.0 maximum length of an option specified per host is
+ <note><simpara>In Kea maximum length of an option specified per host is
arbitrarily set to 4096 bytes.</simpara></note>
</section>
with classification using expressions.</para>
</section>
- <section id="reservations6-mysql-pgsql">
- <title>Storing Host Reservations in MySQL or PostgreSQL</title>
+ <section id="reservations6-mysql-pgsql-cql">
- <title>Storing Host Reservations in MySQL, PostgreSQL or CQL (Cassandra)</title>
++ <title>Storing Host Reservations in MySQL, PostgreSQL or Cassandra</title>
<para>
- It is possible to store host reservations in MySQL or PostgreSQL. See <xref
- linkend="hosts6-storage" /> for information on how to configure Kea to use
- reservations stored in MySQL or PostgreSQL. Kea provides dedicated hook for
+ It is possible to store host reservations in MySQL, PostgreSQL or Cassandra. See
+ <xref linkend="hosts6-storage" /> for information on how to configure Kea to use
- reservations stored in MySQL, PostgreSQL or Cassandra. Kea does not provide any dedicated
- tools for managing reservations in a database. The Kea wiki <ulink
- url="http://kea.isc.org/wiki/HostReservationsHowTo" /> provides detailed
- information and examples of how reservations can be inserted into the
- database.
++ reservations stored in MySQL, PostgreSQL or Cassandra. Kea provides dedicated hook for
+ managing reservations in a database, section <xref linkend="host-cmds" /> provide
+ detailed information.
</para>
- <note><simpara>In Kea 1.1.0 maximum length of an option specified per host is
+ <note><simpara>In Kea maximum length of an option specified per host is
arbitrarily set to 4096 bytes.</simpara></note>
</section>
if HAVE_CQL
libdhcpsrv_unittests_SOURCES += cql_connection_unittest.cc
libdhcpsrv_unittests_SOURCES += cql_lease_mgr_unittest.cc
+libdhcpsrv_unittests_SOURCES += cql_host_data_source_unittest.cc
endif
libdhcpsrv_unittests_SOURCES += pool_unittest.cc
+ libdhcpsrv_unittests_SOURCES += shared_network_parser_unittest.cc
+ libdhcpsrv_unittests_SOURCES += shared_network_unittest.cc
+ libdhcpsrv_unittests_SOURCES += shared_networks_list_parser_unittest.cc
libdhcpsrv_unittests_SOURCES += srv_config_unittest.cc
libdhcpsrv_unittests_SOURCES += subnet_unittest.cc
libdhcpsrv_unittests_SOURCES += test_get_callout_handle.cc test_get_callout_handle.h
EXPECT_EQ(0, countDBReservations6());
}
-}; // namespace test
-}; // namespace dhcp
-}; // namespace isc
+ void
+ GenericHostDataSourceTest::testMultipleHostsNoAddress4() {
+ // Make sure we have a pointer to the host data source.
+ ASSERT_TRUE(hdsptr_);
+
+ // Create a host with zero IPv4 address.
+ HostPtr host1 = initializeHost4("0.0.0.0", Host::IDENT_HWADDR);
+ host1->setIPv4SubnetID(1);
+ host1->setIPv6SubnetID(0);
+ // Add the host to the database.
+ ASSERT_NO_THROW(hdsptr_->add(host1));
+
+ // An attempt to add this host again should fail due to client identifier
+ // duplication.
+ ASSERT_THROW(hdsptr_->add(host1), DuplicateEntry);
+
+ // Create another host with zero IPv4 address. Adding this host to the
+ // database should be successful because zero addresses are not counted
+ // in the unique index.
+ HostPtr host2 = initializeHost4("0.0.0.0", Host::IDENT_HWADDR);
+ host2->setIPv4SubnetID(1);
+ host2->setIPv6SubnetID(0);
+ ASSERT_NO_THROW(hdsptr_->add(host2));
+ }
+
+ void
+ GenericHostDataSourceTest::testMultipleHosts6() {
+ // Make sure we have a pointer to the host data source.
+ ASSERT_TRUE(hdsptr_);
+
+ // Create first host.
+ HostPtr host1 = initializeHost6("2001:db8::1", Host::IDENT_DUID, false);
+ host1->setIPv4SubnetID(0);
+ host1->setIPv6SubnetID(1);
+ // Add the host to the database.
+ ASSERT_NO_THROW(hdsptr_->add(host1));
+
+ // An attempt to add this host again should fail due to client identifier
+ // duplication.
+ ASSERT_THROW(hdsptr_->add(host1), DuplicateEntry);
+
+ HostPtr host2 = initializeHost6("2001:db8::2", Host::IDENT_DUID, false);
+ host2->setIPv4SubnetID(0);
+ host2->setIPv6SubnetID(1);
+ // Add the host to the database.
+ ASSERT_NO_THROW(hdsptr_->add(host2));
+ }
+
+} // namespace test
+} // namespace dhcp
+} // namespace isc
sqlscriptsdir = ${datarootdir}/${PACKAGE_NAME}/scripts/cql
sqlscripts_DATA = dhcpdb_create.cql
sqlscripts_DATA += dhcpdb_drop.cql
+sqlscripts_DATA += upgrade_1.0_to_2.0.sh
+ sqlscripts_DATA += soft_wipe.cql
-
EXTRA_DIST = ${sqlscripts_DATA}
-
- noinst_EXTRA_DIST = soft_wipe.cql
sqlscripts_DATA += upgrade_4.1_to_5.0.sh
sqlscripts_DATA += upgrade_5.0_to_5.1.sh
-
+ DISTCLEANFILES = upgrade_1.0_to_2.0.sh
+ DISTCLEANFILES += upgrade_2.0_to_3.0.sh
+ DISTCLEANFILES += upgrade_3.0_to_4.0.sh
+ DISTCLEANFILES += upgrade_4.0_to_4.1.sh
+ DISTCLEANFILES += upgrade_4.1_to_5.0.sh
+ DISTCLEANFILES += upgrade_5.0_to_5.1.sh
+
EXTRA_DIST = ${sqlscripts_DATA}