mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-01 22:45:18 +00:00
[709-cb_cmds-add-support-for-commands-to-manage-the-servers] Improved server support
This commit is contained in:
@@ -188,12 +188,12 @@ TestConfigBackendDHCPv4::getModifiedOptions4(const db::ServerSelector& /* server
|
|||||||
StampedValuePtr
|
StampedValuePtr
|
||||||
TestConfigBackendDHCPv4::getGlobalParameter4(const db::ServerSelector& server_selector,
|
TestConfigBackendDHCPv4::getGlobalParameter4(const db::ServerSelector& server_selector,
|
||||||
const std::string& name) const {
|
const std::string& name) const {
|
||||||
|
auto tags = server_selector.getTags();
|
||||||
auto candidate = StampedValuePtr();
|
auto candidate = StampedValuePtr();
|
||||||
const auto& index = globals_.get<StampedValueNameIndexTag>();
|
const auto& index = globals_.get<StampedValueNameIndexTag>();
|
||||||
auto global_range = index.equal_range(name);
|
auto global_range = index.equal_range(name);
|
||||||
for (auto global_it = global_range.first; global_it != global_range.second;
|
for (auto global_it = global_range.first; global_it != global_range.second;
|
||||||
++global_it) {
|
++global_it) {
|
||||||
auto tags = server_selector.getTags();
|
|
||||||
for (auto tag : tags) {
|
for (auto tag : tags) {
|
||||||
if ((*global_it)->hasServerTag(ServerTag(tag))) {
|
if ((*global_it)->hasServerTag(ServerTag(tag))) {
|
||||||
return (*global_it);
|
return (*global_it);
|
||||||
@@ -209,18 +209,50 @@ TestConfigBackendDHCPv4::getGlobalParameter4(const db::ServerSelector& server_se
|
|||||||
|
|
||||||
|
|
||||||
StampedValueCollection
|
StampedValueCollection
|
||||||
TestConfigBackendDHCPv4::getAllGlobalParameters4(const db::ServerSelector& /* server_selector */) const {
|
TestConfigBackendDHCPv4::getAllGlobalParameters4(const db::ServerSelector& server_selector) const {
|
||||||
return (globals_);
|
auto tags = server_selector.getTags();
|
||||||
|
StampedValueCollection globals;
|
||||||
|
for (auto global : globals_) {
|
||||||
|
bool got = false;
|
||||||
|
for (auto tag : tags) {
|
||||||
|
if (global->hasServerTag(ServerTag(tag))) {
|
||||||
|
globals.insert(global);
|
||||||
|
got = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (got) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (global->hasAllServerTag()) {
|
||||||
|
globals.insert(global);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (globals);
|
||||||
}
|
}
|
||||||
|
|
||||||
StampedValueCollection
|
StampedValueCollection
|
||||||
TestConfigBackendDHCPv4::getModifiedGlobalParameters4(const db::ServerSelector& /* server_selector */,
|
TestConfigBackendDHCPv4::getModifiedGlobalParameters4(const db::ServerSelector& server_selector,
|
||||||
const boost::posix_time::ptime& modification_time) const {
|
const boost::posix_time::ptime& modification_time) const {
|
||||||
const auto& index = globals_.get<StampedValueModificationTimeIndexTag>();
|
auto tags = server_selector.getTags();
|
||||||
StampedValueCollection globals;
|
StampedValueCollection globals;
|
||||||
|
const auto& index = globals_.get<StampedValueModificationTimeIndexTag>();
|
||||||
auto lb = index.lower_bound(modification_time);
|
auto lb = index.lower_bound(modification_time);
|
||||||
for (auto global = lb; global != index.end(); ++global) {
|
for (auto global = lb; global != index.end(); ++global) {
|
||||||
|
bool got = false;
|
||||||
|
for (auto tag : tags) {
|
||||||
|
if ((*global)->hasServerTag(ServerTag(tag))) {
|
||||||
globals.insert(*global);
|
globals.insert(*global);
|
||||||
|
got = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (got) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((*global)->hasAllServerTag()) {
|
||||||
|
globals.insert(*global);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (globals);
|
return (globals);
|
||||||
}
|
}
|
||||||
@@ -571,10 +603,18 @@ TestConfigBackendDHCPv4::deleteGlobalParameter4(const db::ServerSelector& server
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
TestConfigBackendDHCPv4::deleteAllGlobalParameters4(const db::ServerSelector& /* server_selector */) {
|
TestConfigBackendDHCPv4::deleteAllGlobalParameters4(const db::ServerSelector& server_selector) {
|
||||||
auto globals_size = globals_.size();
|
uint64_t cnt = 0;
|
||||||
globals_.clear();
|
for (auto global_it = globals_.begin(); global_it != globals_.end(); ) {
|
||||||
return (globals_size);
|
auto value = *global_it;
|
||||||
|
if (value->hasServerTag(ServerTag(getServerTag(server_selector)))) {
|
||||||
|
global_it = globals_.erase(global_it);
|
||||||
|
cnt++;
|
||||||
|
} else {
|
||||||
|
++global_it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
|
@@ -187,12 +187,12 @@ TestConfigBackendDHCPv6::getModifiedOptions6(const db::ServerSelector& /* server
|
|||||||
StampedValuePtr
|
StampedValuePtr
|
||||||
TestConfigBackendDHCPv6::getGlobalParameter6(const db::ServerSelector& server_selector,
|
TestConfigBackendDHCPv6::getGlobalParameter6(const db::ServerSelector& server_selector,
|
||||||
const std::string& name) const {
|
const std::string& name) const {
|
||||||
|
auto tags = server_selector.getTags();
|
||||||
auto candidate = StampedValuePtr();
|
auto candidate = StampedValuePtr();
|
||||||
const auto& index = globals_.get<StampedValueNameIndexTag>();
|
const auto& index = globals_.get<StampedValueNameIndexTag>();
|
||||||
auto global_range = index.equal_range(name);
|
auto global_range = index.equal_range(name);
|
||||||
for (auto global_it = global_range.first; global_it != global_range.second;
|
for (auto global_it = global_range.first; global_it != global_range.second;
|
||||||
++global_it) {
|
++global_it) {
|
||||||
auto tags = server_selector.getTags();
|
|
||||||
for (auto tag : tags) {
|
for (auto tag : tags) {
|
||||||
if ((*global_it)->hasServerTag(ServerTag(tag))) {
|
if ((*global_it)->hasServerTag(ServerTag(tag))) {
|
||||||
return (*global_it);
|
return (*global_it);
|
||||||
@@ -208,18 +208,50 @@ TestConfigBackendDHCPv6::getGlobalParameter6(const db::ServerSelector& server_se
|
|||||||
|
|
||||||
|
|
||||||
StampedValueCollection
|
StampedValueCollection
|
||||||
TestConfigBackendDHCPv6::getAllGlobalParameters6(const db::ServerSelector& /* server_selector */) const {
|
TestConfigBackendDHCPv6::getAllGlobalParameters6(const db::ServerSelector& server_selector) const {
|
||||||
return (globals_);
|
auto tags = server_selector.getTags();
|
||||||
|
StampedValueCollection globals;
|
||||||
|
for (auto global : globals_) {
|
||||||
|
bool got = false;
|
||||||
|
for (auto tag : tags) {
|
||||||
|
if (global->hasServerTag(ServerTag(tag))) {
|
||||||
|
globals.insert(global);
|
||||||
|
got = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (got) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (global->hasAllServerTag()) {
|
||||||
|
globals.insert(global);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (globals);
|
||||||
}
|
}
|
||||||
|
|
||||||
StampedValueCollection
|
StampedValueCollection
|
||||||
TestConfigBackendDHCPv6::getModifiedGlobalParameters6(const db::ServerSelector& /* server_selector */,
|
TestConfigBackendDHCPv6::getModifiedGlobalParameters6(const db::ServerSelector& server_selector,
|
||||||
const boost::posix_time::ptime& modification_time) const {
|
const boost::posix_time::ptime& modification_time) const {
|
||||||
const auto& index = globals_.get<StampedValueModificationTimeIndexTag>();
|
auto tags = server_selector.getTags();
|
||||||
StampedValueCollection globals;
|
StampedValueCollection globals;
|
||||||
|
const auto& index = globals_.get<StampedValueModificationTimeIndexTag>();
|
||||||
auto lb = index.lower_bound(modification_time);
|
auto lb = index.lower_bound(modification_time);
|
||||||
for (auto global = lb; global != index.end(); ++global) {
|
for (auto global = lb; global != index.end(); ++global) {
|
||||||
|
bool got = false;
|
||||||
|
for (auto tag : tags) {
|
||||||
|
if ((*global)->hasServerTag(ServerTag(tag))) {
|
||||||
globals.insert(*global);
|
globals.insert(*global);
|
||||||
|
got = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (got) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((*global)->hasAllServerTag()) {
|
||||||
|
globals.insert(*global);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (globals);
|
return (globals);
|
||||||
}
|
}
|
||||||
@@ -608,10 +640,18 @@ TestConfigBackendDHCPv6::deleteGlobalParameter6(const db::ServerSelector& server
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
TestConfigBackendDHCPv6::deleteAllGlobalParameters6(const db::ServerSelector& /* server_selector */) {
|
TestConfigBackendDHCPv6::deleteAllGlobalParameters6(const db::ServerSelector& server_selector) {
|
||||||
auto globals_size = globals_.size();
|
uint64_t cnt = 0;
|
||||||
globals_.clear();
|
for (auto global_it = globals_.begin(); global_it != globals_.end(); ) {
|
||||||
return (globals_size);
|
auto value = *global_it;
|
||||||
|
if (value->hasServerTag(ServerTag(getServerTag(server_selector)))) {
|
||||||
|
global_it = globals_.erase(global_it);
|
||||||
|
cnt++;
|
||||||
|
} else {
|
||||||
|
++global_it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
|
Reference in New Issue
Block a user