48 const boost::posix_time::ptime& lb_modification_time,
50 bool globals_fetched =
false;
51 auto reconfig = audit_entries.empty();
52 auto cb_update = !reconfig;
69 auto range = index.equal_range(boost::make_tuple(
"dhcp6_global_parameter",
70 AuditEntry::ModificationType::DELETE));
71 if (range.first != range.second) {
79 globals =
getMgr().getPool()->getAllGlobalParameters6(backend_selector, server_selector);
86 external_cfg->sanityChecksLifetime(
"preferred-lifetime");
87 external_cfg->sanityChecksLifetime(
"valid-lifetime");
91 current_cfg->clearConfiguredGlobals();
93 globals_fetched =
true;
100 range = index.equal_range(boost::make_tuple(
"dhcp6_option_def",
101 AuditEntry::ModificationType::DELETE));
102 BOOST_FOREACH(
auto const& entry, range) {
103 current_cfg->getCfgOptionDef()->del(entry->getObjectId());
108 range = index.equal_range(boost::make_tuple(
"dhcp6_options",
109 AuditEntry::ModificationType::DELETE));
110 BOOST_FOREACH(
auto const& entry, range) {
111 current_cfg->getCfgOption()->del(entry->getObjectId());
114 range = index.equal_range(boost::make_tuple(
"dhcp6_client_class",
115 AuditEntry::ModificationType::DELETE));
116 BOOST_FOREACH(
auto const& entry, range) {
117 current_cfg->getClientClassDictionary()->removeClass(entry->getObjectId());
120 range = index.equal_range(boost::make_tuple(
"dhcp6_shared_network",
121 AuditEntry::ModificationType::DELETE));
122 BOOST_FOREACH(
auto const& entry, range) {
123 current_cfg->getCfgSharedNetworks6()->del(entry->getObjectId());
126 range = index.equal_range(boost::make_tuple(
"dhcp6_subnet",
127 AuditEntry::ModificationType::DELETE));
128 BOOST_FOREACH(
auto const& entry, range) {
132 auto subnet = current_cfg->getCfgSubnets6()->getBySubnetId(entry->getObjectId());
136 subnet->getSharedNetwork(network);
139 network->del(subnet->getID());
142 current_cfg->getCfgSubnets6()->del(entry->getObjectId());
159 if (!globals_fetched) {
163 if (reconfig || !updated_entries.empty()) {
165 globals =
getMgr().getPool()->getModifiedGlobalParameters6(backend_selector, server_selector,
166 lb_modification_time);
168 globals_fetched =
true;
176 if (reconfig || !updated_entries.empty()) {
178 getMgr().getPool()->getModifiedOptionDefs6(backend_selector, server_selector,
179 lb_modification_time);
180 for (
auto const& option_def : option_defs) {
181 if (!audit_entries.empty() && !
hasObjectId(updated_entries, option_def->getId())) {
184 external_cfg->getCfgOptionDef()->add(option_def);
192 if (reconfig || !updated_entries.empty()) {
195 lb_modification_time);
196 for (
auto const& option : options) {
197 if (!audit_entries.empty() && !
hasObjectId(updated_entries, option.getId())) {
200 external_cfg->getCfgOption()->add(option, option.space_name_);
208 if (reconfig || !updated_entries.empty()) {
213 client_classes.initMatchExpr(AF_INET6);
216 client_classes.createOptions(external_cfg->getCfgOptionDef());
217 client_classes.encapsulateOptions();
219 external_cfg->setClientClassDictionary(boost::make_shared<ClientClassDictionary>(client_classes));
225 std::string global_allocator;
228 global_allocator = allocator->stringValue();
232 std::string global_pd_allocator;
235 global_pd_allocator = allocator->stringValue();
241 auto allocator_changed =
false;
247 allocator_changed = (global_allocator != allocator->stringValue());
252 if (!allocator_changed) {
255 allocator_changed = (global_pd_allocator != allocator->stringValue());
265 if (allocator_changed || reconfig) {
268 networks =
getMgr().getPool()->getAllSharedNetworks6(backend_selector, server_selector);
269 }
else if (!updated_entries.empty()) {
270 networks =
getMgr().getPool()->getModifiedSharedNetworks6(backend_selector, server_selector,
271 lb_modification_time);
273 for (
auto const& network : networks) {
274 if (!allocator_changed && cb_update && !
hasObjectId(updated_entries, network->getId())) {
283 network->setDefaultAllocatorType(global_allocator);
284 network->setDefaultPdAllocatorType(global_pd_allocator);
285 external_cfg->getCfgSharedNetworks6()->add(network);
293 if (allocator_changed || reconfig) {
296 subnets =
getMgr().getPool()->getAllSubnets6(backend_selector, server_selector);
298 }
else if (!updated_entries.empty()) {
301 subnets =
getMgr().getPool()->getModifiedSubnets6(backend_selector,
303 lb_modification_time);
306 for (
auto const& subnet : subnets) {
307 if (!audit_entries.empty() && !
hasObjectId(updated_entries, subnet->getID())) {
316 subnet->setDefaultAllocatorType(global_allocator);
317 subnet->setDefaultPdAllocatorType(global_pd_allocator);
318 external_cfg->getCfgSubnets6()->add(subnet);
326 external_cfg->sanityChecksLifetime(*cfg,
"preferred-lifetime");
327 external_cfg->sanityChecksLifetime(*cfg,
"valid-lifetime");
331 if (globals_fetched) {
334 bool ip_unique =
true;
335 auto ip_unique_param = external_cfg->getConfiguredGlobal(
"ip-reservations-unique");
337 ip_unique = ip_unique_param->boolValue();
345 external_cfg->addConfiguredGlobal(
"ip-reservations-unique",
Element::create(
true));
349 external_cfg->sanityChecksLifetime(*cfg,
"preferred-lifetime");
350 external_cfg->sanityChecksLifetime(*cfg,
"valid-lifetime");
352 CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->initAllocatorsAfterConfigure();
368 callout_handle->setArgument(
"audit_entries", ptr);
boost::multi_index_container< AuditEntryPtr, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< boost::multi_index::tag< AuditEntryObjectTypeTag >, boost::multi_index::composite_key< AuditEntry, boost::multi_index::const_mem_fun< AuditEntry, std::string, &AuditEntry::getObjectType >, boost::multi_index::const_mem_fun< AuditEntry, AuditEntry::ModificationType, &AuditEntry::getModificationType > > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< AuditEntryModificationTimeIdTag >, boost::multi_index::composite_key< AuditEntry, boost::multi_index::const_mem_fun< AuditEntry, boost::posix_time::ptime, &AuditEntry::getModificationTime >, boost::multi_index::const_mem_fun< AuditEntry, uint64_t, &AuditEntry::getRevisionId > > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< AuditEntryObjectIdTag >, boost::multi_index::const_mem_fun< AuditEntry, uint64_t, &AuditEntry::getObjectId > > > > AuditEntryCollection
Multi index container holding AuditEntry instances.
boost::multi_index_container< OptionDescriptor, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_non_unique< KeyFromKeyExtractor< boost::multi_index::const_mem_fun< Option, uint16_t, &Option::getType >, boost::multi_index::member< OptionDescriptor, OptionPtr, &OptionDescriptor::option_ > > >, boost::multi_index::hashed_non_unique< boost::multi_index::member< OptionDescriptor, bool, &OptionDescriptor::persistent_ > >, boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< OptionIdIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, uint64_t, &data::BaseStampedElement::getId > >, boost::multi_index::hashed_non_unique< boost::multi_index::member< OptionDescriptor, bool, &OptionDescriptor::cancelled_ > > > > OptionContainer
Multi index container for DHCP option descriptors.
boost::multi_index_container< OptionDefinitionPtr, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_non_unique< boost::multi_index::const_mem_fun< OptionDefinition, uint16_t, &OptionDefinition::getCode > >, boost::multi_index::hashed_non_unique< boost::multi_index::const_mem_fun< OptionDefinition, std::string, &OptionDefinition::getName > >, boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::StampedElement::getModificationTime > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< OptionIdIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, uint64_t, &data::BaseStampedElement::getId > > > > OptionDefContainer
Multi index container for DHCP option definitions.