These commands are used to delete a shared-network-specific DHCP
option from the database. The option is identified by an option code
-and option space and as of Kea 3.1.1, an optional ``client-classes``
+and option space, and as of Kea 3.1.1, an optional ``client-classes``
parameter may also be specified (see :ref:`cb-cmds-option-class-tags-as-keys`).
These parameters are passed within the ``options`` list.
Another list, ``shared-networks``, contains a map
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This command is used to delete a prefix delegation pool-specific DHCPv6
-option from the database. The option is identified by an option code
-and option space. These two parameters are passed within the ``options`` list.
+option from the database. The option is identified by an option code and
+option space, and as of Kea 3.1.1, an optional ``client-classes`` parameter
+may also be specified (see :ref:`cb-cmds-option-class-tags-as-keys`).
+These parameters are passed within the ``options`` list.
Another list, ``pd-pools``, contains a map with the
prefix-delegation-pool prefix and length identifying the pool. If the
option is not explicitly specified for this pool, no option is deleted.
// Update existing global option.
{ MySqlConfigBackendDHCPv4Impl::UPDATE_OPTION4,
- MYSQL_UPDATE_OPTION4_WITH_TAG(AND o.scope_id = 0 AND o.code = ? AND o.space = ? AND o.client_classes = ?)
+ MYSQL_UPDATE_OPTION4_WITH_TAG(AND o.scope_id = 0 AND o.code = ? AND o.space = ?
+ AND o.client_classes = ?)
},
// Update existing subnet level option.
/// @param space Option space of the deleted option.
/// @param client_classes Optional client classes list of the option to be deleted.
/// Defaults to an empty pointer.
+ /// @return Number of deleted options.
/// @throw NotImplemented if server selector is "unassigned".
virtual uint64_t
deleteOption4(const db::ServerSelector& server_selector,
// Update existing shared network level option.
{ MySqlConfigBackendDHCPv6Impl::UPDATE_OPTION6_SHARED_NETWORK,
- MYSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 4 AND o.shared_network_name = ? AND o.code = ?
- AND o.space = ? AND o.client_classes = ?)
+ MYSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 4 AND o.shared_network_name = ? AND o.code = ? AND o.space = ?
+ AND o.client_classes = ?)
},
// Update existing client class level option.
{ MySqlConfigBackendDHCPv6Impl::UPDATE_OPTION6_CLIENT_CLASS,
- MYSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 2 AND o.dhcp_client_class = ? AND o.code = ?
- AND o.space = ? AND o.client_classes = ?)
+ MYSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 2 AND o.dhcp_client_class = ? AND o.code = ? AND o.space = ?
+ AND o.client_classes = ?)
},
// Update existing client class with specifying its position.
// Delete single option from a subnet.
{ MySqlConfigBackendDHCPv6Impl::DELETE_OPTION6_SUBNET_ID,
MYSQL_DELETE_OPTION_NO_TAG(dhcp6,
- WHERE o.scope_id = 1 AND o.dhcp6_subnet_id = ? AND o.code = ? AND o.space = ?
- AND o.client_classes LIKE ?)
+ WHERE (o.scope_id = 1 AND o.dhcp6_subnet_id = ? AND o.code = ? AND o.space = ?
+ AND o.client_classes LIKE ?))
},
// Delete single option from a pool.
// Delete single option from a shared network.
{ MySqlConfigBackendDHCPv6Impl::DELETE_OPTION6_SHARED_NETWORK,
MYSQL_DELETE_OPTION_NO_TAG(dhcp6,
- WHERE o.scope_id = 4 AND o.shared_network_name = ? AND o.code = ? AND o.space = ?
- AND o.client_classes LIKE ?)
+ WHERE (o.scope_id = 4 AND o.shared_network_name = ? AND o.code = ? AND o.space = ?
+ AND o.client_classes LIKE ?))
},
// Delete options belonging to a subnet.
/// @return Number of deleted options.
/// @throw NotImplemented if server selector is "unassigned".
virtual uint64_t
- deleteOption6(const db::ServerSelector& server_selector,
- const SubnetID& subnet_id,
- const uint16_t code,
- const std::string& space,
+ deleteOption6(const db::ServerSelector& server_selector, const SubnetID& subnet_id,
+ const uint16_t code, const std::string& space,
const ClientClassesPtr client_classes = ClientClassesPtr());
/// @brief Deletes pool level option.
OptionDescriptor::create(*options.begin()));
}
-
OptionContainer
MySqlConfigBackendImpl::getAllOptions(const int index,
const Option::Universe& universe,
OID_TEXT // 18 client_classes (of option to update)
},
"UPDATE_OPTION4",
- PGSQL_UPDATE_OPTION4_WITH_TAG(AND o.scope_id = 0 AND o.code = $16 AND o.space = $17 AND o.client_classes = $18)
+ PGSQL_UPDATE_OPTION4_WITH_TAG(AND o.scope_id = 0 AND o.code = $16 AND o.space = $17
+ AND o.client_classes = $18)
},
// Update existing subnet level option.
OID_TEXT // 18 client_classes (of option to update)
},
"UPDATE_OPTION4_SUBNET_ID",
- PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 1 AND o.dhcp4_subnet_id = $15 AND o.code = $16 AND o.space = $17 AND o.client_classes = $18)
+ PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 1 AND o.dhcp4_subnet_id = $15 AND o.code = $16 AND o.space = $17
+ AND o.client_classes = $18)
},
// Update existing pool level option.
OID_TEXT // 18 client_classes (of option to update)
},
"UPDATE_OPTION4_POOL_ID",
- PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 5 AND o.pool_id = $15 AND o.code = $16 AND o.space = $17 AND o.client_classes = $18)
+ PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 5 AND o.pool_id = $15 AND o.code = $16 AND o.space = $17
+ AND o.client_classes = $18)
},
// Update existing shared network level option.
OID_TEXT, // 18 client_classes (of option to update)
},
"UPDATE_OPTION4_SHARED_NETWORK",
- PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 4 AND o.shared_network_name = $15 AND o.code = $16 AND o.space = $17 AND o.client_classes = $18)
+ PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 4 AND o.shared_network_name = $15 AND o.code = $16 AND o.space = $17
+ AND o.client_classes = $18)
},
// Update existing client class level option.
OID_TEXT // 18 client_classes (of option to update)
},
"UPDATE_OPTION4_CLIENT_CLASS",
- PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 2 AND o.dhcp_client_class = $15 AND o.code = $16 AND o.space = $17 AND o.client_classes = $18)
+ PGSQL_UPDATE_OPTION4_NO_TAG(o.scope_id = 2 AND o.dhcp_client_class = $15 AND o.code = $16 AND o.space = $17
+ AND o.client_classes = $18)
},
// Update existing client class with specifying its position.
/// @param space Option space of the deleted option.
/// @param client_classes Optional client classes list of the option to be deleted.
/// Defaults to an empty pointer.
+ /// @return Number of deleted options.
/// @throw NotImplemented if server selector is "unassigned".
virtual uint64_t
deleteOption4(const db::ServerSelector& server_selector,
OID_TEXT // 19 client_classes (of option to update)
},
"UPDATE_OPTION6_SUBNET_ID",
- PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 1 AND o.dhcp6_subnet_id = $16 AND o.code = $17
- AND o.space = $18 AND o.client_classes = $19)
+ PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 1 AND o.dhcp6_subnet_id = $16 AND o.code = $17 AND o.space = $18
+ AND o.client_classes = $19)
},
// Update existing pool level option.
OID_TEXT // 19 client_classes (of option to update)
},
"UPDATE_OPTION6_POOL_ID",
- PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 5 AND o.pool_id = $16 AND o.code = $17
- AND o.space = $18 AND o.client_classes = $19)
+ PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 5 AND o.pool_id = $16 AND o.code = $17 AND o.space = $18
+ AND o.client_classes = $19)
},
// Update existing pd pool level option.
OID_TEXT // 19 client_classes (of option to update)
},
"UPDATE_OPTION6_PD_POOL_ID",
- PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 6 AND o.pd_pool_id = $16 AND o.code = $17
- AND o.space = $18 AND o.client_classes = $19)
+ PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 6 AND o.pd_pool_id = $16 AND o.code = $17 AND o.space = $18
+ AND o.client_classes = $19)
},
// Update existing shared network level option.
OID_TEXT // 19 client_classes (of option to update)
},
"UPDATE_OPTION6_SHARED_NETWORK",
- PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 4 AND o.shared_network_name = $16 AND o.code = $17
- AND o.space = $18 AND o.client_classes = $19)
+ PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 4 AND o.shared_network_name = $16 AND o.code = $17 AND o.space = $18
+ AND o.client_classes = $19)
},
// Update existing client class level option.
OID_TEXT // 19 client_classes (of option to update)
},
"UPDATE_OPTION6_CLIENT_CLASS",
- PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 2 AND o.dhcp_client_class = $16 AND o.code = $17
- AND o.space = $18 AND o.client_classes = $19)
+ PGSQL_UPDATE_OPTION6_NO_TAG(o.scope_id = 2 AND o.dhcp_client_class = $16 AND o.code = $17 AND o.space = $18
+ AND o.client_classes = $19)
},
// Update existing client class with specifying its position.
"DELETE_OPTION6_SHARED_NETWORK",
PGSQL_DELETE_OPTION_NO_TAG(dhcp6,
WHERE o.scope_id = 4 AND o.shared_network_name = $1 AND o.code = $2 AND o.space = $3
- AND o.client_classes LIKE $4)
+ AND o.client_classes LIKE $4)
},
// Delete options belonging to a subnet.
getModifiedOptions6Test();
}
-
TEST_F(PgSqlConfigBackendDHCPv6Test, globalOption6WithClientClassesTest) {
globalOption6WithClientClassesTest();
}
/// @param space Option space of the option to be deleted.
/// @param client_classes Optional client classes list of the option to be deleted.
/// Defaults to an empty pointer.
+ /// @return Number of deleted options.
virtual uint64_t
deleteOption4(const db::BackendSelector& backend_selector,
const db::ServerSelector& server_selector,
const ServerSelector& server_selector,
const uint16_t code,
const std::string& space,
- const ClientClassesPtr client_classes
- /* = ClientClassesPtr() */) const {
+ const ClientClassesPtr client_classes /* = ClientClassesPtr() */) const {
OptionDescriptorPtr option;
getPropertyPtrConst<OptionDescriptorPtr, uint16_t, const std::string&>
(&ConfigBackendDHCPv6::getOption6, backend_selector, server_selector,
const ServerSelector& server_selector,
const uint16_t code,
const std::string& space,
- const ClientClassesPtr client_classes
- /* = ClientClassesPtr() */) {
+ const ClientClassesPtr client_classes /* = ClientClassesPtr() */) {
return (createUpdateDeleteProperty<uint64_t, uint16_t, const std::string&,
const ClientClassesPtr>
(&ConfigBackendDHCPv6::deleteOption6, backend_selector, server_selector,
const std::string& shared_network_name,
const uint16_t code,
const std::string& space,
- const ClientClassesPtr client_classes
- /* = ClientClassesPtr() */) {
+ const ClientClassesPtr client_classes /* = ClientClassesPtr() */) {
return (createUpdateDeleteProperty<uint64_t, const std::string&, uint16_t,
const std::string&,
const ClientClassesPtr>
const SubnetID& subnet_id,
const uint16_t code,
const std::string& space,
- const ClientClassesPtr client_classes
- /* = ClientClassesPtr() */) {
+ const ClientClassesPtr client_classes /* = ClientClassesPtr() */) {
return (createUpdateDeleteProperty<uint64_t, const SubnetID&, uint16_t,
const std::string&,
const ClientClassesPtr>
const asiolink::IOAddress& pool_end_address,
const uint16_t code,
const std::string& space,
- const ClientClassesPtr client_classes
- /* = ClientClassesPtr() */) {
+ const ClientClassesPtr client_classes /* = ClientClassesPtr() */) {
return (createUpdateDeleteProperty<uint64_t, const IOAddress&, const IOAddress&,
uint16_t, const std::string&,
const ClientClassesPtr>
const uint8_t pd_pool_prefix_length,
const uint16_t code,
const std::string& space,
- const ClientClassesPtr client_classes
- /* = ClientClassesPtr() */) {
+ const ClientClassesPtr client_classes /* = ClientClassesPtr() */) {
return (createUpdateDeleteProperty<uint64_t, const IOAddress&, uint8_t,
uint16_t, const std::string&,
const ClientClassesPtr>
/// deleted option belongs.
/// @param code Code of the deleted option.
/// @param space Option space of the deleted option.
+ /// @param client_classes Optional client classes list of the option to be deleted.
+ /// Defaults to an empty pointer.
/// @return Number of deleted options.
virtual uint64_t
deleteOption6(const db::BackendSelector& backend_selector,
ref_option->option_->getType(),
DHCP4_OPTION_SPACE,
ref_option->copyClientClasses());
- ASSERT_TRUE(found_option);
+ ASSERT_TRUE(found_option) << "ref_option" << ref_option->option_->toText()
+ << ", cc: " << ref_option->client_classes_.toText();
SCOPED_OPT_COMPARE((*ref_option), (*found_option));
}
void
GenericConfigBackendDHCPv6Test::TearDown() {
cbptr_.reset();
+ // If data wipe enabled, delete transient data otherwise destroy the schema.
if (getenv("KEA_UNIT_TEST_KEEP_SCHEMA")) {
std::cout << "KEA_UNIT_TEST_KEEP_SCHEMA set, avoid schema destruction" << std::endl;
} else {
- // If data wipe enabled, delete transient data otherwise destroy the schema.
destroySchema();
}
}
subnet->getID());
ASSERT_TRUE(returned_subnet);
- PoolPtr returned_pool = returned_subnet->getPool(Lease::TYPE_NA, IOAddress("2001:db8::10"));
+ PoolPtr returned_pool = returned_subnet->getPool(Lease::TYPE_NA,
+ IOAddress("2001:db8::10"));
ASSERT_TRUE(returned_pool);
// Make sure that CfgOption->get() with client_classes finds each ref option.
// Now make sure that we can set the options individually.
updateClassTaggedOptions(ref_options);
+
for (auto const& ref_option : ref_options) {
cbptr_->createUpdateOption6(ServerSelector::ALL(),
pool->getFirstAddress(),
returned_subnet = cbptr_->getSubnet6(ServerSelector::ALL(), subnet->getID());
ASSERT_TRUE(returned_subnet);
- returned_pool = returned_subnet->getPool(Lease::TYPE_NA, IOAddress("2001:db8::10"));
+ returned_pool = returned_subnet->getPool(Lease::TYPE_NA,
+ IOAddress("2001:db8::10"));
ASSERT_TRUE(returned_pool);
// Make sure that CfgOption->get() with client_classes finds each ref option.
returned_subnet = cbptr_->getSubnet6(ServerSelector::ALL(), subnet->getID());
ASSERT_TRUE(returned_subnet);
- returned_pool = returned_subnet->getPool(Lease::TYPE_NA, IOAddress("2001:db8::10"));
+ returned_pool = returned_subnet->getPool(Lease::TYPE_NA,
+ IOAddress("2001:db8::10"));
ASSERT_TRUE(returned_pool);
// Make sure that CfgOption is empty
/// @param space Option space of the option to be deleted.
/// @param client_classes Optional client classes list of the option to be deleted.
/// Defaults to an empty pointer.
+ /// @return Number of deleted options.
virtual uint64_t
deleteOption4(const db::ServerSelector& server_selector,
const std::string& shared_network_name,
/// @param space Option space of the deleted option.
/// @return Number of deleted options.
virtual uint64_t
- deleteOption6(const db::ServerSelector& server_selector,
- const SubnetID& subnet_id,
- const uint16_t code,
- const std::string& space,
+ deleteOption6(const db::ServerSelector& server_selector, const SubnetID& subnet_id,
+ const uint16_t code, const std::string& space,
const ClientClassesPtr client_classes = ClientClassesPtr());
/// @brief Deletes pool level option.