Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
ISC Open Source Projects
Kea
Commits
9f3d76f6
Commit
9f3d76f6
authored
Oct 25, 2019
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[904-add-ability-to-force-a-cb-update-remotely] Addressed last comments
parent
546dd1b4
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
79 additions
and
71 deletions
+79
-71
doc/sphinx/arm/ctrl-channel.rst
doc/sphinx/arm/ctrl-channel.rst
+1
-1
src/bin/dhcp4/ctrl_dhcp4_srv.cc
src/bin/dhcp4/ctrl_dhcp4_srv.cc
+4
-3
src/bin/dhcp4/dhcp4_messages.cc
src/bin/dhcp4/dhcp4_messages.cc
+7
-7
src/bin/dhcp4/dhcp4_messages.h
src/bin/dhcp4/dhcp4_messages.h
+4
-4
src/bin/dhcp4/dhcp4_messages.mes
src/bin/dhcp4/dhcp4_messages.mes
+7
-7
src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
+2
-2
src/bin/dhcp6/ctrl_dhcp6_srv.cc
src/bin/dhcp6/ctrl_dhcp6_srv.cc
+12
-12
src/bin/dhcp6/ctrl_dhcp6_srv.h
src/bin/dhcp6/ctrl_dhcp6_srv.h
+4
-4
src/bin/dhcp6/dhcp6_messages.cc
src/bin/dhcp6/dhcp6_messages.cc
+7
-5
src/bin/dhcp6/dhcp6_messages.h
src/bin/dhcp6/dhcp6_messages.h
+4
-3
src/bin/dhcp6/dhcp6_messages.mes
src/bin/dhcp6/dhcp6_messages.mes
+14
-10
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
+6
-6
src/bin/dhcp6/tests/kea_controller_unittest.cc
src/bin/dhcp6/tests/kea_controller_unittest.cc
+7
-7
No files found.
doc/sphinx/arm/ctrl-channel.rst
View file @
9f3d76f6
...
@@ -549,7 +549,7 @@ the DHCPv4 or DHCPv6 server (:ref:`cb-sharing` explains the server tag concept)
...
@@ -549,7 +549,7 @@ the DHCPv4 or DHCPv6 server (:ref:`cb-sharing` explains the server tag concept)
.. _command-config-backend-pull:
.. _command-config-backend-pull:
The config-backend-pull Command:
The config-backend-pull Command:
--------------------------
--------------------------
~~~~~~
The ``config-backend-pull`` command triggers the polling of Config Backends
The ``config-backend-pull`` command triggers the polling of Config Backends
(which should be configured for this command to do something)
(which should be configured for this command to do something)
...
...
src/bin/dhcp4/ctrl_dhcp4_srv.cc
View file @
9f3d76f6
...
@@ -564,7 +564,7 @@ ControlledDhcpv4Srv::commandConfigBackendPullHandler(const std::string&,
...
@@ -564,7 +564,7 @@ ControlledDhcpv4Srv::commandConfigBackendPullHandler(const std::string&,
auto
mode
=
CBControlDHCPv4
::
FetchMode
::
FETCH_UPDATE
;
auto
mode
=
CBControlDHCPv4
::
FetchMode
::
FETCH_UPDATE
;
server_
->
getCBControl
()
->
databaseConfigFetch
(
srv_cfg
,
mode
);
server_
->
getCBControl
()
->
databaseConfigFetch
(
srv_cfg
,
mode
);
}
catch
(
const
std
::
exception
&
ex
)
{
}
catch
(
const
std
::
exception
&
ex
)
{
LOG_ERROR
(
dhcp4_logger
,
DHCP4_CB_PULL_FAIL
)
LOG_ERROR
(
dhcp4_logger
,
DHCP4_CB_PULL_
FETCH_UPDATES_
FAIL
)
.
arg
(
ex
.
what
());
.
arg
(
ex
.
what
());
return
(
createAnswer
(
CONTROL_RESULT_ERROR
,
return
(
createAnswer
(
CONTROL_RESULT_ERROR
,
"Server update failed: "
+
string
(
ex
.
what
())));
"Server update failed: "
+
string
(
ex
.
what
())));
...
@@ -1076,14 +1076,15 @@ ControlledDhcpv4Srv::cbFetchUpdates(const SrvConfigPtr& srv_cfg,
...
@@ -1076,14 +1076,15 @@ ControlledDhcpv4Srv::cbFetchUpdates(const SrvConfigPtr& srv_cfg,
(
*
failure_count
)
=
0
;
(
*
failure_count
)
=
0
;
}
catch
(
const
std
::
exception
&
ex
)
{
}
catch
(
const
std
::
exception
&
ex
)
{
LOG_ERROR
(
dhcp4_logger
,
DHCP4_CB_FETCH_UPDATES_FAIL
)
LOG_ERROR
(
dhcp4_logger
,
DHCP4_CB_
PERIODIC_
FETCH_UPDATES_FAIL
)
.
arg
(
ex
.
what
());
.
arg
(
ex
.
what
());
// We allow at most 10 consecutive failures after which we stop
// We allow at most 10 consecutive failures after which we stop
// making further attempts to fetch the configuration updates.
// making further attempts to fetch the configuration updates.
// Let's return without re-scheduling the timer.
// Let's return without re-scheduling the timer.
if
(
++
(
*
failure_count
)
>
10
)
{
if
(
++
(
*
failure_count
)
>
10
)
{
LOG_ERROR
(
dhcp4_logger
,
DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED
);
LOG_ERROR
(
dhcp4_logger
,
DHCP4_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED
);
return
;
return
;
}
}
}
}
...
...
src/bin/dhcp4/dhcp4_messages.cc
View file @
9f3d76f6
// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Fri Oct 25 2019
18:13
// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Fri Oct 25 2019
22:42
#include <cstddef>
#include <cstddef>
#include <log/message_types.h>
#include <log/message_types.h>
...
@@ -13,9 +13,9 @@ extern const isc::log::MessageID DHCP4_BUFFER_RECEIVED = "DHCP4_BUFFER_RECEIVED"
...
@@ -13,9 +13,9 @@ extern const isc::log::MessageID DHCP4_BUFFER_RECEIVED = "DHCP4_BUFFER_RECEIVED"
extern
const
isc
::
log
::
MessageID
DHCP4_BUFFER_RECEIVE_FAIL
=
"DHCP4_BUFFER_RECEIVE_FAIL"
;
extern
const
isc
::
log
::
MessageID
DHCP4_BUFFER_RECEIVE_FAIL
=
"DHCP4_BUFFER_RECEIVE_FAIL"
;
extern
const
isc
::
log
::
MessageID
DHCP4_BUFFER_UNPACK
=
"DHCP4_BUFFER_UNPACK"
;
extern
const
isc
::
log
::
MessageID
DHCP4_BUFFER_UNPACK
=
"DHCP4_BUFFER_UNPACK"
;
extern
const
isc
::
log
::
MessageID
DHCP4_BUFFER_WAIT_SIGNAL
=
"DHCP4_BUFFER_WAIT_SIGNAL"
;
extern
const
isc
::
log
::
MessageID
DHCP4_BUFFER_WAIT_SIGNAL
=
"DHCP4_BUFFER_WAIT_SIGNAL"
;
extern
const
isc
::
log
::
MessageID
DHCP4_CB_FETCH_UPDATES_FAIL
=
"DHCP4_CB_FETCH_UPDATES_FAIL"
;
extern
const
isc
::
log
::
MessageID
DHCP4_CB_
PERIODIC_
FETCH_UPDATES_FAIL
=
"DHCP4_CB_
PERIODIC_
FETCH_UPDATES_FAIL"
;
extern
const
isc
::
log
::
MessageID
DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED
=
"DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED"
;
extern
const
isc
::
log
::
MessageID
DHCP4_CB_
PERIODIC_
FETCH_UPDATES_RETRIES_EXHAUSTED
=
"DHCP4_CB_
PERIODIC_
FETCH_UPDATES_RETRIES_EXHAUSTED"
;
extern
const
isc
::
log
::
MessageID
DHCP4_CB_PULL_FAIL
=
"DHCP4_CB_PULL_FAIL"
;
extern
const
isc
::
log
::
MessageID
DHCP4_CB_PULL_
FETCH_UPDATES_
FAIL
=
"DHCP4_CB_PULL_
FETCH_UPDATES_
FAIL"
;
extern
const
isc
::
log
::
MessageID
DHCP4_CLASS_ASSIGNED
=
"DHCP4_CLASS_ASSIGNED"
;
extern
const
isc
::
log
::
MessageID
DHCP4_CLASS_ASSIGNED
=
"DHCP4_CLASS_ASSIGNED"
;
extern
const
isc
::
log
::
MessageID
DHCP4_CLASS_UNCONFIGURED
=
"DHCP4_CLASS_UNCONFIGURED"
;
extern
const
isc
::
log
::
MessageID
DHCP4_CLASS_UNCONFIGURED
=
"DHCP4_CLASS_UNCONFIGURED"
;
extern
const
isc
::
log
::
MessageID
DHCP4_CLASS_UNDEFINED
=
"DHCP4_CLASS_UNDEFINED"
;
extern
const
isc
::
log
::
MessageID
DHCP4_CLASS_UNDEFINED
=
"DHCP4_CLASS_UNDEFINED"
;
...
@@ -151,9 +151,9 @@ const char* values[] = {
...
@@ -151,9 +151,9 @@ const char* values[] = {
"DHCP4_BUFFER_RECEIVE_FAIL"
,
"error on attempt to receive packet: %1"
,
"DHCP4_BUFFER_RECEIVE_FAIL"
,
"error on attempt to receive packet: %1"
,
"DHCP4_BUFFER_UNPACK"
,
"parsing buffer received from %1 to %2 over interface %3"
,
"DHCP4_BUFFER_UNPACK"
,
"parsing buffer received from %1 to %2 over interface %3"
,
"DHCP4_BUFFER_WAIT_SIGNAL"
,
"signal received while waiting for next packet, next waiting signal is %1"
,
"DHCP4_BUFFER_WAIT_SIGNAL"
,
"signal received while waiting for next packet, next waiting signal is %1"
,
"DHCP4_CB_FETCH_UPDATES_FAIL"
,
"error on attempt to fetch configuration updates from the configuration backend(s): %1"
,
"DHCP4_CB_
PERIODIC_
FETCH_UPDATES_FAIL"
,
"error on
periodic
attempt to fetch configuration updates from the configuration backend(s): %1"
,
"DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED"
,
"maximum number of configuration fetch attempts: 10, has been exhausted without success"
,
"DHCP4_CB_
PERIODIC_
FETCH_UPDATES_RETRIES_EXHAUSTED"
,
"maximum number of configuration fetch attempts: 10, has been exhausted without success"
,
"DHCP4_CB_PULL_FAIL"
,
"error on pull configuration updates from the configuration backend(s): %1"
,
"DHCP4_CB_PULL_
FETCH_UPDATES_
FAIL"
,
"error on pull
attempt to fetch
configuration updates from the configuration backend(s): %1"
,
"DHCP4_CLASS_ASSIGNED"
,
"%1: client packet has been assigned to the following class(es): %2"
,
"DHCP4_CLASS_ASSIGNED"
,
"%1: client packet has been assigned to the following class(es): %2"
,
"DHCP4_CLASS_UNCONFIGURED"
,
"%1: client packet belongs to an unconfigured class: %2"
,
"DHCP4_CLASS_UNCONFIGURED"
,
"%1: client packet belongs to an unconfigured class: %2"
,
"DHCP4_CLASS_UNDEFINED"
,
"required class %1 has no definition"
,
"DHCP4_CLASS_UNDEFINED"
,
"required class %1 has no definition"
,
...
...
src/bin/dhcp4/dhcp4_messages.h
View file @
9f3d76f6
// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Fri Oct 25 2019
18:13
// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Fri Oct 25 2019
22:42
#ifndef DHCP4_MESSAGES_H
#ifndef DHCP4_MESSAGES_H
#define DHCP4_MESSAGES_H
#define DHCP4_MESSAGES_H
...
@@ -14,9 +14,9 @@ extern const isc::log::MessageID DHCP4_BUFFER_RECEIVED;
...
@@ -14,9 +14,9 @@ extern const isc::log::MessageID DHCP4_BUFFER_RECEIVED;
extern
const
isc
::
log
::
MessageID
DHCP4_BUFFER_RECEIVE_FAIL
;
extern
const
isc
::
log
::
MessageID
DHCP4_BUFFER_RECEIVE_FAIL
;
extern
const
isc
::
log
::
MessageID
DHCP4_BUFFER_UNPACK
;
extern
const
isc
::
log
::
MessageID
DHCP4_BUFFER_UNPACK
;
extern
const
isc
::
log
::
MessageID
DHCP4_BUFFER_WAIT_SIGNAL
;
extern
const
isc
::
log
::
MessageID
DHCP4_BUFFER_WAIT_SIGNAL
;
extern
const
isc
::
log
::
MessageID
DHCP4_CB_FETCH_UPDATES_FAIL
;
extern
const
isc
::
log
::
MessageID
DHCP4_CB_
PERIODIC_
FETCH_UPDATES_FAIL
;
extern
const
isc
::
log
::
MessageID
DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED
;
extern
const
isc
::
log
::
MessageID
DHCP4_CB_
PERIODIC_
FETCH_UPDATES_RETRIES_EXHAUSTED
;
extern
const
isc
::
log
::
MessageID
DHCP4_CB_PULL_FAIL
;
extern
const
isc
::
log
::
MessageID
DHCP4_CB_PULL_
FETCH_UPDATES_
FAIL
;
extern
const
isc
::
log
::
MessageID
DHCP4_CLASS_ASSIGNED
;
extern
const
isc
::
log
::
MessageID
DHCP4_CLASS_ASSIGNED
;
extern
const
isc
::
log
::
MessageID
DHCP4_CLASS_UNCONFIGURED
;
extern
const
isc
::
log
::
MessageID
DHCP4_CLASS_UNCONFIGURED
;
extern
const
isc
::
log
::
MessageID
DHCP4_CLASS_UNDEFINED
;
extern
const
isc
::
log
::
MessageID
DHCP4_CLASS_UNDEFINED
;
...
...
src/bin/dhcp4/dhcp4_messages.mes
View file @
9f3d76f6
...
@@ -46,23 +46,23 @@ by the process. The signal will be handled before the server starts
...
@@ -46,23 +46,23 @@ by the process. The signal will be handled before the server starts
waiting for next packets. The argument specifies the next signal to
waiting for next packets. The argument specifies the next signal to
be handled by the server.
be handled by the server.
% DHCP4_CB_FETCH_UPDATES_FAIL error on attempt to fetch configuration updates from the configuration backend(s): %1
% DHCP4_CB_
PERIODIC_
FETCH_UPDATES_FAIL error on
periodic
attempt to fetch configuration updates from the configuration backend(s): %1
This error message is issued when the server attempted to fetch
This error message is issued when the server attempted to fetch
configuration updates from the database and this attempt failed.
configuration updates from the database and this
periodic
attempt failed.
The server will re-try according to the configured value of the
The server will re-try according to the configured value of the
config-fetch-wait-time parameter. The sole argument contains the
config-fetch-wait-time parameter. The sole argument contains the
reason for failure.
reason for failure.
% DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED maximum number of configuration fetch attempts: 10, has been exhausted without success
% DHCP4_CB_
PERIODIC_
FETCH_UPDATES_RETRIES_EXHAUSTED maximum number of configuration fetch attempts: 10, has been exhausted without success
This error indicates that the server has made a number of unsuccessful
This error indicates that the server has made a number of unsuccessful
attempts to fetch configuration updates from a configuration backend.
periodic
attempts to fetch configuration updates from a configuration backend.
The server will continue to operate but won't make any further attempts
The server will continue to operate but won't make any further attempts
to fetch configuration updates. The administrator must fix the configuration
to fetch configuration updates. The administrator must fix the configuration
in the database and reload (or restart) the server.
in the database and reload (or restart) the server.
% DHCP4_CB_PULL_FAIL error on pull configuration updates from the configuration backend(s): %1
% DHCP4_CB_PULL_
FETCH_UPDATES_
FAIL error on pull
attempt to fetch
configuration updates from the configuration backend(s): %1
This error message is issued when the server attempted to
pull
This error message is issued when the server attempted to
fetch
configuration updates from the database and this attempt failed.
configuration updates from the database and this
pull
attempt failed.
The sole argument which is returned to the config-backend-pull command
The sole argument which is returned to the config-backend-pull command
caller too contains the reason for failure.
caller too contains the reason for failure.
...
...
src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
View file @
9f3d76f6
...
@@ -479,13 +479,13 @@ TEST_F(CtrlChannelDhcpv4SrvTest, commandsRegistration) {
...
@@ -479,13 +479,13 @@ TEST_F(CtrlChannelDhcpv4SrvTest, commandsRegistration) {
EXPECT_TRUE
(
command_list
.
find
(
"
\"
list-commands
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
list-commands
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
build-report
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
build-report
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-backend-pull
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-get
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-get
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-set
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-set
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-write
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-write
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
leases-reclaim
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
leases-reclaim
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
libreload
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
libreload
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
server-tag-get
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
server-tag-get
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-backend-pull
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
shutdown
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
shutdown
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
statistic-get
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
statistic-get
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
statistic-get-all
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
statistic-get-all
\"
"
)
!=
string
::
npos
);
...
@@ -1149,6 +1149,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, listCommands) {
...
@@ -1149,6 +1149,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, listCommands) {
// We expect the server to report at least the following commands:
// We expect the server to report at least the following commands:
checkListCommands
(
rsp
,
"build-report"
);
checkListCommands
(
rsp
,
"build-report"
);
checkListCommands
(
rsp
,
"config-backend-pull"
);
checkListCommands
(
rsp
,
"config-get"
);
checkListCommands
(
rsp
,
"config-get"
);
checkListCommands
(
rsp
,
"config-reload"
);
checkListCommands
(
rsp
,
"config-reload"
);
checkListCommands
(
rsp
,
"config-set"
);
checkListCommands
(
rsp
,
"config-set"
);
...
@@ -1159,7 +1160,6 @@ TEST_F(CtrlChannelDhcpv4SrvTest, listCommands) {
...
@@ -1159,7 +1160,6 @@ TEST_F(CtrlChannelDhcpv4SrvTest, listCommands) {
checkListCommands
(
rsp
,
"libreload"
);
checkListCommands
(
rsp
,
"libreload"
);
checkListCommands
(
rsp
,
"version-get"
);
checkListCommands
(
rsp
,
"version-get"
);
checkListCommands
(
rsp
,
"server-tag-get"
);
checkListCommands
(
rsp
,
"server-tag-get"
);
checkListCommands
(
rsp
,
"config-backend-pull"
);
checkListCommands
(
rsp
,
"shutdown"
);
checkListCommands
(
rsp
,
"shutdown"
);
checkListCommands
(
rsp
,
"statistic-get"
);
checkListCommands
(
rsp
,
"statistic-get"
);
checkListCommands
(
rsp
,
"statistic-get-all"
);
checkListCommands
(
rsp
,
"statistic-get-all"
);
...
...
src/bin/dhcp6/ctrl_dhcp6_srv.cc
View file @
9f3d76f6
...
@@ -545,8 +545,8 @@ ControlledDhcpv6Srv::commandServerTagGetHandler(const std::string&,
...
@@ -545,8 +545,8 @@ ControlledDhcpv6Srv::commandServerTagGetHandler(const std::string&,
}
}
ConstElementPtr
ConstElementPtr
ControlledDhcpv6Srv
::
command
ServerUpdate
Handler
(
const
std
::
string
&
,
ControlledDhcpv6Srv
::
command
ConfigBackendPull
Handler
(
const
std
::
string
&
,
ConstElementPtr
)
{
ConstElementPtr
)
{
auto
ctl_info
=
CfgMgr
::
instance
().
getCurrentCfg
()
->
getConfigControlInfo
();
auto
ctl_info
=
CfgMgr
::
instance
().
getCurrentCfg
()
->
getConfigControlInfo
();
if
(
!
ctl_info
)
{
if
(
!
ctl_info
)
{
return
(
createAnswer
(
CONTROL_RESULT_EMPTY
,
"No config backend."
));
return
(
createAnswer
(
CONTROL_RESULT_EMPTY
,
"No config backend."
));
...
@@ -564,8 +564,7 @@ ControlledDhcpv6Srv::commandServerUpdateHandler(const std::string&,
...
@@ -564,8 +564,7 @@ ControlledDhcpv6Srv::commandServerUpdateHandler(const std::string&,
auto
mode
=
CBControlDHCPv6
::
FetchMode
::
FETCH_UPDATE
;
auto
mode
=
CBControlDHCPv6
::
FetchMode
::
FETCH_UPDATE
;
server_
->
getCBControl
()
->
databaseConfigFetch
(
srv_cfg
,
mode
);
server_
->
getCBControl
()
->
databaseConfigFetch
(
srv_cfg
,
mode
);
}
catch
(
const
std
::
exception
&
ex
)
{
}
catch
(
const
std
::
exception
&
ex
)
{
LOG_ERROR
(
dhcp6_logger
,
DHCP6_CB_FETCH_UPDATES_FAIL
)
LOG_ERROR
(
dhcp6_logger
,
DHCP6_CB_PULL_FETCH_UPDATES_FAIL
)
.
arg
(
"server-update command"
)
.
arg
(
ex
.
what
());
.
arg
(
ex
.
what
());
return
(
createAnswer
(
CONTROL_RESULT_ERROR
,
return
(
createAnswer
(
CONTROL_RESULT_ERROR
,
"Server update failed: "
+
string
(
ex
.
what
())));
"Server update failed: "
+
string
(
ex
.
what
())));
...
@@ -630,8 +629,8 @@ ControlledDhcpv6Srv::processCommand(const std::string& command,
...
@@ -630,8 +629,8 @@ ControlledDhcpv6Srv::processCommand(const std::string& command,
}
else
if
(
command
==
"server-tag-get"
)
{
}
else
if
(
command
==
"server-tag-get"
)
{
return
(
srv
->
commandServerTagGetHandler
(
command
,
args
));
return
(
srv
->
commandServerTagGetHandler
(
command
,
args
));
}
else
if
(
command
==
"
server-update
"
)
{
}
else
if
(
command
==
"
config-backend-pull
"
)
{
return
(
srv
->
command
ServerUpdate
Handler
(
command
,
args
));
return
(
srv
->
command
ConfigBackendPull
Handler
(
command
,
args
));
}
}
...
@@ -859,6 +858,9 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t server_port,
...
@@ -859,6 +858,9 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t server_port,
CommandMgr
::
instance
().
registerCommand
(
"build-report"
,
CommandMgr
::
instance
().
registerCommand
(
"build-report"
,
boost
::
bind
(
&
ControlledDhcpv6Srv
::
commandBuildReportHandler
,
this
,
_1
,
_2
));
boost
::
bind
(
&
ControlledDhcpv6Srv
::
commandBuildReportHandler
,
this
,
_1
,
_2
));
CommandMgr
::
instance
().
registerCommand
(
"config-backend-pull"
,
boost
::
bind
(
&
ControlledDhcpv6Srv
::
commandConfigBackendPullHandler
,
this
,
_1
,
_2
));
CommandMgr
::
instance
().
registerCommand
(
"config-get"
,
CommandMgr
::
instance
().
registerCommand
(
"config-get"
,
boost
::
bind
(
&
ControlledDhcpv6Srv
::
commandConfigGetHandler
,
this
,
_1
,
_2
));
boost
::
bind
(
&
ControlledDhcpv6Srv
::
commandConfigGetHandler
,
this
,
_1
,
_2
));
...
@@ -883,9 +885,6 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t server_port,
...
@@ -883,9 +885,6 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t server_port,
CommandMgr
::
instance
().
registerCommand
(
"server-tag-get"
,
CommandMgr
::
instance
().
registerCommand
(
"server-tag-get"
,
boost
::
bind
(
&
ControlledDhcpv6Srv
::
commandServerTagGetHandler
,
this
,
_1
,
_2
));
boost
::
bind
(
&
ControlledDhcpv6Srv
::
commandServerTagGetHandler
,
this
,
_1
,
_2
));
CommandMgr
::
instance
().
registerCommand
(
"server-update"
,
boost
::
bind
(
&
ControlledDhcpv6Srv
::
commandServerUpdateHandler
,
this
,
_1
,
_2
));
CommandMgr
::
instance
().
registerCommand
(
"libreload"
,
CommandMgr
::
instance
().
registerCommand
(
"libreload"
,
boost
::
bind
(
&
ControlledDhcpv6Srv
::
commandLibReloadHandler
,
this
,
_1
,
_2
));
boost
::
bind
(
&
ControlledDhcpv6Srv
::
commandLibReloadHandler
,
this
,
_1
,
_2
));
...
@@ -950,6 +949,7 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() {
...
@@ -950,6 +949,7 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() {
// Deregister any registered commands (please keep in alphabetic order)
// Deregister any registered commands (please keep in alphabetic order)
CommandMgr
::
instance
().
deregisterCommand
(
"build-report"
);
CommandMgr
::
instance
().
deregisterCommand
(
"build-report"
);
CommandMgr
::
instance
().
deregisterCommand
(
"config-backend-pull"
);
CommandMgr
::
instance
().
deregisterCommand
(
"config-get"
);
CommandMgr
::
instance
().
deregisterCommand
(
"config-get"
);
CommandMgr
::
instance
().
deregisterCommand
(
"config-set"
);
CommandMgr
::
instance
().
deregisterCommand
(
"config-set"
);
CommandMgr
::
instance
().
deregisterCommand
(
"config-reload"
);
CommandMgr
::
instance
().
deregisterCommand
(
"config-reload"
);
...
@@ -960,7 +960,6 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() {
...
@@ -960,7 +960,6 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() {
CommandMgr
::
instance
().
deregisterCommand
(
"leases-reclaim"
);
CommandMgr
::
instance
().
deregisterCommand
(
"leases-reclaim"
);
CommandMgr
::
instance
().
deregisterCommand
(
"libreload"
);
CommandMgr
::
instance
().
deregisterCommand
(
"libreload"
);
CommandMgr
::
instance
().
deregisterCommand
(
"server-tag-get"
);
CommandMgr
::
instance
().
deregisterCommand
(
"server-tag-get"
);
CommandMgr
::
instance
().
deregisterCommand
(
"server-update"
);
CommandMgr
::
instance
().
deregisterCommand
(
"shutdown"
);
CommandMgr
::
instance
().
deregisterCommand
(
"shutdown"
);
CommandMgr
::
instance
().
deregisterCommand
(
"statistic-get"
);
CommandMgr
::
instance
().
deregisterCommand
(
"statistic-get"
);
CommandMgr
::
instance
().
deregisterCommand
(
"statistic-get-all"
);
CommandMgr
::
instance
().
deregisterCommand
(
"statistic-get-all"
);
...
@@ -1095,7 +1094,7 @@ ControlledDhcpv6Srv::cbFetchUpdates(const SrvConfigPtr& srv_cfg,
...
@@ -1095,7 +1094,7 @@ ControlledDhcpv6Srv::cbFetchUpdates(const SrvConfigPtr& srv_cfg,
(
*
failure_count
)
=
0
;
(
*
failure_count
)
=
0
;
}
catch
(
const
std
::
exception
&
ex
)
{
}
catch
(
const
std
::
exception
&
ex
)
{
LOG_ERROR
(
dhcp6_logger
,
DHCP6_CB_FETCH_UPDATES_FAIL
)
LOG_ERROR
(
dhcp6_logger
,
DHCP6_CB_
PERIODIC_
FETCH_UPDATES_FAIL
)
.
arg
(
"periodic poll"
)
.
arg
(
"periodic poll"
)
.
arg
(
ex
.
what
());
.
arg
(
ex
.
what
());
...
@@ -1103,7 +1102,8 @@ ControlledDhcpv6Srv::cbFetchUpdates(const SrvConfigPtr& srv_cfg,
...
@@ -1103,7 +1102,8 @@ ControlledDhcpv6Srv::cbFetchUpdates(const SrvConfigPtr& srv_cfg,
// making further attempts to fetch the configuration updates.
// making further attempts to fetch the configuration updates.
// Let's return without re-scheduling the timer.
// Let's return without re-scheduling the timer.
if
(
++
(
*
failure_count
)
>
10
)
{
if
(
++
(
*
failure_count
)
>
10
)
{
LOG_ERROR
(
dhcp6_logger
,
DHCP6_CB_FETCH_UPDATES_RETRIES_EXHAUSTED
);
LOG_ERROR
(
dhcp6_logger
,
DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED
);
return
;
return
;
}
}
}
}
...
...
src/bin/dhcp6/ctrl_dhcp6_srv.h
View file @
9f3d76f6
...
@@ -303,9 +303,9 @@ private:
...
@@ -303,9 +303,9 @@ private:
commandServerTagGetHandler
(
const
std
::
string
&
command
,
commandServerTagGetHandler
(
const
std
::
string
&
command
,
isc
::
data
::
ConstElementPtr
args
);
isc
::
data
::
ConstElementPtr
args
);
/// @brief handler for
server-update
command
/// @brief handler for
config-backend-pull
command
///
///
/// This method handles the
server-update
command, which updates
/// This method handles the
config-backend-pull
command, which updates
/// the server configuration from the Config Backends immediately.
/// the server configuration from the Config Backends immediately.
///
///
/// @param command (parameter ignored)
/// @param command (parameter ignored)
...
@@ -313,8 +313,8 @@ private:
...
@@ -313,8 +313,8 @@ private:
///
///
/// @return status of the command/
/// @return status of the command/
isc
::
data
::
ConstElementPtr
isc
::
data
::
ConstElementPtr
command
ServerUpdate
Handler
(
const
std
::
string
&
command
,
command
ConfigBackendPull
Handler
(
const
std
::
string
&
command
,
isc
::
data
::
ConstElementPtr
args
);
isc
::
data
::
ConstElementPtr
args
);
/// @brief Reclaims expired IPv6 leases and reschedules timer.
/// @brief Reclaims expired IPv6 leases and reschedules timer.
///
///
...
...
src/bin/dhcp6/dhcp6_messages.cc
View file @
9f3d76f6
// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Fri Oct 25 2019
16
:4
1
// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Fri Oct 25 2019
22
:4
2
#include <cstddef>
#include <cstddef>
#include <log/message_types.h>
#include <log/message_types.h>
...
@@ -14,8 +14,9 @@ extern const isc::log::MessageID DHCP6_ALREADY_RUNNING = "DHCP6_ALREADY_RUNNING"
...
@@ -14,8 +14,9 @@ extern const isc::log::MessageID DHCP6_ALREADY_RUNNING = "DHCP6_ALREADY_RUNNING"
extern
const
isc
::
log
::
MessageID
DHCP6_BUFFER_RECEIVED
=
"DHCP6_BUFFER_RECEIVED"
;
extern
const
isc
::
log
::
MessageID
DHCP6_BUFFER_RECEIVED
=
"DHCP6_BUFFER_RECEIVED"
;
extern
const
isc
::
log
::
MessageID
DHCP6_BUFFER_UNPACK
=
"DHCP6_BUFFER_UNPACK"
;
extern
const
isc
::
log
::
MessageID
DHCP6_BUFFER_UNPACK
=
"DHCP6_BUFFER_UNPACK"
;
extern
const
isc
::
log
::
MessageID
DHCP6_BUFFER_WAIT_SIGNAL
=
"DHCP6_BUFFER_WAIT_SIGNAL"
;
extern
const
isc
::
log
::
MessageID
DHCP6_BUFFER_WAIT_SIGNAL
=
"DHCP6_BUFFER_WAIT_SIGNAL"
;
extern
const
isc
::
log
::
MessageID
DHCP6_CB_FETCH_UPDATES_FAIL
=
"DHCP6_CB_FETCH_UPDATES_FAIL"
;
extern
const
isc
::
log
::
MessageID
DHCP6_CB_PERIODIC_FETCH_UPDATES_FAIL
=
"DHCP6_CB_PERIODIC_FETCH_UPDATES_FAIL"
;
extern
const
isc
::
log
::
MessageID
DHCP6_CB_FETCH_UPDATES_RETRIES_EXHAUSTED
=
"DHCP6_CB_FETCH_UPDATES_RETRIES_EXHAUSTED"
;
extern
const
isc
::
log
::
MessageID
DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED
=
"DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED"
;
extern
const
isc
::
log
::
MessageID
DHCP6_CB_PULL_FETCH_UPDATES_FAIL
=
"DHCP6_CB_PULL_FETCH_UPDATES_FAIL"
;
extern
const
isc
::
log
::
MessageID
DHCP6_CLASS_ASSIGNED
=
"DHCP6_CLASS_ASSIGNED"
;
extern
const
isc
::
log
::
MessageID
DHCP6_CLASS_ASSIGNED
=
"DHCP6_CLASS_ASSIGNED"
;
extern
const
isc
::
log
::
MessageID
DHCP6_CLASS_UNCONFIGURED
=
"DHCP6_CLASS_UNCONFIGURED"
;
extern
const
isc
::
log
::
MessageID
DHCP6_CLASS_UNCONFIGURED
=
"DHCP6_CLASS_UNCONFIGURED"
;
extern
const
isc
::
log
::
MessageID
DHCP6_CLASS_UNDEFINED
=
"DHCP6_CLASS_UNDEFINED"
;
extern
const
isc
::
log
::
MessageID
DHCP6_CLASS_UNDEFINED
=
"DHCP6_CLASS_UNDEFINED"
;
...
@@ -157,8 +158,9 @@ const char* values[] = {
...
@@ -157,8 +158,9 @@ const char* values[] = {
"DHCP6_BUFFER_RECEIVED"
,
"received buffer from %1:%2 to %3:%4 over interface %5"
,
"DHCP6_BUFFER_RECEIVED"
,
"received buffer from %1:%2 to %3:%4 over interface %5"
,
"DHCP6_BUFFER_UNPACK"
,
"parsing buffer received from %1 to %2 over interface %3"
,
"DHCP6_BUFFER_UNPACK"
,
"parsing buffer received from %1 to %2 over interface %3"
,
"DHCP6_BUFFER_WAIT_SIGNAL"
,
"signal received while waiting for next packet, next waiting signal is %1"
,
"DHCP6_BUFFER_WAIT_SIGNAL"
,
"signal received while waiting for next packet, next waiting signal is %1"
,
"DHCP6_CB_FETCH_UPDATES_FAIL"
,
"error on attempt to fetch configuration updates from the configuration backend(s): %1"
,
"DHCP6_CB_PERIODIC_FETCH_UPDATES_FAIL"
,
"error on periodic attempt to fetch configuration updates from the configuration backend(s): %1"
,
"DHCP6_CB_FETCH_UPDATES_RETRIES_EXHAUSTED"
,
"maximum number of configuration fetch attempts: 10, has been exhausted without success"
,
"DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED"
,
"maximum number of configuration fetch attempts: 10, has been exhausted without success"
,
"DHCP6_CB_PULL_FETCH_UPDATES_FAIL"
,
"error on pull attempt to fetch configuration updates from the configuration backend(s): %1"
,
"DHCP6_CLASS_ASSIGNED"
,
"%1: client packet has been assigned to the following class(es): %2"
,
"DHCP6_CLASS_ASSIGNED"
,
"%1: client packet has been assigned to the following class(es): %2"
,
"DHCP6_CLASS_UNCONFIGURED"
,
"%1: client packet belongs to an unconfigured class: %2"
,
"DHCP6_CLASS_UNCONFIGURED"
,
"%1: client packet belongs to an unconfigured class: %2"
,
"DHCP6_CLASS_UNDEFINED"
,
"required class %1 has no definition"
,
"DHCP6_CLASS_UNDEFINED"
,
"required class %1 has no definition"
,
...
...
src/bin/dhcp6/dhcp6_messages.h
View file @
9f3d76f6
// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Fri Oct 25 2019
16
:4
1
// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Fri Oct 25 2019
22
:4
2
#ifndef DHCP6_MESSAGES_H
#ifndef DHCP6_MESSAGES_H
#define DHCP6_MESSAGES_H
#define DHCP6_MESSAGES_H
...
@@ -15,8 +15,9 @@ extern const isc::log::MessageID DHCP6_ALREADY_RUNNING;
...
@@ -15,8 +15,9 @@ extern const isc::log::MessageID DHCP6_ALREADY_RUNNING;
extern
const
isc
::
log
::
MessageID
DHCP6_BUFFER_RECEIVED
;
extern
const
isc
::
log
::
MessageID
DHCP6_BUFFER_RECEIVED
;
extern
const
isc
::
log
::
MessageID
DHCP6_BUFFER_UNPACK
;
extern
const
isc
::
log
::
MessageID
DHCP6_BUFFER_UNPACK
;
extern
const
isc
::
log
::
MessageID
DHCP6_BUFFER_WAIT_SIGNAL
;
extern
const
isc
::
log
::
MessageID
DHCP6_BUFFER_WAIT_SIGNAL
;
extern
const
isc
::
log
::
MessageID
DHCP6_CB_FETCH_UPDATES_FAIL
;
extern
const
isc
::
log
::
MessageID
DHCP6_CB_PERIODIC_FETCH_UPDATES_FAIL
;
extern
const
isc
::
log
::
MessageID
DHCP6_CB_FETCH_UPDATES_RETRIES_EXHAUSTED
;
extern
const
isc
::
log
::
MessageID
DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED
;
extern
const
isc
::
log
::
MessageID
DHCP6_CB_PULL_FETCH_UPDATES_FAIL
;
extern
const
isc
::
log
::
MessageID
DHCP6_CLASS_ASSIGNED
;
extern
const
isc
::
log
::
MessageID
DHCP6_CLASS_ASSIGNED
;
extern
const
isc
::
log
::
MessageID
DHCP6_CLASS_UNCONFIGURED
;
extern
const
isc
::
log
::
MessageID
DHCP6_CLASS_UNCONFIGURED
;
extern
const
isc
::
log
::
MessageID
DHCP6_CLASS_UNDEFINED
;
extern
const
isc
::
log
::
MessageID
DHCP6_CLASS_UNDEFINED
;
...
...
src/bin/dhcp6/dhcp6_messages.mes
View file @
9f3d76f6
...
@@ -53,22 +53,26 @@ by the process. The signal will be handled before the server starts
...
@@ -53,22 +53,26 @@ by the process. The signal will be handled before the server starts
waiting for next packets. The argument specifies the next signal to
waiting for next packets. The argument specifies the next signal to
be handled by the server.
be handled by the server.
% DHCP6_CB_FETCH_UPDATES_FAIL error on attempt to fetch configuration updates from the configuration backend(s): %1
% DHCP6_CB_
PERIODIC_
FETCH_UPDATES_FAIL error on
periodic
attempt to fetch configuration updates from the configuration backend(s): %1
This error message is issued when the server attempted to fetch
This error message is issued when the server attempted to fetch
configuration updates from the database and this attempt failed.
configuration updates from the database and this periodic attempt failed.
If the error happens during periodic poll, the server will re-try
The server will re-try according to the configured value of the
according to the configured value of the config-fetch-wait-time
config-fetch-wait-time parameter. The sole argument contains the
parameter. The arguments contain the fetch context, i.e. during
reason for failure.
periodic poll or by the server-update command, and the reason for
failure.
% DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED maximum number of configuration fetch attempts: 10, has been exhausted without success
% DHCP6_CB_FETCH_UPDATES_RETRIES_EXHAUSTED maximum number of configuration fetch attempts: 10, has been exhausted without success
This error indicates that the server has made a number of unsuccessful
This error indicates that the server has made a number of unsuccessful
attempts to fetch configuration updates from a configuration backend.
periodic
attempts to fetch configuration updates from a configuration backend.
The server will continue to operate but won't make any further attempts
The server will continue to operate but won't make any further attempts
to fetch configuration updates. The administrator must fix the configuration
to fetch configuration updates. The administrator must fix the configuration
in the database and reload (or restart) the server.
in the database and reload (or restart) the server.
% DHCP6_CB_PULL_FETCH_UPDATES_FAIL error on pull attempt to fetch configuration updates from the configuration backend(s): %1
This error message is issued when the server attempted to fetch
configuration updates from the database and this pull attempt failed.
The sole argument which is returned to the config-backend-pull command
caller too contains the reason for failure.
% DHCP6_CLASS_ASSIGNED %1: client packet has been assigned to the following class(es): %2
% DHCP6_CLASS_ASSIGNED %1: client packet has been assigned to the following class(es): %2
This debug message informs that incoming packet has been assigned to specified
This debug message informs that incoming packet has been assigned to specified
class or classes. This is a normal behavior and indicates successful operation.
class or classes. This is a normal behavior and indicates successful operation.
...
...
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
View file @
9f3d76f6
...
@@ -498,13 +498,13 @@ TEST_F(CtrlDhcpv6SrvTest, commandsRegistration) {
...
@@ -498,13 +498,13 @@ TEST_F(CtrlDhcpv6SrvTest, commandsRegistration) {
EXPECT_TRUE
(
command_list
.
find
(
"
\"
list-commands
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
list-commands
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
build-report
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
build-report
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-backend-pull
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-get
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-get
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-set
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-set
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-write
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
config-write
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
leases-reclaim
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
leases-reclaim
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
libreload
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
libreload
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
server-tag-get
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
server-tag-get
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
server-update
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
shutdown
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
shutdown
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
statistic-get
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
statistic-get
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
statistic-get-all
\"
"
)
!=
string
::
npos
);
EXPECT_TRUE
(
command_list
.
find
(
"
\"
statistic-get-all
\"
"
)
!=
string
::
npos
);
...
@@ -938,15 +938,15 @@ TEST_F(CtrlChannelDhcpv6SrvTest, serverTagGet) {
...
@@ -938,15 +938,15 @@ TEST_F(CtrlChannelDhcpv6SrvTest, serverTagGet) {
expected
=
"{
\"
arguments
\"
: {
\"
server-tag
\"
:
\"
foobar
\"
},
\"
result
\"
: 0 }"
;
expected
=
"{
\"
arguments
\"
: {
\"
server-tag
\"
:
\"
foobar
\"
},
\"
result
\"
: 0 }"
;
}
}
// This test verifies that the DHCP server handles
server-update
command
// This test verifies that the DHCP server handles
config-backend-pull
command
TEST_F
(
CtrlChannelDhcpv6SrvTest
,
serverUpdate
)
{
TEST_F
(
CtrlChannelDhcpv6SrvTest
,
configBackendPull
)
{
createUnixChannelServer
();
createUnixChannelServer
();
std
::
string
response
;
std
::
string
response
;
std
::
string
expected
;
std
::
string
expected
;
// Send the
server-update
command. Note there is no configured backed.
// Send the
config-backend-pull
command. Note there is no configured backed.
sendUnixCommand
(
"{
\"
command
\"
:
\"
server-update
\"
}"
,
response
);
sendUnixCommand
(
"{
\"
command
\"
:
\"
config-backend-pull
\"
}"
,
response
);
expected
=
"{
\"
result
\"
: 3,
\"
text
\"
:
\"
No config backend.
\"
}"
;
expected
=
"{
\"
result
\"
: 3,
\"
text
\"
:
\"
No config backend.
\"
}"
;
EXPECT_EQ
(
expected
,
response
);
EXPECT_EQ
(
expected
,
response
);
}
}
...
@@ -1180,6 +1180,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, listCommands) {
...
@@ -1180,6 +1180,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, listCommands) {
// We expect the server to report at least the following commands:
// We expect the server to report at least the following commands:
checkListCommands
(
rsp
,
"build-report"
);
checkListCommands
(
rsp
,
"build-report"
);
checkListCommands
(
rsp
,
"config-backend-pull"
);
checkListCommands
(
rsp
,
"config-get"
);
checkListCommands
(
rsp
,
"config-get"
);
checkListCommands
(
rsp
,
"config-reload"
);
checkListCommands
(
rsp
,
"config-reload"
);
checkListCommands
(
rsp
,
"config-set"
);
checkListCommands
(
rsp
,
"config-set"
);
...
@@ -1190,7 +1191,6 @@ TEST_F(CtrlChannelDhcpv6SrvTest, listCommands) {
...
@@ -1190,7 +1191,6 @@ TEST_F(CtrlChannelDhcpv6SrvTest, listCommands) {
checkListCommands
(
rsp
,
"libreload"
);
checkListCommands
(
rsp
,
"libreload"
);
checkListCommands
(
rsp
,
"version-get"
);
checkListCommands
(
rsp
,
"version-get"
);
checkListCommands
(
rsp
,
"server-tag-get"
);
checkListCommands
(
rsp
,
"server-tag-get"
);
checkListCommands
(
rsp
,
"server-update"
);
checkListCommands
(
rsp
,
"shutdown"
);
checkListCommands
(
rsp
,
"shutdown"
);
checkListCommands
(
rsp
,
"statistic-get"
);
checkListCommands
(
rsp
,
"statistic-get"
);
checkListCommands
(
rsp
,
"statistic-get-all"
);
checkListCommands
(
rsp
,
"statistic-get-all"
);
...
...
src/bin/dhcp6/tests/kea_controller_unittest.cc
View file @
9f3d76f6
...
@@ -257,7 +257,7 @@ public:
...
@@ -257,7 +257,7 @@ public:
EXPECT_EQ
(
cb_control
->
getDatabaseConfigFetchCalls
(),
1
);
EXPECT_EQ
(
cb_control
->
getDatabaseConfigFetchCalls
(),
1
);
ConstElementPtr
result
=
ConstElementPtr
result
=
ControlledDhcpv6Srv
::
processCommand
(
"
server-update
"
,
ControlledDhcpv6Srv
::
processCommand
(
"
config-backend-pull
"
,
ConstElementPtr
());
ConstElementPtr
());
EXPECT_EQ
(
cb_control
->
getDatabaseConfigFetchCalls
(),
2
);
EXPECT_EQ
(
cb_control
->
getDatabaseConfigFetchCalls
(),
2
);
std
::
string
expected
;
std
::
string
expected
;
...
@@ -878,20 +878,20 @@ TEST_F(JSONFileBackendTest, configBackendTimerWithThrow) {
...
@@ -878,20 +878,20 @@ TEST_F(JSONFileBackendTest, configBackendTimerWithThrow) {
testConfigBackendTimer
(
1
,
true
);
testConfigBackendTimer
(
1
,
true
);
}
}