]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2959] removed deprecated parameter reservation-mode
authorRazvan Becheriu <razvan@isc.org>
Tue, 7 May 2024 12:47:11 +0000 (15:47 +0300)
committerRazvan Becheriu <razvan@isc.org>
Wed, 22 May 2024 18:37:12 +0000 (21:37 +0300)
35 files changed:
doc/examples/kea4/all-keys-netconf.json
doc/examples/kea4/all-keys.json
doc/examples/kea4/global-reservations.json
doc/examples/kea4/reservations.json
doc/examples/kea4/shared-network.json
doc/examples/kea6/all-keys-netconf.json
doc/examples/kea6/all-keys.json
doc/examples/kea6/global-reservations.json
doc/examples/kea6/reservations.json
doc/examples/kea6/shared-network.json
doc/sphinx/arm/dhcp4-srv.rst
doc/sphinx/arm/dhcp6-srv.rst
doc/sphinx/arm/hooks-subnet-cmds.rst
src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_parser.yy
src/bin/dhcp4/json_config_parser.cc
src/bin/dhcp4/parser_context.cc
src/bin/dhcp4/parser_context.h
src/bin/dhcp4/tests/parser_unittest.cc
src/bin/dhcp6/dhcp6_lexer.ll
src/bin/dhcp6/dhcp6_parser.yy
src/bin/dhcp6/json_config_parser.cc
src/bin/dhcp6/parser_context.cc
src/bin/dhcp6/parser_context.h
src/bin/dhcp6/tests/parser_unittest.cc
src/lib/dhcpsrv/cfg_globals.cc
src/lib/dhcpsrv/cfg_globals.h
src/lib/dhcpsrv/parsers/base_network_parser.cc
src/lib/dhcpsrv/parsers/base_network_parser.h
src/lib/dhcpsrv/parsers/dhcp_parsers.cc
src/lib/dhcpsrv/parsers/shared_network_parser.cc
src/lib/dhcpsrv/parsers/simple_parser4.cc
src/lib/dhcpsrv/parsers/simple_parser6.cc
src/lib/dhcpsrv/srv_config.cc
src/lib/dhcpsrv/tests/network_unittest.cc

index 1b7f08a8c99881fd334115fd118a3ad0fec64f84..d5246b26be943ccef6277e2fd06376cf4a4f79e5 100644 (file)
                 // lease is returned as it was "cached".
                 "cache-max-age": 1000,
 
-                // Enumeration specifying the server's mode of operation when it
-                // fetches host reservations.
-                // "reservation-mode": "all",
-                // It is replaced by the "reservations-global",
-                // "reservations-in-subnet", and "reservations-out-of-pool"
-                // parameters.
-
                 // Specify whether the server should look up global reservations.
                 "reservations-global": false,
 
                         // Subnet-level value of the renew timer.
                         "renew-timer": 30,
 
-                        // Enumeration specifying the server's mode of operation when it
-                        // fetches host reservations.
-                        // "reservation-mode": "all",
-                        // It is replaced by the "reservations-global",
-                        // "reservations-in-subnet", and
-                        // "reservations-out-of-pool" parameters.
-
                         // Specify whether the server should look up global reservations.
                         "reservations-global": false,
 
             "capacity": 64
         },
 
-        // Fetches host reservations.
-        // "reservation-mode": "all",
-        // It is replaced by the "reservations-global",
-        // "reservations-in-subnet", and "reservations-out-of-pool" parameters.
-
         // Specify whether the server should look up global reservations.
         "reservations-global": false,
 
index 716afdd202ac0b5979a25481b03fa50223b1d01a..ff62093877659ef7bf3d2bc6af7882dbb5d49f77 100644 (file)
                 // lease is returned as it was "cached".
                 "cache-max-age": 1000,
 
-                // Enumeration specifying the server's mode of operation when it
-                // fetches host reservations.
-                // "reservation-mode": "all",
-                // It is replaced by the "reservations-global",
-                // "reservations-in-subnet", and "reservations-out-of-pool"
-                // parameters.
-
                 // Specify whether the server should look up global reservations.
                 "reservations-global": false,
 
                         // Subnet-level value of the renew timer.
                         "renew-timer": 30,
 
-                        // Enumeration specifying the server's mode of operation when it
-                        // fetches host reservations.
-                        // "reservation-mode": "all",
-                        // It is replaced by the "reservations-global",
-                        // "reservations-in-subnet", and
-                        // "reservations-out-of-pool" parameters.
-
                         // Specify whether the server should look up global reservations.
                         "reservations-global": false,
 
             "capacity": 64
         },
 
-        // Fetches host reservations.
-        // "reservation-mode": "all",
-        // It is replaced by the "reservations-global",
-        // "reservations-in-subnet", and "reservations-out-of-pool" parameters.
-
         // Specify whether the server should look up global reservations.
         "reservations-global": false,
 
index 37cba508f589e73373cc97849328a9cc9f9f214b..be020af56dc9b38b427ab108dad32fa9e9903090 100644 (file)
@@ -51,9 +51,6 @@
 
 // This directive tells Kea that reservations are global. Note that this
 // can also be specified at shared network and/or subnet level.
-// "reservation-mode": "global",
-// It is replaced by the "reservations-global", "reservations-in-subnet", and
-// "reservations-out-of-pool" parameters.
 
 // Specify whether the server should look up global reservations.
   "reservations-global": true,
index da44c1b4bc0e572588b5064362b032e7b67deaf9..94d3541e2db9e64e6137458a407fa40c6275cb3b 100644 (file)
 // to the dynamic pool. Kea is able to handle this case, but it is not
 // recommended from a performance perspective, as Kea would not only need to
 // check if a given address is free, but also whether it is reserved.
-// To avoid this check, one can change reservation-mode to out-of-pool, rather
-// than 'all'. If a subnet does not have reservations at all, the reservation
-// lookup can be skipped altogether (reservation-mode is set to 'disabled').
-// The reservation-mode has been replaced by reservations-global,
-// reservations-in-subnet and reservations-out-of-pool.
+// To avoid this check, one can set "reservations-out-of-pool", beside
+// the "reservations-in-subnet". If a subnet does not have reservations at all,
+// the reservation lookup can be skipped altogether by disabling
+// "reservations-in-subnet".
 
 // Note that the second reservation is for an address which is within the
 // range of the pool of the dynamically allocated address. The server will
         "interface": "eth0",
         // This directive tells Kea that reservations may be made both in-pool
         // and out-of-pool. For improved performance, you may move all reservations
-        // out of the dynamic pool and change reservation-mode to "out-of-pool".
+        // out of the dynamic pool and set "reservations-out-of-pool".
         // Kea will then be able to skip querying for host reservations when
         // assigning leases from dynamic pool.
-        // "reservation-mode": "all",
-        // It is replaced by the "reservations-global", "reservations-in-subnet"
-        // and "reservations-out-of-pool" parameters.
 
         // Specify whether the server should look up global reservations.
         "reservations-global": false,
index ae9881300d1dfa34b400b0930bb1b96936e53ec4..3407cf79f69d609b8e832cd48e80dd64f42de00e 100644 (file)
             // Timer values can be overridden here.
             "renew-timer": 100,
 
-            // "reservation-mode": "all",
-            // It is replaced by the "reservations-global",
-            // "reservations-in-subnet", and "reservations-out-of-pool"
-            // parameters.
-
             // Specify whether the server should look up global reservations.
             "reservations-global": false,
 
                         "ip-addresses": [ "0.0.0.0" ]
                     },
                     "renew-timer": 10,
-                    // "reservation-mode": "all",
-                    // It is replaced by the "reservations-global",
-                    // "reservations-in-subnet", and "reservations-out-of-pool"
-                    // parameters.
                     // Specify whether the server should look up global reservations.
                     "reservations-global": false,
                     // Specify whether the server should look up in-subnet reservations.
                     "pools": [ ],
                     "rebind-timer": 20,
                     "renew-timer": 10,
-                    // "reservation-mode": "all",
-                    // It is replaced by the "reservations-global",
-                    // "reservations-in-subnet", and "reservations-out-of-pool"
-                    // parameters.
                     // Specify whether the server should look up global reservations.
                     "reservations-global": false,
                     // Specify whether the server should look up in-subnet reservations.
index 23f5c6f7afd5dc2eecc93d297fa0b76f409531e4..16fe6ef725503f12ab5803f8cd9ee808038ca0ea 100644 (file)
                 // lease is returned as it was "cached".
                 "cache-max-age": 1000,
 
-                // Enumeration specifying the server's mode of operation when it
-                // fetches host reservations.
-                // "reservation-mode": "all",
-                // It is replaced by the "reservations-global",
-                // "reservations-in-subnet", and "reservations-out-of-pool"
-                // parameters.
-
                 // Specify whether the server should look up global reservations.
                 "reservations-global": false,
 
                         // Subnet-level renew timer.
                         "renew-timer": 30,
 
-                        // Enumeration specifying the server's mode of operation when it
-                        // fetches host reservations.
-                        // "reservation-mode": "all",
-                        // It is replaced by the "reservations-global",
-                        // "reservations-in-subnet", and
-                        // "reservations-out-of-pool" parameters.
-
                         // Specify whether the server should look up global reservations.
                         "reservations-global": false,
 
             "capacity": 64
         },
 
-        // Fetches host reservations.
-        // "reservation-mode": "all",
-        // It is replaced by the "reservations-global",
-        // "reservations-in-subnet", and "reservations-out-of-pool" parameters.
-
         // Specify whether the server should look up global reservations.
         "reservations-global": false,
 
index cbf615c1906d14560487d5d85c14906e98d54811..cde5ee61e50b3db76447d0f6d8770e623f0ed7fa 100644 (file)
                 // lease is returned as it was "cached".
                 "cache-max-age": 1000,
 
-                // Enumeration specifying the server's mode of operation when it
-                // fetches host reservations.
-                // "reservation-mode": "all",
-                // It is replaced by the "reservations-global",
-                // "reservations-in-subnet", and "reservations-out-of-pool"
-                // parameters.
-
                 // Specify whether the server should look up global reservations.
                 "reservations-global": false,
 
                         // Subnet-level renew timer.
                         "renew-timer": 30,
 
-                        // Enumeration specifying the server's mode of operation when it
-                        // fetches host reservations.
-                        // "reservation-mode": "all",
-                        // It is replaced by the "reservations-global",
-                        // "reservations-in-subnet", and
-                        // "reservations-out-of-pool" parameters.
-
                         // Specify whether the server should look up global reservations.
                         "reservations-global": false,
 
             "capacity": 64
         },
 
-        // Fetches host reservations.
-        // "reservation-mode": "all",
-        // It is replaced by the "reservations-global",
-        // "reservations-in-subnet", and "reservations-out-of-pool" parameters.
-
         // Specify whether the server should look up global reservations.
         "reservations-global": false,
 
index b98b3e0ede20c18b59253ec9734c2f7769592718..20173b0db17e14f653d03c29b9743d14380044fe 100644 (file)
@@ -40,9 +40,6 @@
 
 // This directive tells Kea that reservations are global. Note that this
 // can also be specified at shared network and/or subnet level.
-// "reservation-mode": "global",
-// It is replaced by the "reservations-global", "reservations-in-subnet", and
-// "reservations-out-of-pool" parameters.
 
 // Specify whether the server should look up global reservations.
   "reservations-global": true,
index c793cb8c42000e950ffced7a2e21c7e03dc2e8e3..4dd47908f16106fb3f05ae8206fc4ff1556e0954 100644 (file)
 
         // This directive tells Kea that reservations may be made both in-pool
         // and out-of-pool. For improved performance, you may move all reservations
-        // out of the dynamic pool and change reservation-mode to "out-of-pool".
+        // out of the dynamic pool and set "reservations-out-of-pool".
         // Kea will then be able to skip querying for host reservations when
         // assigning leases from dynamic pool.
-        // "reservation-mode": "all",
-        // It is replaced by the "reservations-global", "reservations-in-subnet"
-        // and "reservations-out-of-pool" parameters.
 
         // Specify whether the server should look up global reservations.
         "reservations-global": false,
index c0405bb8d46b3c0f7086b9e2932af5ca91bb46a9..e54aa54d4c60faf1085a76de80b485e1fe14f18e 100644 (file)
             },
             "renew-timer": 100,
 
-            // "reservation-mode": "all",
-            // It is replaced by the "reservations-global",
-            // "reservations-in-subnet", and "reservations-out-of-pool"
-            // parameters.
-
             // Specify whether the server should look up global reservations.
             "reservations-global": false,
 
                         "ip-addresses": [ "2001:db8:1::123" ]
                     },
                     "renew-timer": 10,
-                    // "reservation-mode": "all",
-                    // It is replaced by the "reservations-global",
-                    // "reservations-in-subnet", and "reservations-out-of-pool"
-                    // parameters.
                     // Specify whether the server should look up global reservations.
                     "reservations-global": false,
                     // Specify whether the server should look up in-subnet reservations.
                         "ip-addresses": [ "3000::1" ]
                     },
                     "renew-timer": 10,
-                    // "reservation-mode": "all",
-                    // It is replaced by the "reservations-global",
-                    // "reservations-in-subnet", and "reservations-out-of-pool"
-                    // parameters.
                     // Specify whether the server should look up global reservations.
                     "reservations-global": false,
                     // Specify whether the server should look up in-subnet reservations.
index 2651e90af25418ca16ecb96470d44bf9169336bf..dcb083144d8b0d554a5db6ed1e119be43339ea81 100644 (file)
@@ -5316,61 +5316,60 @@ address should be revoked and the reserved one be used instead.
 
 Some of those checks may be unnecessary in certain deployments, and not
 performing them may improve performance. The Kea server provides the
-``reservation-mode`` configuration parameter to select the types of
+``reservations-global``, ``reservations-in-subnet`` and
+``reservations-out-of-pool`` configuration parameters to select the types of
 reservations allowed for a particular subnet. Each reservation type has
 different constraints for the checks to be performed by the server when
-allocating or renewing a lease for the client. Although ``reservation-mode``
-was deprecated in Kea 1.9.1, it is still available; the allowed values are:
-
--  ``all`` - enables both in-pool and out-of-pool host reservation
-   types. This setting is the default value, and is the safest and most
-   flexible. However, as all checks are conducted, it is also the slowest.
-   It does not check against global reservations.
-
--  ``out-of-pool`` - allows only out-of-pool host reservations. With
-   this setting in place, the server assumes that all host
-   reservations are for addresses that do not belong to the dynamic
-   pool. Therefore, it can skip the reservation checks when dealing with
-   in-pool addresses, thus improving performance. Do not use this mode
-   if any reservations use in-pool addresses. Caution is advised
-   when using this setting; Kea does not sanity-check the reservations
-   against ``reservation-mode`` and misconfiguration may cause problems.
-
--  ``global`` - allows only global host reservations. With this setting
-   in place, the server searches for reservations for a client only
-   among the defined global reservations. If an address is specified,
-   the server skips the reservation checks carried out in
-   other modes, thus improving performance. Caution is advised when
-   using this setting; Kea does not sanity-check reservations when
-   ``global`` is set, and misconfiguration may cause problems.
-
--  ``disabled`` - host reservation support is disabled. As there are no
-   reservations, the server skips all checks. Any reservations
-   defined are completely ignored. As checks are skipped, the
-   server may operate faster in this mode.
-
-Since Kea 1.9.1, the ``reservation-mode`` parameter is replaced by the
-``reservations-global``, ``reservations-in-subnet``, and
-``reservations-out-of-pool`` flags.
-The flags can be activated independently and can produce various combinations,
-some of which were not supported by the deprecated ``reservation-mode``.
-
-The ``reservation-mode`` parameter can be specified at:
-
-- global level: ``.Dhcp4["reservation-mode"]`` (lowest priority: gets overridden
+allocating or renewing a lease for the client.
+
+Configuration flags are:
+
+-  ``reservations-in-subnet`` - enables in-pool host reservation types. This
+   setting is the default value, and is the safest and most flexible. However,
+   as all checks are conducted, it is also the slowest. It does not check
+   against global reservations.
+
+-  ``reservations-out-of-pool`` - allows only out-of-pool host reservations.
+   With this setting in place, the server assumes that all host reservations are
+   for addresses that do not belong to the dynamic pool. Therefore, it can skip
+   the reservation checks when dealing with in-pool addresses, thus improving
+   performance. Do not use this mode if any reservations use in-pool addresses.
+   Caution is advised when using this setting; Kea does not sanity-check the
+   reservations against ``reservations-out-of-pool`` and misconfiguration may
+   cause problems.
+
+-  ``reservations-global`` - allows global host reservations. With this setting
+   in place, the server searches for reservations for a client among the defined
+   global reservations. If an address is specified, the server skips the
+   reservation checks carried out in other modes, thus improving performance.
+   Caution is advised when using this setting; Kea does not sanity-check the
+   reservations when ``reservations-global`` is set, and misconfiguration may
+   cause problems.
+
+Note: disabling all flags disables host reservation support. As there are no
+   reservations, the server skips all checks. Any reservations defined are
+   completely ignored. As checks are skipped, the server may operate faster in
+   this mode.
+
+Since Kea 1.9.1 the ``reservations-global``, ``reservations-in-subnet`` and
+``reservations-out-of-pool`` flags are suported.
+
+The ``reservations-global``, ``reservations-in-subnet`` and
+``reservations-out-of-pool`` parameters can be specified at:
+
+- global level: ``.Dhcp4["reservations-global"]`` (lowest priority: gets overridden
   by all others)
 
-- subnet level: ``.Dhcp4.subnet4[]["reservation-mode"]`` (low priority)
+- subnet level: ``.Dhcp4.subnet4[]["reservations-in-subnet"]`` (low priority)
 
-- shared-network level: ``.Dhcp4["shared-networks"][]["reservation-mode"]``
+- shared-network level: ``.Dhcp4["shared-networks"][]["reservations-out-of-pool"]``
   (high priority)
 
 - shared-network subnet-level:
-  ``.Dhcp4["shared-networks"][].subnet4[]["reservation-mode"]`` (highest
+  ``.Dhcp4["shared-networks"][].subnet4[]["reservations-out-of-pool"]`` (highest
   priority: overrides all others)
 
-To decide which ``reservation-mode`` to choose, the
-following decision diagram may be useful:
+To decide which flags to use, the following decision diagram may be useful:
 
 ::
 
@@ -5422,7 +5421,7 @@ following decision diagram may be useful:
             |                |                  |     |
             |             yes|                no|     |
             |                |                  |     V
-            +----------------+                  +--> "all"
+            +----------------+                  +--> "in-subnet"
 
 An example configuration that disables reservations looks as follows:
 
@@ -5438,7 +5437,8 @@ An example configuration that disables reservations looks as follows:
                 "pool": "192.0.2.10-192.0.2.100"
               }
             ],
-            "reservation-mode": "disabled",
+            "reservations-global": false,
+            "reservations-in-subnet": false,
             "subnet": "192.0.2.0/24"
           }
         ]
@@ -5451,7 +5451,7 @@ An example configuration using global reservations is shown below:
 
     {
       "Dhcp4": {
-        "reservation-mode": "global",
+        "reservations-global": true,
         "reservations": [
           {
             "hostname": "host-one",
@@ -5493,7 +5493,7 @@ The meaning of the reservation flags are:
   the respective reservations from inside the dynamic pools (if any) can be
   dynamically assigned to any client.
 
-The ``disabled`` value from the deprecated ``reservation-mode`` corresponds to:
+The ``disabled`` configuration corresponds to:
 
 .. code-block:: json
 
@@ -5504,7 +5504,7 @@ The ``disabled`` value from the deprecated ``reservation-mode`` corresponds to:
       }
     }
 
-The ``global`` value from the deprecated ``reservation-mode`` corresponds to:
+The ``global``configuration using ``reservations-global`` corresponds to:
 
 .. code-block:: json
 
@@ -5515,7 +5515,7 @@ The ``global`` value from the deprecated ``reservation-mode`` corresponds to:
       }
     }
 
-The ``out-of-pool`` value from the deprecated ``reservation-mode`` corresponds to:
+The ``out-of-pool`` configuration using ``reservations-out-of-pool`` corresponds to:
 
 .. code-block:: json
 
@@ -5527,7 +5527,7 @@ The ``out-of-pool`` value from the deprecated ``reservation-mode`` corresponds t
       }
     }
 
-And the ``all`` value from the deprecated ``reservation-mode`` corresponds to:
+And the ``in-subnet`` configuration using ``reservations-in-subnet`` corresponds to:
 
 .. code-block:: json
 
@@ -5539,7 +5539,7 @@ And the ``all`` value from the deprecated ``reservation-mode`` corresponds to:
       }
     }
 
-To activate both ``global`` and ``all``, the following combination can be used:
+To activate both ``global`` and ``in-subnet``, the following combination can be used:
 
 .. code-block:: json
 
index 1c41ab563ceb63dfb70561bb62ba582c6168ba56..87e1becbf1a4bdfde9c3711d6c2662473672fb05 100644 (file)
@@ -4614,60 +4614,60 @@ instead.
 
 Some of those checks may be unnecessary in certain deployments, and not
 performing them may improve performance. The Kea server provides the
-``reservation-mode`` configuration parameter to select the types of
+``reservations-global``, ``reservations-in-subnet`` and
+``reservations-out-of-pool`` configuration parameters to select the types of
 reservations allowed for a particular subnet. Each reservation type has
 different constraints for the checks to be performed by the server when
-allocating or renewing a lease for the client. Allowed values are:
-
--  ``all`` - enables both in-pool and out-of-pool host reservation
-   types. This setting is the default value, and is the safest and most
-   flexible. However, as all checks are conducted, it is also the slowest.
-   It does not check against global reservations.
-
--  ``out-of-pool`` - allows only out-of-pool host reservations. With
-   this setting in place, the server assumes that all host
-   reservations are for addresses that do not belong to the dynamic
-   pool. Therefore, it can skip the reservation checks when dealing with
-   in-pool addresses, thus improving performance. Do not use this mode
-   if any reservations use in-pool addresses. Caution is advised
-   when using this setting; Kea does not sanity-check the reservations
-   against ``reservation-mode`` and misconfiguration may cause problems.
-
--  ``global`` - allows only global host reservations. With this setting
-   in place, the server searches for reservations for a client only
-   among the defined global reservations. If an address is specified,
-   the server skips the reservation checks carried out in
-   other modes, thus improving performance. Caution is advised when
-   using this setting; Kea does not sanity-check the reservations when
-   ``global`` is set, and misconfiguration may cause problems.
-
--  ``disabled`` - host reservation support is disabled. As there are no
-   reservations, the server skips all checks. Any reservations
-   defined are completely ignored. As checks are skipped, the
-   server may operate faster in this mode.
-
-Since Kea 1.9.1, the ``reservation-mode`` parameter is replaced by the
-``reservations-global``, ``reservations-in-subnet`` and
-``reservations-out-of-pool`` flags.
-The flags can be activated independently and can produce various combinations,
-some of them being unsupported by the deprecated ``reservation-mode``.
-
-The ``reservation-mode`` parameter can be specified at:
-
-- global level: ``.Dhcp6["reservation-mode"]`` (lowest priority: gets overridden
+allocating or renewing a lease for the client.
+
+Configuration flags are:
+
+-  ``reservations-in-subnet`` - enables in-pool host reservation types. This
+   setting is the default value, and is the safest and most flexible. However,
+   as all checks are conducted, it is also the slowest. It does not check
+   against global reservations.
+
+-  ``reservations-out-of-pool`` - allows only out-of-pool host reservations.
+   With this setting in place, the server assumes that all host reservations are
+   for addresses that do not belong to the dynamic pool. Therefore, it can skip
+   the reservation checks when dealing with in-pool addresses, thus improving
+   performance. Do not use this mode if any reservations use in-pool addresses.
+   Caution is advised when using this setting; Kea does not sanity-check the
+   reservations against ``reservations-out-of-pool`` and misconfiguration may
+   cause problems.
+
+-  ``reservations-global`` - allows global host reservations. With this setting
+   in place, the server searches for reservations for a client among the defined
+   global reservations. If an address is specified, the server skips the
+   reservation checks carried out in other modes, thus improving performance.
+   Caution is advised when using this setting; Kea does not sanity-check the
+   reservations when ``reservations-global`` is set, and misconfiguration may
+   cause problems.
+
+Note: disabling all flags disables host reservation support. As there are no
+   reservations, the server skips all checks. Any reservations defined are
+   completely ignored. As checks are skipped, the server may operate faster in
+   this mode.
+
+Since Kea 1.9.1 the ``reservations-global``, ``reservations-in-subnet`` and
+``reservations-out-of-pool`` flags are suported.
+
+The ``reservations-global``, ``reservations-in-subnet`` and
+``reservations-out-of-pool`` parameters can be specified at:
+
+- global level: ``.Dhcp6["reservations-global"]`` (lowest priority: gets overridden
   by all others)
 
-- subnet level: ``.Dhcp6.subnet6[]["reservation-mode"]`` (low priority)
+- subnet level: ``.Dhcp6.subnet6[]["reservations-in-subnet"]`` (low priority)
 
-- shared-network level: ``.Dhcp6["shared-networks"][]["reservation-mode"]``
+- shared-network level: ``.Dhcp6["shared-networks"][]["reservations-out-of-pool"]``
   (high priority)
 
 - shared-network subnet-level:
-  ``.Dhcp6["shared-networks"][].subnet6[]["reservation-mode"]`` (highest
+  ``.Dhcp6["shared-networks"][].subnet6[]["reservations-out-of-pool"]`` (highest
   priority: overrides all others)
 
-To decide which ``"reservation-mode"`` to choose, the
-following decision diagram may be useful:
+To decide which flags to use, the following decision diagram may be useful:
 
 ::
 
@@ -4720,7 +4720,7 @@ following decision diagram may be useful:
             |                |                  |     |
             |             yes|                no|     |
             |                |                  |     V
-            +----------------+                  +--> "all"
+            +----------------+                  +--> "in-subnet"
 
 An example configuration that disables reservations looks as follows:
 
@@ -4736,7 +4736,8 @@ An example configuration that disables reservations looks as follows:
                 "pool": "2001:db8:1::-2001:db8:1::100"
               }
             ],
-            "reservation-mode": "disabled",
+            "reservations-global": false,
+            "reservations-in-subnet": false,
             "subnet": "2001:db8:1::/64"
           }
         ]
@@ -4749,7 +4750,7 @@ An example configuration using global reservations is shown below:
 
     {
       "Dhcp6": {
-        "reservation-mode": "global",
+        "reservations-global": true,
         "reservations": [
           {
             "duid": "00:03:00:01:11:22:33:44:55:66",
@@ -4791,7 +4792,7 @@ The meaning of the reservation flags are:
   the respective reservations from inside the dynamic pools (if any) can be
   dynamically assigned to any client.
 
-The ``disabled`` value from the deprecated ``reservation-mode`` corresponds to:
+The ``disabled`` configuration corresponds to:
 
 .. code-block:: json
 
@@ -4802,7 +4803,7 @@ The ``disabled`` value from the deprecated ``reservation-mode`` corresponds to:
       }
     }
 
-The ``global`` value from the deprecated ``reservation-mode`` corresponds to:
+The ``global``configuration using ``reservations-global`` corresponds to:
 
 .. code-block:: json
 
@@ -4813,7 +4814,7 @@ The ``global`` value from the deprecated ``reservation-mode`` corresponds to:
       }
     }
 
-The ``out-of-pool`` value from the deprecated ``reservation-mode`` corresponds to:
+The ``out-of-pool`` configuration using ``reservations-out-of-pool`` corresponds to:
 
 .. code-block:: json
 
@@ -4825,7 +4826,7 @@ The ``out-of-pool`` value from the deprecated ``reservation-mode`` corresponds t
       }
     }
 
-And the ``all`` value from the deprecated ``reservation-mode`` corresponds to:
+And the ``in-subnet`` configuration using ``reservations-in-subnet`` corresponds to:
 
 .. code-block:: json
 
@@ -4837,7 +4838,7 @@ And the ``all`` value from the deprecated ``reservation-mode`` corresponds to:
       }
     }
 
-To activate both ``global`` and ``all``, the following combination can be used:
+To activate both ``global`` and ``in-subnet``, the following combination can be used:
 
 .. code-block:: json
 
index 383a48af198e979e75d4caf7a63a436d932eb139..b09dc35ad716f2ce5f20cd98e1e9a9f6dbc385e9 100644 (file)
@@ -1031,10 +1031,6 @@ An example response could look as follows:
                    "ip-address": "0.0.0.0"
                },
                "renew-timer": 60,
-               # "reservation-mode": "all",
-               # It is replaced by the "reservations-global",
-               # "reservations-in-subnet", and "reservations-out-of-pool"
-               # parameters.
                # Specify if the server should look up global reservations.
                "reservations-global": false,
                # Specify if the server should look up in-subnet reservations.
index f3a722cba14fbeae7040372558a36c709e6aae5c..c0eaa4598482964dd59ae5597a656b0e4c9f4636 100644 (file)
@@ -1125,62 +1125,6 @@ ControlCharacterFill            [^"\\]|\\["\\/bfnrtu]
     }
 }
 
-\"reservation-mode\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser4Context::DHCP4:
-    case isc::dhcp::Parser4Context::SUBNET4:
-    case isc::dhcp::Parser4Context::SHARED_NETWORK:
-        return isc::dhcp::Dhcp4Parser::make_RESERVATION_MODE(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp4Parser::make_STRING("reservation-mode", driver.loc_);
-    }
-}
-
-\"disabled\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser4Context::RESERVATION_MODE:
-        return isc::dhcp::Dhcp4Parser::make_DISABLED(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp4Parser::make_STRING("disabled", driver.loc_);
-    }
-}
-
-\"off\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser4Context::RESERVATION_MODE:
-        return isc::dhcp::Dhcp4Parser::make_DISABLED(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp4Parser::make_STRING("off", driver.loc_);
-    }
-}
-
-\"out-of-pool\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser4Context::RESERVATION_MODE:
-        return isc::dhcp::Dhcp4Parser::make_OUT_OF_POOL(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp4Parser::make_STRING("out-of-pool", driver.loc_);
-    }
-}
-
-\"global\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser4Context::RESERVATION_MODE:
-        return isc::dhcp::Dhcp4Parser::make_GLOBAL(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp4Parser::make_STRING("global", driver.loc_);
-    }
-}
-
-\"all\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser4Context::RESERVATION_MODE:
-        return isc::dhcp::Dhcp4Parser::make_ALL(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp4Parser::make_STRING("all", driver.loc_);
-    }
-}
-
 \"reservations-global\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser4Context::DHCP4:
index 9cad59405c62f19295f38bfc31e8ebc028bdb03b..a0816348ce84c1e28aa495e5126f308b4a9a8724 100644 (file)
@@ -175,11 +175,6 @@ using namespace std;
   SUBNET "subnet"
   INTERFACE "interface"
   ID "id"
-  RESERVATION_MODE "reservation-mode"
-  DISABLED "disabled"
-  OUT_OF_POOL "out-of-pool"
-  GLOBAL "global"
-  ALL "all"
   RESERVATIONS_GLOBAL "reservations-global"
   RESERVATIONS_IN_SUBNET "reservations-in-subnet"
   RESERVATIONS_OUT_OF_POOL "reservations-out-of-pool"
@@ -299,7 +294,6 @@ using namespace std;
 %type <ElementPtr> outbound_interface_value
 %type <ElementPtr> db_type
 %type <ElementPtr> on_fail_mode
-%type <ElementPtr> hr_mode
 %type <ElementPtr> ncr_protocol_value
 %type <ElementPtr> ddns_replace_client_name_value
 %type <ElementPtr> ddns_conflict_resolution_mode_value
@@ -534,7 +528,6 @@ global_param: valid_lifetime
             | reservations
             | config_control
             | server_tag
-            | reservation_mode
             | reservations_global
             | reservations_in_subnet
             | reservations_out_of_pool
@@ -1599,7 +1592,6 @@ subnet4_param: valid_lifetime
              | client_class
              | require_client_classes
              | reservations
-             | reservation_mode
              | reservations_global
              | reservations_in_subnet
              | reservations_out_of_pool
@@ -1720,20 +1712,6 @@ reservations_out_of_pool: RESERVATIONS_OUT_OF_POOL COLON BOOLEAN {
     ctx.stack_.back()->set("reservations-out-of-pool", b);
 };
 
-reservation_mode: RESERVATION_MODE {
-    ctx.unique("reservation-mode", ctx.loc2pos(@1));
-    ctx.enter(ctx.RESERVATION_MODE);
-} COLON hr_mode {
-    ctx.stack_.back()->set("reservation-mode", $4);
-    ctx.leave();
-};
-
-hr_mode: DISABLED { $$ = ElementPtr(new StringElement("disabled", ctx.loc2pos(@1))); }
-       | OUT_OF_POOL { $$ = ElementPtr(new StringElement("out-of-pool", ctx.loc2pos(@1))); }
-       | GLOBAL { $$ = ElementPtr(new StringElement("global", ctx.loc2pos(@1))); }
-       | ALL { $$ = ElementPtr(new StringElement("all", ctx.loc2pos(@1))); }
-       ;
-
 id: ID COLON INTEGER {
     ctx.unique("id", ctx.loc2pos(@1));
     ElementPtr id(new IntElement($3, ctx.loc2pos(@3)));
@@ -1793,7 +1771,6 @@ shared_network_param: name
                     | server_hostname
                     | boot_file_name
                     | relay
-                    | reservation_mode
                     | reservations_global
                     | reservations_in_subnet
                     | reservations_out_of_pool
index 02741cf0a0ae24e3db50500899350ba5343f7a11..c2e34c50f049882f56b61852e5554248e8cacad3 100644 (file)
@@ -352,10 +352,6 @@ processDhcp4Config(isc::data::ConstElementPtr config_set) {
         // default values and will insert derived values as well.
         mutable_cfg = boost::const_pointer_cast<Element>(config_set);
 
-        // Move from reservation mode to new reservations flags.
-        // @todo add warning
-        BaseNetworkParser::moveReservationMode(mutable_cfg);
-
         // Set all default values if not specified by the user.
         SimpleParser4::setAllDefaults(mutable_cfg);
 
@@ -627,7 +623,6 @@ processDhcp4Config(isc::data::ConstElementPtr config_set) {
                  (config_pair.first == "server-hostname") ||
                  (config_pair.first == "boot-file-name") ||
                  (config_pair.first == "server-tag") ||
-                 (config_pair.first == "reservation-mode") ||
                  (config_pair.first == "reservations-global") ||
                  (config_pair.first == "reservations-in-subnet") ||
                  (config_pair.first == "reservations-out-of-pool") ||
index 3974ce659db640585e737f632cbdc4a355492f14..52bfe2be88251e1a213fc4c4d3c7dbf991da9951 100644 (file)
@@ -175,8 +175,6 @@ Parser4Context::contextName() {
         return ("hooks-libraries");
     case SUBNET4:
         return ("subnet4");
-    case RESERVATION_MODE:
-        return ("reservation-mode");
     case OPTION_DEF:
         return ("option-def");
     case OPTION_DATA:
index 404e586e1e020a78fd4f31bc5921a6a13834a9df..070b731517bc87014238f609309a30411a882d31 100644 (file)
@@ -273,9 +273,6 @@ public:
         /// Used while parsing shared-networks structures.
         SHARED_NETWORK,
 
-        /// Used while parsing Dhcp4/reservation-mode.
-        RESERVATION_MODE,
-
         /// Used while parsing Dhcp4/option-def structures.
         OPTION_DEF,
 
index ec32d122cce5880fd798c168affdeef5bfc6443b..9d801374db002c29ef845df32413d1f55a1cfeea 100644 (file)
@@ -789,8 +789,7 @@ TEST(ParserTest, mapEntries) {
     loadFile(sample_dir + "reservations.json", sample_json);
     loadFile(sample_dir + "all-keys-netconf.json", sample_json);
     KeywordSet sample_keys = {
-        "hosts-database",
-        "reservation-mode"
+        "hosts-database"
     };
     // Recursively extract keywords.
     static void (*extract)(ConstElementPtr, KeywordSet&) =
index db827af2a4aa98b0270aef7bab353f84c85f1fee..8ff67365713814d1e88e525396df601c863b4f05 100644 (file)
@@ -1403,62 +1403,6 @@ ControlCharacterFill            [^"\\]|\\["\\/bfnrtu]
     }
 }
 
-\"reservation-mode\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser6Context::DHCP6:
-    case isc::dhcp::Parser6Context::SUBNET6:
-    case isc::dhcp::Parser6Context::SHARED_NETWORK:
-        return isc::dhcp::Dhcp6Parser::make_RESERVATION_MODE(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp6Parser::make_STRING("reservation-mode", driver.loc_);
-    }
-}
-
-\"disabled\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser6Context::RESERVATION_MODE:
-        return isc::dhcp::Dhcp6Parser::make_DISABLED(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp6Parser::make_STRING("disabled", driver.loc_);
-    }
-}
-
-\"off\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser6Context::RESERVATION_MODE:
-        return isc::dhcp::Dhcp6Parser::make_DISABLED(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp6Parser::make_STRING("off", driver.loc_);
-    }
-}
-
-\"out-of-pool\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser6Context::RESERVATION_MODE:
-        return isc::dhcp::Dhcp6Parser::make_OUT_OF_POOL(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp6Parser::make_STRING("out-of-pool", driver.loc_);
-    }
-}
-
-\"global\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser6Context::RESERVATION_MODE:
-        return isc::dhcp::Dhcp6Parser::make_GLOBAL(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp6Parser::make_STRING("global", driver.loc_);
-    }
-}
-
-\"all\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser6Context::RESERVATION_MODE:
-        return isc::dhcp::Dhcp6Parser::make_ALL(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp6Parser::make_STRING("all", driver.loc_);
-    }
-}
-
 \"reservations-global\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser6Context::DHCP6:
index bdf9d5aeeca6f8afa77d6f4b86a73199424aed30..e4ccde453e5e8d346fa7574f754e191a28707881 100644 (file)
@@ -166,11 +166,6 @@ using namespace std;
   INTERFACE_ID "interface-id"
   ID "id"
   RAPID_COMMIT "rapid-commit"
-  RESERVATION_MODE "reservation-mode"
-  DISABLED "disabled"
-  OUT_OF_POOL "out-of-pool"
-  GLOBAL "global"
-  ALL "all"
   RESERVATIONS_GLOBAL "reservations-global"
   RESERVATIONS_IN_SUBNET "reservations-in-subnet"
   RESERVATIONS_OUT_OF_POOL "reservations-out-of-pool"
@@ -300,7 +295,6 @@ using namespace std;
 %type <ElementPtr> map_value
 %type <ElementPtr> db_type
 %type <ElementPtr> on_fail_mode
-%type <ElementPtr> hr_mode
 %type <ElementPtr> duid_type
 %type <ElementPtr> ncr_protocol_value
 %type <ElementPtr> ddns_replace_client_name_value
@@ -538,7 +532,6 @@ global_param: data_directory
             | reservations
             | config_control
             | server_tag
-            | reservation_mode
             | reservations_global
             | reservations_in_subnet
             | reservations_out_of_pool
@@ -1615,7 +1608,6 @@ subnet6_param: preferred_lifetime
              | client_class
              | require_client_classes
              | reservations
-             | reservation_mode
              | reservations_global
              | reservations_in_subnet
              | reservations_out_of_pool
@@ -1710,20 +1702,6 @@ reservations_out_of_pool: RESERVATIONS_OUT_OF_POOL COLON BOOLEAN {
     ctx.stack_.back()->set("reservations-out-of-pool", b);
 };
 
-reservation_mode: RESERVATION_MODE {
-    ctx.unique("reservation-mode", ctx.loc2pos(@1));
-    ctx.enter(ctx.RESERVATION_MODE);
-} COLON hr_mode {
-    ctx.stack_.back()->set("reservation-mode", $4);
-    ctx.leave();
-};
-
-hr_mode: DISABLED { $$ = ElementPtr(new StringElement("disabled", ctx.loc2pos(@1))); }
-       | OUT_OF_POOL { $$ = ElementPtr(new StringElement("out-of-pool", ctx.loc2pos(@1))); }
-       | GLOBAL { $$ = ElementPtr(new StringElement("global", ctx.loc2pos(@1))); }
-       | ALL { $$ = ElementPtr(new StringElement("all", ctx.loc2pos(@1))); }
-       ;
-
 id: ID COLON INTEGER {
     ctx.unique("id", ctx.loc2pos(@1));
     ElementPtr id(new IntElement($3, ctx.loc2pos(@3)));
@@ -1785,7 +1763,6 @@ shared_network_param: name
                     | rebind_timer
                     | option_data_list
                     | relay
-                    | reservation_mode
                     | reservations_global
                     | reservations_in_subnet
                     | reservations_out_of_pool
index cd7fa99e5dec5ed32b22952156a9bd9e3538b37b..671d69a802ebbb3180e16894fa2c5a40b14abe73 100644 (file)
@@ -454,10 +454,6 @@ processDhcp6Config(isc::data::ConstElementPtr config_set) {
         // default values and will insert derived values as well.
         mutable_cfg = boost::const_pointer_cast<Element>(config_set);
 
-        // Move from reservation mode to new reservations flags.
-        // @todo add warning
-        BaseNetworkParser::moveReservationMode(mutable_cfg);
-
         // Set all default values if not specified by the user.
         SimpleParser6::setAllDefaults(mutable_cfg);
 
@@ -760,7 +756,6 @@ processDhcp6Config(isc::data::ConstElementPtr config_set) {
                  (config_pair.first == "decline-probation-period") ||
                  (config_pair.first == "dhcp4o6-port") ||
                  (config_pair.first == "server-tag") ||
-                 (config_pair.first == "reservation-mode") ||
                  (config_pair.first == "reservations-global") ||
                  (config_pair.first == "reservations-in-subnet") ||
                  (config_pair.first == "reservations-out-of-pool") ||
index b2c9c072f5fdf6bb175f42c485be99963296e000..649e1e37c04ac19d5004290f6d20575cbddc95be 100644 (file)
@@ -172,8 +172,6 @@ Parser6Context::contextName() {
         return ("hooks-libraries");
     case SUBNET6:
         return ("subnet6");
-    case RESERVATION_MODE:
-        return ("reservation-mode");
     case OPTION_DEF:
         return ("option-def");
     case OPTION_DATA:
index ff6e9d963560d661167d3fae7634e443be66b584..8d20453a65b86d41f154dd67eb0a77199ad92f73 100644 (file)
@@ -273,9 +273,6 @@ public:
         /// Used while parsing shared-networks structures.
         SHARED_NETWORK,
 
-        /// Used while parsing Dhcp6/reservation-mode.
-        RESERVATION_MODE,
-
         /// Used while parsing Dhcp6/option-def structures.
         OPTION_DEF,
 
index a0a110be6a52e252d7bcd7d7338ae4efdb640a27..1ba44e123606678016e821348e914fa9a102be62 100644 (file)
@@ -780,8 +780,7 @@ TEST(ParserTest, mapEntries) {
     loadFile(sample_dir + "reservations.json", sample_json);
     loadFile(sample_dir + "all-keys-netconf.json", sample_json);
     KeywordSet sample_keys = {
-        "hosts-database",
-        "reservation-mode"
+        "hosts-database"
     };
     // Recursively extract keywords.
     static void (*extract)(ConstElementPtr, KeywordSet&) =
index c5f23464438ad989f09f7a7ff175fa44d5121457..7c0201bf7f79351acec6b98b04039505f7ba5103 100644 (file)
@@ -24,7 +24,6 @@ CfgGlobals::nameToIndex = {
     { "dhcp4o6-port", DHCP4O6_PORT },
     { "comment", COMMENT },
     { "server-tag", SERVER_TAG },
-    { "reservation-mode", RESERVATION_MODE },
     { "reservations-global", RESERVATIONS_GLOBAL },
     { "reservations-in-subnet", RESERVATIONS_IN_SUBNET },
     { "reservations-out-of-pool", RESERVATIONS_OUT_OF_POOL },
index 06e3cde10d295e98ba5a3427806bc8a3564375ab..bb28d52189effa51a0dead1d1584d24a28fb27df 100644 (file)
@@ -47,7 +47,6 @@ public:
         DHCP4O6_PORT,
         COMMENT,
         SERVER_TAG,
-        RESERVATION_MODE,
         RESERVATIONS_GLOBAL,
         RESERVATIONS_IN_SUBNET,
         RESERVATIONS_OUT_OF_POOL,
index 6f0ab84efce16a738922cd6e16f504703012ca6d..8d73b7aed9c9ab90897ffe3627332dbdf84fed0c 100644 (file)
@@ -17,77 +17,6 @@ using namespace isc::util;
 namespace isc {
 namespace dhcp {
 
-void
-BaseNetworkParser::moveReservationMode(ElementPtr config) {
-    if (!config->contains("reservation-mode")) {
-        return;
-    }
-    if (config->contains("reservations-global") ||
-        config->contains("reservations-in-subnet") ||
-        config->contains("reservations-out-of-pool")) {
-        isc_throw(DhcpConfigError, "invalid use of both 'reservation-mode'"
-                  " and one of 'reservations-global', 'reservations-in-subnet'"
-                  " or 'reservations-out-of-pool' parameters");
-    }
-    std::string hr_mode = getString(config, "reservation-mode");
-    if ((hr_mode == "disabled") || (hr_mode == "off")) {
-        config->set("reservations-global", Element::create(false));
-        config->set("reservations-in-subnet", Element::create(false));
-    } else if (hr_mode == "out-of-pool") {
-        config->set("reservations-global", Element::create(false));
-        config->set("reservations-in-subnet", Element::create(true));
-        config->set("reservations-out-of-pool", Element::create(true));
-    } else if (hr_mode == "global") {
-        config->set("reservations-global", Element::create(true));
-        config->set("reservations-in-subnet", Element::create(false));
-    } else if (hr_mode == "all") {
-        config->set("reservations-global", Element::create(false));
-        config->set("reservations-in-subnet", Element::create(true));
-        config->set("reservations-out-of-pool", Element::create(false));
-    } else {
-        isc_throw(DhcpConfigError, "invalid reservation-mode parameter: '"
-                  << hr_mode << "' ("
-                  << getPosition("reservation-mode", config) << ")");
-    }
-    config->remove("reservation-mode");
-}
-
-void
-BaseNetworkParser::moveReservationMode(CfgGlobalsPtr config) {
-    if (!config->get(CfgGlobals::RESERVATION_MODE)) {
-        return;
-    }
-    if (config->get(CfgGlobals::RESERVATIONS_GLOBAL) ||
-        config->get(CfgGlobals::RESERVATIONS_IN_SUBNET) ||
-        config->get(CfgGlobals::RESERVATIONS_OUT_OF_POOL)) {
-        isc_throw(DhcpConfigError, "invalid use of both 'reservation-mode'"
-                  " and one of 'reservations-global', 'reservations-in-subnet'"
-                  " or 'reservations-out-of-pool' parameters");
-    }
-    std::string hr_mode = config->get(CfgGlobals::RESERVATION_MODE)->stringValue();
-    if ((hr_mode == "disabled") || (hr_mode == "off")) {
-        config->set(CfgGlobals::RESERVATIONS_GLOBAL, Element::create(false));
-        config->set(CfgGlobals::RESERVATIONS_IN_SUBNET, Element::create(false));
-    } else if (hr_mode == "out-of-pool") {
-        config->set(CfgGlobals::RESERVATIONS_GLOBAL, Element::create(false));
-        config->set(CfgGlobals::RESERVATIONS_IN_SUBNET, Element::create(true));
-        config->set(CfgGlobals::RESERVATIONS_OUT_OF_POOL, Element::create(true));
-    } else if (hr_mode == "global") {
-        config->set(CfgGlobals::RESERVATIONS_GLOBAL, Element::create(true));
-        config->set(CfgGlobals::RESERVATIONS_IN_SUBNET, Element::create(false));
-    } else if (hr_mode == "all") {
-        config->set(CfgGlobals::RESERVATIONS_GLOBAL, Element::create(false));
-        config->set(CfgGlobals::RESERVATIONS_IN_SUBNET, Element::create(true));
-        config->set("reservations-out-of-pool", Element::create(false));
-    } else {
-        isc_throw(DhcpConfigError, "invalid reservation-mode parameter: '"
-                  << hr_mode << "' ("
-                  << config->get(CfgGlobals::RESERVATION_MODE)->getPosition()
-                  << ")");
-    }
-    config->set(CfgGlobals::RESERVATION_MODE, ConstElementPtr());
-}
-
 void
 BaseNetworkParser::parseCommon(const ConstElementPtr& network_data,
                                NetworkPtr& network) {
index f0714c5de45b026a73b08bbf5fad5d64c79b6342..fe903d36a6b92ca7a79bbd783fc987ab46cbb6bb 100644 (file)
@@ -18,24 +18,6 @@ namespace dhcp {
 /// @brief Common configuration parser for shared networks
 /// and subnets.
 class BaseNetworkParser : public data::SimpleParser {
-public:
-
-    /// @brief Moves deprecated reservation-mode parameter to
-    /// new reservations flags.
-    ///
-    /// @param config [in/out] configuration to alter.
-    /// @throw DhcpConfigError on error e.g. when both reservation-mode
-    /// and a flag are specified.
-    static void moveReservationMode(isc::data::ElementPtr config);
-
-    /// @brief Moves deprecated reservation-mode parameter to
-    /// new reservations flags.
-    ///
-    /// @param config [in/out] global parameters to alter.
-    /// @throw DhcpConfigError on error e.g. when both reservation-mode
-    /// and a flag are specified.
-    static void moveReservationMode(CfgGlobalsPtr config);
-
 protected:
 
     /// @brief Parses common parameters
index 724d2381cbdbd94d680f71dee122f918410bb9fc..76b7c7f661bee3ba64956d7608b6bcf2fd21bd11 100644 (file)
@@ -740,11 +740,8 @@ Subnet4ConfigParser::initSubnet(data::ConstElementPtr params,
                                    subnet_id);
     subnet_ = subnet4;
 
-    // Move from reservation mode to new reservations flags.
     ElementPtr mutable_params;
     mutable_params = boost::const_pointer_cast<Element>(params);
-    // @todo add warning
-    BaseNetworkParser::moveReservationMode(mutable_params);
 
     // Parse parameters common to all Network derivations.
     NetworkPtr network = boost::dynamic_pointer_cast<Network>(subnet4);
@@ -1280,11 +1277,8 @@ Subnet6ConfigParser::initSubnet(data::ConstElementPtr params,
                                    subnet_id);
     subnet_ = subnet6;
 
-    // Move from reservation mode to new reservations flags.
     ElementPtr mutable_params;
     mutable_params = boost::const_pointer_cast<Element>(params);
-    // @todo add warning
-    BaseNetworkParser::moveReservationMode(mutable_params);
 
     // Parse parameters common to all Network derivations.
     NetworkPtr network = boost::dynamic_pointer_cast<Network>(subnet_);
index 3cf689c6d6583860cddc8cb8e0c990498aeec580..95e444339d3bbb34a8c26e0dd1fe6004f4ecf7a1 100644 (file)
@@ -45,10 +45,8 @@ SharedNetwork4Parser::parse(const data::ConstElementPtr& shared_network_data,
         std::string name = getString(shared_network_data, "name");
         shared_network.reset(new SharedNetwork4(name));
 
-        // Move from reservation mode to new reservations flags.
         ElementPtr mutable_params;
         mutable_params = boost::const_pointer_cast<Element>(shared_network_data);
-        BaseNetworkParser::moveReservationMode(mutable_params);
 
         // Parse parameters common to all Network derivations.
         NetworkPtr network = boost::dynamic_pointer_cast<Network>(shared_network);
@@ -253,10 +251,8 @@ SharedNetwork6Parser::parse(const data::ConstElementPtr& shared_network_data,
         std::string name = getString(shared_network_data, "name");
         shared_network.reset(new SharedNetwork6(name));
 
-        // Move from reservation mode to new reservations flags.
         ElementPtr mutable_params;
         mutable_params = boost::const_pointer_cast<Element>(shared_network_data);
-        BaseNetworkParser::moveReservationMode(mutable_params);
 
         // Parse parameters common to all Network derivations.
         NetworkPtr network = boost::dynamic_pointer_cast<Network>(shared_network);
index 6c979bea335fc1bb021fe8a21046cc44a1fa6763..abc4d96fa3538aefb2330da8ff0dae028a22ee42 100644 (file)
@@ -69,7 +69,6 @@ const SimpleKeywords SimpleParser4::GLOBAL4_PARAMETERS = {
     { "reservations",                     Element::list },
     { "config-control",                   Element::map },
     { "server-tag",                       Element::string },
-    { "reservation-mode",                 Element::string },
     { "reservations-global",              Element::boolean },
     { "reservations-in-subnet",           Element::boolean },
     { "reservations-out-of-pool",         Element::boolean },
@@ -225,7 +224,6 @@ const SimpleKeywords SimpleParser4::SUBNET4_PARAMETERS = {
     { "client-class",                   Element::string },
     { "require-client-classes",         Element::list },
     { "reservations",                   Element::list },
-    { "reservation-mode",               Element::string },
     { "reservations-global",            Element::boolean },
     { "reservations-in-subnet",         Element::boolean },
     { "reservations-out-of-pool",       Element::boolean },
@@ -267,8 +265,8 @@ const SimpleKeywords SimpleParser4::SUBNET4_PARAMETERS = {
 /// Note: When updating this array, please also update SHARED_SUBNET4_DEFAULTS
 /// below. In most cases, those two should be kept in sync, except cases
 /// where a parameter can be derived from shared-networks, but is not
-/// defined on global level. Currently there are two such parameters:
-/// interface and reservation-mode
+/// defined on global level. Currently there in only one such parameter:
+/// interface.
 const SimpleDefaults SimpleParser4::SUBNET4_DEFAULTS = {
     { "interface",        Element::string,  "" },
     { "client-class",     Element::string,  "" },
@@ -280,9 +278,9 @@ const SimpleDefaults SimpleParser4::SUBNET4_DEFAULTS = {
 /// @brief This table defines default values for each IPv4 subnet that is
 ///        part of a shared network
 ///
-/// This is mostly the same as @ref SUBNET4_DEFAULTS, except two parameters
+/// This is mostly the same as @ref SUBNET4_DEFAULTS, except one parameter
 /// that can be derived from shared-network, but cannot from global scope.
-/// Those are: interface and reservation-mode.
+/// This is: interface.
 const SimpleDefaults SimpleParser4::SHARED_SUBNET4_DEFAULTS = {
     { "4o6-interface",    Element::string,  "" },
     { "4o6-interface-id", Element::string,  "" },
@@ -355,7 +353,6 @@ const SimpleKeywords SimpleParser4::SHARED_NETWORK4_PARAMETERS = {
     { "server-hostname",                Element::string },
     { "boot-file-name",                 Element::string },
     { "relay",                          Element::map },
-    { "reservation-mode",               Element::string },
     { "reservations-global",            Element::boolean },
     { "reservations-in-subnet",         Element::boolean },
     { "reservations-out-of-pool",       Element::boolean },
index f31c5d53c844a9c5b2b493da86c35bec1b96c7b4..fd2eca8dee431324da9b7f03e682b011c70133e3 100644 (file)
@@ -69,7 +69,6 @@ const SimpleKeywords SimpleParser6::GLOBAL6_PARAMETERS = {
     { "reservations",                     Element::list },
     { "config-control",                   Element::map },
     { "server-tag",                       Element::string },
-    { "reservation-mode",                 Element::string },
     { "reservations-global",              Element::boolean },
     { "reservations-in-subnet",           Element::boolean },
     { "reservations-out-of-pool",         Element::boolean },
@@ -225,7 +224,6 @@ const SimpleKeywords SimpleParser6::SUBNET6_PARAMETERS = {
     { "client-class",                   Element::string },
     { "require-client-classes",         Element::list },
     { "reservations",                   Element::list },
-    { "reservation-mode",               Element::string },
     { "reservations-global",            Element::boolean },
     { "reservations-in-subnet",         Element::boolean },
     { "reservations-out-of-pool",       Element::boolean },
@@ -362,7 +360,6 @@ const SimpleKeywords SimpleParser6::SHARED_NETWORK6_PARAMETERS = {
     { "rebind-timer",                   Element::integer },
     { "option-data",                    Element::list },
     { "relay",                          Element::map },
-    { "reservation-mode",               Element::string },
     { "reservations-global",            Element::boolean },
     { "reservations-in-subnet",         Element::boolean },
     { "reservations-out-of-pool",       Element::boolean },
index 3979dc467be2f0efab89c0df6d0905e6dbf4bd3f..0227f64b4bb6b791ac72ad3bdd44041e55be29ae 100644 (file)
@@ -246,22 +246,12 @@ SrvConfig::merge6(SrvConfig& other) {
 void
 SrvConfig::mergeGlobals(SrvConfig& other) {
     auto config_set = getConfiguredGlobals();
-    // If the deprecated reservation-mode is found in database, overwrite other
-    // reservation flags so there is no conflict when merging to new flags.
-    if (other.getConfiguredGlobal(CfgGlobals::RESERVATION_MODE)) {
-        config_set->set(CfgGlobals::RESERVATIONS_GLOBAL, ConstElementPtr());
-        config_set->set(CfgGlobals::RESERVATIONS_IN_SUBNET, ConstElementPtr());
-        config_set->set(CfgGlobals::RESERVATIONS_OUT_OF_POOL, ConstElementPtr());
-    }
     // Iterate over the "other" globals, adding/overwriting them into
     // this config's list of globals.
     for (auto const& other_global : other.getConfiguredGlobals()->valuesMap()) {
         addConfiguredGlobal(other_global.first, other_global.second);
     }
 
-    // Merge the reservation-mode to new reservation flags.
-    BaseNetworkParser::moveReservationMode(config_set);
-
     // A handful of values are stored as members in SrvConfig. So we'll
     // iterate over the merged globals, setting appropriate members.
     for (auto const& merged_global : getConfiguredGlobals()->valuesMap()) {
index 036513ff2e5443c4aa1d6aa684befd76c2e07646..341afa57a7b3b9e40fe931d9c716499111e9c559 100644 (file)
@@ -644,155 +644,6 @@ TEST_F(NetworkTest, getSiaddrNeverFail) {
     EXPECT_NO_THROW(net4_child->getSiaddr());
 }
 
-/// @brief Test fixture class for testing @c moveReservationMode.
-class NetworkReservationTest : public ::testing::Test {
-public:
-
-    /// @brief Move test error case.
-    ///
-    /// Error cases of @ref BaseNetworkParser::moveReservationMode.
-    ///
-    /// @param config String with the config to test.
-    /// @param expected String with the expected error message.
-    void TestError(const std::string& config, const std::string& expected) {
-        ElementPtr cfg;
-        ASSERT_NO_THROW(cfg = Element::fromJSON(config))
-            << "bad config, test broken";
-
-        ElementPtr copy = isc::data::copy(cfg);
-
-        EXPECT_THROW_MSG(BaseNetworkParser::moveReservationMode(cfg),
-                         DhcpConfigError, expected);
-
-        ASSERT_TRUE(copy->equals(*cfg));
-    }
-
-    /// @brief Move test case.
-    ///
-    /// Test cases of @ref BaseNetworkParser::moveReservationMode.
-    ///
-    /// @param config String with the config to test.
-    /// @param expected String with the config after move.
-    void TestMove(const std::string& config, const std::string& expected) {
-        ElementPtr cfg;
-        ASSERT_NO_THROW(cfg = Element::fromJSON(config))
-            << "bad config, test broken";
-
-        EXPECT_NO_THROW(BaseNetworkParser::moveReservationMode(cfg));
-
-        EXPECT_EQ(expected, cfg->str());
-    }
-};
-
-/// @brief Test @ref BaseNetworkParser::moveReservationMode error cases.
-TEST_F(NetworkReservationTest, errors) {
-    // Conflicts.
-    std::string config = "{\n"
-        "\"reservation-mode\": \"all\",\n"
-        "\"reservations-global\": true\n"
-        "}";
-    std::string expected = "invalid use of both 'reservation-mode'"
-        " and one of 'reservations-global', 'reservations-in-subnet'"
-        " or 'reservations-out-of-pool' parameters";
-    TestError(config, expected);
-
-    config = "{\n"
-        "\"reservation-mode\": \"all\",\n"
-        "\"reservations-in-subnet\": true\n"
-        "}";
-    TestError(config, expected);
-
-    config = "{\n"
-        "\"reservation-mode\": \"all\",\n"
-        "\"reservations-out-of-pool\": false\n"
-        "}";
-    TestError(config, expected);
-
-    // Unknown mode.
-    config = "{\n"
-        "\"reservation-mode\": \"foo\"\n"
-        "}";
-    expected = "invalid reservation-mode parameter: 'foo' (<string>:2:21)";
-    TestError(config, expected);
-}
-
-/// @brief Test @ref BaseNetworkParser::moveReservationMode.
-TEST_F(NetworkReservationTest, move) {
-    // No-ops.
-    std::string config = "{\n"
-        "}";
-    std::string expected = "{ "
-        " }";
-    TestMove(config, expected);
-
-    config = "{\n"
-        "\"reservations-global\": true\n"
-        "}";
-    expected = "{"
-        " \"reservations-global\": true"
-        " }";
-    TestMove(config, expected);
-
-    // Disabled.
-    config = "{\n"
-        "\"reservation-mode\": \"disabled\"\n"
-        "}";
-    expected = "{"
-        " \"reservations-global\": false,"
-        " \"reservations-in-subnet\": false"
-        " }";
-    TestMove(config, expected);
-
-    config = "{\n"
-        "\"reservation-mode\": \"off\"\n"
-        "}";
-    TestMove(config, expected);
-
-    // Out-of-pool.
-    config = "{\n"
-        "\"reservation-mode\": \"out-of-pool\"\n"
-        "}";
-    expected = "{"
-        " \"reservations-global\": false,"
-        " \"reservations-in-subnet\": true,"
-        " \"reservations-out-of-pool\": true"
-        " }";
-    TestMove(config, expected);
-
-    // Global.
-    config = "{\n"
-        "\"reservation-mode\": \"global\"\n"
-        "}";
-    expected = "{"
-        " \"reservations-global\": true,"
-        " \"reservations-in-subnet\": false"
-        " }";
-    TestMove(config, expected);
-
-    // All.
-    config = "{\n"
-        "\"reservation-mode\": \"all\"\n"
-        "}";
-    expected = "{"
-        " \"reservations-global\": false,"
-        " \"reservations-in-subnet\": true,"
-        " \"reservations-out-of-pool\": false"
-        " }";
-    TestMove(config, expected);
-
-    config = "{\n"
-        "\"foobar\": 1234,\n"
-        "\"reservation-mode\": \"all\"\n"
-        "}";
-    expected = "{"
-        " \"foobar\": 1234,"
-        " \"reservations-global\": false,"
-        " \"reservations-in-subnet\": true,"
-        " \"reservations-out-of-pool\": false"
-        " }";
-    TestMove(config, expected);
-}
-
 // This test verifies that the inheritance is supported for triplets.
 // Note that triplets have no comparison operator.
 TEST_F(NetworkTest, inheritanceTriplet) {