Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
418
Issues
418
List
Boards
Labels
Service Desk
Milestones
Merge Requests
67
Merge Requests
67
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
a9b5fc56
Commit
a9b5fc56
authored
Oct 12, 2019
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[392-search-of-reservations-by-hostname] Addressed comments
parent
df889e1a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
50 additions
and
43 deletions
+50
-43
doc/sphinx/arm/hooks.rst
doc/sphinx/arm/hooks.rst
+2
-2
src/lib/dhcpsrv/cql_host_data_source.cc
src/lib/dhcpsrv/cql_host_data_source.cc
+1
-0
src/lib/dhcpsrv/tests/cql_host_data_source_unittest.cc
src/lib/dhcpsrv/tests/cql_host_data_source_unittest.cc
+4
-4
src/lib/dhcpsrv/tests/host_mgr_unittest.cc
src/lib/dhcpsrv/tests/host_mgr_unittest.cc
+23
-23
src/lib/dhcpsrv/tests/mysql_host_data_source_unittest.cc
src/lib/dhcpsrv/tests/mysql_host_data_source_unittest.cc
+4
-4
src/lib/dhcpsrv/tests/pgsql_host_data_source_unittest.cc
src/lib/dhcpsrv/tests/pgsql_host_data_source_unittest.cc
+4
-4
src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc
...ib/dhcpsrv/testutils/generic_host_data_source_unittest.cc
+10
-4
src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h
...lib/dhcpsrv/testutils/generic_host_data_source_unittest.h
+2
-2
No files found.
doc/sphinx/arm/hooks.rst
View file @
a9b5fc56
...
...
@@ -1231,7 +1231,7 @@ The subnet-id Parameter
Prior to diving into the individual commands, it is worth discussing the
parameter, ``subnet-id``. Currently this parameter is mandatory for all of the
commands supplied by this library
at
the exception of
commands supplied by this library
with
the exception of
reservation-get-by-hostname where it is optional.
In previous versions of Kea, reservations had
to belong to a specific subnet; as of Kea 1.5.0, reservations may
...
...
@@ -1687,7 +1687,7 @@ returns some IPv4 hosts:
]
},
"result": 0,
"text": "
72
IPv4 host(s) found."
"text": "
5
IPv4 host(s) found."
}
The response returned by ``reservation-get-by-hostname`` can be long
...
...
src/lib/dhcpsrv/cql_host_data_source.cc
View file @
a9b5fc56
...
...
@@ -1503,6 +1503,7 @@ CqlHostExchange::prepareExchange(const HostPtr& host,
// lower_case_hostname: text
lower_case_hostname_
=
host
->
getLowerHostname
();
if
(
lower_case_hostname_
.
size
()
>
HOSTNAME_MAX_LEN
)
{
// Should never happen...
isc_throw
(
BadValue
,
"CqlHostExchange::prepareExchange(): lower "
"case hostname "
<<
lower_case_hostname_
<<
" of length "
<<
lower_case_hostname_
.
size
()
...
...
src/lib/dhcpsrv/tests/cql_host_data_source_unittest.cc
View file @
a9b5fc56
...
...
@@ -339,14 +339,14 @@ TEST_F(CqlHostDataSourceTest, getAllbyHostname) {
// Verifies that IPv4 host reservations with the same hostname and in
// the same subnet can be retrieved
TEST_F
(
CqlHostDataSourceTest
,
getAllbyHostname4
)
{
testGetAllbyHostname4
();
TEST_F
(
CqlHostDataSourceTest
,
getAllbyHostname
Subnet
4
)
{
testGetAllbyHostname
Subnet
4
();
}
// Verifies that IPv6 host reservations with the same hostname and in
// the same subnet can be retrieved
TEST_F
(
CqlHostDataSourceTest
,
getAllbyHostname6
)
{
testGetAllbyHostname6
();
TEST_F
(
CqlHostDataSourceTest
,
getAllbyHostname
Subnet
6
)
{
testGetAllbyHostname
Subnet
6
();
}
// Verifies that IPv4 host reservations in the same subnet can be retrieved
...
...
src/lib/dhcpsrv/tests/host_mgr_unittest.cc
View file @
a9b5fc56
...
...
@@ -145,8 +145,8 @@ protected:
/// inserted.
/// @param data_source2 Host data source to which second reservation is
/// inserted.
void
testGetAllbyHostname4
(
BaseHostDataSource
&
data_source1
,
BaseHostDataSource
&
data_source2
);
void
testGetAllbyHostname
Subnet
4
(
BaseHostDataSource
&
data_source1
,
BaseHostDataSource
&
data_source2
);
/// @brief This test verifies that HostMgr returns all reservations for the
/// specified hostname and DHCPv6 subnet.
...
...
@@ -158,8 +158,8 @@ protected:
/// inserted.
/// @param data_source2 Host data source to which second reservation is
/// inserted.
void
testGetAllbyHostname6
(
BaseHostDataSource
&
data_source1
,
BaseHostDataSource
&
data_source2
);
void
testGetAllbyHostname
Subnet
6
(
BaseHostDataSource
&
data_source1
,
BaseHostDataSource
&
data_source2
);
/// @brief This test verifies that HostMgr returns all reservations for the
/// specified DHCPv4 subnet by pages.
...
...
@@ -456,8 +456,8 @@ HostMgrTest::testGetAllbyHostname(BaseHostDataSource& data_source1,
}
void
HostMgrTest
::
testGetAllbyHostname4
(
BaseHostDataSource
&
data_source1
,
BaseHostDataSource
&
data_source2
)
{
HostMgrTest
::
testGetAllbyHostname
Subnet
4
(
BaseHostDataSource
&
data_source1
,
BaseHostDataSource
&
data_source2
)
{
// Initially, no reservations should be present.
ConstHostCollection
hosts
=
HostMgr
::
instance
().
getAllbyHostname4
(
"host"
,
SubnetID
(
1
));
...
...
@@ -505,8 +505,8 @@ HostMgrTest::testGetAllbyHostname4(BaseHostDataSource& data_source1,
}
void
HostMgrTest
::
testGetAllbyHostname6
(
BaseHostDataSource
&
data_source1
,
BaseHostDataSource
&
data_source2
)
{
HostMgrTest
::
testGetAllbyHostname
Subnet
6
(
BaseHostDataSource
&
data_source1
,
BaseHostDataSource
&
data_source2
)
{
// Initially, no reservations should be present.
ConstHostCollection
hosts
=
HostMgr
::
instance
().
getAllbyHostname6
(
"host"
,
SubnetID
(
1
));
...
...
@@ -982,15 +982,15 @@ TEST_F(HostMgrTest, getAllbyHostname) {
// 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
,
getAllbyHostname
Subnet
4
)
{
testGetAllbyHostname
Subnet
4
(
*
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
());
testGetAllbyHostname
Subnet
4
(
*
getCfgHosts
(),
*
getCfgHosts
());
}
// This test verifies that HostMgr returns all reservations for the
...
...
@@ -1246,15 +1246,15 @@ TEST_F(MySQLHostMgrTest, getAllbyHostname) {
// 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
,
getAllbyHostname
Subnet
4
)
{
testGetAllbyHostname
Subnet
4
(
*
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
,
getAllbyHostname
Subnet
6
)
{
testGetAllbyHostname
Subnet
6
(
*
getCfgHosts
(),
HostMgr
::
instance
());
}
// This test verifies that reservations for a particular subnet can
...
...
@@ -1391,15 +1391,15 @@ TEST_F(PostgreSQLHostMgrTest, getAllbyHostname) {
// 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
,
getAllbyHostname
Subnet
4
)
{
testGetAllbyHostname
Subnet
4
(
*
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
,
getAllbyHostname
Subnet
6
)
{
testGetAllbyHostname
Subnet
6
(
*
getCfgHosts
(),
HostMgr
::
instance
());
}
// This test verifies that reservations for a particular subnet can
...
...
@@ -1517,15 +1517,15 @@ TEST_F(CQLHostMgrTest, getAllbyHostname) {
// 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
,
getAllbyHostname
Subnet
4
)
{
testGetAllbyHostname
Subnet
4
(
*
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
,
getAllbyHostname
Subnet
6
)
{
testGetAllbyHostname
Subnet
6
(
*
getCfgHosts
(),
HostMgr
::
instance
());
}
// This test verifies that reservations for a particular subnet can
...
...
src/lib/dhcpsrv/tests/mysql_host_data_source_unittest.cc
View file @
a9b5fc56
...
...
@@ -328,14 +328,14 @@ TEST_F(MySqlHostDataSourceTest, getAllbyHostname) {
// Verifies that IPv4 host reservations with the same hostname and in
// the same subnet can be retrieved
TEST_F
(
MySqlHostDataSourceTest
,
getAllbyHostname4
)
{
testGetAllbyHostname4
();
TEST_F
(
MySqlHostDataSourceTest
,
getAllbyHostname
Subnet
4
)
{
testGetAllbyHostname
Subnet
4
();
}
// Verifies that IPv6 host reservations with the same hostname and in
// the same subnet can be retrieved
TEST_F
(
MySqlHostDataSourceTest
,
getAllbyHostname6
)
{
testGetAllbyHostname6
();
TEST_F
(
MySqlHostDataSourceTest
,
getAllbyHostname
Subnet
6
)
{
testGetAllbyHostname
Subnet
6
();
}
// Verifies that IPv4 host reservations in the same subnet can be retrieved
...
...
src/lib/dhcpsrv/tests/pgsql_host_data_source_unittest.cc
View file @
a9b5fc56
...
...
@@ -314,14 +314,14 @@ TEST_F(PgSqlHostDataSourceTest, getAllbyHostname) {
// Verifies that IPv4 host reservations with the same hostname and in
// the same subnet can be retrieved
TEST_F
(
PgSqlHostDataSourceTest
,
getAllbyHostname4
)
{
testGetAllbyHostname4
();
TEST_F
(
PgSqlHostDataSourceTest
,
getAllbyHostname
Subnet
4
)
{
testGetAllbyHostname
Subnet
4
();
}
// Verifies that IPv6 host reservations with the same hostname and in
// the same subnet can be retrieved
TEST_F
(
PgSqlHostDataSourceTest
,
getAllbyHostname6
)
{
testGetAllbyHostname6
();
TEST_F
(
PgSqlHostDataSourceTest
,
getAllbyHostname
Subnet
6
)
{
testGetAllbyHostname
Subnet
6
();
}
// Verifies that IPv4 host reservations in the same subnet can be retrieved
...
...
src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc
View file @
a9b5fc56
...
...
@@ -525,7 +525,7 @@ GenericHostDataSourceTest::testGetAllbyHostname() {
}
void
GenericHostDataSourceTest
::
testGetAllbyHostname4
()
{
GenericHostDataSourceTest
::
testGetAllbyHostname
Subnet
4
()
{
// Make sure we have a pointer to the host data source.
ASSERT_TRUE
(
hdsptr_
);
...
...
@@ -549,7 +549,9 @@ GenericHostDataSourceTest::testGetAllbyHostname4() {
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
);
...
...
@@ -564,6 +566,7 @@ GenericHostDataSourceTest::testGetAllbyHostname4() {
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
);
...
...
@@ -606,7 +609,7 @@ GenericHostDataSourceTest::testGetAllbyHostname4() {
}
void
GenericHostDataSourceTest
::
testGetAllbyHostname6
()
{
GenericHostDataSourceTest
::
testGetAllbyHostname
Subnet
6
()
{
// Make sure we have a pointer to the host data source.
ASSERT_TRUE
(
hdsptr_
);
...
...
@@ -630,7 +633,9 @@ GenericHostDataSourceTest::testGetAllbyHostname6() {
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
);
...
...
@@ -645,6 +650,7 @@ GenericHostDataSourceTest::testGetAllbyHostname6() {
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
);
...
...
src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h
View file @
a9b5fc56
...
...
@@ -212,13 +212,13 @@ public:
/// hostname and in the same subnet can be retrieved properly.
///
/// Uses gtest macros to report failures.
void
testGetAllbyHostname4
();
void
testGetAllbyHostname
Subnet
4
();
/// @brief Test that Verifies that IPv6 host reservations with the same
/// hostname and in the same subnet can be retrieved properly.
///
/// Uses gtest macros to report failures.
void
testGetAllbyHostname6
();
void
testGetAllbyHostname
Subnet
6
();
/// @brief Test that Verifies that pages of host reservations in the
/// same subnet can be retrieved properly.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment