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
450
Issues
450
List
Boards
Labels
Service Desk
Milestones
Merge Requests
75
Merge Requests
75
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
bfeaf289
Commit
bfeaf289
authored
Oct 21, 2014
by
Tomek Mrugalski
🛰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[3555] Version number check in Memfile.
parent
fd96a357
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
5 deletions
+45
-5
src/lib/dhcpsrv/memfile_lease_mgr.h
src/lib/dhcpsrv/memfile_lease_mgr.h
+18
-5
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
+6
-0
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h
+5
-0
src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
+16
-0
No files found.
src/lib/dhcpsrv/memfile_lease_mgr.h
View file @
bfeaf289
...
...
@@ -71,6 +71,23 @@ namespace dhcp {
class
Memfile_LeaseMgr
:
public
LeaseMgr
{
public:
/// @defgroup versions Specified memfile backend version.
///
/// @brief Defines major version of the memfile backend.
///
/// Version history:
/// 1.0 - initial version (released in Kea 0.9)
/// 2.0 - hwaddr column added (to be released in Kea 0.9.1)
///
/// @{
static
const
int
MAJOR_VERSION
=
2
;
/// Defines minor version of the memfile backend.
static
const
int
MINOR_VERSION
=
0
;
/// @}
/// @brief Specifies universe (V4, V6)
///
/// This enumeration is used by various functions in Memfile Lease Manager,
...
...
@@ -274,12 +291,8 @@ public:
///
/// @return Version number as a pair of unsigned integers. "first" is the
/// major version number, "second" the minor number.
///
/// Numbering history:
/// 1.0 - initial version (released as 0.9)
/// 2.0 - hwaddr (hardware address/MAC) column added
virtual
std
::
pair
<
uint32_t
,
uint32_t
>
getVersion
()
const
{
return
(
std
::
make_pair
(
2
,
0
));
return
(
std
::
make_pair
(
MAJOR_VERSION
,
MINOR_VERSION
));
}
/// @brief Commit Transactions
...
...
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
View file @
bfeaf289
...
...
@@ -1602,6 +1602,12 @@ GenericLeaseMgrTest::testNullDuid() {
ASSERT_THROW
(
lmptr_
->
addLease
(
leases
[
1
]),
DbOperationError
);
}
void
GenericLeaseMgrTest
::
testVersion
(
int
major
,
int
minor
)
{
EXPECT_EQ
(
major
,
lmptr_
->
getVersion
().
first
);
EXPECT_EQ
(
minor
,
lmptr_
->
getVersion
().
second
);
}
};
// namespace test
};
// namespace dhcp
...
...
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h
View file @
bfeaf289
...
...
@@ -257,6 +257,11 @@ public:
/// @brief Verifies that a null DUID is not allowed.
void
testNullDuid
();
/// @brief Verifies that the backend reports expected version numbers.
/// @param major Expected major version to be reported.
/// @param minor Expected minor version to be reported.
void
testVersion
(
int
major
,
int
minor
);
/// @brief String forms of IPv4 addresses
std
::
vector
<
std
::
string
>
straddress4_
;
...
...
src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
View file @
bfeaf289
...
...
@@ -465,4 +465,20 @@ TEST_F(MemfileLeaseMgrTest, testUpgrade0_9_0_to_0_9_1) {
EXPECT_FALSE
(
stored3
->
hwaddr_
);
}
// Check that memfile reports version correctly.
TEST_F
(
MemfileLeaseMgrTest
,
versionCheck
)
{
// Check that V4 backend reports versions correctly.
startBackend
(
V4
);
testVersion
(
Memfile_LeaseMgr
::
MAJOR_VERSION
,
Memfile_LeaseMgr
::
MINOR_VERSION
);
LeaseMgrFactory
::
destroy
();
// Check that V6 backends reports them ok, too.
startBackend
(
V6
);
testVersion
(
Memfile_LeaseMgr
::
MAJOR_VERSION
,
Memfile_LeaseMgr
::
MINOR_VERSION
);
LeaseMgrFactory
::
destroy
();
}
};
// end of anonymous namespace
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