]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Finishing merge of trac4501 (misc unit tests)
authorFrancis Dupont <fdupont@isc.org>
Tue, 18 Apr 2017 06:00:00 +0000 (08:00 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 18 Apr 2017 06:00:00 +0000 (08:00 +0200)
1  2 
doc/examples/kea6/multiple-options.json
doc/examples/kea6/reservations.json
src/bin/d2/tests/d2_cfg_mgr_unittests.cc
src/bin/dhcp4/tests/config_parser_unittest.cc
src/bin/dhcp6/tests/config_parser_unittest.cc
src/bin/lfc/lfc_controller.cc
src/bin/lfc/tests/lfc_controller_unittests.cc
src/lib/dhcpsrv/tests/host_mgr_unittest.cc
src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
src/lib/hooks/tests/library_manager_unittest.cc
src/lib/util/tests/process_spawn_unittest.cc

index 6080ef15e44b6bc3bd733fab5a51348c54de60eb,45b249dd7e715f444680597bf46aa4fea9ebd60c..e7932b80139d3eb57f65b0066c2e4dd61eaaf14c
          {
              "code": 12,
              "data": "2001:db8:1:0:ff00::1"
-           // which can be defined using only strings as the CSV
-           // processing computes lengths.
 +        },
 +        {
 +            // String options that have a comma in their values need to have
 +            // it escaped (i.e. each comma is predeced by two backslashes).
 +            // That's because commas are reserved for separating fields in
 +            // compound options. At the same time, we need to be conformant
 +            // with JSON spec, that does not allow "\,". Therefore the
 +            // slightly uncommon double backslashes notation is needed.
 +            "name": "new-posix-timezone",
 +            "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
 +
 +            // Legal JSON escapes are \ followed by "\/bfnrt character
 +            // or \u followed by 4 hexa-decimal numbers (currently Kea
 +            // supports only \u0000 to \u00ff code points).
 +            // CSV processing translates '\\' into '\' and '\,' into ','
 +            // only so for instance '\x' is translated into '\x'. But
 +            // as it works on a JSON string value each of these '\'
 +            // characters must be doubled on JSON input.
 +        },
 +        {
 +            // A few options are encoded in (length, string) tuples
++            // which can be defined using only strings as the CSV
++            // processing computes lengths.
 +            "name": "bootfile-param",
 +            "data": "root=/dev/sda2, quiet, splash"
          }
        ],
        "pools": [
index 73fbc4b2e25c63423db16cb846ccd702e4f84acd,5f90a5a2d3d4a761e206ad9061b8e73d6dde81a9..0b30d637ae061bca3876c97e373d98e16711b80c
      {
        "subnet": "2001:db8:1::/48",
  
 -      "pools": [ { "pool": "2001:db8:1::/80" } ],
 +      "pools": [ { "pool": "2001:db8:1::/120" } ],
  
        "pd-pools": [
-         {
-             "prefix": "2001:db8:1:8000::",
-             "prefix-len": 56,
-             "delegated-len": 64
-         }
+           {
+               "prefix": "2001:db8:1:8000::",
+               "prefix-len": 56,
+               "delegated-len": 64
+           }
        ],
        "interface": "ethX",
  
 -# Host reservations. Define several reservations, note that
 -# they are all within the range of the pool of the dynamically
 -# allocated address. The server will exclude the addresses from this
 -# pool and only assign them to the client which has a reservation for
 -# them.
 +      "reservation-mode": "out-of-pool",
 +
 +// Host reservations. Define several reservations, note that
 +// they are all within the range of the pool of the dynamically
 +// allocated address. The server will exclude the addresses from this
 +// pool and only assign them to the client which has a reservation for
 +// them.
        "reservations": [
 -# This is a simple host reservation. The host with DUID matching
 -# the specified value will get an address of 2001:db8:1::100.
 +// This is a simple host reservation. The host with DUID matching
 +// the specified value will get an address of 2001:db8:1::100.
-         {
-             "duid": "01:02:03:04:05:0A:0B:0C:0D:0E",
-             "ip-addresses": [ "2001:db8:1::100" ]
-         },
+           {
+               "duid": "01:02:03:04:05:0A:0B:0C:0D:0E",
+               "ip-addresses": [ "2001:db8:1::100" ]
+           },
 -# This is similar to the previous one, but this time the reservation is done
 -# based on hardware/MAC address. The server will do its best to extract
 -# the hardware/MAC address from received packets (see 'mac-sources' directive
 -# for details). This particular reservation also specifies two extra options
 -# to be available for this client. If there are options with the same code
 -# specified in a global, subnet or class scope, the values defined at host level
 -# take precedence.
 +// This is similar to the previous one, but this time the reservation is done
 +// based on hardware/MAC address. The server will do its best to extract
 +// the hardware/MAC address from received packets (see 'mac-sources' directive
 +// for details). This particular reservation also specifies two extra options
 +// to be available for this client. If there are options with the same code
 +// specified in a global, subnet or class scope, the values defined at host level
 +// take precedence.
-         {
-             "hw-address": "00:01:02:03:04:05",
-             "ip-addresses": [ "2001:db8:1::101" ],
-             "option-data": [
-             {
-                 "name": "dns-servers",
-                 "data": "3000:1::234"
-             },
-             {
-                 "name": "nis-servers",
-                 "data": "3000:1::234"
-             }],
-             "client-classes": [ "special_snowflake", "office" ]
-         },
+           {
+               "hw-address": "00:01:02:03:04:05",
+               "ip-addresses": [ "2001:db8:1::101" ],
+               "option-data": [
+               {
+                   "name": "dns-servers",
+                   "data": "3000:1::234"
+               },
+               {
+                   "name": "nis-servers",
+                   "data": "3000:1::234"
+               }],
+               "client-classes": [ "special_snowflake", "office" ]
+           },
 -# This is a bit more advanced reservation. The client with the specified
 -# DUID will get a reserved address, a reserved prefix and a hostname.
 -# This reservation is for an address that it not within the dynamic pool.
 -# Finally, this reservation features vendor specific options for CableLabs,
 -# which happen to use enterprise-id 4491. Those particular values will
 -# be returned only to the client that has a DUID matching this reservation.
 +// This is a bit more advanced reservation. The client with the specified
 +// DUID will get a reserved address, a reserved prefix and a hostname.
 +// This reservation is for an address that it not within the dynamic pool.
 +// Finally, this reservation features vendor specific options for CableLabs,
 +// which happen to use enterprise-id 4491. Those particular values will
 +// be returned only to the client that has a DUID matching this reservation.
-         {
-             "duid": "01:02:03:04:05:06:07:08:09:0A",
-             "ip-addresses": [ "2001:db8:1:cafe::1" ],
-             "prefixes": [ "2001:db8:2:abcd::/64" ],
-             "hostname": "foo.example.com",
-             "option-data": [ {
-                 "name": "vendor-opts",
-                 "data": "4491"
-             },
-             {
-                 "name": "tftp-servers",
-                 "space": "vendor-4491",
-                 "data": "3000:1::234"
-             } ]
+           {
+               "duid": "01:02:03:04:05:06:07:08:09:0A",
+               "ip-addresses": [ "2001:db8:1:cafe::1" ],
+               "prefixes": [ "2001:db8:2:abcd::/64" ],
+               "hostname": "foo.example.com",
+               "option-data": [ {
+                   "name": "vendor-opts",
+                   "data": "4491"
+               },
+               {
+                   "name": "tftp-servers",
+                   "space": "vendor-4491",
+                   "data": "3000:1::234"
+               } ]
  
-         },
 -          }
++          },
 +// This reservation is using flexible identifier. Instead of relying on specific
 +// field, sysadmin can define an expression similar to what is used for client
 +// classification, e.g. substring(relay[0].option[17],0,6). Then, based on the
 +// value of that expression for incoming packet, the reservation is matched.
 +// Expression can be specified either as hex or plain text using single
 +// quotes.
 +// Note: flexible identifier requires flex_id hook library to be loaded to work.
-        {
-            "flex-id": "'somevalue'",
-            "ip-addresses": [ "2001:db8:1:cafe::2" ]
-        }
++         {
++             "flex-id": "'somevalue'",
++             "ip-addresses": [ "2001:db8:1:cafe::2" ]
++         }
 +
        ]
      }
    ]
  },
  
 -# The following configures logging. It assumes that messages with at least
 -# informational level (info, warn, error and fatal) should be logged to stdout.
 +// The following configures logging. It assumes that messages with at least
 +// informational level (info, warn, error and fatal) should be logged to stdout.
  "Logging": {
      "loggers": [
-       {
-           "name": "kea-dhcp6",
-           "output_options": [
-               {
-                   "output": "stdout"
-               }
-           ],
-           "debuglevel": 0,
-           "severity": "INFO"
-       }
+         {
+             "name": "kea-dhcp6",
+             "output_options": [
+                 {
+                     "output": "stdout"
+                 }
+             ],
+             "debuglevel": 0,
+             "severity": "INFO"
+         }
      ]
  }
  
Simple merge