From: Razvan Becheriu Date: Thu, 22 Feb 2018 11:51:10 +0000 (+0200) Subject: fixed unit tests - added constraints in cql host data source X-Git-Tag: kea5574_base~10^2~1^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f4fd0567cecf0d1764bede7e7efb2cb66bcea42e;p=thirdparty%2Fkea.git fixed unit tests - added constraints in cql host data source --- diff --git a/src/lib/dhcpsrv/cql_host_data_source.cc b/src/lib/dhcpsrv/cql_host_data_source.cc index cd786f08e8..8e501a365e 100644 --- a/src/lib/dhcpsrv/cql_host_data_source.cc +++ b/src/lib/dhcpsrv/cql_host_data_source.cc @@ -1143,8 +1143,15 @@ CqlHostExchange::hashIntoId() const { // Get key. std::stringstream key_stream; - key_stream << std::setw(3 * DUID::MAX_DUID_LEN - 1) << std::setfill('-') - << DUID(host_identifier_).toText(); + if (host_ipv4_address_) { + key_stream << std::setw(3 * DUID::MAX_DUID_LEN - 1) << std::setfill('-') + << "-"; + key_stream << std::setw(10) << std::setfill('-') << "-"; + } else { + key_stream << std::setw(3 * DUID::MAX_DUID_LEN - 1) << std::setfill('-') + << DUID(host_identifier_).toText(); + key_stream << std::setw(10) << std::setfill('-') << host_identifier_type_; + } key_stream << std::setw(10) << std::setfill('-') << host_ipv4_subnet_id_; key_stream << std::setw(10) << std::setfill('-') << host_ipv6_subnet_id_; key_stream << std::setw(V4ADDRESS_TEXT_MAX_LEN) << std::setfill('-') diff --git a/src/lib/dhcpsrv/testutils/host_data_source_utils.cc b/src/lib/dhcpsrv/testutils/host_data_source_utils.cc index 8ad892e874..a13914bdeb 100644 --- a/src/lib/dhcpsrv/testutils/host_data_source_utils.cc +++ b/src/lib/dhcpsrv/testutils/host_data_source_utils.cc @@ -101,8 +101,8 @@ HostDataSourceUtils::initializeHost6(std::string address, // subnet4 with subnet6. static SubnetID subnet4 = 0; static SubnetID subnet6 = 100; - subnet4++; - subnet6++; + ++subnet4; + ++subnet6; HostPtr host(new Host(&ident[0], ident.size(), identifier, subnet4, subnet6, IOAddress("0.0.0.0")));