]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
Merge remote-tracking branch 'andrei-remote/cassandra-update' into HEAD
authorRazvan Becheriu <razvan.becheriu@qualitance.com>
Tue, 12 Dec 2017 11:41:58 +0000 (13:41 +0200)
committerRazvan Becheriu <razvan.becheriu@qualitance.com>
Tue, 12 Dec 2017 11:41:58 +0000 (13:41 +0200)
1  2 
configure.ac
doc/guide/dhcp4-srv.xml
doc/guide/dhcp6-srv.xml
src/lib/dhcpsrv/Makefile.am
src/lib/dhcpsrv/host_data_source_factory.cc
src/lib/dhcpsrv/mysql_host_data_source.cc
src/lib/dhcpsrv/tests/Makefile.am
src/lib/dhcpsrv/tests/generic_host_data_source_unittest.cc
src/lib/dhcpsrv/tests/generic_host_data_source_unittest.h
src/share/database/scripts/cql/Makefile.am
src/share/database/scripts/mysql/Makefile.am

diff --cc configure.ac
Simple merge
index 8bae9a1d3f3ba3a8ce497f4f736ff9f66b59441f,6de398ff0ce7259f681064196626b07f52baa871..7738ef1353efba1711ec9c29d2c4aafb4b2f8098
@@@ -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).</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
@@@ -3145,20 -3387,18 +3386,18 @@@ It is merely echoed by the serve
      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>
  
index 47f1039ecf166117d92e176b979becf18efbfad2,67e181d2bdd5b8d6e6ace3b254f350448ccfd8b1..e1f7ca488e0ebed88b4e573b10c7d9cb50f33c54
@@@ -2862,20 -2905,18 +2905,18 @@@ should include options from the isc opt
      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>
  
Simple merge
index 9beafc8813c307e43599aeaee38076613ca78ab5,54abcf39197358fe79cad592dcdbe3f4d12928dd..5e4580ba6ad5c6582c0da7c8b14cace6a88c16db
@@@ -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
index 3a1301fd97a2cc161a358889bf691a2e4efb255e,71f9f46f7e4665dfe7e03beec2c2e5d2f09aa7d2..607b7ab024972170a786a1217e8d22177b25491e
@@@ -1718,6 -1655,54 +1718,54 @@@ void GenericHostDataSourceTest::testDel
      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
index 369b371b53b5f052490b14a1c20df696ec315d62,6c3efd69e03ed5eb5be3c23d76258aed5eaaccd9..46f8e26f8e9c125c7b796ca9a8233c7527b1c627
@@@ -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
index cbd9d26f20a79c152113fa645912b615c0d98b19,2469328d041bdca2acd98584d051d1e67aa9a5b2..d5eb5d474a6cea3fc149e014b14dbf1dcbda5d10
@@@ -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}