#!/bin/sh
-# Copyright (C) 2014-2022 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2014-2023 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
#!/bin/sh
-# Copyright (C) 2015-2022 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2015-2023 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
}
pgsql_upgrade_13_to_14_test() {
+ run_command \
+ pgsql_execute "$session_sql"
+
# Added cancelled column to dhcp4_options
run_command \
pgsql_execute "select cancelled from dhcp4_options;"
MySqlBinding::createInteger<uint8_t>(), // reservations_out_of_pool
MySqlBinding::createInteger<float>(), // cache_threshold
MySqlBinding::createInteger<uint32_t>(), // cache_max_age
+ MySqlBinding::createInteger<uint32_t>(), // offer lifetime
MySqlBinding::createString(SERVER_TAG_BUF_LENGTH) // server_tag
};
last_subnet->setCacheMaxAge(out_bindings[69]->getInteger<uint32_t>());
}
+ // offer lifetime at 70.
+ if (!out_bindings[70]->amNull()) {
+ Optional<uint32_t> offer_lft(out_bindings[70]->getInteger<uint32_t>());
+ last_subnet->setOfferLft(offer_lft);
+ }
+
// server_tag at 70.
// Subnet ready. Add it to the list.
MySqlBinding::condCreateBool(subnet->getReservationsInSubnet(Network::Inheritance::NONE)),
MySqlBinding::condCreateBool(subnet->getReservationsOutOfPool(Network::Inheritance::NONE)),
MySqlBinding::condCreateFloat(subnet->getCacheThreshold(Network::Inheritance::NONE)),
- condCreateInteger<uint32_t>(subnet->getCacheMaxAge(Network::Inheritance::NONE))
+ condCreateInteger<uint32_t>(subnet->getCacheMaxAge(Network::Inheritance::NONE)),
+ condCreateInteger<uint32_t>(subnet->getOfferLft(Network::Inheritance::NONE))
};
MySqlTransaction transaction(conn_);
MySqlBinding::createInteger<uint8_t>(), // reservations_out_of_pool
MySqlBinding::createInteger<float>(), // cache_threshold
MySqlBinding::createInteger<uint32_t>(), // cache_max_age
+ MySqlBinding::createInteger<uint32_t>(), // offer lifetime
MySqlBinding::createString(SERVER_TAG_BUF_LENGTH) // server_tag
};
last_network->setCacheMaxAge(out_bindings[44]->getInteger<uint32_t>());
}
- // server_tag at 45.
+ // offer lifetime at 45.
+ if (!out_bindings[45]->amNull()) {
+ Optional<uint32_t> offer_lft(out_bindings[45]->getInteger<uint32_t>());
+ last_network->setOfferLft(offer_lft);
+ }
+
+ // server_tag at 46.
// Add the shared network.
auto ret = shared_networks.push_back(last_network);
}
// Check for new server tags.
- if (!out_bindings[45]->amNull() &&
- (last_tag != out_bindings[45]->getString())) {
- last_tag = out_bindings[45]->getString();
+ if (!out_bindings[46]->amNull() &&
+ (last_tag != out_bindings[46]->getString())) {
+ last_tag = out_bindings[46]->getString();
if (!last_tag.empty() && !last_network->hasServerTag(ServerTag(last_tag))) {
last_network->setServerTag(last_tag);
}
MySqlBinding::condCreateBool(shared_network->getReservationsInSubnet(Network::Inheritance::NONE)),
MySqlBinding::condCreateBool(shared_network->getReservationsOutOfPool(Network::Inheritance::NONE)),
MySqlBinding::condCreateFloat(shared_network->getCacheThreshold(Network::Inheritance::NONE)),
- condCreateInteger<uint32_t>(shared_network->getCacheMaxAge(Network::Inheritance::NONE))
+ condCreateInteger<uint32_t>(shared_network->getCacheMaxAge(Network::Inheritance::NONE)),
+ condCreateInteger<uint32_t>(shared_network->getOfferLft(Network::Inheritance::NONE))
};
MySqlTransaction transaction(conn_);
MySqlBinding::createInteger<uint8_t>(), // depend on known indirectly
MySqlBinding::createTimestamp(), // modification_ts
MySqlBinding::createString(USER_CONTEXT_BUF_LENGTH), // user_context
+ MySqlBinding::createInteger<uint32_t>(), // offer lifetime
MySqlBinding::createInteger<uint64_t>(), // option def: id
MySqlBinding::createInteger<uint16_t>(), // option def: code
MySqlBinding::createString(OPTION_NAME_BUF_LENGTH), // option def: name
last_client_class->setContext(user_context);
}
+ // offer lifetime
+ if (!out_bindings[14]->amNull()) {
+ Optional<uint32_t> offer_lft(out_bindings[14]->getInteger<uint32_t>());
+ last_client_class->setOfferLft(offer_lft);
+ }
+
class_list.push_back(last_client_class);
}
}
}
- // Parse client class specific option definition from 14 to 23.
- if (!out_bindings[14]->amNull() &&
- (last_option_def_id < out_bindings[14]->getInteger<uint64_t>())) {
- last_option_def_id = out_bindings[14]->getInteger<uint64_t>();
+ // Parse client class specific option definition from 15 to 24.
+ if (!out_bindings[15]->amNull() &&
+ (last_option_def_id < out_bindings[15]->getInteger<uint64_t>())) {
+ last_option_def_id = out_bindings[15]->getInteger<uint64_t>();
- auto def = processOptionDefRow(out_bindings.begin() + 14);
+ auto def = processOptionDefRow(out_bindings.begin() + 15);
if (def) {
last_client_class->getCfgOptionDef()->add(def);
}
}
- // Parse client class specific option from 24 to 36.
- if (!out_bindings[24]->amNull() &&
- (last_option_id < out_bindings[24]->getInteger<uint64_t>())) {
- last_option_id = out_bindings[24]->getInteger<uint64_t>();
-
- OptionDescriptorPtr desc = processOptionRow(Option::V4, out_bindings.begin() + 24);
+ // Parse client class specific option from 25 to 36.
+ if (!out_bindings[25]->amNull() &&
+ (last_option_id < out_bindings[25]->getInteger<uint64_t>())) {
+ last_option_id = out_bindings[25]->getInteger<uint64_t>();
+ OptionDescriptorPtr desc = processOptionRow(Option::V4, out_bindings.begin() + 25);
if (desc) {
last_client_class->getCfgOption()->add(*desc, desc->space_name_);
}
(follow_class_name.empty() ? MySqlBinding::createNull() :
MySqlBinding::createString(follow_class_name)),
MySqlBinding::createTimestamp(client_class->getModificationTime()),
- createInputContextBinding(client_class)
+ createInputContextBinding(client_class),
+ condCreateInteger(client_class->getOfferLft())
};
MySqlTransaction transaction(conn_);
" reservations_in_subnet,"
" reservations_out_of_pool,"
" cache_threshold,"
- " cache_max_age"
+ " cache_max_age,"
+ " offer_lifetime"
") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,"
- " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" },
+ " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" },
// Insert association of the subnet with a server.
{ MySqlConfigBackendDHCPv4Impl::INSERT_SUBNET4_SERVER,
" reservations_in_subnet,"
" reservations_out_of_pool,"
" cache_threshold,"
- " cache_max_age"
+ " cache_max_age,"
+ " offer_lifetime"
") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,"
- " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" },
+ " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" },
// Insert association of the shared network with a server.
{ MySqlConfigBackendDHCPv4Impl::INSERT_SHARED_NETWORK4_SERVER,
" depend_on_known_directly,"
" follow_class_name,"
" modification_ts,"
- " user_context "
- ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
+ " user_context, "
+ " offer_lifetime "
+ ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
},
// Insert association of a client class with a server.
" reservations_in_subnet = ?,"
" reservations_out_of_pool = ?,"
" cache_threshold = ?,"
- " cache_max_age = ? "
+ " cache_max_age = ?, "
+ " offer_lifetime = ? "
"WHERE subnet_id = ? OR subnet_prefix = ?" },
// Update existing shared network.
" reservations_in_subnet = ?,"
" reservations_out_of_pool = ?,"
" cache_threshold = ?,"
- " cache_max_age = ? "
+ " cache_max_age = ?,"
+ " offer_lifetime = ? "
"WHERE name = ?" },
// Update existing option definition.
if (value.unspecified()) {
return (db::MySqlBinding::createNull());
}
- return (db::MySqlBinding::createInteger(value));
+ return (db::MySqlBinding::createInteger(value.get()));
}
/// @brief Creates MySQL binding from a @c Triplet.
" s.reservations_out_of_pool," \
" s.cache_threshold," \
" s.cache_max_age," \
+ " s.offer_lifetime, " \
" srv.tag " \
"FROM dhcp4_subnet AS s " \
server_join \
" n.reservations_out_of_pool," \
" n.cache_threshold," \
" n.cache_max_age," \
+ " n.offer_lifetime, " \
" s.tag " \
"FROM dhcp4_shared_network AS n " \
server_join \
" o.depend_on_known_indirectly, " \
" c.modification_ts," \
" c.user_context," \
+ " c.offer_lifetime," \
" d.id," \
" d.code," \
" d.name," \
" d.encapsulate = ?," \
" d.record_types = ?," \
" d.user_context = ? " \
- "WHERE d.class_id = (SELECT id FROM dhcp4_client_class WHERE name = ?) " \
+ "WHERE d.class_id = (SELECT id FROM " #table_prefix "_client_class WHERE name = ?) " \
" AND s.tag = ? AND d.code = ? AND d.space = ?"
#endif
" depend_on_known_directly = ?," \
follow_class_name_set \
" modification_ts = ?, " \
- " user_context = ? " \
+ " user_context = ?," \
+ " offer_lifetime = ? "\
"WHERE name = ?"
#endif
last_subnet->setCacheMaxAge(worker.getInt(69));
}
- // server_tag at 70.
+ // offer_lifetime at 70.
+ if (!worker.isColumnNull(70)) {
+ last_subnet->setOfferLft(worker.getInt(70));
+ }
+
+ // server_tag at 71.
// Subnet ready. Add it to the list.
auto ret = subnets.insert(last_subnet);
in_bindings.addOptional(subnet->getReservationsOutOfPool(Network::Inheritance::NONE));
in_bindings.addOptional(subnet->getCacheThreshold(Network::Inheritance::NONE));
in_bindings.addOptional(subnet->getCacheMaxAge(Network::Inheritance::NONE));
+ in_bindings.addOptional(subnet->getOfferLft(Network::Inheritance::NONE));
// Start transaction.
PgSqlTransaction transaction(conn_);
last_network->setCacheMaxAge(worker.getInt(44));
}
- // server_tag at 45.
+ // offer_lifetime at 45.
+ if (!worker.isColumnNull(45)) {
+ last_network->setOfferLft(worker.getInt(45));
+ }
+
+ // server_tag at 46.
// Add the shared network.
auto ret = shared_networks.push_back(last_network);
}
// Check for new server tags.
- if (!worker.isColumnNull(45)) {
- std::string new_tag = worker.getString(45);
+ if (!worker.isColumnNull(46)) {
+ std::string new_tag = worker.getString(46);
if (last_tag != new_tag) {
if (!new_tag.empty() && !last_network->hasServerTag(ServerTag(new_tag))) {
last_network->setServerTag(new_tag);
in_bindings.addOptional(shared_network->getReservationsOutOfPool(Network::Inheritance::NONE));
in_bindings.addOptional(shared_network->getCacheThreshold(Network::Inheritance::NONE));
in_bindings.addOptional(shared_network->getCacheMaxAge(Network::Inheritance::NONE));
+ in_bindings.addOptional(shared_network->getOfferLft(Network::Inheritance::NONE));
// Start transaction.
PgSqlTransaction transaction(conn_);
}
}
+ // offer_lifetime at 14.
+ if (!worker.isColumnNull(14)) {
+ last_client_class->setOfferLft(worker.getInt(14));
+ }
+
class_list.push_back(last_client_class);
}
}
}
- // Parse client class specific option definition from 14 to 23.
- if (!worker.isColumnNull(14) &&
- (last_option_def_id < worker.getBigInt(14))) {
- last_option_def_id = worker.getBigInt(14);
+ // Parse client class specific option definition from 15 to 24.
+ if (!worker.isColumnNull(15) &&
+ (last_option_def_id < worker.getBigInt(15))) {
+ last_option_def_id = worker.getBigInt(15);
- auto def = processOptionDefRow(worker, 14);
+ auto def = processOptionDefRow(worker, 15);
if (def) {
last_client_class->getCfgOptionDef()->add(def);
}
}
- // Parse client class specific option from 24 to 36.
- if (!worker.isColumnNull(24) &&
- (last_option_id < worker.getBigInt(24))) {
- last_option_id = worker.getBigInt(24);
-
- OptionDescriptorPtr desc = processOptionRow(Option::V4, worker, 24);
+ // Parse client class specific option from 25 to 36.
+ if (!worker.isColumnNull(25) &&
+ (last_option_id < worker.getBigInt(25))) {
+ last_option_id = worker.getBigInt(25);
+ OptionDescriptorPtr desc = processOptionRow(Option::V4, worker, 25);
if (desc) {
last_client_class->getCfgOption()->add(*desc, desc->space_name_);
}
in_bindings.addTimestamp(client_class->getModificationTime());
in_bindings.add(client_class->getContext());
+ in_bindings.addOptional(client_class->getOfferLft());
PgSqlTransaction transaction(conn_);
// Insert a subnet.
{
// PgSqlConfigBackendDHCPv4Impl::INSERT_SUBNET4,
- 36,
+ 37,
{
OID_INT8, // 1 subnet_id,
OID_VARCHAR, // 2 subnet_prefix
OID_BOOL, // 33 reservations_in_subnet
OID_BOOL, // 34 reservations_out_of_pool
OID_TEXT, // 35 cache_threshold - cast as float
- OID_INT8 // 36 cache_max_age"
+ OID_INT8, // 36 cache_max_age"
+ OID_INT8 // 37 offer_lifetime"
},
"INSERT_SUBNET4",
"INSERT INTO dhcp4_subnet("
" reservations_in_subnet,"
" reservations_out_of_pool,"
" cache_threshold,"
- " cache_max_age"
+ " cache_max_age,"
+ " offer_lifetime"
") VALUES ("
"$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, "
"cast($11 as inet), $12, $13, $14, $15, $16, $17, $18, cast($19 as json), $20, "
"$21, $22, $23, cast($24 as float), cast($25 as float), $26, $27, $28, $29, $30, "
- "$31, $32, $33, $34, cast($35 as float), $36"
+ "$31, $32, $33, $34, cast($35 as float), $36, $37"
")"
},
// Insert a shared network.
{
// PgSqlConfigBackendDHCPv4Impl::INSERT_SHARED_NETWORK4,
- 31,
+ 32,
{
OID_VARCHAR, // 1 name,
OID_VARCHAR, // 2 client_class,
OID_BOOL, // 28 reservations_in_subnet,
OID_BOOL, // 29 reservations_out_of_pool,
OID_TEXT, // 30 cache_threshold - cast as float
- OID_INT8 // 31 cache_max_age
+ OID_INT8, // 31 cache_max_age
+ OID_INT8 // 32 offer_lifetime
},
"INSERT_SHARED_NETWORK4",
"INSERT INTO dhcp4_shared_network("
" reservations_in_subnet,"
" reservations_out_of_pool,"
" cache_threshold,"
- " cache_max_age"
+ " cache_max_age,"
+ " offer_lifetime"
") VALUES ("
"$1, $2, $3, $4, $5, $6, $7, $8, $9, $10,"
"cast($11 as json), $12, $13, $14, $15, "
"cast($16 as float), cast($17 as float), $18, $19, cast($20 as inet), "
- "$21, $22, $23, $24, $25, $26, $27, $28, $29, cast($30 as float), $31"
+ "$21, $22, $23, $24, $25, $26, $27, $28, $29, cast($30 as float), $31, $32"
")"
},
// Insert client class.
{
// PgSqlConfigBackendDHCPv4Impl::INSERT_CLIENT_CLASS4,
- 13,
+ 14,
{
OID_VARCHAR, // 1 name
OID_TEXT, // 2 test
OID_BOOL, // 10 depend_on_known_directly
OID_VARCHAR, // 11 follow_class_name
OID_TIMESTAMP, // 12 modification_ts
- OID_TEXT // 13 user_context cast as JSON
+ OID_TEXT, // 13 user_context cast as JSON
+ OID_INT8 // 14 offer_lifetime
},
"INSERT_CLIENT_CLASS4",
"INSERT INTO dhcp4_client_class("
" depend_on_known_directly,"
" follow_class_name,"
" modification_ts, "
- " user_context "
+ " user_context, "
+ " offer_lifetime "
") VALUES ("
- "$1, $2, cast($3 as inet), $4, $5, $6, $7, $8, $9, $10, $11, $12, cast($13 as JSON)"
+ "$1, $2, cast($3 as inet), $4, $5, $6, $7, $8, $9, $10, $11, $12, cast($13 as JSON), $14"
")"
},
// Update existing subnet.
{
// PgSqlConfigBackendDHCPv4Impl::UPDATE_SUBNET4,
- 38,
+ 39,
{
OID_INT8, // 1 subnet_id,
OID_VARCHAR, // 2 subnet_prefix
OID_BOOL, // 34 reservations_out_of_pool
OID_TEXT, // 35 cache_threshold - cast as float
OID_INT8, // 36 cache_max_age"
- OID_INT8, // 37 subnet_id (of subnet to update)
- OID_VARCHAR // 38 subnet_prefix (of subnet to update)
+ OID_INT8, // 37 offer_lifetime"
+ OID_INT8, // 38 subnet_id (of subnet to update)
+ OID_VARCHAR // 39 subnet_prefix (of subnet to update)
},
"UPDATE_SUBNET4,",
"UPDATE dhcp4_subnet SET"
" reservations_in_subnet = $33,"
" reservations_out_of_pool = $34,"
" cache_threshold = cast($35 as float),"
- " cache_max_age = $36 "
- "WHERE subnet_id = $37 OR subnet_prefix = $38"
+ " cache_max_age = $36,"
+ " offer_lifetime = $37 "
+ "WHERE subnet_id = $38 OR subnet_prefix = $39"
},
// Update existing shared network.
{
// PgSqlConfigBackendDHCPv4Impl::UPDATE_SHARED_NETWORK4,
- 32,
+ 33,
{
OID_VARCHAR, // 1 name,
OID_VARCHAR, // 2 client_class,
OID_BOOL, // 29 reservations_out_of_pool,
OID_TEXT, // 30 cache_threshold - cast as float
OID_INT8, // 31 cache_max_age
- OID_VARCHAR // 32 name (of network to update)
+ OID_INT8, // 32 offer_lifetime
+ OID_VARCHAR // 33 name (of network to update)
},
"UPDATE_SHARED_NETWORK4",
"UPDATE dhcp4_shared_network SET"
" reservations_in_subnet = $28,"
" reservations_out_of_pool = $29,"
" cache_threshold = cast($30 as float),"
- " cache_max_age = $31 "
- "WHERE name = $32"
+ " cache_max_age = $31,"
+ " offer_lifetime = $32 "
+ "WHERE name = $33"
},
// Update existing option definition.
// Update existing client class with specifying its position.
{
// PgSqlConfigBackendDHCPv4Impl::UPDATE_CLIENT_CLASS4,
- 14,
+ 15,
{
OID_VARCHAR, // 1 name
OID_TEXT, // 2 test
OID_VARCHAR, // 11 follow_class_name
OID_TIMESTAMP, // 12 modification_ts
OID_TEXT, // 13 user_context cast as JSON
- OID_VARCHAR // 14 name (of class to update)
+ OID_INT8, // 14 offer_lifetime
+ OID_VARCHAR // 15 name (of class to update)
},
"UPDATE_CLIENT_CLASS4",
PGSQL_UPDATE_CLIENT_CLASS4("follow_class_name = $11,")
// Update existing client class without specifying its position.
{
// PgSqlConfigBackendDHCPv4Impl::UPDATE_CLIENT_CLASS4_SAME_POSITION,
- 14,
+ 15,
{
OID_VARCHAR, // 1 name
OID_TEXT, // 2 test
OID_VARCHAR, // 11 follow_class_name
OID_TIMESTAMP, // 12 modification_ts
OID_TEXT, // 13 user_context cast as JSON
- OID_VARCHAR // 14 name (of class to update)
+ OID_INT8, // 14 offer_lifetime
+ OID_VARCHAR // 15 name (of class to update)
},
"UPDATE_CLIENT_CLASS4_SAME_POSITION",
PGSQL_UPDATE_CLIENT_CLASS4("")
" s.reservations_out_of_pool," \
" s.cache_threshold," \
" s.cache_max_age," \
+ " s.offer_lifetime," \
" srv.tag " \
"FROM dhcp4_subnet AS s " \
server_join \
" n.reservations_out_of_pool," \
" n.cache_threshold," \
" n.cache_max_age," \
+ " n.offer_lifetime," \
" s.tag " \
"FROM dhcp4_shared_network AS n " \
server_join \
" o.depend_on_known_indirectly, " \
" gmt_epoch(c.modification_ts) as modification_ts, " \
" c.user_context," \
+ " c.offer_lifetime," \
" d.id," \
" d.code," \
" d.name," \
" " #table_prefix "_server as s " \
"WHERE d.id = a.option_def_id AND " \
" a.server_id = s.id AND " \
- " d.class_id = (SELECT id FROM dhcp4_client_class WHERE name = $10) " \
+ " d.class_id = (SELECT id FROM " #table_prefix "_client_class WHERE name = $10) " \
" AND s.tag = $11 AND d.code = $12 AND d.space = $13"
#endif
" depend_on_known_directly = $10," \
follow_class_name_set \
" modification_ts = $12, " \
- " user_context = cast($13 as json)" \
- "WHERE name = $14"
+ " user_context = cast($13 as json), " \
+ " offer_lifetime = $14 " \
+ "WHERE name = $15"
#endif
#ifndef PGSQL_UPDATE_CLIENT_CLASS6
match_expr_(ExpressionPtr()), test_(rhs.test_), required_(rhs.required_),
depend_on_known_(rhs.depend_on_known_), cfg_option_(new CfgOption()),
next_server_(rhs.next_server_), sname_(rhs.sname_),
- filename_(rhs.filename_), valid_(rhs.valid_), preferred_(rhs.preferred_) {
+ filename_(rhs.filename_), valid_(rhs.valid_), preferred_(rhs.preferred_),
+ offer_lft_(rhs.offer_lft_) {
if (rhs.match_expr_) {
match_expr_.reset(new Expression());
cclass->setValid(valid);
cclass->setPreferred(preferred);
cclass->setOfferLft(offer_lft);
+ std::cout << "OK WE called it!" << std::endl;
addClass(cclass);
}
subnet->setT1Percent(0.345);
subnet->setT2Percent(0.444);
subnet->setDdnsSendUpdates(false);
+ subnet->setCacheThreshold(0.25);
+ subnet->setCacheMaxAge(20);
+ subnet->setOfferLft(77);
Pool4Ptr pool1(new Pool4(IOAddress("192.0.2.10"),
IOAddress("192.0.2.20")));
shared_network->setFilename("/dev/null");
shared_network->setAuthoritative(true);
shared_network->setDdnsSendUpdates(false);
+ shared_network->setCacheThreshold(0.26);
+ shared_network->setCacheMaxAge(21);
+ shared_network->setOfferLft(78);
// Add several options to the shared network.
shared_network->getCfgOption()->add(test_options_[2]->option_,
ElementPtr user_context = Element::createMap();
user_context->set("melon", Element::create("water"));
class1->setContext(user_context);
+ class1->setOfferLft(20);
test_client_classes_.push_back(class1);
auto class2 = boost::make_shared<ClientClassDef>("bar", match_expr, cfg_option);
"client class set",
ServerSelector::ONE("server1"));
}
+
// Create second class.
auto class2 = test_client_classes_[1];
ASSERT_NO_THROW_LOG(cbptr_->createUpdateClientClass4(ServerSelector::ONE("server1"), class2, ""));
"client class set",
ServerSelector::ONE("server1"));
}
+
// Only the first class should be returned for the server selector ALL.
auto client_classes = cbptr_->getAllClientClasses4(ServerSelector::ALL());
ASSERT_EQ(1, client_classes.getClasses()->size());
+
// All three classes should be returned for the server1.
client_classes = cbptr_->getAllClientClasses4(ServerSelector::ONE("server1"));
auto classes_list = client_classes.getClasses();
UPDATE schema_version
SET version = '13', minor = '0';
--- This line concludes the schema upgrade to version 13.
+-- This line concludes the schema upgrade to version 12.
+
+-- This line starts the schema upgrade to version 14.
+
+-- Add offer_lifetime column to v4 tables.
+ALTER TABLE dhcp4_shared_network
+ ADD COLUMN offer_lifetime BIGINT DEFAULT NULL;
+
+ALTER TABLE dhcp4_subnet
+ ADD COLUMN offer_lifetime BIGINT DEFAULT NULL;
+
+ALTER TABLE dhcp4_client_class
+ ADD COLUMN offer_lifetime BIGINT DEFAULT NULL;
+
+-- Update the schema version number.
+UPDATE schema_version
+ SET version = '14', minor = '0';
+
+-- This line concludes the schema upgrade to version 14.
-- This line starts the schema upgrade to version 14.