]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[397-cb-implement-mysqlconfigbackenddhcpv6] Checkpoint: make code to compile
authorFrancis Dupont <fdupont@isc.org>
Fri, 29 Mar 2019 21:18:12 +0000 (22:18 +0100)
committerFrancis Dupont <fdupont@isc.org>
Thu, 18 Apr 2019 13:52:51 +0000 (15:52 +0200)
src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc
src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.h
src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc

index 83c3f4e62447f574fb490c57f7642fa344b1bdbe..4fbcebd5e935a4ce01bde12f8d112615ce76b112 100644 (file)
@@ -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) {
index 561d084d11c801dca532cd9bb0e44b504611fa21..cc8726cb4bb778b2026f216acb716af5d5fa1f07 100644 (file)
@@ -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.
index 2e1b23e7678a343cae757f389c4e336bd841685e..4ecc551765ff002b41d6007c5072767d45c963de 100644 (file)
@@ -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();