From: Razvan Becheriu Date: Tue, 12 Dec 2017 11:41:58 +0000 (+0200) Subject: Merge remote-tracking branch 'andrei-remote/cassandra-update' into HEAD X-Git-Tag: trac5425a_base~11^2~1^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fd9677be655e31ee6869053b4e269e0fdcbe711;p=thirdparty%2Fkea.git Merge remote-tracking branch 'andrei-remote/cassandra-update' into HEAD --- 5fd9677be655e31ee6869053b4e269e0fdcbe711 diff --cc doc/guide/dhcp4-srv.xml index 8bae9a1d3f,6de398ff0c..7738ef1353 --- a/doc/guide/dhcp4-srv.xml +++ b/doc/guide/dhcp4-srv.xml @@@ -517,7 -517,8 +517,7 @@@ If a timeout is given though, it shoul 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). - supported hosts database types are MySQL and PostgreSQL. The Cassandra - backend does not support host reservations yet. ++ supported hosts database types are MySQL, PostgreSQL and Cassandra. 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 @@@ -3145,20 -3387,18 +3386,18 @@@ It is merely echoed by the serve with classification using expressions. -
- Storing Host Reservations in MySQL or PostgreSQL +
- Storing Host Reservations in MySQL, PostgreSQL or CQL (Cassandra) ++ Storing Host Reservations in MySQL, PostgreSQL or Cassandra - It is possible to store host reservations in MySQL or PostgreSQL. See 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 - 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 provides detailed - information and examples of how reservations can be inserted into the - database. ++ 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 provide + detailed information. - In Kea 1.1.0 maximum length of an option specified per host is + In Kea maximum length of an option specified per host is arbitrarily set to 4096 bytes.
diff --cc doc/guide/dhcp6-srv.xml index 47f1039ecf,67e181d2bd..e1f7ca488e --- a/doc/guide/dhcp6-srv.xml +++ b/doc/guide/dhcp6-srv.xml @@@ -2862,20 -2905,18 +2905,18 @@@ should include options from the isc opt with classification using expressions.
-
- Storing Host Reservations in MySQL or PostgreSQL +
- Storing Host Reservations in MySQL, PostgreSQL or CQL (Cassandra) ++ Storing Host Reservations in MySQL, PostgreSQL or Cassandra - It is possible to store host reservations in MySQL or PostgreSQL. See 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 + 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 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 provide + detailed information. - In Kea 1.1.0 maximum length of an option specified per host is + In Kea maximum length of an option specified per host is arbitrarily set to 4096 bytes.
diff --cc src/lib/dhcpsrv/tests/Makefile.am index 9beafc8813,54abcf3919..5e4580ba6a --- a/src/lib/dhcpsrv/tests/Makefile.am +++ b/src/lib/dhcpsrv/tests/Makefile.am @@@ -120,9 -123,11 +123,12 @@@ endi 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 diff --cc src/lib/dhcpsrv/tests/generic_host_data_source_unittest.cc index 3a1301fd97,71f9f46f7e..607b7ab024 --- a/src/lib/dhcpsrv/tests/generic_host_data_source_unittest.cc +++ b/src/lib/dhcpsrv/tests/generic_host_data_source_unittest.cc @@@ -1718,6 -1655,54 +1718,54 @@@ void GenericHostDataSourceTest::testDel EXPECT_EQ(0, countDBReservations6()); } + 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 +} // namespace test +} // namespace dhcp +} // namespace isc diff --cc src/share/database/scripts/cql/Makefile.am index 369b371b53,6c3efd69e0..46f8e26f8e --- a/src/share/database/scripts/cql/Makefile.am +++ b/src/share/database/scripts/cql/Makefile.am @@@ -3,8 -3,7 +3,7 @@@ SUBDIRS = 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 diff --cc src/share/database/scripts/mysql/Makefile.am index cbd9d26f20,2469328d04..d5eb5d474a --- a/src/share/database/scripts/mysql/Makefile.am +++ b/src/share/database/scripts/mysql/Makefile.am @@@ -10,4 -10,12 +10,11 @@@ sqlscripts_DATA += upgrade_4.0_to_4.1.s 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}