summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/testutils
diff options
context:
space:
mode:
authorRazvan Becheriu <razvan@isc.org>2023-12-20 20:06:42 +0100
committerRazvan Becheriu <razvan@isc.org>2024-01-22 16:33:26 +0100
commit54dd674d0da13aac0cf2ca484842740477276e26 (patch)
tree884e70409a29a318cf9b038855204a8edbd042b0 /src/lib/dhcpsrv/testutils
parent[#3119] Fixed some coverity reported defects (diff)
downloadkea-54dd674d0da13aac0cf2ca484842740477276e26.tar.xz
kea-54dd674d0da13aac0cf2ca484842740477276e26.zip
[#3119] use auto const& whenever possible
Diffstat (limited to 'src/lib/dhcpsrv/testutils')
-rw-r--r--src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc12
-rw-r--r--src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc12
-rw-r--r--src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc6
-rw-r--r--src/lib/dhcpsrv/testutils/generic_lease_mgr_unittest.cc16
-rw-r--r--src/lib/dhcpsrv/testutils/test_config_backend.h2
-rw-r--r--src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc100
-rw-r--r--src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.cc104
7 files changed, 126 insertions, 126 deletions
diff --git a/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc b/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc
index 505813d958..8ab8df7616 100644
--- a/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc
+++ b/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc
@@ -1326,7 +1326,7 @@ void
GenericConfigBackendDHCPv4Test::getAllSubnets4Test() {
// Insert test subnets into the database. Note that the second subnet will
// overwrite the first subnet as they use the same ID.
- for (auto subnet : test_subnets_) {
+ for (auto const& subnet : test_subnets_) {
cbptr_->createUpdateSubnet4(ServerSelector::ALL(), subnet);
// That subnet overrides the first subnet so the audit entry should
@@ -1853,12 +1853,12 @@ GenericConfigBackendDHCPv4Test::getSharedNetworkSubnets4Test() {
test_subnets_[3]->setSharedNetworkName("level2");
// Store shared networks in the database.
- for (auto network : test_networks_) {
+ for (auto const& network : test_networks_) {
cbptr_->createUpdateSharedNetwork4(ServerSelector::ALL(), network);
}
// Store subnets in the database.
- for (auto subnet : test_subnets_) {
+ for (auto const& subnet : test_subnets_) {
cbptr_->createUpdateSubnet4(ServerSelector::ALL(), subnet);
}
@@ -2266,7 +2266,7 @@ void
GenericConfigBackendDHCPv4Test::getAllSharedNetworks4Test() {
// Insert test shared networks into the database. Note that the second shared
// network will overwrite the first shared network as they use the same name.
- for (auto network : test_networks_) {
+ for (auto const& network : test_networks_) {
cbptr_->createUpdateSharedNetwork4(ServerSelector::ALL(), network);
// That shared network overrides the first one so the audit entry should
@@ -3070,7 +3070,7 @@ GenericConfigBackendDHCPv4Test::getAllOptionDefs4Test() {
// option definition will overwrite the first option definition as they use
// the same code and space.
size_t updates_num = 0;
- for (auto option_def : test_option_defs_) {
+ for (auto const& option_def : test_option_defs_) {
cbptr_->createUpdateOptionDef4(ServerSelector::ALL(), option_def);
// That option definition overrides the first one so the audit entry should
@@ -3915,7 +3915,7 @@ GenericConfigBackendDHCPv4Test::subnetOptionIdOrderTest() {
ASSERT_EQ(2, subnets.size());
// Verify that the subnets returned are as expected.
- for (auto subnet : subnets) {
+ for (auto const& subnet : subnets) {
ASSERT_EQ(1, subnet->getServerTags().size());
EXPECT_EQ("all", subnet->getServerTags().begin()->get());
if (subnet->getID() == 1024) {
diff --git a/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc b/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc
index 522400920e..584f2998ec 100644
--- a/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc
+++ b/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc
@@ -1340,7 +1340,7 @@ void
GenericConfigBackendDHCPv6Test::getAllSubnets6Test() {
// Insert test subnets into the database. Note that the second subnet will
// overwrite the first subnet as they use the same ID.
- for (auto subnet : test_subnets_) {
+ for (auto const& subnet : test_subnets_) {
cbptr_->createUpdateSubnet6(ServerSelector::ALL(), subnet);
// That subnet overrides the first subnet so the audit entry should
@@ -1868,12 +1868,12 @@ GenericConfigBackendDHCPv6Test::getSharedNetworkSubnets6Test() {
test_subnets_[3]->setSharedNetworkName("level2");
// Store shared networks in the database.
- for (auto network : test_networks_) {
+ for (auto const& network : test_networks_) {
cbptr_->createUpdateSharedNetwork6(ServerSelector::ALL(), network);
}
// Store subnets in the database.
- for (auto subnet : test_subnets_) {
+ for (auto const& subnet : test_subnets_) {
cbptr_->createUpdateSubnet6(ServerSelector::ALL(), subnet);
}
@@ -2290,7 +2290,7 @@ void
GenericConfigBackendDHCPv6Test::getAllSharedNetworks6Test() {
// Insert test shared networks into the database. Note that the second shared
// network will overwrite the first shared network as they use the same name.
- for (auto network : test_networks_) {
+ for (auto const& network : test_networks_) {
cbptr_->createUpdateSharedNetwork6(ServerSelector::ALL(), network);
// That shared network overrides the first one so the audit entry should
@@ -3096,7 +3096,7 @@ GenericConfigBackendDHCPv6Test::getAllOptionDefs6Test() {
// option definition will overwrite the first option definition as they use
// the same code and space.
size_t updates_num = 0;
- for (auto option_def : test_option_defs_) {
+ for (auto const& option_def : test_option_defs_) {
cbptr_->createUpdateOptionDef6(ServerSelector::ALL(), option_def);
// That option definition overrides the first one so the audit entry should
@@ -4072,7 +4072,7 @@ GenericConfigBackendDHCPv6Test::subnetOptionIdOrderTest() {
ASSERT_EQ(2, subnets.size());
// Verify that the subnets returned are as expected.
- for (auto subnet : subnets) {
+ for (auto const& subnet : subnets) {
ASSERT_EQ(1, subnet->getServerTags().size());
EXPECT_EQ("all", subnet->getServerTags().begin()->get());
if (subnet->getID() == 1024) {
diff --git a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc
index 1dbc92026d..0920bc4bba 100644
--- a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc
+++ b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc
@@ -518,7 +518,7 @@ GenericHostDataSourceTest::testGetAllbyHostname() {
bool got1 = false;
bool got2 = false;
bool got3 = false;
- for (auto host : from_hds) {
+ for (auto const& host : from_hds) {
if (host->getIdentifierType() == Host::IDENT_HWADDR) {
EXPECT_FALSE(got1);
got1 = true;
@@ -601,7 +601,7 @@ GenericHostDataSourceTest::testGetAllbyHostnameSubnet4() {
bool got1 = false;
bool got2 = false;
bool got3 = false;
- for (auto host : from_hds) {
+ for (auto const& host : from_hds) {
if (host->getIdentifierType() == Host::IDENT_HWADDR) {
EXPECT_FALSE(got1);
got1 = true;
@@ -684,7 +684,7 @@ GenericHostDataSourceTest::testGetAllbyHostnameSubnet6() {
bool got1 = false;
bool got2 = false;
bool got3 = false;
- for (auto host : from_hds) {
+ for (auto const& host : from_hds) {
if (host->getIdentifierType() == Host::IDENT_HWADDR) {
EXPECT_FALSE(got1);
got1 = true;
diff --git a/src/lib/dhcpsrv/testutils/generic_lease_mgr_unittest.cc b/src/lib/dhcpsrv/testutils/generic_lease_mgr_unittest.cc
index bcc671097f..9e1d87c9eb 100644
--- a/src/lib/dhcpsrv/testutils/generic_lease_mgr_unittest.cc
+++ b/src/lib/dhcpsrv/testutils/generic_lease_mgr_unittest.cc
@@ -1335,7 +1335,7 @@ GenericLeaseMgrTest::testGetLeases4Paged() {
Lease4Collection page = lmptr_->getLeases4(last_address, LeasePageSize(3));
// Collect leases in a common structure. They may be out of order.
- for (Lease4Ptr lease : page) {
+ for (const Lease4Ptr& lease : page) {
all_leases.push_back(lease);
}
@@ -1356,9 +1356,9 @@ GenericLeaseMgrTest::testGetLeases4Paged() {
// Make sure that all leases that we stored in the lease database
// have been retrieved.
- for (Lease4Ptr lease : leases) {
+ for (const Lease4Ptr& lease : leases) {
bool found = false;
- for (Lease4Ptr returned_lease : all_leases) {
+ for (const Lease4Ptr& returned_lease : all_leases) {
if (lease->addr_ == returned_lease->addr_) {
found = true;
break;
@@ -1517,7 +1517,7 @@ GenericLeaseMgrTest::testGetLeases6Paged() {
Lease6Collection page = lmptr_->getLeases6(last_address, LeasePageSize(3));
// Collect leases in a common structure. They may be out of order.
- for (Lease6Ptr lease : page) {
+ for (const Lease6Ptr& lease : page) {
all_leases.push_back(lease);
}
@@ -1538,9 +1538,9 @@ GenericLeaseMgrTest::testGetLeases6Paged() {
// Make sure that all leases that we stored in the lease database
// have been retrieved.
- for (Lease6Ptr lease : leases) {
+ for (const Lease6Ptr& lease : leases) {
bool found = false;
- for (Lease6Ptr returned_lease : all_leases) {
+ for (const Lease6Ptr& returned_lease : all_leases) {
if (lease->addr_ == returned_lease->addr_) {
found = true;
break;
@@ -3066,7 +3066,7 @@ int
GenericLeaseMgrTest::countLogs(TrackingLeaseMgr::CallbackType type, SubnetID subnet_id,
Lease::Type lease_type) const {
int count = 0;
- for (auto log : logs_) {
+ for (auto const& log : logs_) {
if ((log.type == type) && (log.subnet_id == subnet_id) && (log.lease->getType() == lease_type)) {
++count;
}
@@ -4383,7 +4383,7 @@ GenericLeaseMgrTest::makeContextWithClasses(const std::list<ClientClass>& classe
ElementPtr ctx = Element::createMap();
if (classes.size()) {
ElementPtr clist = Element::createList();
- for (auto client_class : classes ) {
+ for (auto const& client_class : classes ) {
clist->add(Element::create(client_class));
}
diff --git a/src/lib/dhcpsrv/testutils/test_config_backend.h b/src/lib/dhcpsrv/testutils/test_config_backend.h
index d78f97f8fd..f6f4e5e2be 100644
--- a/src/lib/dhcpsrv/testutils/test_config_backend.h
+++ b/src/lib/dhcpsrv/testutils/test_config_backend.h
@@ -96,7 +96,7 @@ public:
void mergeServerTags(const StampedElementPtr& elem,
const db::ServerSelector& server_selector) const {
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
elem->setServerTag(tag.get());
}
}
diff --git a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc
index 8648d97f29..a3cfcbd1c8 100644
--- a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc
+++ b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc
@@ -50,7 +50,7 @@ TestConfigBackendDHCPv4::getSubnet4(const db::ServerSelector& server_selector,
return (subnet->getServerTags().empty() ? subnet : Subnet4Ptr());
}
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
return (subnet);
}
@@ -74,7 +74,7 @@ TestConfigBackendDHCPv4::getSubnet4(const db::ServerSelector& server_selector,
return (subnet->getServerTags().empty() ? subnet : Subnet4Ptr());
}
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
return (subnet);
}
@@ -85,7 +85,7 @@ TestConfigBackendDHCPv4::getSubnet4(const db::ServerSelector& server_selector,
Subnet4Collection
TestConfigBackendDHCPv4::getAllSubnets4(const db::ServerSelector& server_selector) const {
Subnet4Collection subnets;
- for (auto subnet : subnets_) {
+ for (auto const& subnet : subnets_) {
if (server_selector.amAny()) {
subnets.insert(subnet);
continue;
@@ -98,7 +98,7 @@ TestConfigBackendDHCPv4::getAllSubnets4(const db::ServerSelector& server_selecto
}
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
subnets.insert(subnet);
got = true;
@@ -134,7 +134,7 @@ TestConfigBackendDHCPv4::getModifiedSubnets4(const db::ServerSelector& server_se
}
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*subnet)->hasServerTag(ServerTag(tag))) {
subnets.insert(*subnet);
got = true;
@@ -159,7 +159,7 @@ TestConfigBackendDHCPv4::getSharedNetworkSubnets4(const db::ServerSelector& serv
// Subnet collection does not include the index by shared network name.
// We need to iterate over the subnets and pick those that are associated
// with a shared network.
- for (auto subnet : subnets_) {
+ for (auto const& subnet : subnets_) {
// Skip subnets which do not match the server selector.
if (server_selector.amUnassigned() &&
!subnet->getServerTags().empty()) {
@@ -168,7 +168,7 @@ TestConfigBackendDHCPv4::getSharedNetworkSubnets4(const db::ServerSelector& serv
if (!server_selector.amAny()) {
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
got = true;
break;
@@ -210,7 +210,7 @@ TestConfigBackendDHCPv4::getSharedNetwork4(const db::ServerSelector& server_sele
return (network->getServerTags().empty() ? network : SharedNetwork4Ptr());
}
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (network->hasServerTag(ServerTag(tag))) {
return (network);
}
@@ -221,7 +221,7 @@ TestConfigBackendDHCPv4::getSharedNetwork4(const db::ServerSelector& server_sele
SharedNetwork4Collection
TestConfigBackendDHCPv4::getAllSharedNetworks4(const db::ServerSelector& server_selector) const{
SharedNetwork4Collection shared_networks;
- for (auto shared_network : shared_networks_) {
+ for (auto const& shared_network : shared_networks_) {
if (server_selector.amAny()) {
shared_networks.push_back(shared_network);
continue;
@@ -234,7 +234,7 @@ TestConfigBackendDHCPv4::getAllSharedNetworks4(const db::ServerSelector& server_
}
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (shared_network->hasServerTag(ServerTag(tag))) {
shared_networks.push_back(shared_network);
got = true;
@@ -270,7 +270,7 @@ TestConfigBackendDHCPv4::getModifiedSharedNetworks4(const db::ServerSelector& se
}
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*shared_network)->hasServerTag(ServerTag(tag))) {
shared_networks.push_back(*shared_network);
got = true;
@@ -300,7 +300,7 @@ TestConfigBackendDHCPv4::getOptionDef4(const db::ServerSelector& server_selector
option_def_it != option_def_it_pair.second;
++option_def_it) {
if ((*option_def_it)->getOptionSpaceName() == space) {
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*option_def_it)->hasServerTag(ServerTag(tag))) {
return (*option_def_it);
}
@@ -317,7 +317,7 @@ OptionDefContainer
TestConfigBackendDHCPv4::getAllOptionDefs4(const db::ServerSelector& server_selector) const {
auto tags = server_selector.getTags();
OptionDefContainer option_defs;
- for (auto option_def : option_defs_) {
+ for (auto const& option_def : option_defs_) {
bool got = false;
if (server_selector.amUnassigned()) {
if (option_def->getServerTags().empty()) {
@@ -325,7 +325,7 @@ TestConfigBackendDHCPv4::getAllOptionDefs4(const db::ServerSelector& server_sele
got = true;
}
} else {
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (option_def->hasServerTag(ServerTag(tag))) {
option_defs.push_back(option_def);
got = true;
@@ -352,7 +352,7 @@ TestConfigBackendDHCPv4::getModifiedOptionDefs4(const db::ServerSelector& server
auto lb = index.lower_bound(modification_time);
for (auto option_def = lb; option_def != index.end(); ++option_def) {
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*option_def)->hasServerTag(ServerTag(tag))) {
option_defs.push_back(*option_def);
got = true;
@@ -381,7 +381,7 @@ TestConfigBackendDHCPv4::getOption4(const db::ServerSelector& server_selector,
for (auto option_it = option_it_pair.first; option_it != option_it_pair.second;
++option_it) {
if (option_it->space_name_ == space) {
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (option_it->hasServerTag(ServerTag(tag))) {
return (OptionDescriptorPtr(new OptionDescriptor(*option_it)));
}
@@ -399,9 +399,9 @@ OptionContainer
TestConfigBackendDHCPv4::getAllOptions4(const db::ServerSelector& server_selector) const {
auto tags = server_selector.getTags();
OptionContainer options;
- for (auto option : options_) {
+ for (auto const& option : options_) {
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (option.hasServerTag(ServerTag(tag))) {
options.push_back(option);
got = true;
@@ -427,7 +427,7 @@ TestConfigBackendDHCPv4::getModifiedOptions4(const db::ServerSelector& server_se
auto lb = index.lower_bound(modification_time);
for (auto option = lb; option != index.end(); ++option) {
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (option->hasServerTag(ServerTag(tag))) {
options.push_back(*option);
got = true;
@@ -453,7 +453,7 @@ TestConfigBackendDHCPv4::getGlobalParameter4(const db::ServerSelector& server_se
auto global_range = index.equal_range(name);
for (auto global_it = global_range.first; global_it != global_range.second;
++global_it) {
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*global_it)->hasServerTag(ServerTag(tag))) {
return (*global_it);
}
@@ -471,9 +471,9 @@ StampedValueCollection
TestConfigBackendDHCPv4::getAllGlobalParameters4(const db::ServerSelector& server_selector) const {
auto tags = server_selector.getTags();
StampedValueCollection globals;
- for (auto global : globals_) {
+ for (auto const& global : globals_) {
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (global->hasServerTag(ServerTag(tag))) {
globals.insert(global);
got = true;
@@ -499,7 +499,7 @@ TestConfigBackendDHCPv4::getModifiedGlobalParameters4(const db::ServerSelector&
auto lb = index.lower_bound(modification_time);
for (auto global = lb; global != index.end(); ++global) {
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*global)->hasServerTag(ServerTag(tag))) {
globals.insert(*global);
got = true;
@@ -520,7 +520,7 @@ ClientClassDefPtr
TestConfigBackendDHCPv4::getClientClass4(const db::ServerSelector& server_selector,
const std::string& name) const {
ClientClassDefPtr client_class;
- for (auto c : classes_) {
+ for (auto const& c : classes_) {
if (c->getName() == name) {
client_class = c;
break;
@@ -533,7 +533,7 @@ TestConfigBackendDHCPv4::getClientClass4(const db::ServerSelector& server_select
return (client_class->getServerTags().empty() ? client_class : ClientClassDefPtr());
}
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (client_class->hasServerTag(ServerTag(tag))) {
return (client_class);
}
@@ -545,7 +545,7 @@ ClientClassDictionary
TestConfigBackendDHCPv4::getAllClientClasses4(const db::ServerSelector& server_selector) const {
auto tags = server_selector.getTags();
ClientClassDictionary all_classes;
- for (auto client_class : classes_) {
+ for (auto const& client_class : classes_) {
if (server_selector.amAny()) {
all_classes.addClass(client_class);
continue;
@@ -557,7 +557,7 @@ TestConfigBackendDHCPv4::getAllClientClasses4(const db::ServerSelector& server_s
continue;
}
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (client_class->hasServerTag(ServerTag(tag))) {
all_classes.addClass(client_class);
got = true;
@@ -579,10 +579,10 @@ TestConfigBackendDHCPv4::getModifiedClientClasses4(const db::ServerSelector& ser
const boost::posix_time::ptime& modification_time) const {
auto tags = server_selector.getTags();
ClientClassDictionary modified_classes;
- for (auto client_class : classes_) {
+ for (auto const& client_class : classes_) {
if (client_class->getModificationTime() >= modification_time) {
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (client_class->hasServerTag(ServerTag(tag))) {
modified_classes.addClass(client_class);
got = true;
@@ -621,7 +621,7 @@ TestConfigBackendDHCPv4::createUpdateClientClass4(const db::ServerSelector& serv
mergeServerTags(client_class, server_selector);
int existing_class_index = -1;
- for (auto i = 0; i < classes_.size(); ++i) {
+ for (size_t i = 0; i < classes_.size(); ++i) {
if (classes_[i]->getName() == client_class->getName()) {
existing_class_index = i;
break;
@@ -778,7 +778,7 @@ TestConfigBackendDHCPv4::createUpdateOption4(const db::ServerSelector& server_se
found = true;
} else {
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (shared_network->hasServerTag(ServerTag(tag))) {
found = true;
break;
@@ -819,7 +819,7 @@ TestConfigBackendDHCPv4::createUpdateOption4(const db::ServerSelector& server_se
found = true;
} else {
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
found = true;
break;
@@ -842,7 +842,7 @@ TestConfigBackendDHCPv4::createUpdateOption4(const db::ServerSelector& server_se
const asiolink::IOAddress& pool_end_address,
const OptionDescriptorPtr& option) {
auto not_in_selected_servers = false;
- for (auto subnet : subnets_) {
+ for (auto const& subnet : subnets_) {
// Get the pool: if it is not here we can directly go to the next subnet.
auto pool = subnet->getPool(Lease::TYPE_V4, pool_start_address);
if (!pool) {
@@ -858,7 +858,7 @@ TestConfigBackendDHCPv4::createUpdateOption4(const db::ServerSelector& server_se
} else if (!server_selector.amAny() && !subnet->hasAllServerTag()) {
auto in_tags = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
in_tags = true;
break;
@@ -939,7 +939,7 @@ TestConfigBackendDHCPv4::deleteSubnet4(const db::ServerSelector& server_selector
if (!server_selector.amAny()) {
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*subnet_it)->hasServerTag(ServerTag(tag))) {
got = true;
break;
@@ -967,7 +967,7 @@ TestConfigBackendDHCPv4::deleteSubnet4(const db::ServerSelector& server_selector
if (!server_selector.amAny()) {
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*subnet_it)->hasServerTag(ServerTag(tag))) {
got = true;
break;
@@ -984,7 +984,7 @@ uint64_t
TestConfigBackendDHCPv4::deleteAllSubnets4(const db::ServerSelector& server_selector) {
// Collect subnet to remove by ID.
std::list<SubnetID> ids;
- for (auto subnet : subnets_) {
+ for (auto const& subnet : subnets_) {
if (server_selector.amAny()) {
ids.push_back(subnet->getID());
continue;
@@ -997,7 +997,7 @@ TestConfigBackendDHCPv4::deleteAllSubnets4(const db::ServerSelector& server_sele
}
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
ids.push_back(subnet->getID());
got = true;
@@ -1015,7 +1015,7 @@ TestConfigBackendDHCPv4::deleteAllSubnets4(const db::ServerSelector& server_sele
// Erase subnets.
uint64_t erased = 0;
auto& index = subnets_.get<SubnetSubnetIdIndexTag>();
- for (auto subnet_id : ids) {
+ for (auto const& subnet_id : ids) {
erased += index.erase(subnet_id);
}
return (erased);
@@ -1035,7 +1035,7 @@ TestConfigBackendDHCPv4::deleteSharedNetworkSubnets4(const db::ServerSelector& s
if (!server_selector.amAny()) {
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*subnet)->hasServerTag(ServerTag(tag))) {
got = true;
break;
@@ -1079,7 +1079,7 @@ TestConfigBackendDHCPv4::deleteSharedNetwork4(const db::ServerSelector& server_s
if (!server_selector.amAny()) {
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*network_it)->hasServerTag(ServerTag(tag))) {
got = true;
break;
@@ -1104,7 +1104,7 @@ uint64_t
TestConfigBackendDHCPv4::deleteAllSharedNetworks4(const db::ServerSelector& server_selector) {
// Collect shared network to remove.
std::list<std::string> names;
- for (auto shared_network : shared_networks_) {
+ for (auto const& shared_network : shared_networks_) {
if (server_selector.amAny()) {
names.push_back(shared_network->getName());
continue;
@@ -1117,7 +1117,7 @@ TestConfigBackendDHCPv4::deleteAllSharedNetworks4(const db::ServerSelector& serv
}
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (shared_network->hasServerTag(ServerTag(tag))) {
names.push_back(shared_network->getName());
got = true;
@@ -1135,7 +1135,7 @@ TestConfigBackendDHCPv4::deleteAllSharedNetworks4(const db::ServerSelector& serv
// Erase shared networks.
uint64_t erased = 0;
auto& index = shared_networks_.get<SharedNetworkNameIndexTag>();
- for (auto name : names) {
+ for (auto const& name : names) {
erased += index.erase(name);
}
return (erased);
@@ -1219,7 +1219,7 @@ TestConfigBackendDHCPv4::deleteOption4(const db::ServerSelector& server_selector
found = true;
} else {
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (shared_network->hasServerTag(ServerTag(tag))) {
found = true;
break;
@@ -1260,7 +1260,7 @@ TestConfigBackendDHCPv4::deleteOption4(const db::ServerSelector& server_selector
found = true;
} else {
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
found = true;
break;
@@ -1283,7 +1283,7 @@ TestConfigBackendDHCPv4::deleteOption4(const db::ServerSelector& server_selector
const uint16_t code,
const std::string& space) {
auto not_in_selected_servers = false;
- for (auto subnet : subnets_) {
+ for (auto const& subnet : subnets_) {
// Get the pool: if it is not here we can directly go to the next subnet.
auto pool = subnet->getPool(Lease::TYPE_V4, pool_start_address);
@@ -1300,7 +1300,7 @@ TestConfigBackendDHCPv4::deleteOption4(const db::ServerSelector& server_selector
} else if (!server_selector.amAny() && !subnet->hasAllServerTag()) {
auto in_tags = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
in_tags = true;
break;
@@ -1381,7 +1381,7 @@ TestConfigBackendDHCPv4::deleteClientClass4(const db::ServerSelector& server_sel
if (!server_selector.amAny()) {
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (existing_class->hasServerTag(ServerTag(tag))) {
got = true;
break;
@@ -1414,7 +1414,7 @@ TestConfigBackendDHCPv4::deleteAllClientClasses4(const db::ServerSelector& serve
}
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (client_class->hasServerTag(ServerTag(tag))) {
c = classes_.erase(c);
++count;
diff --git a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.cc b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.cc
index e59ad5dd66..cd9045bfe3 100644
--- a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.cc
+++ b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.cc
@@ -49,7 +49,7 @@ TestConfigBackendDHCPv6::getSubnet6(const db::ServerSelector& server_selector,
return (subnet->getServerTags().empty() ? subnet : Subnet6Ptr());
}
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
return (subnet);
}
@@ -73,7 +73,7 @@ TestConfigBackendDHCPv6::getSubnet6(const db::ServerSelector& server_selector,
return (subnet->getServerTags().empty() ? subnet : Subnet6Ptr());
}
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
return (subnet);
}
@@ -84,7 +84,7 @@ TestConfigBackendDHCPv6::getSubnet6(const db::ServerSelector& server_selector,
Subnet6Collection
TestConfigBackendDHCPv6::getAllSubnets6(const db::ServerSelector& server_selector) const {
Subnet6Collection subnets;
- for (auto subnet : subnets_) {
+ for (auto const& subnet : subnets_) {
if (server_selector.amAny()) {
subnets.insert(subnet);
continue;
@@ -97,7 +97,7 @@ TestConfigBackendDHCPv6::getAllSubnets6(const db::ServerSelector& server_selecto
}
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
subnets.insert(subnet);
got = true;
@@ -133,7 +133,7 @@ TestConfigBackendDHCPv6::getModifiedSubnets6(const db::ServerSelector& server_se
}
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*subnet)->hasServerTag(ServerTag(tag))) {
subnets.insert(*subnet);
got = true;
@@ -158,7 +158,7 @@ TestConfigBackendDHCPv6::getSharedNetworkSubnets6(const db::ServerSelector& serv
// Subnet collection does not include the index by shared network name.
// We need to iterate over the subnets and pick those that are associated
// with a shared network.
- for (auto subnet : subnets_) {
+ for (auto const& subnet : subnets_) {
// Skip subnets which do not match the server selector.
if (server_selector.amUnassigned() &&
!subnet->getServerTags().empty()) {
@@ -167,7 +167,7 @@ TestConfigBackendDHCPv6::getSharedNetworkSubnets6(const db::ServerSelector& serv
if (!server_selector.amAny()) {
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
got = true;
break;
@@ -209,7 +209,7 @@ TestConfigBackendDHCPv6::getSharedNetwork6(const db::ServerSelector& server_sele
return (network->getServerTags().empty() ? network : SharedNetwork6Ptr());
}
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (network->hasServerTag(ServerTag(tag))) {
return (network);
}
@@ -220,7 +220,7 @@ TestConfigBackendDHCPv6::getSharedNetwork6(const db::ServerSelector& server_sele
SharedNetwork6Collection
TestConfigBackendDHCPv6::getAllSharedNetworks6(const db::ServerSelector& server_selector) const{
SharedNetwork6Collection shared_networks;
- for (auto shared_network : shared_networks_) {
+ for (auto const& shared_network : shared_networks_) {
if (server_selector.amAny()) {
shared_networks.push_back(shared_network);
continue;
@@ -233,7 +233,7 @@ TestConfigBackendDHCPv6::getAllSharedNetworks6(const db::ServerSelector& server_
}
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (shared_network->hasServerTag(ServerTag(tag))) {
shared_networks.push_back(shared_network);
got = true;
@@ -269,7 +269,7 @@ TestConfigBackendDHCPv6::getModifiedSharedNetworks6(const db::ServerSelector& se
}
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*shared_network)->hasServerTag(ServerTag(tag))) {
shared_networks.push_back(*shared_network);
got = true;
@@ -299,7 +299,7 @@ TestConfigBackendDHCPv6::getOptionDef6(const db::ServerSelector& server_selector
option_def_it != option_def_it_pair.second;
++option_def_it) {
if ((*option_def_it)->getOptionSpaceName() == space) {
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*option_def_it)->hasServerTag(ServerTag(tag))) {
return (*option_def_it);
}
@@ -316,7 +316,7 @@ OptionDefContainer
TestConfigBackendDHCPv6::getAllOptionDefs6(const db::ServerSelector& server_selector) const {
auto tags = server_selector.getTags();
OptionDefContainer option_defs;
- for (auto option_def : option_defs_) {
+ for (auto const& option_def : option_defs_) {
bool got = false;
if (server_selector.amUnassigned()) {
if (option_def->getServerTags().empty()) {
@@ -324,7 +324,7 @@ TestConfigBackendDHCPv6::getAllOptionDefs6(const db::ServerSelector& server_sele
got = true;
}
} else {
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (option_def->hasServerTag(ServerTag(tag))) {
option_defs.push_back(option_def);
got = true;
@@ -351,7 +351,7 @@ TestConfigBackendDHCPv6::getModifiedOptionDefs6(const db::ServerSelector& server
auto lb = index.lower_bound(modification_time);
for (auto option_def = lb; option_def != index.end(); ++option_def) {
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*option_def)->hasServerTag(ServerTag(tag))) {
option_defs.push_back(*option_def);
got = true;
@@ -380,7 +380,7 @@ TestConfigBackendDHCPv6::getOption6(const db::ServerSelector& server_selector,
for (auto option_it = option_it_pair.first; option_it != option_it_pair.second;
++option_it) {
if (option_it->space_name_ == space) {
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (option_it->hasServerTag(ServerTag(tag))) {
return (OptionDescriptorPtr(new OptionDescriptor(*option_it)));
}
@@ -398,9 +398,9 @@ OptionContainer
TestConfigBackendDHCPv6::getAllOptions6(const db::ServerSelector& server_selector) const {
auto tags = server_selector.getTags();
OptionContainer options;
- for (auto option : options_) {
+ for (auto const& option : options_) {
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (option.hasServerTag(ServerTag(tag))) {
options.push_back(option);
got = true;
@@ -426,7 +426,7 @@ TestConfigBackendDHCPv6::getModifiedOptions6(const db::ServerSelector& server_se
auto lb = index.lower_bound(modification_time);
for (auto option = lb; option != index.end(); ++option) {
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (option->hasServerTag(ServerTag(tag))) {
options.push_back(*option);
got = true;
@@ -452,7 +452,7 @@ TestConfigBackendDHCPv6::getGlobalParameter6(const db::ServerSelector& server_se
auto global_range = index.equal_range(name);
for (auto global_it = global_range.first; global_it != global_range.second;
++global_it) {
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*global_it)->hasServerTag(ServerTag(tag))) {
return (*global_it);
}
@@ -470,9 +470,9 @@ StampedValueCollection
TestConfigBackendDHCPv6::getAllGlobalParameters6(const db::ServerSelector& server_selector) const {
auto tags = server_selector.getTags();
StampedValueCollection globals;
- for (auto global : globals_) {
+ for (auto const& global : globals_) {
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (global->hasServerTag(ServerTag(tag))) {
globals.insert(global);
got = true;
@@ -498,7 +498,7 @@ TestConfigBackendDHCPv6::getModifiedGlobalParameters6(const db::ServerSelector&
auto lb = index.lower_bound(modification_time);
for (auto global = lb; global != index.end(); ++global) {
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*global)->hasServerTag(ServerTag(tag))) {
globals.insert(*global);
got = true;
@@ -519,7 +519,7 @@ ClientClassDefPtr
TestConfigBackendDHCPv6::getClientClass6(const db::ServerSelector& server_selector,
const std::string& name) const {
ClientClassDefPtr client_class;
- for (auto c : classes_) {
+ for (auto const& c : classes_) {
if (c->getName() == name) {
client_class = c;
break;
@@ -532,7 +532,7 @@ TestConfigBackendDHCPv6::getClientClass6(const db::ServerSelector& server_select
return (client_class->getServerTags().empty() ? client_class : ClientClassDefPtr());
}
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (client_class->hasServerTag(ServerTag(tag))) {
return (client_class);
}
@@ -544,7 +544,7 @@ ClientClassDictionary
TestConfigBackendDHCPv6::getAllClientClasses6(const db::ServerSelector& server_selector) const {
auto tags = server_selector.getTags();
ClientClassDictionary all_classes;
- for (auto client_class : classes_) {
+ for (auto const& client_class : classes_) {
if (server_selector.amAny()) {
all_classes.addClass(client_class);
continue;
@@ -556,7 +556,7 @@ TestConfigBackendDHCPv6::getAllClientClasses6(const db::ServerSelector& server_s
continue;
}
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (client_class->hasServerTag(ServerTag(tag))) {
all_classes.addClass(client_class);
got = true;
@@ -578,10 +578,10 @@ TestConfigBackendDHCPv6::getModifiedClientClasses6(const db::ServerSelector& ser
const boost::posix_time::ptime& modification_time) const {
auto tags = server_selector.getTags();
ClientClassDictionary modified_classes;
- for (auto client_class : classes_) {
+ for (auto const& client_class : classes_) {
if (client_class->getModificationTime() >= modification_time) {
bool got = false;
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (client_class->hasServerTag(ServerTag(tag))) {
modified_classes.addClass(client_class);
got = true;
@@ -777,7 +777,7 @@ TestConfigBackendDHCPv6::createUpdateOption6(const db::ServerSelector& server_se
found = true;
} else {
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (shared_network->hasServerTag(ServerTag(tag))) {
found = true;
break;
@@ -818,7 +818,7 @@ TestConfigBackendDHCPv6::createUpdateOption6(const db::ServerSelector& server_se
found = true;
} else {
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
found = true;
break;
@@ -841,7 +841,7 @@ TestConfigBackendDHCPv6::createUpdateOption6(const db::ServerSelector& server_se
const asiolink::IOAddress& pool_end_address,
const OptionDescriptorPtr& option) {
auto not_in_selected_servers = false;
- for (auto subnet : subnets_) {
+ for (auto const& subnet : subnets_) {
// Get the pool: if it is not here we can directly go to the next subnet.
auto pool = subnet->getPool(Lease::TYPE_NA, pool_start_address);
if (!pool) {
@@ -857,7 +857,7 @@ TestConfigBackendDHCPv6::createUpdateOption6(const db::ServerSelector& server_se
} else if (!server_selector.amAny() && !subnet->hasAllServerTag()) {
auto in_tags = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
in_tags = true;
break;
@@ -895,7 +895,7 @@ TestConfigBackendDHCPv6::createUpdateOption6(const db::ServerSelector& server_se
const uint8_t pd_pool_prefix_length,
const OptionDescriptorPtr& option) {
auto not_in_selected_servers = false;
- for (auto subnet : subnets_) {
+ for (auto const& subnet : subnets_) {
// Get the pd pool: if it is not here we can directly go to the next subnet.
auto pdpool = subnet->getPool(Lease::TYPE_PD, pd_pool_prefix);
if (!pdpool) {
@@ -911,7 +911,7 @@ TestConfigBackendDHCPv6::createUpdateOption6(const db::ServerSelector& server_se
} else if (!server_selector.amAny() && !subnet->hasAllServerTag()) {
auto in_tags = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
in_tags = true;
break;
@@ -992,7 +992,7 @@ TestConfigBackendDHCPv6::deleteSubnet6(const db::ServerSelector& server_selector
if (!server_selector.amAny()) {
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*subnet_it)->hasServerTag(ServerTag(tag))) {
got = true;
break;
@@ -1020,7 +1020,7 @@ TestConfigBackendDHCPv6::deleteSubnet6(const db::ServerSelector& server_selector
if (!server_selector.amAny()) {
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*subnet_it)->hasServerTag(ServerTag(tag))) {
got = true;
break;
@@ -1037,7 +1037,7 @@ uint64_t
TestConfigBackendDHCPv6::deleteAllSubnets6(const db::ServerSelector& server_selector) {
// Collect subnet to remove by ID.
std::list<SubnetID> ids;
- for (auto subnet : subnets_) {
+ for (auto const& subnet : subnets_) {
if (server_selector.amAny()) {
ids.push_back(subnet->getID());
continue;
@@ -1050,7 +1050,7 @@ TestConfigBackendDHCPv6::deleteAllSubnets6(const db::ServerSelector& server_sele
}
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
ids.push_back(subnet->getID());
got = true;
@@ -1068,7 +1068,7 @@ TestConfigBackendDHCPv6::deleteAllSubnets6(const db::ServerSelector& server_sele
// Erase subnets.
uint64_t erased = 0;
auto& index = subnets_.get<SubnetSubnetIdIndexTag>();
- for (auto subnet_id : ids) {
+ for (auto const& subnet_id : ids) {
erased += index.erase(subnet_id);
}
return (erased);
@@ -1088,7 +1088,7 @@ TestConfigBackendDHCPv6::deleteSharedNetworkSubnets6(const db::ServerSelector& s
if (!server_selector.amAny()) {
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*subnet)->hasServerTag(ServerTag(tag))) {
got = true;
break;
@@ -1132,7 +1132,7 @@ TestConfigBackendDHCPv6::deleteSharedNetwork6(const db::ServerSelector& server_s
if (!server_selector.amAny()) {
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if ((*network_it)->hasServerTag(ServerTag(tag))) {
got = true;
break;
@@ -1157,7 +1157,7 @@ uint64_t
TestConfigBackendDHCPv6::deleteAllSharedNetworks6(const db::ServerSelector& server_selector) {
// Collect shared network to remove.
std::list<std::string> names;
- for (auto shared_network : shared_networks_) {
+ for (auto const& shared_network : shared_networks_) {
if (server_selector.amAny()) {
names.push_back(shared_network->getName());
continue;
@@ -1170,7 +1170,7 @@ TestConfigBackendDHCPv6::deleteAllSharedNetworks6(const db::ServerSelector& serv
}
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (shared_network->hasServerTag(ServerTag(tag))) {
names.push_back(shared_network->getName());
got = true;
@@ -1188,7 +1188,7 @@ TestConfigBackendDHCPv6::deleteAllSharedNetworks6(const db::ServerSelector& serv
// Erase shared networks.
uint64_t erased = 0;
auto& index = shared_networks_.get<SharedNetworkNameIndexTag>();
- for (auto name : names) {
+ for (auto const& name : names) {
erased += index.erase(name);
}
return (erased);
@@ -1272,7 +1272,7 @@ TestConfigBackendDHCPv6::deleteOption6(const db::ServerSelector& server_selector
found = true;
} else {
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (shared_network->hasServerTag(ServerTag(tag))) {
found = true;
break;
@@ -1313,7 +1313,7 @@ TestConfigBackendDHCPv6::deleteOption6(const db::ServerSelector& server_selector
found = true;
} else {
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
found = true;
break;
@@ -1336,7 +1336,7 @@ TestConfigBackendDHCPv6::deleteOption6(const db::ServerSelector& server_selector
const uint16_t code,
const std::string& space) {
auto not_in_selected_servers = false;
- for (auto subnet : subnets_) {
+ for (auto const& subnet : subnets_) {
// Get the pool: if it is not here we can directly go to the next subnet.
auto pool = subnet->getPool(Lease::TYPE_NA, pool_start_address);
@@ -1353,7 +1353,7 @@ TestConfigBackendDHCPv6::deleteOption6(const db::ServerSelector& server_selector
} else if (!server_selector.amAny() && !subnet->hasAllServerTag()) {
auto in_tags = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
in_tags = true;
break;
@@ -1386,7 +1386,7 @@ TestConfigBackendDHCPv6::deleteOption6(const db::ServerSelector& server_selector
const uint16_t code,
const std::string& space) {
auto not_in_selected_servers = false;
- for (auto subnet : subnets_) {
+ for (auto const& subnet : subnets_) {
// Get the pd pool: if it is not here we can directly go to the next subnet.
auto pdpool = subnet->getPool(Lease::TYPE_PD, pd_pool_prefix);
if (!pdpool) {
@@ -1402,7 +1402,7 @@ TestConfigBackendDHCPv6::deleteOption6(const db::ServerSelector& server_selector
} else if (!server_selector.amAny() && !subnet->hasAllServerTag()) {
auto in_tags = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (subnet->hasServerTag(ServerTag(tag))) {
in_tags = true;
break;
@@ -1485,7 +1485,7 @@ TestConfigBackendDHCPv6::deleteClientClass6(const db::ServerSelector& server_sel
if (!server_selector.amAny()) {
bool got = false;
auto tags = server_selector.getTags();
- for (auto tag : tags) {
+ for (auto const& tag : tags) {
if (existing_class->hasServerTag(ServerTag(tag))) {
got = true;
break;