From: Francis Dupont Date: Fri, 29 Mar 2019 21:18:12 +0000 (+0100) Subject: [397-cb-implement-mysqlconfigbackenddhcpv6] Checkpoint: make code to compile X-Git-Tag: Kea-1.6.0-beta~250 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=546ad08031cae943d2cafc8c3204e2edf3c356cf;p=thirdparty%2Fkea.git [397-cb-implement-mysqlconfigbackenddhcpv6] Checkpoint: make code to compile --- diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc index 83c3f4e624..4fbcebd5e9 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc @@ -104,6 +104,7 @@ public: DELETE_SUBNET6_ID, DELETE_SUBNET6_PREFIX, DELETE_ALL_SUBNETS6, + DELETE_ALL_SUBNETS6_SHARED_NETWORK_NAME, DELETE_POOLS6_SUBNET_ID, DELETE_PD_POOLS_SUBNET_ID, DELETE_SHARED_NETWORK6_NAME, @@ -2462,6 +2463,11 @@ TaggedStatementArray tagged_statements = { { MYSQL_DELETE_SUBNET(dhcp6) }, + // Delete all subnets for a shared network. + { MySqlConfigBackendDHCPv6Impl::DELETE_ALL_SUBNETS6_SHARED_NETWORK_NAME, + MYSQL_DELETE_SUBNET(dhcp6, AND s.shared_network_name = ?) + }, + // Delete pools for a subnet. { MySqlConfigBackendDHCPv6Impl::DELETE_POOLS6_SUBNET_ID, MYSQL_DELETE_POOLS(dhcp6) @@ -2694,8 +2700,8 @@ getModifiedGlobalParameters6(const db::ServerSelector& server_selector, AuditEntryCollection MySqlConfigBackendDHCPv6:: -getRecentAuditEntries6(const db::ServerSelector& server_selector, - const boost::posix_time::ptime& modification_time) const { +getRecentAuditEntries(const db::ServerSelector& server_selector, + const boost::posix_time::ptime& modification_time) const { AuditEntryCollection audit_entries; impl_->getRecentAuditEntries(MySqlConfigBackendDHCPv6Impl::GET_AUDIT_ENTRIES6_TIME, server_selector, modification_time, audit_entries); @@ -2787,6 +2793,16 @@ MySqlConfigBackendDHCPv6::deleteAllSubnets6(const ServerSelector& server_selecto "deleted all subnets", true)); } +uint64_t +MySqlConfigBackendDHCPv6::deleteSharedNetworkSubnets6(const db::ServerSelector& server_selector, + const std::string& shared_network_name) { + return (impl_->deleteTransactional(MySqlConfigBackendDHCPv6Impl::DELETE_ALL_SUBNETS6_SHARED_NETWORK_NAME, + server_selector, + "deleting all subnets for a shared network", + "deleted all subnets for a shared network", + true, shared_network_name)); +} + uint64_t MySqlConfigBackendDHCPv6::deleteSharedNetwork6(const ServerSelector& server_selector, const std::string& name) { diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.h b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.h index 561d084d11..cc8726cb4b 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.h +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.h @@ -192,8 +192,8 @@ public: /// result set, i.e. entries later than specified time are returned. /// @return Collection of audit entries. virtual db::AuditEntryCollection - getRecentAuditEntries6(const db::ServerSelector& server_selector, - const boost::posix_time::ptime& modification_time) const; + getRecentAuditEntries(const db::ServerSelector& server_selector, + const boost::posix_time::ptime& modification_time) const; /// @brief Creates or updates a subnet. /// @@ -321,6 +321,16 @@ public: virtual uint64_t deleteAllSubnets6(const db::ServerSelector& server_selector); + /// @brief Deletes all subnets belonging to a specified shared network. + /// + /// @param server_selector Server selector. + /// @param shared_network_name Name of the shared network for which the + /// subnets should be deleted. + /// @return Number of deleted subnets. + virtual uint64_t + deleteSharedNetworkSubnets6(const db::ServerSelector& server_selector, + const std::string& shared_network_name); + /// @brief Deletes shared network by name. /// /// @param server_selector Server selector. diff --git a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc index 2e1b23e767..4ecc551765 100644 --- a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc +++ b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc @@ -375,8 +375,8 @@ public: const std::string& exp_log_message, const size_t new_entries_num = 1) { auto audit_entries_size_save = audit_entries_.size(); - audit_entries_ = cbptr_->getRecentAuditEntries6(ServerSelector::ALL(), - timestamps_["two days ago"]); + audit_entries_ = cbptr_->getRecentAuditEntries(ServerSelector::ALL(), + timestamps_["two days ago"]); ASSERT_EQ(audit_entries_size_save + new_entries_num, audit_entries_.size()) << logExistingAuditEntries();