/// inserted.
/// @param data_source2 Host data source to which second reservation is
/// inserted.
- void testGetAllbyHostname4(BaseHostDataSource& data_source1,
- BaseHostDataSource& data_source2);
+ void testGetAllbyHostnameSubnet4(BaseHostDataSource& data_source1,
+ BaseHostDataSource& data_source2);
/// @brief This test verifies that HostMgr returns all reservations for the
/// specified hostname and DHCPv6 subnet.
/// inserted.
/// @param data_source2 Host data source to which second reservation is
/// inserted.
- void testGetAllbyHostname6(BaseHostDataSource& data_source1,
- BaseHostDataSource& data_source2);
+ void testGetAllbyHostnameSubnet6(BaseHostDataSource& data_source1,
+ BaseHostDataSource& data_source2);
/// @brief This test verifies that HostMgr returns all reservations for the
/// specified DHCPv4 subnet by pages.
}
void
-HostMgrTest::testGetAllbyHostname4(BaseHostDataSource& data_source1,
- BaseHostDataSource& data_source2) {
+HostMgrTest::testGetAllbyHostnameSubnet4(BaseHostDataSource& data_source1,
+ BaseHostDataSource& data_source2) {
// Initially, no reservations should be present.
ConstHostCollection hosts =
HostMgr::instance().getAllbyHostname4("host", SubnetID(1));
}
void
-HostMgrTest::testGetAllbyHostname6(BaseHostDataSource& data_source1,
- BaseHostDataSource& data_source2) {
+HostMgrTest::testGetAllbyHostnameSubnet6(BaseHostDataSource& data_source1,
+ BaseHostDataSource& data_source2) {
// Initially, no reservations should be present.
ConstHostCollection hosts =
HostMgr::instance().getAllbyHostname6("host", SubnetID(1));
// This test verifies that HostMgr returns all reservations for the specified
// hostname and DHCPv4 subnet. The reservations are defined in the server's
// configuration.
-TEST_F(HostMgrTest, getAllbyHostname4) {
- testGetAllbyHostname4(*getCfgHosts(), *getCfgHosts());
+TEST_F(HostMgrTest, getAllbyHostnameSubnet4) {
+ testGetAllbyHostnameSubnet4(*getCfgHosts(), *getCfgHosts());
}
// This test verifies that HostMgr returns all reservations for the specified
// hostname and DHCPv6 subnet. The reservations are defined in the server's
// configuration.
TEST_F(HostMgrTest, getAllbyHostname6) {
- testGetAllbyHostname4(*getCfgHosts(), *getCfgHosts());
+ testGetAllbyHostnameSubnet4(*getCfgHosts(), *getCfgHosts());
}
// This test verifies that HostMgr returns all reservations for the
// This test verifies that reservations for a particular hostname and
// DHCPv4 subnet can be retrieved from the configuration file and a
// database simultaneously.
-TEST_F(MySQLHostMgrTest, getAllbyHostname4) {
- testGetAllbyHostname4(*getCfgHosts(), HostMgr::instance());
+TEST_F(MySQLHostMgrTest, getAllbyHostnameSubnet4) {
+ testGetAllbyHostnameSubnet4(*getCfgHosts(), HostMgr::instance());
}
// This test verifies that reservations for a particular hostname and
// DHCPv6 subnet can be retrieved from the configuration file and a
// database simultaneously.
-TEST_F(MySQLHostMgrTest, getAllbyHostname6) {
- testGetAllbyHostname6(*getCfgHosts(), HostMgr::instance());
+TEST_F(MySQLHostMgrTest, getAllbyHostnameSubnet6) {
+ testGetAllbyHostnameSubnet6(*getCfgHosts(), HostMgr::instance());
}
// This test verifies that reservations for a particular subnet can
// This test verifies that reservations for a particular hostname and
// DHCPv4 subnet can be retrieved from the configuration file and a
// database simultaneously.
-TEST_F(PostgreSQLHostMgrTest, getAllbyHostname4) {
- testGetAllbyHostname4(*getCfgHosts(), HostMgr::instance());
+TEST_F(PostgreSQLHostMgrTest, getAllbyHostnameSubnet4) {
+ testGetAllbyHostnameSubnet4(*getCfgHosts(), HostMgr::instance());
}
// This test verifies that reservations for a particular hostname and
// DHCPv6 subnet can be retrieved from the configuration file and a
// database simultaneously.
-TEST_F(PostgreSQLHostMgrTest, getAllbyHostname6) {
- testGetAllbyHostname6(*getCfgHosts(), HostMgr::instance());
+TEST_F(PostgreSQLHostMgrTest, getAllbyHostnameSubnet6) {
+ testGetAllbyHostnameSubnet6(*getCfgHosts(), HostMgr::instance());
}
// This test verifies that reservations for a particular subnet can
// This test verifies that reservations for a particular hostname and
// DHCPv4 subnet can be retrieved from the configuration file and a
// database simultaneously.
-TEST_F(CQLHostMgrTest, getAllbyHostname4) {
- testGetAllbyHostname4(*getCfgHosts(), HostMgr::instance());
+TEST_F(CQLHostMgrTest, getAllbyHostnameSubnet4) {
+ testGetAllbyHostnameSubnet4(*getCfgHosts(), HostMgr::instance());
}
// This test verifies that reservations for a particular hostname and
// DHCPv6 subnet can be retrieved from the configuration file and a
// database simultaneously.
-TEST_F(CQLHostMgrTest, getAllbyHostname6) {
- testGetAllbyHostname6(*getCfgHosts(), HostMgr::instance());
+TEST_F(CQLHostMgrTest, getAllbyHostnameSubnet6) {
+ testGetAllbyHostnameSubnet6(*getCfgHosts(), HostMgr::instance());
}
// This test verifies that reservations for a particular subnet can
}
void
-GenericHostDataSourceTest::testGetAllbyHostname4() {
+GenericHostDataSourceTest::testGetAllbyHostnameSubnet4() {
// Make sure we have a pointer to the host data source.
ASSERT_TRUE(hdsptr_);
HostPtr host4 = HostDataSourceUtils::initializeHost4("192.0.2.4", id);
host4->setHostname("host.example.com");
- // Set them in the same subnets.
+ HostPtr host5 = HostDataSourceUtils::initializeHost4("192.0.2.5", id);
+
+ // Set them in the same subnet at the exception of host5.
SubnetID subnet4 = host1->getIPv4SubnetID();
host2->setIPv4SubnetID(subnet4);
host3->setIPv4SubnetID(subnet4);
ASSERT_NO_THROW(hdsptr_->add(host2));
ASSERT_NO_THROW(hdsptr_->add(host3));
ASSERT_NO_THROW(hdsptr_->add(host4));
+ ASSERT_NO_THROW(hdsptr_->add(host5));
// Retrieve unknown name.
ConstHostCollection from_hds = hdsptr_->getAllbyHostname4("foo", subnet4);
}
void
-GenericHostDataSourceTest::testGetAllbyHostname6() {
+GenericHostDataSourceTest::testGetAllbyHostnameSubnet6() {
// Make sure we have a pointer to the host data source.
ASSERT_TRUE(hdsptr_);
HostPtr host4 = HostDataSourceUtils::initializeHost6("2001:db8::4", id, false);
host4->setHostname("host.example.com");
- // Set them in the same subnets.
+ HostPtr host5 = HostDataSourceUtils::initializeHost6("2001:db8::5", id, false);
+
+ // Set them in the same subnet at the exception of host5.
SubnetID subnet4 = host1->getIPv4SubnetID();
host2->setIPv4SubnetID(subnet4);
host3->setIPv4SubnetID(subnet4);
ASSERT_NO_THROW(hdsptr_->add(host2));
ASSERT_NO_THROW(hdsptr_->add(host3));
ASSERT_NO_THROW(hdsptr_->add(host4));
+ ASSERT_NO_THROW(hdsptr_->add(host5));
// Retrieve unknown name.
ConstHostCollection from_hds = hdsptr_->getAllbyHostname6("foo", subnet6);