]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[465-add-subnet4-update-and-subnet6-update-commands-to-subnet-cmds-hook] Addressed...
authorFrancis Dupont <fdupont@isc.org>
Wed, 17 Apr 2019 10:38:14 +0000 (12:38 +0200)
committerTomek Mrugalski <tomek@isc.org>
Fri, 19 Apr 2019 10:39:47 +0000 (06:39 -0400)
src/bin/perfdhcp/test_control.cc
src/bin/perfdhcp/test_control.h
src/lib/dhcpsrv/cfg_subnets4.cc
src/lib/dhcpsrv/cfg_subnets6.cc
src/lib/dhcpsrv/dhcpsrv_messages.mes
src/lib/dhcpsrv/shared_network.cc
src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc
src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc
src/lib/exceptions/exceptions.h

index 1493a8f1e6cfcae1a680ffbdf9f6528af24e53da..9ae1e9dd4551d377528393e2040100cd4f8a55a3 100644 (file)
@@ -133,7 +133,7 @@ TestControl::copyIaOptions(const Pkt6Ptr& pkt_from, Pkt6Ptr& pkt_to) {
         .includes(CommandOptions::LeaseType::ADDRESS)) {
         OptionPtr option = pkt_from->getOption(D6O_IA_NA);
         if (!option) {
-            isc_throw(OptionNotFound, "IA_NA option not found in the"
+            isc_throw(NotFound, "IA_NA option not found in the"
                       " server's response");
         }
         pkt_to->addOption(option);
@@ -143,7 +143,7 @@ TestControl::copyIaOptions(const Pkt6Ptr& pkt_from, Pkt6Ptr& pkt_to) {
         .includes(CommandOptions::LeaseType::PREFIX)) {
         OptionPtr option = pkt_from->getOption(D6O_IA_PD);
         if (!option) {
-            isc_throw(OptionNotFound, "IA_PD option not found in the"
+            isc_throw(NotFound, "IA_PD option not found in the"
                       " server's response");
         }
         pkt_to->addOption(option);
index b30ddf4882d05c87e68daab90302188640ac536b..af10314b97a81952916ca26db557696df22019d6 100644 (file)
@@ -54,14 +54,6 @@ static const size_t DHCPV6_SERVERID_OFFSET = 22;
 /// Default DHCPV6 IA_NA offset in the packet template.
 static const size_t DHCPV6_IA_NA_OFFSET = 40;
 
-/// @brief Exception thrown when the required option is not found in a packet.
-class OptionNotFound : public Exception {
-public:
-    OptionNotFound(const char* file, size_t line, const char* what) :
-        isc::Exception(file, line, what) { };
-};
-
-
 /// \brief Test Control class.
 ///
 /// This class is used to run the performance test with
@@ -822,8 +814,8 @@ protected:
     /// \param [in] pkt_from A packet from which options should be copied.
     /// \param [out] pkt_to A packet to which options should be copied.
     ///
-    /// \throw isc::perfdhcp::OptionNotFound if a required option is not
-    /// found in the packet from which options should be copied.
+    /// \throw isc::NotFound if a required option is not found in the
+    /// packet from which options should be copied.
     /// \throw isc::BadValue if any of the specified pointers to packets
     /// is NULL.
     void copyIaOptions(const dhcp::Pkt6Ptr& pkt_from, dhcp::Pkt6Ptr& pkt_to);
index ffb323502fe445159dcf7c51d921978a16cabd16..348ed1d75ef6118ce00b8d3cb1a0ef0a2a1b12a9 100644 (file)
@@ -48,8 +48,7 @@ CfgSubnets4::replace(const Subnet4Ptr& subnet) {
     auto& index = subnets_.template get<SubnetSubnetIdIndexTag>();
     auto subnet_it = index.find(subnet_id);
     if (subnet_it == index.end()) {
-        isc_throw(BadValue, "ID of the IPv4 subnet '" << subnet_id
-                  << "' is not in use");
+        isc_throw(BadValue, "There is no IPv4 subnet with ID " <<subnet_id);
     }
     Subnet4Ptr old = *subnet_it;
     bool ret = index.replace(subnet_it, subnet);
index 2405594736b38c0f6a7063ea05c4d7848e323a1c..a1561635779be3ddbcaf73a4ac62e08c932d6d94 100644 (file)
@@ -48,8 +48,7 @@ CfgSubnets6::replace(const Subnet6Ptr& subnet) {
     auto& index = subnets_.template get<SubnetSubnetIdIndexTag>();
     auto subnet_it = index.find(subnet_id);
     if (subnet_it == index.end()) {
-        isc_throw(BadValue, "ID of the IPv6 subnet '" << subnet_id
-                  << "' is not in use");
+        isc_throw(BadValue, "There is no IPv6 subnet with ID " << subnet_id);
     }
     Subnet6Ptr old = *subnet_it;
     bool ret = index.replace(subnet_it, subnet);
index 0dbe55b0ce11f9ecdbe98e3f0de4e05f89a77717..a6155f05da1f04263983dd81d83d95c08fca3383 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2012-2019 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
@@ -102,13 +102,13 @@ move to the new list parameter.
 
 % DHCPSRV_CFGMGR_UPDATE_SUBNET4 updating subnet %1 (result %2)
 A debug message reported when the DHCP configuration manager is updating the
-specified IPv4 subnet to its database. Subnet ID and result (expected to
-be true) are displayed.
+specified IPv4 subnet in its current configuration. Subnet ID and result
+(expected to be true) are displayed.
 
 % DHCPSRV_CFGMGR_UPDATE_SUBNET6 updating subnet %1 (result %2)
 A debug message reported when the DHCP configuration manager is replacing the
-specified IPv6 subnet to its database.  Subnet ID and result (expected to
-be true) are displayed.
+specified IPv6 subnet in its current configuration.  Subnet ID and result
+(expected to be true) are displayed.
 
 % DHCPSRV_CFGMGR_SOCKET_RAW_UNSUPPORTED use of raw sockets is unsupported on this OS, UDP sockets will be used
 This warning message is logged when the user specified that the
index d691e73af455193d2a14227121bdd41f0a32d5b6..8582276faaba4b4bbf9ae669588fd8fc77a6f64b 100644 (file)
@@ -93,7 +93,7 @@ public:
     static bool replace(SubnetCollectionType& subnets,
                         const SubnetPtrType& subnet) {
 
-        // Check if the subnet is already associated with some network.
+        // Check if the new subnet is already associated with some network.
         NetworkPtr network;
         subnet->getSharedNetwork(network);
         if (network) {
index 64f436ec5351023323133de899a432d25ed8129a..9a1fef2f31417c629205ad34220b7ab17e0e076d 100644 (file)
@@ -183,7 +183,7 @@ TEST(CfgSubnets4Test, replaceSubnet) {
     ASSERT_TRUE(returned);
     EXPECT_TRUE(returned == subnet);
 
-    // Rollback.
+    // Restore.
     replaced = cfg.replace(replaced);
     ASSERT_TRUE(replaced);
     EXPECT_TRUE(replaced == subnet);
index 53124bf5ba267b6622d4a7f07f6a541e59c539d2..332f8fc1f44ca75f4496401e948afb7ece230884 100644 (file)
@@ -181,7 +181,7 @@ TEST(CfgSubnets6Test, replaceSubnet) {
     ASSERT_TRUE(returned);
     EXPECT_TRUE(returned == subnet);
 
-    // Rollback.
+    // Restore.
     replaced = cfg.replace(replaced);
     ASSERT_TRUE(replaced);
     EXPECT_TRUE(replaced == subnet);
index 6fa6c5ec3c87fee362b7456f74ca5e6f6858d7b7..f5368c84587c80add646e22bb66e8bccf4d22bc1 100644 (file)
@@ -169,6 +169,15 @@ public:
         isc::Exception(file, line, what) {}
 };
 
+///
+/// \brief A generic exception that is thrown when an object can
+/// not be found.
+class NotFound : public Exception {
+public:
+    NotFound(const char* file, size_t line, const char* what) :
+        isc::Exception(file, line, what) {}
+};
+
 ///
 /// A shortcut macro to insert known values into exception arguments.
 ///