mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 13:37:55 +00:00
[#3481] Set runtime option defs in CB
This commit is contained in:
parent
d0e0bf4a01
commit
d2b249ceda
@ -197,6 +197,7 @@ CfgMgr::mergeIntoCurrentCfg(const uint32_t seq) {
|
|||||||
// First we need to remove statistics.
|
// First we need to remove statistics.
|
||||||
getCurrentCfg()->removeStatistics();
|
getCurrentCfg()->removeStatistics();
|
||||||
mergeIntoCfg(getCurrentCfg(), seq);
|
mergeIntoCfg(getCurrentCfg(), seq);
|
||||||
|
LibDHCP::setRuntimeOptionDefs(getCurrentCfg()->getCfgOptionDef()->getContainer());
|
||||||
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
// Make sure the statistics is updated even if the merge failed.
|
// Make sure the statistics is updated even if the merge failed.
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <exceptions/exceptions.h>
|
#include <exceptions/exceptions.h>
|
||||||
#include <dhcp/dhcp6.h>
|
#include <dhcp/dhcp6.h>
|
||||||
|
#include <dhcp/libdhcp++.h>
|
||||||
#include <dhcp/testutils/iface_mgr_test_config.h>
|
#include <dhcp/testutils/iface_mgr_test_config.h>
|
||||||
#include <dhcpsrv/cfgmgr.h>
|
#include <dhcpsrv/cfgmgr.h>
|
||||||
#include <dhcpsrv/lease_mgr_factory.h>
|
#include <dhcpsrv/lease_mgr_factory.h>
|
||||||
@ -1054,6 +1055,13 @@ TEST_F(CfgMgrTest, mergeIntoCurrentCfg) {
|
|||||||
// Those must be two separate instances.
|
// Those must be two separate instances.
|
||||||
ASSERT_FALSE(ext_cfg1 == ext_cfg2);
|
ASSERT_FALSE(ext_cfg1 == ext_cfg2);
|
||||||
|
|
||||||
|
// Add an option definition.
|
||||||
|
ext_cfg1->getCfgOptionDef()->add(OptionDefinition::create("option-foo",
|
||||||
|
1,
|
||||||
|
"isc",
|
||||||
|
OPT_EMPTY_TYPE,
|
||||||
|
""));
|
||||||
|
|
||||||
// Add a subnet which will be merged from first configuration.
|
// Add a subnet which will be merged from first configuration.
|
||||||
Subnet4Ptr subnet1(new Subnet4(IOAddress("192.1.2.0"), 24, 1, 2, 3, 123));
|
Subnet4Ptr subnet1(new Subnet4(IOAddress("192.1.2.0"), 24, 1, 2, 3, 123));
|
||||||
ext_cfg1->getCfgSubnets4()->add(subnet1);
|
ext_cfg1->getCfgSubnets4()->add(subnet1);
|
||||||
@ -1073,6 +1081,10 @@ TEST_F(CfgMgrTest, mergeIntoCurrentCfg) {
|
|||||||
ASSERT_TRUE(cfg_mgr.getCurrentCfg()->getCfgSubnets4()->getBySubnetId(123));
|
ASSERT_TRUE(cfg_mgr.getCurrentCfg()->getCfgSubnets4()->getBySubnetId(123));
|
||||||
ASSERT_FALSE(cfg_mgr.getCurrentCfg()->getCfgSubnets4()->getBySubnetId(124));
|
ASSERT_FALSE(cfg_mgr.getCurrentCfg()->getCfgSubnets4()->getBySubnetId(124));
|
||||||
|
|
||||||
|
// Ensure that the runtime option definitions have been updated.
|
||||||
|
auto runtime_def = LibDHCP::getRuntimeOptionDef("isc", "option-foo");
|
||||||
|
ASSERT_TRUE(runtime_def);
|
||||||
|
|
||||||
// Create another configuration instance to check what sequence it would
|
// Create another configuration instance to check what sequence it would
|
||||||
// pick. It should pick the first available one.
|
// pick. It should pick the first available one.
|
||||||
SrvConfigPtr ext_cfg3;
|
SrvConfigPtr ext_cfg3;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user