/// not be modified after the call to @c merge because it may affect the
/// merged configuration.
///
- /// @param cfg_def set of of user-defined option definitions to use
+ /// @param cfg_def set of user-defined option definitions to use
/// when creating option instances.
/// @param networks collection of shared networks that to which assignments
/// should be added. In other words, the list of shared networks that belong
/// not be modified after the call to @c merge because it may affect the
/// merged configuration.
///
- /// @param cfg_def set of of user-defined option definitions to use
+ /// @param cfg_def set of user-defined option definitions to use
/// when creating option instances.
/// @param networks collection of shared networks that to which assignments
/// should be added. In other words, the list of shared networks that belong
TEST(CfgSubnets4Test, getLinks) {
CfgSubnets4 cfg;
- // Create 3 subnets.
+ // Create 4 subnets.
+ Subnet4Ptr subnet0(new Subnet4(IOAddress("0.0.0.0"),
+ 24, 1, 2, 3, SubnetID(111)));
Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.1.0"),
26, 1, 2, 3, SubnetID(1)));
Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.0"),
26, 1, 2, 3, SubnetID(3)));
// Add all subnets to the configuration.
+ ASSERT_NO_THROW(cfg.add(subnet0));
ASSERT_NO_THROW(cfg.add(subnet1));
ASSERT_NO_THROW(cfg.add(subnet2));
ASSERT_NO_THROW(cfg.add(subnet3));
expected = { 20 };
EXPECT_EQ(expected, links);
EXPECT_EQ(24, link_len);
+
+ // Even it is not used for Bulk Leasequery, it works for 0.0.0.0 too.
+ links.clear();
+ link_len = 111;
+ EXPECT_NO_THROW(links = cfg.getLinks(IOAddress("0.0.0.0"), link_len));
+ expected = { 111 };
+ EXPECT_EQ(expected, links);
+ EXPECT_EQ(24, link_len);
}
} // end of anonymous namespace
TEST(CfgSubnets6Test, getLinks) {
CfgSubnets6 cfg;
- // Create 3 subnets.
+ // Create 4 subnets.
+ Subnet6Ptr subnet0(new Subnet6(IOAddress("::"), 48, 1, 2, 3, 4,
+ SubnetID(111)));
Subnet6Ptr subnet1(new Subnet6(IOAddress("2001:db8:1::"), 64, 1, 2, 3, 4,
SubnetID(1)));
Subnet6Ptr subnet2(new Subnet6(IOAddress("2001:db8:2::"), 64, 1, 2, 3, 4,
SubnetID(3)));
// Add all subnets to the configuration.
+ ASSERT_NO_THROW(cfg.add(subnet0));
ASSERT_NO_THROW(cfg.add(subnet1));
ASSERT_NO_THROW(cfg.add(subnet2));
ASSERT_NO_THROW(cfg.add(subnet3));
expected = { 20 };
EXPECT_EQ(expected, links);
EXPECT_EQ(56, link_len);
+
+ // Even it is not used for Bulk Leasequery, it works for :: too.
+ links.clear();
+ link_len = 111;
+ EXPECT_NO_THROW(links = cfg.getLinks(IOAddress("::"), link_len));
+ expected = { 111 };
+ EXPECT_EQ(expected, links);
+ EXPECT_EQ(48, link_len);
}
} // end of anonymous namespace