// Create binding for host reservation mode.
MySqlBindingPtr hr_mode_binding;
- auto hr_mode = subnet->getHostReservationMode();
+ auto hr_mode = subnet->getHostReservationMode(Network::Inheritance::NONE);
if (!hr_mode.unspecified()) {
hr_mode_binding = MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>
(hr_mode.get()));
MySqlBindingCollection in_bindings = {
MySqlBinding::createInteger<uint32_t>(subnet->getID()),
MySqlBinding::createString(subnet->toText()),
- MySqlBinding::condCreateString(subnet->getClientClass()),
- MySqlBinding::condCreateString(subnet->getIface()),
+ MySqlBinding::condCreateString(subnet->getClientClass(Network::Inheritance::NONE)),
+ MySqlBinding::condCreateString(subnet->getIface(Network::Inheritance::NONE)),
MySqlBinding::createTimestamp(subnet->getModificationTime()),
- createBinding(subnet->getPreferred()),
- MySqlBinding::condCreateBool(subnet->getRapidCommit()),
- createBinding(subnet->getT2()),
+ createBinding(subnet->getPreferred(Network::Inheritance::NONE)),
+ MySqlBinding::condCreateBool(subnet->getRapidCommit(Network::Inheritance::NONE)),
+ createBinding(subnet->getT2(Network::Inheritance::NONE)),
createInputRelayBinding(subnet),
- createBinding(subnet->getT1()),
+ createBinding(subnet->getT1(Network::Inheritance::NONE)),
createInputRequiredClassesBinding(subnet),
hr_mode_binding,
shared_network_binding,
createInputContextBinding(subnet),
- createBinding(subnet->getValid()),
- MySqlBinding::condCreateBool(subnet->getCalculateTeeTimes()),
- MySqlBinding::condCreateFloat(subnet->getT1Percent()),
- MySqlBinding::condCreateFloat(subnet->getT2Percent())
+ createBinding(subnet->getValid(Network::Inheritance::NONE)),
+ MySqlBinding::condCreateBool(subnet->getCalculateTeeTimes(Network::Inheritance::NONE)),
+ MySqlBinding::condCreateFloat(subnet->getT1Percent(Network::Inheritance::NONE)),
+ MySqlBinding::condCreateFloat(subnet->getT2Percent(Network::Inheritance::NONE))
};
MySqlTransaction transaction(conn_);
last_network_id = out_bindings[0]->getInteger<uint64_t>();
last_network.reset(new SharedNetwork6(out_bindings[1]->getString()));
+ last_network->setId(last_network_id);
// client_class
if (!out_bindings[2]->amNull()) {
// Create binding for host reservation mode.
MySqlBindingPtr hr_mode_binding;
- auto hr_mode = shared_network->getHostReservationMode();
+ auto hr_mode = shared_network->getHostReservationMode(Network::Inheritance::NONE);
if (!hr_mode.unspecified()) {
hr_mode_binding = MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>
(hr_mode.get()));
MySqlBindingCollection in_bindings = {
MySqlBinding::createString(shared_network->getName()),
- MySqlBinding::condCreateString(shared_network->getClientClass()),
- MySqlBinding::condCreateString(shared_network->getIface()),
+ MySqlBinding::condCreateString(shared_network->getClientClass(Network::Inheritance::NONE)),
+ MySqlBinding::condCreateString(shared_network->getIface(Network::Inheritance::NONE)),
MySqlBinding::createTimestamp(shared_network->getModificationTime()),
- createBinding(shared_network->getPreferred()),
- MySqlBinding::condCreateBool(shared_network->getRapidCommit()),
- createBinding(shared_network->getT2()),
+ createBinding(shared_network->getPreferred(Network::Inheritance::NONE)),
+ MySqlBinding::condCreateBool(shared_network->getRapidCommit(Network::Inheritance::NONE)),
+ createBinding(shared_network->getT2(Network::Inheritance::NONE)),
createInputRelayBinding(shared_network),
- createBinding(shared_network->getT1()),
+ createBinding(shared_network->getT1(Network::Inheritance::NONE)),
createInputRequiredClassesBinding(shared_network),
hr_mode_binding,
createInputContextBinding(shared_network),
- createBinding(shared_network->getValid()),
- MySqlBinding::condCreateBool(shared_network->getCalculateTeeTimes()),
- MySqlBinding::condCreateFloat(shared_network->getT1Percent()),
- MySqlBinding::condCreateFloat(shared_network->getT2Percent())
+ createBinding(shared_network->getValid(Network::Inheritance::NONE)),
+ MySqlBinding::condCreateBool(shared_network->getCalculateTeeTimes(Network::Inheritance::NONE)),
+ MySqlBinding::condCreateFloat(shared_network->getT1Percent(Network::Inheritance::NONE)),
+ MySqlBinding::condCreateFloat(shared_network->getT2Percent(Network::Inheritance::NONE))
};
MySqlTransaction transaction(conn_);
// Test that the information about unspecified optional parameters gets
// propagated to the database.
TEST_F(MySqlConfigBackendDHCPv6Test, getSubnet6WithOptionalUnspecified) {
- // Insert new subnet.
+ // Create a subnet and wrap it within a shared network. It is important
+ // to have the shared network to verify that the subnet doesn't inherit
+ // the values of the shared network but stores the NULL values in the
+ // for those parameters that are unspecified on the subnet level.
Subnet6Ptr subnet = test_subnets_[2];
+ SharedNetwork6Ptr shared_network = test_networks_[0];
+ shared_network->add(subnet);
+
+ // Need to add the shared network to the database because otherwise
+ // the subnet foreign key would fail.
+ cbptr_->createUpdateSharedNetwork6(ServerSelector::ALL(), shared_network);
cbptr_->createUpdateSubnet6(ServerSelector::ALL(), subnet);
// Fetch this subnet by subnet identifier.
test_networks_[0]->getName());
ASSERT_TRUE(returned_network);
+ EXPECT_GT(returned_network->getId(), 0);
+
// The easiest way to verify whether the returned shared network matches the
// inserted shared network is to convert both to text.
EXPECT_EQ(shared_network->toElement()->str(),
test_option_defs_[0]->getCode(),
test_option_defs_[0]->getOptionSpaceName());
ASSERT_TRUE(returned_option_def);
+ EXPECT_GT(returned_option_def->getId(), 0);
EXPECT_TRUE(returned_option_def->equals(*option_def));
auto option0 = index.find(test_options_[0]->option_->getType());
ASSERT_FALSE(option0 == index.end());
testOptionsEquivalent(*test_options_[0], *option0);
+ EXPECT_GT(option0->getId(), 0);
}
{
auto option1 = index.find(test_options_[1]->option_->getType());
ASSERT_FALSE(option1 == index.end());
testOptionsEquivalent(*test_options_[1], *option1);
+ EXPECT_GT(option1->getId(), 0);
}
{
auto option5 = index.find(test_options_[5]->option_->getType());
ASSERT_FALSE(option5 == index.end());
testOptionsEquivalent(*test_options_[5], *option5);
+ EXPECT_GT(option5->getId(), 0);
}
}
{
SCOPED_TRACE("verify returned option");
testOptionsEquivalent(*opt_posix_timezone, returned_opt_posix_timezone);
+ EXPECT_GT(returned_opt_posix_timezone.getId(), 0);
}
{
{
SCOPED_TRACE("verify returned pool option");
testOptionsEquivalent(*opt_posix_timezone, returned_opt_posix_timezone);
+ EXPECT_GT(returned_opt_posix_timezone.getId(), 0);
}
{
{
SCOPED_TRACE("verify returned pool option");
testOptionsEquivalent(*opt_posix_timezone, returned_opt_posix_timezone);
+ EXPECT_GT(returned_opt_posix_timezone.getId(), 0);
}
{
{
SCOPED_TRACE("verify returned option");
testOptionsEquivalent(*opt_posix_timezone, returned_opt_posix_timezone);
+ EXPECT_GT(returned_opt_posix_timezone.getId(), 0);
}
{