Commit 06826b5e authored by Francis Dupont's avatar Francis Dupont

[676-add-support-for-server-tags-in-the-cb_cmds-hooks-library] Addressed comments

parent 2840515b
......@@ -188,6 +188,7 @@ TestConfigBackendDHCPv4::getModifiedOptions4(const db::ServerSelector& /* server
StampedValuePtr
TestConfigBackendDHCPv4::getGlobalParameter4(const db::ServerSelector& server_selector,
const std::string& name) const {
auto candidate = StampedValuePtr();
const auto& index = globals_.get<StampedValueNameIndexTag>();
auto global_range = index.equal_range(name);
for (auto global_it = global_range.first; global_it != global_range.second;
......@@ -196,16 +197,13 @@ TestConfigBackendDHCPv4::getGlobalParameter4(const db::ServerSelector& server_se
for (auto tag : tags) {
if ((*global_it)->hasServerTag(ServerTag(tag))) {
return (*global_it);
} else if ((*global_it)->hasAllServerTag()) {
candidate = *global_it;
}
}
}
auto global_all_it = index.find(name);
if ((global_all_it != index.end()) && ((*global_all_it)->hasAllServerTag())) {
return (*global_all_it);
}
return (StampedValuePtr());
return (candidate);
}
......
......@@ -187,6 +187,7 @@ TestConfigBackendDHCPv6::getModifiedOptions6(const db::ServerSelector& /* server
StampedValuePtr
TestConfigBackendDHCPv6::getGlobalParameter6(const db::ServerSelector& server_selector,
const std::string& name) const {
auto candidate = StampedValuePtr();
const auto& index = globals_.get<StampedValueNameIndexTag>();
auto global_range = index.equal_range(name);
for (auto global_it = global_range.first; global_it != global_range.second;
......@@ -196,15 +197,12 @@ TestConfigBackendDHCPv6::getGlobalParameter6(const db::ServerSelector& server_se
if ((*global_it)->hasServerTag(ServerTag(tag))) {
return (*global_it);
}
} else if ((*global_it)->hasAllServerTag()) {
candidate = *global_it;
}
}
auto global_all_it = index.find(name);
if ((global_all_it != index.end()) && ((*global_all_it)->hasAllServerTag())) {
return (*global_all_it);
}
return (StampedValuePtr());
return (candidate);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment