Commit 8060cb78 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[github37] Various changes after review

parent b64567ca
......@@ -593,7 +593,7 @@ $ <userinput>kea-admin lease-upgrade pgsql -u <replaceable>database-user</replac
Cassandra, or Cassandra Query Language (CQL), is the newest backend
added to Kea. Since it was added recently and has not undergone as much
testing as other backends, it is considered experimental. Please use
with caution. The Casandra backend is currently able to store leases,
with caution. The Cassandra backend is able to store leases,
host reservations and options defined on a per host basis.
</para>
......
// Copyright (C) 2010-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2010-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -23,11 +23,20 @@
namespace isc {
namespace asiolink {
/// Defines length of IPv6 address.
const static size_t V6ADDRESS_LEN = 16;
/// Defines length of IPv6 address (in binary format).
static constexpr size_t V6ADDRESS_LEN = 16;
/// Defines length of IPv4 address.
const static size_t V4ADDRESS_LEN = 4;
/// Defines length of IPv4 address (in binary format).
static constexpr size_t V4ADDRESS_LEN = 4;
/// @brief Maximum size of an IPv4 address represented as a text string. 12
/// digits plus 3 full stops (dots).
static constexpr size_t V4ADDRESS_TEXT_MAX_LEN = 15u;
/// @brief Maximum size of an IPv6 address represented as a text string. 32
/// hexadecimal characters written in 8 groups of four, plus 7 colon
/// separators.
static constexpr size_t V6ADDRESS_TEXT_MAX_LEN = 39u;
/// \brief The \c IOAddress class represents an IP addresses (version
/// agnostic)
......
......@@ -142,11 +142,13 @@ public:
///
/// Opens the database using the information supplied in the parameters
/// passed to the constructor. If no parameters are supplied, the default
/// values will be used. The defaults are:
/// - contact points: 127.0.0.1
/// - port 9042
/// - no user, no password
/// - keyspace keatest
/// values will be used. The parameters supported as as follows (default
/// values specified in parentheses):
/// - keyspace: name of the database to which to connect (keatest)
/// - contact-points: IP addresses of the nodes to connect to (127.0.0.1)
/// - port: The TCP port to use (9042)
/// - user - credentials to use when connecting (no username)
/// - password - credentails to use when connecting (no password)
/// - reconnect-wait-time 2000
/// - connect-timeout 5000
/// - request-timeout 12000
......
This diff is collapsed.
......@@ -34,20 +34,43 @@ class CqlHostDataSourceImpl;
/// Implements @ref isc::dhcp::BaseHostDataSource interface customized to
/// Cassandra. Use of this backend implies that a Cassandra database is
/// available and that the Kea schema has been created within it.
///
/// The database schema is radically different than the MySQL and the
/// PostgreSQL schemas. Rather than creating a different table for
/// hosts, reservations, DHCPv4 options and DHCPv6 options
/// respectively, the data is denormalized into a single table to
/// benefit from Cassandra's non-relational nature. To make up for the
/// lack of relations, on insertion, the reservations and options are
/// matched against hosts on the server and merged into database
/// entries. When retrieving, each database row is split into the
/// corresponding host, reservation and options.
///
/// There can be an inconsistency in the database due to the order of
/// the changes e.g. if you insert a host with no reservations and no
/// options followed by the same host with one reservation will result
/// in 2 entries versus inserting the host with reservation from the
/// beginning which will result in a single entry. In spite of this,
/// retrieving the host will give you the attached reservation in both
/// cases.
class CqlHostDataSource : public BaseHostDataSource {
public:
/// @brief Constructor
///
/// Uses the following keywords in the parameters passed to it to connect
/// to the database:
/// - name - Name of the database to which to connect (mandatory)
/// - host - Host to which to connect (optional, defaults to "localhost")
/// - user - Username under which to connect (optional)
/// - password - Password for "user" on the database (optional)
///
/// If the database is successfully opened, the version number in the
/// schema_version table will be checked against hard-coded value in the
/// implementation file.
/// - keyspace
/// - host
/// - user
/// - password
/// - contact-points
/// - reconnect-wait-time
/// - connect-timeout
/// - request-timeout
/// - tcp-keepalive
/// - tcp-nodelay
///
/// For details regarding those paraemters, see
/// @ref isc::dhcp::CqlConnection::openDatabase.
///
/// Finally, all the CQL commands are pre-compiled.
///
......@@ -58,8 +81,7 @@ public:
/// @throw isc::dhcp::DbOpenError Error opening the database
/// @throw isc::dhcp::DbOperationError An operation on the open database has
/// failed.
explicit CqlHostDataSource(
const DatabaseConnection::ParameterMap& parameters);
explicit CqlHostDataSource(const DatabaseConnection::ParameterMap& parameters);
/// @brief Virtual destructor.
///
......@@ -73,8 +95,7 @@ public:
/// the reservation for the same @ref HWAddr and @ref SubnetID is added
/// twice, @ref add() should throw a @ref DuplicateEntry exception. Note,
/// that usually it is impossible to guard against adding duplicated @ref
/// Host, where one instance is identified by @ref HWAddr, another one by
/// @ref DUID.
/// Host, where one instance is identified by different identifier types.
///
/// @param host pointer to the new @ref Host being added.
virtual void add(const HostPtr& host) override;
......@@ -101,6 +122,8 @@ public:
/// @brief Retrieves a @ref Host connected to an IPv4 subnet.
///
/// The host is identified by specific identifier.
///
/// @param subnet_id subnet identifier to filter by
/// @param identifier_type identifier type to filter by
/// @param identifier_begin pointer to the beginning of a buffer containing
......@@ -116,10 +139,7 @@ public:
/// @brief Retrieves a @ref Host connected to an IPv4 subnet.
///
/// Note that dynamically allocated addresses and reserved addresses can
/// come into conflict. When the new address is assigned to a client, the
/// allocation mechanism should check if this address is not reserved for
/// some other @ref Host and not allocate it if a reservation is present.
/// The host is identifier by specified IPv4 address.
///
/// @param subnet_id Subnet identifier.
/// @param address reserved IPv4 address.
......@@ -256,10 +276,10 @@ public:
virtual bool del(const SubnetID& subnet_id,
const asiolink::IOAddress& addr);
/// @brief Attempts to delete a host by (subnet-id4, identifier,
/// identifier-type)
/// @brief Attempts to delete a host by (subnet-id4, identifier-type,
/// identifier).
///
/// This method supports both v4 hosts only.
/// This method supports v4 hosts only.
///
/// @param subnet_id IPv4 Subnet identifier.
/// @param identifier_type Identifier type.
......@@ -274,10 +294,10 @@ public:
const uint8_t* identifier_begin,
const size_t identifier_len);
/// @brief Attempts to delete a host by (subnet-id6, identifier,
/// identifier-type)
/// @brief Attempts to delete a host by (subnet-id6, identifier-type,
/// identifier).
///
/// This method supports both v6 hosts only.
/// This method supports v6 hosts only.
///
/// @param subnet_id IPv6 Subnet identifier.
/// @param identifier_type Identifier type.
......@@ -292,9 +312,7 @@ public:
const uint8_t* identifier_begin,
const size_t identifier_len);
/// @brief Returns description of the backend.
///
/// This description may be multiline text that describes the backend.
/// @brief Returns textual description of the backend.
///
/// @return Description of the backend.
virtual std::string getDescription() const;
......@@ -309,7 +327,7 @@ public:
/// @return backend type "cql"
virtual std::string getType() const override;
/// @brief Retrieves schema version.
/// @brief Retrieves schema version from the DB.
///
/// @return Version number stored in the database, as a pair of unsigned
/// integers. "first" is the major version number, "second" is the
......@@ -321,12 +339,12 @@ public:
/// @brief Commit Transactions
///
/// Commits all pending database operations.
/// Commits all pending database operations (no-op for Cassandra)
virtual void commit() override;
/// @brief Rollback Transactions
///
/// Rolls back all pending database operations.
/// Rolls back all pending database operations (no-op for Cassandra)
virtual void rollback() override;
private:
......
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -31,6 +31,7 @@ using namespace isc::asiolink;
using namespace isc::dhcp;
using namespace isc::dhcp::test;
/// @brief Fixture class for testing Cassandra host data source
class CqlHostDataSourceTest : public GenericHostDataSourceTest {
public:
/// @brief Clears the database and opens connection to it.
......@@ -59,7 +60,8 @@ public:
try {
hdsptr_->rollback();
} catch (...) {
// Rollback may fail if backend is in read only mode. That's ok.
// Rollback should never fail, as Cassandra doesn't support transactions
// (commit and rollback are both no-op).
}
HostDataSourceFactory::destroy();
destroyCqlSchema(false, true);
......@@ -123,8 +125,7 @@ TEST(CqlHostDataSource, OpenDatabase) {
// Check that lease manager open the database opens correctly with a longer
// timeout. If it fails, print the error message.
try {
std::string connection_string = validCqlConnectionString() +
std::string(" ") +
std::string connection_string = validCqlConnectionString() + std::string(" ") +
std::string(VALID_TIMEOUT);
HostDataSourceFactory::create(connection_string);
EXPECT_NO_THROW((void)HostDataSourceFactory::getHostDataSourcePtr());
......@@ -143,39 +144,35 @@ TEST(CqlHostDataSource, OpenDatabase) {
// Check that wrong specification of backend throws an exception.
// (This is really a check on HostDataSourceFactory, but is convenient to
// perform here.)
EXPECT_THROW(
HostDataSourceFactory::create(connectionString(
NULL, VALID_NAME, VALID_HOST, INVALID_USER, VALID_PASSWORD)),
InvalidParameter);
EXPECT_THROW(
HostDataSourceFactory::create(connectionString(
INVALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD)),
InvalidType);
EXPECT_THROW(HostDataSourceFactory::create(connectionString(
NULL, VALID_NAME, VALID_HOST, INVALID_USER, VALID_PASSWORD)),
InvalidParameter);
EXPECT_THROW(HostDataSourceFactory::create(connectionString(
INVALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD)),
InvalidType);
// Check that invalid login data does not cause an exception, CQL should use
// default values.
EXPECT_NO_THROW(HostDataSourceFactory::create(connectionString(
CQL_VALID_TYPE, INVALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD)));
EXPECT_NO_THROW(HostDataSourceFactory::create(connectionString(
CQL_VALID_TYPE, VALID_NAME, INVALID_HOST, VALID_USER, VALID_PASSWORD)));
EXPECT_NO_THROW(HostDataSourceFactory::create(connectionString(
CQL_VALID_TYPE, VALID_NAME, VALID_HOST, INVALID_USER, VALID_PASSWORD)));
EXPECT_NO_THROW(HostDataSourceFactory::create(connectionString(
CQL_VALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER, INVALID_PASSWORD)));
EXPECT_NO_THROW(HostDataSourceFactory::create(connectionString(CQL_VALID_TYPE,
INVALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD)));
EXPECT_NO_THROW(HostDataSourceFactory::create(connectionString(CQL_VALID_TYPE,
VALID_NAME, INVALID_HOST, VALID_USER, VALID_PASSWORD)));
EXPECT_NO_THROW(HostDataSourceFactory::create(connectionString(CQL_VALID_TYPE,
VALID_NAME, VALID_HOST, INVALID_USER, VALID_PASSWORD)));
EXPECT_NO_THROW(HostDataSourceFactory::create(connectionString(CQL_VALID_TYPE,
VALID_NAME, VALID_HOST, VALID_USER, INVALID_PASSWORD)));
// Check that invalid timeouts throw DbOperationError.
EXPECT_THROW(HostDataSourceFactory::create(connectionString(
CQL_VALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER,
VALID_PASSWORD, INVALID_TIMEOUT_1)),
EXPECT_THROW(HostDataSourceFactory::create(connectionString(CQL_VALID_TYPE,
VALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD, INVALID_TIMEOUT_1)),
DbOperationError);
EXPECT_THROW(HostDataSourceFactory::create(connectionString(
CQL_VALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER,
VALID_PASSWORD, INVALID_TIMEOUT_2)),
EXPECT_THROW(HostDataSourceFactory::create(connectionString(CQL_VALID_TYPE,
VALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD, INVALID_TIMEOUT_2)),
DbOperationError);
// Check that CQL allows the hostname to not be specified.
EXPECT_NO_THROW(HostDataSourceFactory::create(connectionString(
CQL_VALID_TYPE, NULL, VALID_HOST, INVALID_USER, VALID_PASSWORD)));
EXPECT_NO_THROW(HostDataSourceFactory::create(connectionString(CQL_VALID_TYPE,
NULL, VALID_HOST, INVALID_USER, VALID_PASSWORD)));
// Tidy up after the test
destroyCqlSchema(false, true);
......@@ -205,6 +202,7 @@ TEST(CqlConnection, checkTimeConversion) {
CqlExchange::convertFromDatabaseTime(cql_expire, valid_lft, converted_cltt);
EXPECT_EQ(cltt, converted_cltt);
}
// Test verifies if a host reservation can be added and later retrieved by IPv4
// address. Host uses hw address as identifier.
TEST_F(CqlHostDataSourceTest, basic4HWAddr) {
......@@ -356,7 +354,7 @@ TEST_F(CqlHostDataSourceTest, multipleReservationsDifferentOrder) {
// Test verifies if multiple client classes for IPv4 can be stored.
TEST_F(CqlHostDataSourceTest, DISABLED_multipleClientClasses4) {
/// @todo: Implement this test as part of #4213.
/// @todo: Implement this test as part of #5503.
/// Add host reservation with a multiple v4 client-classes, retrieve it and
/// make sure that all client classes are retrieved properly.
......@@ -364,7 +362,7 @@ TEST_F(CqlHostDataSourceTest, DISABLED_multipleClientClasses4) {
// Test verifies if multiple client classes for IPv6 can be stored.
TEST_F(CqlHostDataSourceTest, DISABLED_multipleClientClasses6) {
/// @todo: Implement this test as part of #4213.
/// @todo: Implement this test as part of #5503.
/// Add host reservation with a multiple v6 client-classes, retrieve it and
/// make sure that all client classes are retrieved properly.
......@@ -373,7 +371,7 @@ TEST_F(CqlHostDataSourceTest, DISABLED_multipleClientClasses6) {
// Test verifies if multiple client classes for both IPv4 and IPv6 can be
// stored.
TEST_F(CqlHostDataSourceTest, DISABLED_multipleClientClassesBoth) {
/// @todo: Implement this test as part of #4213.
/// @todo: Implement this test as part of #5503.
/// Add host reservation with a multiple v4 and v6 client-classes, retrieve
/// it and make sure that all client classes are retrieved properly. Also,
......@@ -513,4 +511,56 @@ TEST_F(CqlHostDataSourceTest, testAddRollback) {
DbOperationError);
}
// This test checks that siaddr, sname, file fields can be retrieved
/// from a database for a host.
/// @todo: Uncomment this after 5507 is implemented.
TEST_F(CqlHostDataSourceTest, DISABLED_messageFields) {
testMessageFields4();
}
// Check that delete(subnet-id, addr4) works.
/// @todo: Uncomment this after #5506 is implemented.
TEST_F(CqlHostDataSourceTest, DISABLED_deleteByAddr4) {
testDeleteByAddr4();
}
// Check that delete(subnet4-id, identifier-type, identifier) works.
/// @todo: Uncomment this after #5506 is implemented.
TEST_F(CqlHostDataSourceTest, DISABLED_deleteById4) {
testDeleteById4();
}
// Check that delete(subnet4-id, identifier-type, identifier) works,
// even when options are present.
/// @todo: Uncomment this after #5506 is implemented.
TEST_F(CqlHostDataSourceTest, DISABLED_deleteById4Options) {
testDeleteById4Options();
}
// Check that delete(subnet6-id, identifier-type, identifier) works.
/// @todo: Uncomment this after #5506 is implemented.
TEST_F(CqlHostDataSourceTest, DISABLED_deleteById6) {
testDeleteById6();
}
// Check that delete(subnet6-id, identifier-type, identifier) works,
// even when options are present.
/// @todo: Uncomment this after #5506 is implemented.
TEST_F(CqlHostDataSourceTest, DISABLED_deleteById6Options) {
testDeleteById6Options();
}
// Tests that multiple reservations without IPv4 addresses can be
// specified within a subnet.
/// @todo: Uncomment this after #5506 is implemented.
TEST_F(CqlHostDataSourceTest, DISABLED_testMultipleHostsNoAddress4) {
testMultipleHostsNoAddress4();
}
// Tests that multiple hosts can be specified within an IPv6 subnet.
/// @todo: Uncomment this after #5506 is implemented.
TEST_F(CqlHostDataSourceTest, DISABLED_testMultipleHosts6) {
testMultipleHosts6();
}
} // namespace
......@@ -481,16 +481,13 @@ GenericHostDataSourceTest::addTestOptions(
opts->add(createOption<OptionUint8>(Option::V4, DHO_DEFAULT_IP_TTL,
false, formatted, 64),
DHCP4_OPTION_SPACE);
opts->add(
createOption<OptionUint32>(Option::V4, 1, false, formatted, 312131),
"vendor-encapsulated-options");
opts->add(createOption<OptionUint32>(Option::V4, 1, false, formatted, 312131),
"vendor-encapsulated-options");
opts->add(createAddressOption<Option4AddrLst>(254, false, formatted,
"192.0.2.3"),
DHCP4_OPTION_SPACE);
"192.0.2.3"), DHCP4_OPTION_SPACE);
opts->add(createEmptyOption(Option::V4, 1, true), "isc");
opts->add(createAddressOption<Option4AddrLst>(
2, false, formatted, "10.0.0.5", "10.0.0.3", "10.0.3.4"),
"isc");
opts->add(createAddressOption<Option4AddrLst>(2, false, formatted, "10.0.0.5",
"10.0.0.3", "10.0.3.4"), "isc");
// Add definitions for DHCPv4 non-standard options.
defs.addItem(OptionDefinitionPtr(new OptionDefinition(
......@@ -499,11 +496,8 @@ GenericHostDataSourceTest::addTestOptions(
defs.addItem(OptionDefinitionPtr(new OptionDefinition(
"option-254", 254, "ipv4-address", true)),
DHCP4_OPTION_SPACE);
defs.addItem(
OptionDefinitionPtr(new OptionDefinition("isc-1", 1, "empty")),
"isc");
defs.addItem(OptionDefinitionPtr(new OptionDefinition(
"isc-2", 2, "ipv4-address", true)),
defs.addItem(OptionDefinitionPtr(new OptionDefinition("isc-1", 1, "empty")), "isc");
defs.addItem(OptionDefinitionPtr(new OptionDefinition("isc-2", 2, "ipv4-address", true)),
"isc");
}
......@@ -523,19 +517,15 @@ GenericHostDataSourceTest::addTestOptions(
"2001:db8:1::1"),
DHCP6_OPTION_SPACE);
opts->add(createEmptyOption(Option::V6, 1, true), "isc2");
opts->add(createAddressOption<Option6AddrLst>(
2, false, formatted, "3000::1", "3000::2", "3000::3"),
"isc2");
opts->add(createAddressOption<Option6AddrLst>(2, false, formatted, "3000::1",
"3000::2", "3000::3"), "isc2");
// Add definitions for DHCPv6 non-standard options.
defs.addItem(OptionDefinitionPtr(new OptionDefinition(
"option-1024", 1024, "ipv6-address", true)),
DHCP6_OPTION_SPACE);
defs.addItem(
OptionDefinitionPtr(new OptionDefinition("option-1", 1, "empty")),
"isc2");
defs.addItem(OptionDefinitionPtr(new OptionDefinition(
"option-2", 2, "ipv6-address", true)),
defs.addItem(OptionDefinitionPtr(new OptionDefinition("option-1", 1, "empty")), "isc2");
defs.addItem(OptionDefinitionPtr(new OptionDefinition("option-2", 2, "ipv6-address", true)),
"isc2");
}
......@@ -900,13 +890,13 @@ GenericHostDataSourceTest::testGet6ByHWAddr() {
SubnetID subnet1 = host1->getIPv6SubnetID();
SubnetID subnet2 = host2->getIPv6SubnetID();
ConstHostPtr from_hds1 =
hdsptr_->get6(subnet1, Host::IDENT_HWADDR, &host1->getIdentifier()[0],
host1->getIdentifier().size());
ConstHostPtr from_hds1 = hdsptr_->get6(subnet1, Host::IDENT_HWADDR,
&host1->getIdentifier()[0],
host1->getIdentifier().size());
ConstHostPtr from_hds2 =
hdsptr_->get6(subnet2, Host::IDENT_HWADDR, &host2->getIdentifier()[0],
host2->getIdentifier().size());
ConstHostPtr from_hds2 = hdsptr_->get6(subnet2, Host::IDENT_HWADDR,
&host2->getIdentifier()[0],
host2->getIdentifier().size());
// Now let's check if we got what we expected.
ASSERT_TRUE(from_hds1);
......@@ -937,13 +927,13 @@ GenericHostDataSourceTest::testGet6ByClientId() {
SubnetID subnet1 = host1->getIPv6SubnetID();
SubnetID subnet2 = host2->getIPv6SubnetID();
ConstHostPtr from_hds1 =
hdsptr_->get6(subnet1, Host::IDENT_DUID, &host1->getIdentifier()[0],
host1->getIdentifier().size());
ConstHostPtr from_hds1 = hdsptr_->get6(subnet1, Host::IDENT_DUID,
&host1->getIdentifier()[0],
host1->getIdentifier().size());
ConstHostPtr from_hds2 =
hdsptr_->get6(subnet2, Host::IDENT_DUID, &host2->getIdentifier()[0],
host2->getIdentifier().size());
ConstHostPtr from_hds2 = hdsptr_->get6(subnet2, Host::IDENT_DUID,
&host2->getIdentifier()[0],
host2->getIdentifier().size());
// Now let's check if we got what we expected.
ASSERT_TRUE(from_hds1);
......@@ -978,17 +968,16 @@ GenericHostDataSourceTest::testSubnetId6(int subnets, Host::IdentifierType id) {
// Check that the reservations can be retrieved from each subnet separately.
for (int i = 0; i < subnets; ++i) {
// Try to retrieve the host
ConstHostPtr from_hds =
hdsptr_->get6(i + 1000, id, &host->getIdentifier()[0],
host->getIdentifier().size());
ConstHostPtr from_hds = hdsptr_->get6(i + 1000, id, &host->getIdentifier()[0],
host->getIdentifier().size());
ASSERT_TRUE(from_hds) << "failed for i=" << i;
EXPECT_EQ(i + 1000, from_hds->getIPv6SubnetID());
}
// Check that the hosts can all be retrieved by HW address or DUID
ConstHostCollection all_by_id = hdsptr_->getAll(
id, &host->getIdentifier()[0], host->getIdentifier().size());
ConstHostCollection all_by_id = hdsptr_->getAll(id, &host->getIdentifier()[0],
host->getIdentifier().size());
ASSERT_EQ(subnets, all_by_id.size());
// Check that the returned values are as expected.
......@@ -1066,14 +1055,10 @@ GenericHostDataSourceTest::testGetBySubnetIPv6() {
ASSERT_NO_THROW(hdsptr_->add(host4));
// And then try to retrieve them back.
ConstHostPtr from_hds1 =
hdsptr_->get6(host1->getIPv6SubnetID(), IOAddress("2001:db8:1::"));
ConstHostPtr from_hds2 =
hdsptr_->get6(host2->getIPv6SubnetID(), IOAddress("2001:db8:2::"));
ConstHostPtr from_hds3 =
hdsptr_->get6(host3->getIPv6SubnetID(), IOAddress("2001:db8:3::"));
ConstHostPtr from_hds4 =
hdsptr_->get6(host4->getIPv6SubnetID(), IOAddress("2001:db8:4::"));
ConstHostPtr from_hds1 = hdsptr_->get6(host1->getIPv6SubnetID(), IOAddress("2001:db8:1::"));
ConstHostPtr from_hds2 = hdsptr_->get6(host2->getIPv6SubnetID(), IOAddress("2001:db8:2::"));
ConstHostPtr from_hds3 = hdsptr_->get6(host3->getIPv6SubnetID(), IOAddress("2001:db8:3::"));
ConstHostPtr from_hds4 = hdsptr_->get6(host4->getIPv6SubnetID(), IOAddress("2001:db8:4::"));
// Make sure we got something back.
ASSERT_TRUE(from_hds1);
......
......@@ -103,9 +103,8 @@ public:
/// @param host2 second host to be compared
/// @param expect_match true = HW addresses expected to be the same,
/// false = HW addresses expected to be different
void
compareHwaddrs(const ConstHostPtr& host1, const ConstHostPtr& host2,
bool expect_match);
void compareHwaddrs(const ConstHostPtr& host1, const ConstHostPtr& host2,
bool expect_match);
/// @brief Compares DUIDs of the two hosts.
///
......@@ -117,9 +116,8 @@ public:
/// @param host2 second host to be compared
/// @param expect_match true = DUIDs expected to be the same,
/// false = DUIDs expected to be different
void
compareDuids(const ConstHostPtr& host1, const ConstHostPtr& host2,
bool expect_match);
void compareDuids(const ConstHostPtr& host1, const ConstHostPtr& host2,
bool expect_match);
/// @brief Compares two hosts
///
......@@ -130,10 +128,14 @@ public:
void compareHosts(const ConstHostPtr& host1, const ConstHostPtr& host2);
/// @brief Used to sort a host collection by IPv4 subnet id.
/// @param host1 first host to be compared
/// @param host2 second host to be compared
static bool compareHostsForSort4(const ConstHostPtr& host1,
const ConstHostPtr& host2);
/// @brief Used to sort a host collection by IPv6 subnet id.
/// @param host1 first host to be compared
/// @param host2 second host to be compared
static bool compareHostsForSort6(const ConstHostPtr& host1,
const ConstHostPtr& host2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment