Browse Source

[master] documentation and examples updated for flex-id hook

Wlodek Wencel 8 years ago
parent
commit
008208dc26
3 changed files with 34 additions and 9 deletions
  1. 5 3
      doc/examples/kea4/reservations.json
  2. 4 3
      doc/examples/kea6/reservations.json
  3. 25 3
      doc/guide/hooks.xml

+ 5 - 3
doc/examples/kea4/reservations.json

@@ -31,8 +31,9 @@
 
 
 // Kea supports reservations by several different types of identifiers:
 // Kea supports reservations by several different types of identifiers:
 // hw-address (hardware/MAC address of the client), duid (DUID inserted by the
 // hw-address (hardware/MAC address of the client), duid (DUID inserted by the
-// client), client-id (client identifier inserted by the client) and circuit-id
-// (circuit identifier inserted by the relay agent). When told to do so, Kea can
+// client), client-id (client identifier inserted by the client), circuit-id
+// (circuit identifier inserted by the relay agent) and flex-id (flexible identifier
+// available when flex_id hook library is loaded). When told to do so, Kea can
 // check for all of those identifier types, but it takes a costly database lookup
 // check for all of those identifier types, but it takes a costly database lookup
 // to do so. It is therefore useful from a performance perspective to use only
 // to do so. It is therefore useful from a performance perspective to use only
 // the reservation types that are actually used in a given network.
 // the reservation types that are actually used in a given network.
@@ -40,7 +41,8 @@
 // The example below is not optimal from a performance perspective, but it
 // The example below is not optimal from a performance perspective, but it
 // nicely showcases the host reservation capabilities. Please use the minimum
 // nicely showcases the host reservation capabilities. Please use the minimum
 // set of identifier types used in your network.
 // set of identifier types used in your network.
-"host-reservation-identifiers": [ "circuit-id", "hw-address", "duid", "client-id" ],
+"host-reservation-identifiers": [ "circuit-id", "hw-address", "duid",
+                                  "client-id", "flex-id" ],
 
 
 // Define a subnet with four reservations. Some of the reservations belong
 // Define a subnet with four reservations. Some of the reservations belong
 // to the dynamic pool. Kea is able to handle this case, but it is not
 // to the dynamic pool. Kea is able to handle this case, but it is not

+ 4 - 3
doc/examples/kea6/reservations.json

@@ -27,12 +27,13 @@
   "renew-timer": 1000,
   "renew-timer": 1000,
   "rebind-timer": 2000,
   "rebind-timer": 2000,
 
 
-// Kea supports two types of identifiers in DHCPv6: hw-address (hardware/MAC address
-// of the client) and duid (DUID inserted by the client). When told to do so, Kea can
+// Kea supports three types of identifiers in DHCPv6: hw-address (hardware/MAC address
+// of the client), duid (DUID inserted by the client) and flex-id (flexible identifier
+// available when flex_id hook library is loaded) When told to do so, Kea can
 // check for each of these identifier types, but it takes a costly database lookup
 // check for each of these identifier types, but it takes a costly database lookup
 // to do so. It is therefore useful from a performance perspective to use only
 // to do so. It is therefore useful from a performance perspective to use only
 // the reservation types that are actually used in a given network.
 // the reservation types that are actually used in a given network.
-    "host-reservation-identifiers": [ "duid", "hw-address" ],
+    "host-reservation-identifiers": [ "duid", "hw-address", "flex-id" ],
 
 
 // The following list defines subnets. Subnet, pools and interface definitions
 // The following list defines subnets. Subnet, pools and interface definitions
 // are the same as in the regular scenario, without host reservations.
 // are the same as in the regular scenario, without host reservations.

+ 25 - 3
doc/guide/hooks.xml

@@ -630,8 +630,9 @@ link address: 3001::1, hop count: 1, identified by remote-id:
           only the first 6 bytes of the interface-id are interesting, because
           only the first 6 bytes of the interface-id are interesting, because
           remaining bytes are either randomly changed or not unique between
           remaining bytes are either randomly changed or not unique between
           devices. Therefore the customer decided to use first 6 bytes of the
           devices. Therefore the customer decided to use first 6 bytes of the
-          interface-id option inserted by the relay agent. This could be
-          achieved by using the following configuration:
+          interface-id option inserted by the relay agent. After adding "flex-id"
+          host-reservation-identifiers goal can be achieved by using the
+          following configuration:
 <screen>
 <screen>
 "Dhcp6": {
 "Dhcp6": {
     "subnet6": [{ ..., // subnet definition starts here
     "subnet6": [{ ..., // subnet definition starts here
@@ -640,11 +641,12 @@ link address: 3001::1, hop count: 1, identified by remote-id:
         "ip-addresses": [ "2001:db8::1" ]
         "ip-addresses": [ "2001:db8::1" ]
     ],
     ],
     }], // end of subnet definitions
     }], // end of subnet definitions
+    "host-reservation-identifiers": ["duid", "flex-id"], // add "flex-id" to reservation identifiers
     "hooks-libraries": [
     "hooks-libraries": [
         {
         {
             "library": "/path/libdhcp_flex_id.so",
             "library": "/path/libdhcp_flex_id.so",
             "parameters": {
             "parameters": {
-                "identifier-expression": "<userinput>substring(relay6[0].option[18],0,8)</userinput>"
+                "identifier-expression": "<userinput>substring(relay6[0].option[18].hex,0,8)</userinput>"
             }
             }
         },
         },
         ...
         ...
@@ -672,6 +674,26 @@ link address: 3001::1, hop count: 1, identified by remote-id:
           The former is more convenient for printable characters, while hex
           The former is more convenient for printable characters, while hex
           string values are more convenient for non-printable characters.
           string values are more convenient for non-printable characters.
         </para>
         </para>
+<screen>
+"Dhcp6": {
+    "subnet6": [{ ..., // subnet definition starts here
+    "reservations": [
+        <userinput>"flex-id": "01:02:03:04:05:06"</userinput>, // value of the first 8 bytes of the interface-id
+        "ip-addresses": [ "2001:db8::1" ]
+    ],
+    }], // end of subnet definitions
+    "host-reservation-identifiers": ["duid", "flex-id"], // add "flex-id" to reservation identifiers
+    "hooks-libraries": [
+        {
+            "library": "/path/libdhcp_flex_id.so",
+            "parameters": {
+                "identifier-expression": "<userinput>vendor[4491].option[1026].hex</userinput>"
+            }
+        },
+        ...
+    ]
+}
+</screen>
       </section>
       </section>
 
 
       <section id="host-cmds">
       <section id="host-cmds">