Commit 2ad41651 authored by Francis Dupont's avatar Francis Dupont

[509-improve-disabling-client-id] [509-improve-disabling-client-id-] Change subnetsAllHRGlobal type

parent 1041a8b8
......@@ -370,14 +370,14 @@ SharedNetwork4::subnetsIncludeMatchClientId(const Subnet4Ptr& first_subnet,
return (false);
}
void
SharedNetwork4::subnetsAllHRGlobal(Subnet4Ptr& bad_subnet) const {
Subnet4Ptr
SharedNetwork4::subnetsAllHRGlobal() const {
for (auto subnet : *getAllSubnets()) {
if (subnet->getHostReservationMode() != Network::HR_GLOBAL) {
bad_subnet = subnet;
return;
return (subnet);
}
}
return (Subnet4Ptr());
}
ElementPtr
......@@ -463,14 +463,14 @@ SharedNetwork6::getPreferredSubnet(const Subnet6Ptr& selected_subnet,
return (Impl::getPreferredSubnet(subnets_, selected_subnet, lease_type));
}
void
SharedNetwork6::subnetsAllHRGlobal(Subnet6Ptr& bad_subnet) const {
Subnet6Ptr
SharedNetwork6::subnetsAllHRGlobal() const {
for (auto subnet : *getAllSubnets()) {
if (subnet->getHostReservationMode() != Network::HR_GLOBAL) {
bad_subnet = subnet;
return;
return (subnet);
}
}
return (Subnet6Ptr());
}
ElementPtr
......
......@@ -190,9 +190,8 @@ public:
/// @brief Check if the shared network includes a subnet with
/// not global host reservation mode.
///
/// @param [out] bad_subnet First subnet which has not a global host
/// reservation mode.
void subnetsAllHRGlobal(Subnet4Ptr& bad_subnet) const;
/// @return First subnet which has not a global host reservation mode.
Subnet4Ptr subnetsAllHRGlobal() const;
/// @brief Unparses shared network object.
///
......@@ -387,9 +386,8 @@ public:
/// @brief Check if the shared network includes a subnet with
/// not global host reservation mode.
///
/// @param [out] bad_subnet First subnet which has not a global host
/// reservation mode.
void subnetsAllHRGlobal(Subnet6Ptr& bad_subnet) const;
/// @return First subnet which has not a global host reservation mode.
Subnet6Ptr subnetsAllHRGlobal() const;
/// @brief Unparses shared network object.
///
......
......@@ -453,7 +453,7 @@ TEST(SharedNetwork4Test, subnetsAllHRGlobal) {
Subnet4Ptr bad;
// Empty shared network is right.
ASSERT_NO_THROW(network->subnetsAllHRGlobal(bad));
ASSERT_NO_THROW(bad = network->subnetsAllHRGlobal());
EXPECT_FALSE(bad);
// Create a subnet and add it to the shared network.
......@@ -463,7 +463,7 @@ TEST(SharedNetwork4Test, subnetsAllHRGlobal) {
// Default host reservation mode is ALL.
bad.reset();
ASSERT_NO_THROW(network->subnetsAllHRGlobal(bad));
ASSERT_NO_THROW(bad = network->subnetsAllHRGlobal());
ASSERT_TRUE(bad);
EXPECT_EQ(1, bad->getID());
EXPECT_EQ("10.0.0.0/8", bad->toText());
......@@ -473,7 +473,7 @@ TEST(SharedNetwork4Test, subnetsAllHRGlobal) {
// Now the shared network is all global.
bad.reset();
ASSERT_NO_THROW(network->subnetsAllHRGlobal(bad));
ASSERT_NO_THROW(bad = network->subnetsAllHRGlobal());
EXPECT_FALSE(bad);
}
......@@ -1041,7 +1041,7 @@ TEST(SharedNetwork6Test, subnetsAllHRGlobal) {
Subnet6Ptr bad;
// Empty shared network is right.
ASSERT_NO_THROW(network->subnetsAllHRGlobal(bad));
ASSERT_NO_THROW(bad = network->subnetsAllHRGlobal());
EXPECT_FALSE(bad);
// Create a subnet and add it to the shared network.
......@@ -1051,7 +1051,7 @@ TEST(SharedNetwork6Test, subnetsAllHRGlobal) {
// Default host reservation mode is ALL.
bad.reset();
ASSERT_NO_THROW(network->subnetsAllHRGlobal(bad));
ASSERT_NO_THROW(bad = network->subnetsAllHRGlobal());
ASSERT_TRUE(bad);
EXPECT_EQ(1, bad->getID());
EXPECT_EQ("2001:db8:1::/64", bad->toText());
......@@ -1061,7 +1061,7 @@ TEST(SharedNetwork6Test, subnetsAllHRGlobal) {
// Now the shared network is all global.
bad.reset();
ASSERT_NO_THROW(network->subnetsAllHRGlobal(bad));
ASSERT_NO_THROW(bad = network->subnetsAllHRGlobal());
EXPECT_FALSE(bad);
}
......
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