Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
578bf4d0
Commit
578bf4d0
authored
Aug 26, 2014
by
Marcin Siodelski
Browse files
[3512] Renamed IfaceCfg to CfgIface as suggested in the review.
parent
dddc0834
Changes
16
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp4/bundy_controller.cc
View file @
578bf4d0
...
...
@@ -177,7 +177,7 @@ void ControlledDhcpv4Srv::init(const std::string& config_file) {
// Configuration may disable or enable interfaces so we have to
// reopen sockets according to new configuration.
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
CfgMgr
::
instance
().
getConfiguration
()
->
cfg_
iface_
.
openSockets
(
getPort
(),
useBroadcast
());
}
catch
(
const
std
::
exception
&
ex
)
{
...
...
src/bin/dhcp4/ctrl_dhcp4_srv.cc
View file @
578bf4d0
...
...
@@ -149,7 +149,7 @@ ControlledDhcpv4Srv::processConfig(isc::data::ConstElementPtr config) {
// safe and we really don't want to emit exceptions to whoever called this
// method. Instead, catch an exception and create appropriate answer.
try
{
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
CfgMgr
::
instance
().
getConfiguration
()
->
cfg_
iface_
.
openSockets
(
srv
->
getPort
(),
getInstance
()
->
useBroadcast
());
}
catch
(
std
::
exception
&
ex
)
{
...
...
src/bin/dhcp4/tests/config_parser_unittest.cc
View file @
578bf4d0
...
...
@@ -2917,7 +2917,7 @@ TEST_F(Dhcp4ParserTest, selectedInterfaces) {
ASSERT_TRUE
(
status
);
checkResult
(
status
,
0
);
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
.
openSockets
(
10000
);
CfgMgr
::
instance
().
getConfiguration
()
->
cfg_
iface_
.
openSockets
(
10000
);
// eth0 and eth1 were explicitly selected. eth2 was not.
EXPECT_TRUE
(
test_config
.
socketOpen
(
"eth0"
,
AF_INET
));
...
...
@@ -2952,7 +2952,7 @@ TEST_F(Dhcp4ParserTest, allInterfaces) {
ASSERT_TRUE
(
status
);
checkResult
(
status
,
0
);
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
.
openSockets
(
10000
);
CfgMgr
::
instance
().
getConfiguration
()
->
cfg_
iface_
.
openSockets
(
10000
);
// All interfaces should be now active.
ASSERT_TRUE
(
test_config
.
socketOpen
(
"eth0"
,
AF_INET
));
...
...
src/bin/dhcp4/tests/dhcp4_test_utils.cc
View file @
578bf4d0
...
...
@@ -45,7 +45,7 @@ Dhcpv4SrvTest::Dhcpv4SrvTest()
pool_
=
Pool4Ptr
(
new
Pool4
(
IOAddress
(
"192.0.2.100"
),
IOAddress
(
"192.0.2.110"
)));
subnet_
->
addPool
(
pool_
);
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
.
reset
();
CfgMgr
::
instance
().
getConfiguration
()
->
cfg_
iface_
.
reset
();
CfgMgr
::
instance
().
deleteSubnets4
();
CfgMgr
::
instance
().
addSubnet4
(
subnet_
);
...
...
@@ -58,7 +58,7 @@ Dhcpv4SrvTest::Dhcpv4SrvTest()
Dhcpv4SrvTest
::~
Dhcpv4SrvTest
()
{
// Make sure that we revert to default value
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
.
reset
();
CfgMgr
::
instance
().
getConfiguration
()
->
cfg_
iface_
.
reset
();
CfgMgr
::
instance
().
echoClientId
(
true
);
}
...
...
src/bin/dhcp6/bundy_controller.cc
View file @
578bf4d0
...
...
@@ -183,7 +183,10 @@ ControlledDhcpv6Srv::init(const std::string& config_file) {
// Configuration may disable or enable interfaces so we have to
// reopen sockets according to new configuration.
openActiveSockets
(
getPort
());
// Configuration may disable or enable interfaces so we have to
// reopen sockets according to new configuration.
CfgMgr
::
instance
().
getConfiguration
()
->
cfg_iface_
.
openSockets
(
getPort
(),
useBroadcast
());
}
catch
(
const
std
::
exception
&
ex
)
{
LOG_ERROR
(
dhcp6_logger
,
DHCP6_CONFIG_LOAD_FAIL
).
arg
(
ex
.
what
());
...
...
src/bin/dhcp6/ctrl_dhcp6_srv.cc
View file @
578bf4d0
...
...
@@ -144,7 +144,7 @@ ControlledDhcpv6Srv::processConfig(isc::data::ConstElementPtr config) {
// safe and we really don't want to emit exceptions to the callback caller.
// Instead, catch an exception and create appropriate answer.
try
{
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
CfgMgr
::
instance
().
getConfiguration
()
->
cfg_
iface_
.
openSockets
(
srv
->
getPort
());
}
catch
(
const
std
::
exception
&
ex
)
{
...
...
src/bin/dhcp6/dhcp6_srv.cc
View file @
578bf4d0
...
...
@@ -154,7 +154,7 @@ Dhcpv6Srv::Dhcpv6Srv(uint16_t port)
// domain, so as the IPv6 sockets are opened rather than IPv4 sockets
// which are the default.
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
.
setFamily
(
Iface
Cfg
::
V6
);
->
cfg_
iface_
.
setFamily
(
Cfg
Iface
::
V6
);
/// @todo call loadLibraries() when handling configuration changes
...
...
src/bin/dhcp6/tests/config_parser_unittest.cc
View file @
578bf4d0
...
...
@@ -359,9 +359,9 @@ public:
// properly test interface configuration we disable listening on
// all interfaces before each test and later check that this setting
// has been overriden by the configuration used in the test.
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
.
reset
();
CfgMgr
::
instance
().
getConfiguration
()
->
cfg_
iface_
.
reset
();
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
.
setFamily
(
Iface
Cfg
::
V6
);
cfg_
iface_
.
setFamily
(
Cfg
Iface
::
V6
);
// Create fresh context.
globalContext
()
->
copyContext
(
ParserContext
(
Option
::
V6
));
}
...
...
@@ -3057,7 +3057,7 @@ TEST_F(Dhcp6ParserTest, selectedInterfaces) {
// as the pool does not belong to that subnet
checkResult
(
status
,
0
);
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
.
openSockets
(
10000
);
CfgMgr
::
instance
().
getConfiguration
()
->
cfg_
iface_
.
openSockets
(
10000
);
// eth0 and eth1 were explicitly selected. eth2 was not.
EXPECT_TRUE
(
test_config
.
socketOpen
(
"eth0"
,
AF_INET6
));
...
...
@@ -3090,7 +3090,7 @@ TEST_F(Dhcp6ParserTest, allInterfaces) {
EXPECT_NO_THROW
(
status
=
configureDhcp6Server
(
srv_
,
json
));
checkResult
(
status
,
0
);
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
.
openSockets
(
10000
);
CfgMgr
::
instance
().
getConfiguration
()
->
cfg_
iface_
.
openSockets
(
10000
);
// All interfaces should be now active.
EXPECT_TRUE
(
test_config
.
socketOpen
(
"eth0"
,
AF_INET6
));
...
...
src/lib/dhcpsrv/Makefile.am
View file @
578bf4d0
...
...
@@ -55,7 +55,7 @@ libkea_dhcpsrv_la_SOURCES += dhcpsrv_log.cc dhcpsrv_log.h
libkea_dhcpsrv_la_SOURCES
+=
cfgmgr.cc cfgmgr.h
libkea_dhcpsrv_la_SOURCES
+=
dhcp_config_parser.h
libkea_dhcpsrv_la_SOURCES
+=
dhcp_parsers.cc dhcp_parsers.h
libkea_dhcpsrv_la_SOURCES
+=
iface
_cfg
.cc iface
_cfg
.h
libkea_dhcpsrv_la_SOURCES
+=
cfg_
iface.cc
cfg_
iface.h
libkea_dhcpsrv_la_SOURCES
+=
key_from_key.h
libkea_dhcpsrv_la_SOURCES
+=
lease.cc lease.h
libkea_dhcpsrv_la_SOURCES
+=
lease_mgr.cc lease_mgr.h
...
...
src/lib/dhcpsrv/iface
_cfg
.cc
→
src/lib/dhcpsrv/
cfg_
iface.cc
View file @
578bf4d0
...
...
@@ -14,7 +14,7 @@
#include <dhcp/iface_mgr.h>
#include <dhcpsrv/dhcpsrv_log.h>
#include <dhcpsrv/iface
_cfg
.h>
#include <dhcpsrv/
cfg_
iface.h>
#include <util/strutil.h>
#include <boost/bind.hpp>
...
...
@@ -23,20 +23,20 @@ using namespace isc::asiolink;
namespace
isc
{
namespace
dhcp
{
const
char
*
Iface
Cfg
::
ALL_IFACES_KEYWORD
=
"*"
;
const
char
*
Cfg
Iface
::
ALL_IFACES_KEYWORD
=
"*"
;
IfaceCfg
::
Iface
Cfg
(
Family
family
)
Cfg
Iface
::
CfgIface
(
Family
family
)
:
family_
(
family
),
wildcard_used_
(
false
)
{
}
void
Iface
Cfg
::
closeSockets
()
{
Cfg
Iface
::
closeSockets
()
{
IfaceMgr
::
instance
().
closeSockets
();
}
void
Iface
Cfg
::
openSockets
(
const
uint16_t
port
,
const
bool
use_bcast
)
{
Cfg
Iface
::
openSockets
(
const
uint16_t
port
,
const
bool
use_bcast
)
{
// If wildcard interface '*' was not specified, set all interfaces to
// inactive state. We will later enable them selectively using the
// interface names specified by the user. If wildcard interface was
...
...
@@ -93,7 +93,7 @@ IfaceCfg::openSockets(const uint16_t port, const bool use_bcast) {
// for some specific interface. This callback will simply log a
// warning message.
IfaceMgrErrorMsgCallback
error_callback
=
boost
::
bind
(
&
Iface
Cfg
::
socketOpenErrorHandler
,
_1
);
boost
::
bind
(
&
Cfg
Iface
::
socketOpenErrorHandler
,
_1
);
bool
sopen
;
if
(
getFamily
()
==
V4
)
{
sopen
=
IfaceMgr
::
instance
().
openSockets4
(
port
,
use_bcast
,
...
...
@@ -111,13 +111,13 @@ IfaceCfg::openSockets(const uint16_t port, const bool use_bcast) {
}
void
Iface
Cfg
::
reset
()
{
Cfg
Iface
::
reset
()
{
wildcard_used_
=
false
;
iface_set_
.
clear
();
}
void
Iface
Cfg
::
setState
(
const
bool
inactive
,
const
bool
loopback_inactive
)
{
Cfg
Iface
::
setState
(
const
bool
inactive
,
const
bool
loopback_inactive
)
{
IfaceMgr
::
IfaceCollection
ifaces
=
IfaceMgr
::
instance
().
getIfaces
();
for
(
IfaceMgr
::
IfaceCollection
::
iterator
iface
=
ifaces
.
begin
();
iface
!=
ifaces
.
end
();
++
iface
)
{
...
...
@@ -133,12 +133,12 @@ IfaceCfg::setState(const bool inactive, const bool loopback_inactive) {
}
void
Iface
Cfg
::
socketOpenErrorHandler
(
const
std
::
string
&
errmsg
)
{
Cfg
Iface
::
socketOpenErrorHandler
(
const
std
::
string
&
errmsg
)
{
LOG_WARN
(
dhcpsrv_logger
,
DHCPSRV_OPEN_SOCKET_FAIL
).
arg
(
errmsg
);
}
void
Iface
Cfg
::
use
(
const
std
::
string
&
iface_name
)
{
Cfg
Iface
::
use
(
const
std
::
string
&
iface_name
)
{
// The interface name specified may have two formats, e.g.:
// - eth0
// - eth0/2001:db8:1::1.
...
...
src/lib/dhcpsrv/iface
_cfg
.h
→
src/lib/dhcpsrv/
cfg_
iface.h
View file @
578bf4d0
...
...
@@ -63,8 +63,8 @@ public:
/// instructs the server to listen on all available interfaces.
///
/// Once interfaces have been specified the sockets (either IPv4 or IPv6)
/// can be opened by calling @c Iface
Cfg
::openSockets function.
class
Iface
Cfg
{
/// can be opened by calling @c
Cfg
Iface::openSockets function.
class
Cfg
Iface
{
public:
/// @brief Keyword used to enable all interfaces.
///
...
...
@@ -83,12 +83,12 @@ public:
/// @brief Constructor.
///
/// @param family Protocol family (default is V4).
Iface
Cfg
(
Family
family
=
V4
);
Cfg
Iface
(
Family
family
=
V4
);
/// @brief Convenience function which closes all open sockets.
void
closeSockets
();
/// @brief Returns protocol family used by the @c Iface
Cfg
.
/// @brief Returns protocol family used by the @c
Cfg
Iface.
Family
getFamily
()
const
{
return
(
family_
);
}
...
...
@@ -96,7 +96,7 @@ public:
/// @brief Tries to open sockets on selected interfaces.
///
/// This function opens sockets bound to link-local address as well as
/// sockets bound to unicast address. See @c Iface
Cfg
::use function
/// sockets bound to unicast address. See @c
Cfg
Iface::use function
/// documentation for details how to specify interfaces and unicast
/// addresses to bind the sockets to.
///
...
...
@@ -147,7 +147,7 @@ public:
/// to the interface.
/// @throw DuplicateIfaceName If the interface is already selected, i.e.
/// @throw IOError when specified unicast address is invalid.
/// @c Iface
Cfg
::use has been already called for this interface.
/// @c
Cfg
Iface::use has been already called for this interface.
void
use
(
const
std
::
string
&
iface_name
);
private:
...
...
src/lib/dhcpsrv/configuration.h
View file @
578bf4d0
...
...
@@ -15,7 +15,7 @@
#ifndef DHCPSRV_CONFIGURATION_H
#define DHCPSRV_CONFIGURATION_H
#include <dhcpsrv/iface
_cfg
.h>
#include <dhcpsrv/
cfg_
iface.h>
#include <log/logger_level.h>
#include <boost/shared_ptr.hpp>
#include <vector>
...
...
@@ -90,7 +90,7 @@ struct Configuration {
///
/// Used to select interfaces on which the DHCP server will listen to
/// queries.
Iface
C
fg
iface_
cfg_
;
Cfg
Iface
c
fg
_
iface_
;
};
...
...
src/lib/dhcpsrv/dhcp_parsers.cc
View file @
578bf4d0
...
...
@@ -190,11 +190,11 @@ InterfaceListConfigParser(const std::string& param_name)
void
InterfaceListConfigParser
::
build
(
ConstElementPtr
value
)
{
ConfigurationPtr
config
=
CfgMgr
::
instance
().
getConfiguration
();
config
->
iface_
cfg_
.
reset
();
config
->
cfg_
iface_
.
reset
();
BOOST_FOREACH
(
ConstElementPtr
iface
,
value
->
listValue
())
{
std
::
string
iface_name
=
iface
->
stringValue
();
try
{
config
->
iface_
cfg_
.
use
(
iface_name
);
config
->
cfg_
iface_
.
use
(
iface_name
);
}
catch
(
const
std
::
exception
&
ex
)
{
isc_throw
(
DhcpConfigError
,
"Failed to select interface: "
...
...
src/lib/dhcpsrv/tests/Makefile.am
View file @
578bf4d0
...
...
@@ -63,7 +63,7 @@ libdhcpsrv_unittests_SOURCES += d2_client_unittest.cc
libdhcpsrv_unittests_SOURCES
+=
d2_udp_unittest.cc
libdhcpsrv_unittests_SOURCES
+=
daemon_unittest.cc
libdhcpsrv_unittests_SOURCES
+=
dbaccess_parser_unittest.cc
libdhcpsrv_unittests_SOURCES
+=
iface_
cfg_
unittest.cc
libdhcpsrv_unittests_SOURCES
+=
cfg_
iface_unittest.cc
libdhcpsrv_unittests_SOURCES
+=
lease_file_io.cc lease_file_io.h
libdhcpsrv_unittests_SOURCES
+=
lease_unittest.cc
libdhcpsrv_unittests_SOURCES
+=
lease_mgr_factory_unittest.cc
...
...
src/lib/dhcpsrv/tests/iface_
cfg_
unittest.cc
→
src/lib/dhcpsrv/tests/
cfg_
iface_unittest.cc
View file @
578bf4d0
...
...
@@ -15,7 +15,7 @@
#include <config.h>
#include <dhcp/dhcp4.h>
#include <dhcp/tests/iface_mgr_test_config.h>
#include <dhcpsrv/iface
_cfg
.h>
#include <dhcpsrv/
cfg_
iface.h>
#include <gtest/gtest.h>
using
namespace
isc
;
...
...
@@ -24,15 +24,15 @@ using namespace isc::dhcp::test;
namespace
{
/// @brief Test fixture class for testing the @c Iface
Cfg
class.
class
Iface
Cfg
Test
:
public
::
testing
::
Test
{
/// @brief Test fixture class for testing the @c
Cfg
Iface class.
class
Cfg
IfaceTest
:
public
::
testing
::
Test
{
public:
/// @brief Constructor.
///
/// By initializing the @c IfaceMgrTestConfig object it creates a set of
/// fake interfaces: lo, eth0, eth1.
Iface
Cfg
Test
()
:
Cfg
IfaceTest
()
:
iface_mgr_test_config_
(
true
)
{
}
...
...
@@ -53,19 +53,19 @@ public:
};
bool
Iface
Cfg
Test
::
socketOpen
(
const
std
::
string
&
iface_name
,
Cfg
IfaceTest
::
socketOpen
(
const
std
::
string
&
iface_name
,
const
int
family
)
const
{
return
(
iface_mgr_test_config_
.
socketOpen
(
iface_name
,
family
));
}
bool
Iface
Cfg
Test
::
unicastOpen
(
const
std
::
string
&
iface_name
)
const
{
Cfg
IfaceTest
::
unicastOpen
(
const
std
::
string
&
iface_name
)
const
{
return
(
iface_mgr_test_config_
.
unicastOpen
(
iface_name
));
}
// This test checks that the interface names can be explicitly selected
// by their names and IPv4 sockets are opened on these interfaces.
TEST_F
(
Iface
Cfg
Test
,
explicitNamesV4
)
{
Iface
Cfg
cfg
(
Iface
Cfg
::
V4
);
TEST_F
(
Cfg
IfaceTest
,
explicitNamesV4
)
{
Cfg
Iface
cfg
(
Cfg
Iface
::
V4
);
// Specify valid interface names. There should be no error.
ASSERT_NO_THROW
(
cfg
.
use
(
"eth0"
));
ASSERT_NO_THROW
(
cfg
.
use
(
"eth1"
));
...
...
@@ -104,8 +104,8 @@ TEST_F(IfaceCfgTest, explicitNamesV4) {
// This test checks that the interface names can be explicitly selected
// by their names and IPv6 sockets are opened on these interfaces.
TEST_F
(
Iface
Cfg
Test
,
explicitNamesV6
)
{
Iface
Cfg
cfg
(
Iface
Cfg
::
V6
);
TEST_F
(
Cfg
IfaceTest
,
explicitNamesV6
)
{
Cfg
Iface
cfg
(
Cfg
Iface
::
V6
);
// Specify valid interface names. There should be no error.
ASSERT_NO_THROW
(
cfg
.
use
(
"eth0"
));
ASSERT_NO_THROW
(
cfg
.
use
(
"eth1"
));
...
...
@@ -144,9 +144,9 @@ TEST_F(IfaceCfgTest, explicitNamesV6) {
// This test checks that the wildcard interface name can be specified to
// select all interfaces to open IPv4 sockets.
TEST_F
(
Iface
Cfg
Test
,
wildcardV4
)
{
Iface
Cfg
cfg
(
Iface
Cfg
::
V4
);
ASSERT_NO_THROW
(
cfg
.
use
(
Iface
Cfg
::
ALL_IFACES_KEYWORD
));
TEST_F
(
Cfg
IfaceTest
,
wildcardV4
)
{
Cfg
Iface
cfg
(
Cfg
Iface
::
V4
);
ASSERT_NO_THROW
(
cfg
.
use
(
Cfg
Iface
::
ALL_IFACES_KEYWORD
));
cfg
.
openSockets
(
DHCP4_SERVER_PORT
);
...
...
@@ -163,9 +163,9 @@ TEST_F(IfaceCfgTest, wildcardV4) {
// This test checks that the wildcard interface name can be specified to
// select all interfaces to open IPv6 sockets.
TEST_F
(
Iface
Cfg
Test
,
wildcardV6
)
{
Iface
Cfg
cfg
(
Iface
Cfg
::
V6
);
ASSERT_NO_THROW
(
cfg
.
use
(
Iface
Cfg
::
ALL_IFACES_KEYWORD
));
TEST_F
(
Cfg
IfaceTest
,
wildcardV6
)
{
Cfg
Iface
cfg
(
Cfg
Iface
::
V6
);
ASSERT_NO_THROW
(
cfg
.
use
(
Cfg
Iface
::
ALL_IFACES_KEYWORD
));
cfg
.
openSockets
(
DHCP4_SERVER_PORT
);
...
...
@@ -183,8 +183,8 @@ TEST_F(IfaceCfgTest, wildcardV6) {
// Test that unicast address can be specified for the socket to be opened on
// the interface on which the socket bound to link local address is also
// opened.
TEST_F
(
Iface
Cfg
Test
,
validUnicast
)
{
Iface
Cfg
cfg
(
Iface
Cfg
::
V6
);
TEST_F
(
Cfg
IfaceTest
,
validUnicast
)
{
Cfg
Iface
cfg
(
Cfg
Iface
::
V6
);
// One socket will be opened on link-local address, one on unicast but
// on the same interface.
...
...
@@ -198,8 +198,8 @@ TEST_F(IfaceCfgTest, validUnicast) {
}
// Test that when invalid interface names are specified an exception is thrown.
TEST_F
(
Iface
Cfg
Test
,
invalidValues
)
{
Iface
Cfg
cfg
(
Iface
Cfg
::
V4
);
TEST_F
(
Cfg
IfaceTest
,
invalidValues
)
{
Cfg
Iface
cfg
(
Cfg
Iface
::
V4
);
ASSERT_THROW
(
cfg
.
use
(
""
),
InvalidIfaceName
);
ASSERT_THROW
(
cfg
.
use
(
" "
),
InvalidIfaceName
);
ASSERT_THROW
(
cfg
.
use
(
"bogus"
),
NoSuchIface
);
...
...
@@ -209,7 +209,7 @@ TEST_F(IfaceCfgTest, invalidValues) {
ASSERT_THROW
(
cfg
.
use
(
"eth0/2001:db8:1::1"
),
InvalidIfaceName
);
cfg
.
setFamily
(
Iface
Cfg
::
V6
);
cfg
.
setFamily
(
Cfg
Iface
::
V6
);
ASSERT_THROW
(
cfg
.
use
(
"eth0/"
),
InvalidIfaceName
);
ASSERT_THROW
(
cfg
.
use
(
"/2001:db8:1::1"
),
InvalidIfaceName
);
...
...
@@ -219,8 +219,8 @@ TEST_F(IfaceCfgTest, invalidValues) {
ASSERT_THROW
(
cfg
.
use
(
"eth0/fe80::3a60:77ff:fed5:cdef"
),
InvalidIfaceName
);
ASSERT_THROW
(
cfg
.
use
(
"eth0/2001:db8:1::2"
),
NoSuchAddress
);
ASSERT_NO_THROW
(
cfg
.
use
(
Iface
Cfg
::
ALL_IFACES_KEYWORD
));
ASSERT_THROW
(
cfg
.
use
(
Iface
Cfg
::
ALL_IFACES_KEYWORD
),
DuplicateIfaceName
);
ASSERT_NO_THROW
(
cfg
.
use
(
Cfg
Iface
::
ALL_IFACES_KEYWORD
));
ASSERT_THROW
(
cfg
.
use
(
Cfg
Iface
::
ALL_IFACES_KEYWORD
),
DuplicateIfaceName
);
}
}
// end of anonymous namespace
src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
View file @
578bf4d0
...
...
@@ -59,8 +59,8 @@ public:
/// @brief Resets selection of the interfaces from previous tests.
void
resetIfaceCfg
()
{
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
.
closeSockets
();
CfgMgr
::
instance
().
getConfiguration
()
->
iface_
cfg_
.
reset
();
CfgMgr
::
instance
().
getConfiguration
()
->
cfg_
iface_
.
closeSockets
();
CfgMgr
::
instance
().
getConfiguration
()
->
cfg_
iface_
.
reset
();
}
};
...
...
@@ -241,7 +241,7 @@ TEST_F(DhcpParserTest, interfaceListParserTest) {
// eth2 was not added.
ConfigurationPtr
cfg
=
CfgMgr
::
instance
().
getConfiguration
();
ASSERT_TRUE
(
cfg
);
ASSERT_NO_THROW
(
cfg
->
iface_
cfg_
.
openSockets
(
10000
));
ASSERT_NO_THROW
(
cfg
->
cfg_
iface_
.
openSockets
(
10000
));
EXPECT_TRUE
(
test_config
.
socketOpen
(
"eth0"
,
AF_INET
));
EXPECT_FALSE
(
test_config
.
socketOpen
(
"eth1"
,
AF_INET
));
...
...
@@ -253,11 +253,11 @@ TEST_F(DhcpParserTest, interfaceListParserTest) {
// Reset parser and configuration.
parser
.
reset
(
new
InterfaceListConfigParser
(
name
));
cfg
->
iface_
cfg_
.
closeSockets
();
cfg
->
iface_
cfg_
.
reset
();
cfg
->
cfg_
iface_
.
closeSockets
();
cfg
->
cfg_
iface_
.
reset
();
parser
->
build
(
list_element
);
ASSERT_NO_THROW
(
cfg
->
iface_
cfg_
.
openSockets
(
10000
));
ASSERT_NO_THROW
(
cfg
->
cfg_
iface_
.
openSockets
(
10000
));
EXPECT_TRUE
(
test_config
.
socketOpen
(
"eth0"
,
AF_INET
));
EXPECT_TRUE
(
test_config
.
socketOpen
(
"eth1"
,
AF_INET
));
...
...
Write
Preview
Supports
Markdown
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