MySqlTransaction transaction(conn_);
- // The last parameter indicates that the parameter is not bound to any
- // other object (e.g. addition of a subnet), so an audit entry should
- // be created for the addition of the parameter.
- initAuditRevision(MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
- "this is log message", true);
+ // Create scoped audit revision. It initiates session variables in the
+ // database to be used for creating new audit revision. As long as this
+ // instance exists no new audit revisions are created as a result of
+ // any subsequent calls.
+ ScopedAuditRevision audit_revision(this,
+ MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
+ "global parameter set", false);
// Try to update the existing row.
if (conn_.updateDeleteQuery(MySqlConfigBackendDHCPv4Impl::UPDATE_GLOBAL_PARAMETER4,
MySqlTransaction transaction(conn_);
- try {
+ // Create scoped audit revision. It initiates session variables in the
+ // database to be used for creating new audit revision. As long as this
+ // instance exists no new audit revisions are created as a result of
+ // any subsequent calls.
+ ScopedAuditRevision audit_revision(this,
+ MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
+ "subnet set", true);
- // The change will involve multiple statements. The audit entry should
- // be created for the parent object and should not be created for the
- // DHCP options. The boolean value set to false indicates that the
- // MySQL triggers should not create audit revision for the DHCP
- // options associated with the subnet.
- initAuditRevision(MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
- "this is log message", false);
+ try {
// Try to insert subnet. If this duplicates primary key, i.e. this
// subnet already exists it will throw DuplicateEntry exception in
OptionDescriptorPtr desc_copy(new OptionDescriptor(*desc));
desc_copy->space_name_ = option_space;
createUpdateOption4(server_selector, subnet->getID(), desc_copy,
- false);
+ true);
}
}
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy(new OptionDescriptor(*desc));
desc_copy->space_name_ = option_space;
- createUpdateOption4(server_selector, pool_id, desc_copy);
+ createUpdateOption4(server_selector, pool_id, desc_copy, true);
}
}
}
+ template<typename... Args>
+ uint64_t deleteTransactional(const int index,
+ const db::ServerSelector& server_selector,
+ const std::string& operation,
+ const std::string& log_message,
+ const bool cascade_delete,
+ Args&&... keys) {
+
+ MySqlTransaction transaction(conn_);
+
+ // Create scoped audit revision. It initiates session variables in the
+ // database to be used for creating new audit revision. As long as this
+ // instance exists no new audit revisions are created as a result of
+ // any subsequent calls.
+ ScopedAuditRevision audit_revision(this,
+ MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
+ log_message, cascade_delete);
+
+ auto count = deleteFromTable(index, server_selector, operation, keys...);
+
+ transaction.commit();
+
+ return (count);
+ }
+
/// @brief Sends query to delete subnet by id.
///
/// @param server_selector Server selector.
/// @param subnet_id Identifier of the subnet to be deleted.
/// @return Number of deleted subnets.
uint64_t deleteSubnet4(const ServerSelector& server_selector,
- const SubnetID& subnet_id) {
- return (deleteFromTable<uint32_t>(DELETE_SUBNET4_ID, server_selector,
- "deleting a subnet",
- subnet_id));
+ const SubnetID& subnet_id) {
+ return (deleteTransactional(DELETE_SUBNET4_ID, server_selector,
+ "deleting a subnet",
+ "subnet deleted",
+ true,
+ static_cast<uint32_t>(subnet_id)));
}
/// @brief Deletes pools belonging to a subnet from the database.
MySqlTransaction transaction(conn_);
+ // Create scoped audit revision. It initiates session variables in the
+ // database to be used for creating new audit revision. As long as this
+ // instance exists no new audit revisions are created as a result of
+ // any subsequent calls.
+ ScopedAuditRevision audit_revision(this,
+ MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
+ "shared network set", true);
+
try {
- // The change will involve multiple statements. The audit entry should
- // be created for the parent object and should not be created for the
- // DHCP options. The boolean value set to false indicates that the
- // MySQL triggers should not create audit revision for the DHCP
- // options associated with the shared network.
- initAuditRevision(MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
- "this is log message", false);
// Try to insert shared network. The shared network name must be unique,
// so if inserting fails with DuplicateEntry exception we'll need to
OptionDescriptorPtr desc_copy(new OptionDescriptor(*desc));
desc_copy->space_name_ = option_space;
createUpdateOption4(server_selector, shared_network->getName(),
- desc_copy, false);
+ desc_copy, true);
}
}
option->option_->getType(),
option->space_name_);
- // The last parameter indicates that the option is not bound to any
- // other object (e.g. addition of a subnet), so an audit entry should
- // be created for the addition of the option.
- initAuditRevision(MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
- "this is log message", true);
+ // Create scoped audit revision. It initiates session variables in the
+ // database to be used for creating new audit revision. As long as this
+ // instance exists no new audit revisions are created as a result of
+ // any subsequent calls.
+ ScopedAuditRevision audit_revision(this,
+ MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
+ "global option set", false);
if (existing_option) {
in_bindings.push_back(MySqlBinding::createString(tag));
/// @param server_selector Server selector.
/// @param subnet_id Identifier of the subnet the option belongs to.
/// @param option Pointer to the option descriptor encapsulating the option.
- /// @param distinct_transaction Boolean value indicating whether setting
- /// the option value should be enclosed in a separate transaction.
+ /// @param cascade_update Boolean value indicating whether the update is
+ /// performed as part of the ownining element, e.g. subnet.
void createUpdateOption4(const ServerSelector& server_selector,
const SubnetID& subnet_id,
const OptionDescriptorPtr& option,
- const bool distinct_transaction = false) {
+ const bool cascade_update) {
if (server_selector.amUnassigned()) {
isc_throw(NotImplemented, "managing configuration for no particular server"
// Only start new transaction if specified to do so. This function may
// be called from within an existing transaction in which case we
// don't start the new one.
- if (distinct_transaction) {
+ if (!cascade_update) {
transaction.reset(new MySqlTransaction(conn_));
}
option->option_->getType(),
option->space_name_);
- initAuditRevision(MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
- "this is log message", distinct_transaction);
+ // Create scoped audit revision. It initiates session variables in the
+ // database to be used for creating new audit revision. As long as this
+ // instance exists no new audit revisions are created as a result of
+ // any subsequent calls.
+ ScopedAuditRevision audit_revision(this,
+ MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
+ "subnet specific option set", cascade_update);
if (existing_option) {
in_bindings.push_back(MySqlBinding::createString(tag));
<< pool_end_address);
}
- createUpdateOption4(server_selector, pool_id, option, false);
+ createUpdateOption4(server_selector, pool_id, option, true);
}
/// @param selector Server selector.
/// @param pool_id Identifier of the pool the option belongs to.
/// @param option Pointer to the option descriptor encapsulating the option.
- /// @param distinct_transaction Boolean value indicating whether setting
- /// the option value should be enclosed in a separate transaction.
+ /// @param cascade_update Boolean value indicating whether the update is
+ /// performed as part of the ownining element, e.g. subnet.
void createUpdateOption4(const ServerSelector& server_selector,
const uint64_t pool_id,
const OptionDescriptorPtr& option,
- const bool distinct_transaction = false) {
+ const bool cascade_update) {
if (server_selector.amUnassigned()) {
isc_throw(NotImplemented, "managing configuration for no particular server"
// Only start new transaction if specified to do so. This function may
// be called from within an existing transaction in which case we
// don't start the new one.
- if (distinct_transaction) {
+ if (!cascade_update) {
transaction.reset(new MySqlTransaction(conn_));
}
option->option_->getType(),
option->space_name_);
- initAuditRevision(MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
- "this is log message", distinct_transaction);
+ // Create scoped audit revision. It initiates session variables in the
+ // database to be used for creating new audit revision. As long as this
+ // instance exists no new audit revisions are created as a result of
+ // any subsequent calls.
+ ScopedAuditRevision audit_revision(this,
+ MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
+ "pool specific option set", cascade_update);
if (existing_option) {
in_bindings.push_back(MySqlBinding::createString(tag));
/// @param shared_network_name Name of the shared network the option
/// belongs to.
/// @param option Pointer to the option descriptor encapsulating the option.
- /// @param distinct_transaction Boolean value indicating whether setting
- /// the option value should be enclosed in a separate transaction.)
+ /// @param cascade_update Boolean value indicating whether the update is
+ /// performed as part of the ownining element, e.g. shared network.
void createUpdateOption4(const ServerSelector& server_selector,
const std::string& shared_network_name,
const OptionDescriptorPtr& option,
- const bool distinct_transaction = false) {
+ const bool cascade_update) {
if (server_selector.amUnassigned()) {
isc_throw(NotImplemented, "managing configuration for no particular server"
// Only start new transaction if specified to do so. This function may
// be called from within an existing transaction in which case we
// don't start the new one.
- if (distinct_transaction) {
+ if (!cascade_update) {
transaction.reset(new MySqlTransaction(conn_));
}
option->option_->getType(),
option->space_name_);
- initAuditRevision(MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
- "this is log message", distinct_transaction);
+ // Create scoped audit revision. It initiates session variables in the
+ // database to be used for creating new audit revision. As long as this
+ // instance exists no new audit revisions are created as a result of
+ // any subsequent calls.
+ ScopedAuditRevision audit_revision(this,
+ MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
+ "shared network specific option set",
+ cascade_update);
if (existing_option) {
in_bindings.push_back(MySqlBinding::createString(tag));
option_def->getCode(),
option_def->getOptionSpaceName());
- initAuditRevision(MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
- "this is log message", true);
+ // Create scoped audit revision. It initiates session variables in the
+ // database to be used for creating new audit revision. As long as this
+ // instance exists no new audit revisions are created as a result of
+ // any subsequent calls.
+ ScopedAuditRevision audit_revision(this,
+ MySqlConfigBackendDHCPv4Impl::INIT_AUDIT_REVISION,
+ "option definition set",
+ true);
if (existing_definition) {
// Need to add three more bindings for WHERE clause.
const uint16_t code,
const std::string& space) {
- if (server_selector.amUnassigned()) {
- isc_throw(NotImplemented, "managing configuration for no particular server"
- " (unassigned) is unsupported at the moment");
- }
-
- auto tag = getServerTag(server_selector, "deleting option definition");
-
MySqlBindingCollection in_bindings = {
- MySqlBinding::createString(tag),
MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(code)),
MySqlBinding::createString(space)
};
// Run DELETE.
- return (conn_.updateDeleteQuery(DELETE_OPTION_DEF4_CODE_NAME, in_bindings));
+ return (deleteTransactional(DELETE_OPTION_DEF4_CODE_NAME, server_selector,
+ "deleting option definition",
+ "option definition deleted",
+ false,
+ in_bindings));
}
/// @brief Deletes global option.
const uint16_t code,
const std::string& space) {
- if (server_selector.amUnassigned()) {
- isc_throw(NotImplemented, "managing configuration for no particular server"
- " (unassigned) is unsupported at the moment");
- }
-
- auto tag = getServerTag(server_selector, "deleting global option");
-
MySqlBindingCollection in_bindings = {
- MySqlBinding::createString(tag),
MySqlBinding::createInteger<uint8_t>(code),
MySqlBinding::createString(space)
};
// Run DELETE.
- return (conn_.updateDeleteQuery(DELETE_OPTION4, in_bindings));
+ return (deleteTransactional(DELETE_OPTION4, server_selector,
+ "deleting global option",
+ "global option deleted",
+ false,
+ in_bindings));
}
/// @brief Deletes subnet level option.
const uint16_t code,
const std::string& space) {
- if (server_selector.amUnassigned()) {
- isc_throw(NotImplemented, "managing configuration for no particular server"
- " (unassigned) is unsupported at the moment");
- }
-
- auto tag = getServerTag(server_selector, "deleting option for a subnet");
-
MySqlBindingCollection in_bindings = {
- MySqlBinding::createString(tag),
MySqlBinding::createInteger<uint32_t>(static_cast<uint32_t>(subnet_id)),
MySqlBinding::createInteger<uint8_t>(code),
MySqlBinding::createString(space)
};
// Run DELETE.
- return (conn_.updateDeleteQuery(DELETE_OPTION4_SUBNET_ID, in_bindings));
+ return (deleteTransactional(DELETE_OPTION4_SUBNET_ID, server_selector,
+ "deleting option for a subnet",
+ "subnet specific option deleted",
+ false,
+ in_bindings));
}
/// @brief Deletes pool level option.
const uint16_t code,
const std::string& space) {
- if (server_selector.amUnassigned()) {
- isc_throw(NotImplemented, "managing configuration for no particular server"
- " (unassigned) is unsupported at the moment");
- }
-
- auto tag = getServerTag(server_selector, "deleting option for a pool");
-
MySqlBindingCollection in_bindings = {
- MySqlBinding::createString(tag),
MySqlBinding::createInteger<uint8_t>(code),
MySqlBinding::createString(space),
MySqlBinding::createInteger<uint32_t>(pool_start_address.toUint32()),
};
// Run DELETE.
- return (conn_.updateDeleteQuery(DELETE_OPTION4_POOL_RANGE,
- in_bindings));
+ return (deleteTransactional(DELETE_OPTION4_POOL_RANGE, server_selector,
+ "deleting option for a pool",
+ "pool specific option deleted",
+ false,
+ in_bindings));
}
/// @brief Deletes shared network level option.
const uint16_t code,
const std::string& space) {
- if (server_selector.amUnassigned()) {
- isc_throw(NotImplemented, "managing configuration for no particular server"
- " (unassigned) is unsupported at the moment");
- }
-
- auto tag = getServerTag(server_selector, "deleting option for a shared network");
-
MySqlBindingCollection in_bindings = {
- MySqlBinding::createString(tag),
MySqlBinding::createString(shared_network_name),
MySqlBinding::createInteger<uint8_t>(code),
MySqlBinding::createString(space)
};
// Run DELETE.
- return (conn_.updateDeleteQuery(DELETE_OPTION4_SHARED_NETWORK,
- in_bindings));
+ return (deleteTransactional(DELETE_OPTION4_SHARED_NETWORK, server_selector,
+ "deleting option for a shared network",
+ "shared network specific option deleted",
+ false,
+ in_bindings));
}
/// @brief Deletes options belonging to a subnet from the database.
uint64_t deleteOptions4(const ServerSelector& server_selector,
const Subnet4Ptr& subnet) {
- if (server_selector.amUnassigned()) {
- isc_throw(NotImplemented, "managing configuration for no particular server"
- " (unassigned) is unsupported at the moment");
- }
-
- auto tag = getServerTag(server_selector, "deleting options for a subnet");
-
MySqlBindingCollection in_bindings = {
- MySqlBinding::createString(tag),
MySqlBinding::createInteger<uint32_t>(subnet->getID())
};
// Run DELETE.
- return (conn_.updateDeleteQuery(DELETE_OPTIONS4_SUBNET_ID,
- in_bindings));
+ return (deleteTransactional(DELETE_OPTIONS4_SUBNET_ID, server_selector,
+ "deleting options for a subnet",
+ "subnet specific options deleted",
+ true,
+ in_bindings));
}
/// @brief Deletes options belonging to a shared network from the database.
uint64_t deleteOptions4(const ServerSelector& server_selector,
const SharedNetwork4Ptr& shared_network) {
- if (server_selector.amUnassigned()) {
- isc_throw(NotImplemented, "managing configuration for no particular server"
- " (unassigned) is unsupported at the moment");
- }
-
- auto tag = getServerTag(server_selector, "deleting options for a shared network");
-
MySqlBindingCollection in_bindings = {
- MySqlBinding::createString(tag),
MySqlBinding::createString(shared_network->getName())
};
// Run DELETE.
- return (conn_.updateDeleteQuery(DELETE_OPTIONS4_SHARED_NETWORK,
- in_bindings));
+ return (deleteTransactional(DELETE_OPTIONS4_SHARED_NETWORK, server_selector,
+ "deleting options for a shared network",
+ "shared network specific options deleted",
+ true,
+ in_bindings));
}
};
MySqlConfigBackendDHCPv4::createUpdateOption4(const db::ServerSelector& server_selector,
const std::string& shared_network_name,
const OptionDescriptorPtr& option) {
- impl_->createUpdateOption4(server_selector, shared_network_name, option, true);
+ impl_->createUpdateOption4(server_selector, shared_network_name, option, false);
}
void
MySqlConfigBackendDHCPv4::createUpdateOption4(const ServerSelector& server_selector,
const SubnetID& subnet_id,
const OptionDescriptorPtr& option) {
- impl_->createUpdateOption4(server_selector, subnet_id, option, true);
+ impl_->createUpdateOption4(server_selector, subnet_id, option, false);
}
void
uint64_t
MySqlConfigBackendDHCPv4::deleteSubnet4(const ServerSelector& server_selector,
const std::string& subnet_prefix) {
- return(impl_->deleteFromTable(MySqlConfigBackendDHCPv4Impl::DELETE_SUBNET4_PREFIX,
- server_selector, "deleting a subnet by prefix",
- subnet_prefix));
+ return(impl_->deleteTransactional(MySqlConfigBackendDHCPv4Impl::DELETE_SUBNET4_PREFIX,
+ server_selector, "deleting a subnet by prefix",
+ "subnet deleted", true,
+ subnet_prefix));
}
uint64_t
uint64_t
MySqlConfigBackendDHCPv4::deleteAllSubnets4(const ServerSelector& server_selector) {
- return (impl_->deleteFromTable(MySqlConfigBackendDHCPv4Impl::DELETE_ALL_SUBNETS4,
- server_selector, "deleting all subnets"));
+ return (impl_->deleteTransactional(MySqlConfigBackendDHCPv4Impl::DELETE_ALL_SUBNETS4,
+ server_selector, "deleting all subnets",
+ "deleted all subnets", true));
}
uint64_t
MySqlConfigBackendDHCPv4::deleteSharedNetwork4(const ServerSelector& server_selector,
const std::string& name) {
- return (impl_->deleteFromTable(MySqlConfigBackendDHCPv4Impl::DELETE_SHARED_NETWORK4_NAME,
- server_selector, "deleting a shared network",
- name));
+ return (impl_->deleteTransactional(MySqlConfigBackendDHCPv4Impl::DELETE_SHARED_NETWORK4_NAME,
+ server_selector, "deleting a shared network",
+ "shared network deleted", true,
+ name));
}
uint64_t
MySqlConfigBackendDHCPv4::deleteAllSharedNetworks4(const ServerSelector& server_selector) {
- return (impl_->deleteFromTable(MySqlConfigBackendDHCPv4Impl::DELETE_ALL_SHARED_NETWORKS4,
- server_selector, "deleting all shared networks"));
+ return (impl_->deleteTransactional(MySqlConfigBackendDHCPv4Impl::DELETE_ALL_SHARED_NETWORKS4,
+ server_selector, "deleting all shared networks",
+ "deleted all shared networks", true));
}
uint64_t
uint64_t
MySqlConfigBackendDHCPv4::deleteAllOptionDefs4(const ServerSelector& server_selector) {
- return (impl_->deleteFromTable(MySqlConfigBackendDHCPv4Impl::DELETE_ALL_OPTION_DEFS4,
- server_selector, "deleting all option definitions"));
+ return (impl_->deleteTransactional(MySqlConfigBackendDHCPv4Impl::DELETE_ALL_OPTION_DEFS4,
+ server_selector, "deleting all option definitions",
+ "deleted all option definitions", true));
}
uint64_t
uint64_t
MySqlConfigBackendDHCPv4::deleteGlobalParameter4(const ServerSelector& server_selector,
const std::string& name) {
- return (impl_->deleteFromTable(MySqlConfigBackendDHCPv4Impl::DELETE_GLOBAL_PARAMETER4,
- server_selector, "deleting global parameter",
- name));
+ return (impl_->deleteTransactional(MySqlConfigBackendDHCPv4Impl::DELETE_GLOBAL_PARAMETER4,
+ server_selector, "deleting global parameter",
+ "global parameter deleted", false,
+ name));
}
uint64_t
MySqlConfigBackendDHCPv4::deleteAllGlobalParameters4(const ServerSelector& server_selector) {
- return (impl_->deleteFromTable(MySqlConfigBackendDHCPv4Impl::DELETE_ALL_GLOBAL_PARAMETERS4,
- server_selector, "deleting all global parameters"));
+ return (impl_->deleteTransactional(MySqlConfigBackendDHCPv4Impl::DELETE_ALL_GLOBAL_PARAMETERS4,
+ server_selector, "deleting all global parameters",
+ "all global parameters deleted", true));
}
std::string
#include <boost/shared_ptr.hpp>
#include <gtest/gtest.h>
#include <map>
+#include <sstream>
using namespace isc::asiolink;
using namespace isc::db;
timestamps_["tomorrow"] = timestamps_["today"] + boost::posix_time::hours(24);
}
+ std::string logExistingAuditEntries() {
+ std::ostringstream s;
+
+ auto& mod_time_idx = audit_entries_.get<AuditEntryModificationTimeTag>();
+
+ for (auto audit_entry_it = mod_time_idx.begin();
+ audit_entry_it != mod_time_idx.end();
+ ++audit_entry_it) {
+ auto audit_entry = *audit_entry_it;
+ s << audit_entry->getObjectType() << ", "
+ << audit_entry->getObjectId() << ", "
+ << static_cast<int>(audit_entry->getModificationType()) << ", "
+ << audit_entry->getModificationTime() << ", "
+ << audit_entry->getLogMessage()
+ << std::endl;
+ }
+
+ return (s.str());
+ }
+
/// @brief Tests that the new audit entry is added.
///
/// This method retrieves a collection of the existing audit entries and
auto audit_entries_size_save = audit_entries_.size();
audit_entries_ = cbptr_->getRecentAuditEntries4(ServerSelector::ALL(),
timestamps_["two days ago"]);
- ASSERT_EQ(audit_entries_size_save + new_entries_num, audit_entries_.size());
+ ASSERT_EQ(audit_entries_size_save + new_entries_num, audit_entries_.size())
+ << logExistingAuditEntries();
auto& mod_time_idx = audit_entries_.get<AuditEntryModificationTimeTag>();
std::distance(mod_time_idx.rbegin(), audit_entry_it) < new_entries_num;
++audit_entry_it) {
auto audit_entry = *audit_entry_it;
- EXPECT_EQ(exp_object_type, audit_entry->getObjectType());
- EXPECT_EQ(exp_modification_type, audit_entry->getModificationType());
- EXPECT_EQ(exp_log_message, audit_entry->getLogMessage());
+ EXPECT_EQ(exp_object_type, audit_entry->getObjectType())
+ << logExistingAuditEntries();
+ EXPECT_EQ(exp_modification_type, audit_entry->getModificationType())
+ << logExistingAuditEntries();
+ EXPECT_EQ(exp_log_message, audit_entry->getLogMessage())
+ << logExistingAuditEntries();
}
}
SCOPED_TRACE("CREATE audit entry for global parameter");
testNewAuditEntry("dhcp4_global_parameter",
AuditEntry::ModificationType::CREATE,
- "this is a log message");
+ "global parameter set");
}
// Verify returned parameter and the modification time.
SCOPED_TRACE("UPDATE audit entry for the global parameter");
testNewAuditEntry("dhcp4_global_parameter",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "global parameter set");
}
// Should not delete parameter specified for all servers if explicit
SCOPED_TRACE("DELETE audit entry for the global parameter");
testNewAuditEntry("dhcp4_global_parameter",
AuditEntry::ModificationType::DELETE,
- "this is a log message");
+ "global parameter deleted");
}
}
SCOPED_TRACE("CREATE audit entry for the subnet");
testNewAuditEntry("dhcp4_subnet",
AuditEntry::ModificationType::CREATE,
- "this is a log message");
+ "subnet set");
}
// Update the subnet in the database (both use the same ID).
SCOPED_TRACE("UPDATE audit entry for the subnet");
testNewAuditEntry("dhcp4_subnet",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "subnet set");
}
}
SCOPED_TRACE("UPDATE audit entry for the subnet " + subnet->toText());
testNewAuditEntry("dhcp4_subnet",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "subnet set");
} else {
SCOPED_TRACE("CREATE audit entry for the subnet " + subnet->toText());
testNewAuditEntry("dhcp4_subnet",
AuditEntry::ModificationType::CREATE,
- "this is a log message");
+ "subnet set");
}
}
SCOPED_TRACE("DELETE first subnet audit entry");
testNewAuditEntry("dhcp4_subnet",
AuditEntry::ModificationType::DELETE,
- "this is a log message");
+ "subnet deleted");
}
subnets = cbptr_->getAllSubnets4(ServerSelector::ALL());
SCOPED_TRACE("DELETE second subnet audit entry");
testNewAuditEntry("dhcp4_subnet",
AuditEntry::ModificationType::DELETE,
- "this is a log message");
+ "subnet deleted");
}
// Delete all.
SCOPED_TRACE("DELETE all subnets audit entry");
testNewAuditEntry("dhcp4_subnet",
AuditEntry::ModificationType::DELETE,
- "this is a log message");
+ "deleted all subnets");
}
}
SCOPED_TRACE("CREATE audit entry for a shared network");
testNewAuditEntry("dhcp4_shared_network",
AuditEntry::ModificationType::CREATE,
- "this is a log message");
+ "shared network set");
}
-
+
// Update shared network in the database.
SharedNetwork4Ptr shared_network2 = test_networks_[1];
cbptr_->createUpdateSharedNetwork4(ServerSelector::ALL(), shared_network2);
- // Fetch updated subnet and see if it matches.
+ // Fetch updated shared betwork and see if it matches.
returned_network = cbptr_->getSharedNetwork4(ServerSelector::ALL(),
test_networks_[1]->getName());
EXPECT_EQ(shared_network2->toElement()->str(),
SCOPED_TRACE("UPDATE audit entry for a shared network");
testNewAuditEntry("dhcp4_shared_network",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "shared network set");
}
// Fetching the shared network for an explicitly specified server tag should
network->getName());
testNewAuditEntry("dhcp4_shared_network",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "shared network set");
} else {
SCOPED_TRACE("CREATE audit entry for the shared network " +
network->getName());
testNewAuditEntry("dhcp4_shared_network",
AuditEntry::ModificationType::CREATE,
- "this is a log message");
+ "shared network set");
}
-
}
// Fetch all shared networks.
SCOPED_TRACE("DELETE audit entry for the first shared network");
testNewAuditEntry("dhcp4_shared_network",
AuditEntry::ModificationType::DELETE,
- "this is a log message");
+ "shared network deleted");
}
// Delete all.
// The last parameter indicates that we expect two new audit entries.
testNewAuditEntry("dhcp4_shared_network",
AuditEntry::ModificationType::DELETE,
- "this is a log message", 2);
+ "deleted all shared networks", 2);
}
}
SCOPED_TRACE("CREATE audit entry for an option definition");
testNewAuditEntry("dhcp4_option_def",
AuditEntry::ModificationType::CREATE,
- "this is a log message");
+ "option definition set");
}
// Update the option definition in the database.
SCOPED_TRACE("UPDATE audit entry for an option definition");
testNewAuditEntry("dhcp4_option_def",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "option definition set");
}
}
option_def->getName());
testNewAuditEntry("dhcp4_option_def",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "option definition set");
} else {
SCOPED_TRACE("CREATE audit entry for the option defnition " +
option_def->getName());
testNewAuditEntry("dhcp4_option_def",
AuditEntry::ModificationType::CREATE,
- "this is a log message");
+ "option definition set");
}
}
SCOPED_TRACE("DELETE audit entry for the first option definition");
testNewAuditEntry("dhcp4_option_def",
AuditEntry::ModificationType::DELETE,
- "this is a log message");
+ "option definition deleted");
}
// Delete all remaining option definitions.
// The last parameter indicates that we expect two new audit entries.
testNewAuditEntry("dhcp4_option_def",
AuditEntry::ModificationType::DELETE,
- "this is a log message", 2);
+ "deleted all option definitions", 2);
}
}
SCOPED_TRACE("CREATE audit entry for an option");
testNewAuditEntry("dhcp4_options",
AuditEntry::ModificationType::CREATE,
- "this is a log message");
+ "global option set");
}
// Modify option and update it in the database.
SCOPED_TRACE("UPDATE audit entry for an option");
testNewAuditEntry("dhcp4_options",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "global option set");
}
// Deleting an option with explicitly specified server tag should fail.
SCOPED_TRACE("DELETE audit entry for an option");
testNewAuditEntry("dhcp4_options",
AuditEntry::ModificationType::DELETE,
- "this is a log message");
+ "global option deleted");
}
}
SCOPED_TRACE("CREATE audit entry for a new subnet");
testNewAuditEntry("dhcp4_subnet",
AuditEntry::ModificationType::CREATE,
- "this is a log message");
+ "subnet set");
}
OptionDescriptorPtr opt_boot_file_name = test_options_[0];
// have means to retrieve only the newly added option.
testNewAuditEntry("dhcp4_subnet",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "subnet specific option set");
}
opt_boot_file_name->persistent_ = !opt_boot_file_name->persistent_;
SCOPED_TRACE("UPDATE audit entry for an updated subnet option");
testNewAuditEntry("dhcp4_subnet",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "subnet specific option set");
}
// Deleting an option with explicitly specified server tag should fail.
SCOPED_TRACE("UPDATE audit entry for a deleted subnet option");
testNewAuditEntry("dhcp4_subnet",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "subnet specific option deleted");
}
}
SCOPED_TRACE("CREATE audit entry for the new shared network");
testNewAuditEntry("dhcp4_shared_network",
AuditEntry::ModificationType::CREATE,
- "this is a log message");
+ "shared network set");
}
OptionDescriptorPtr opt_boot_file_name = test_options_[0];
// have means to retrieve only the newly added option.
testNewAuditEntry("dhcp4_shared_network",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "shared network specific option set");
}
opt_boot_file_name->persistent_ = !opt_boot_file_name->persistent_;
SCOPED_TRACE("UPDATE audit entry for the updated shared network option");
testNewAuditEntry("dhcp4_shared_network",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "shared network specific option set");
}
// Deleting an option with explicitly specified server tag should fail.
SCOPED_TRACE("UPDATE audit entry for the deleted shared network option");
testNewAuditEntry("dhcp4_shared_network",
AuditEntry::ModificationType::UPDATE,
- "this is a log message");
+ "shared network specific option deleted");
}
}