Browse Source

[5356] Applied proposed changes and add the new file in dist list and parser tests

Francis Dupont 7 years ago
parent
commit
ba4f486966
3 changed files with 39 additions and 28 deletions
  1. 1 0
      doc/Makefile.am
  2. 37 28
      doc/examples/kea6/iPXE.json
  3. 1 0
      src/bin/dhcp6/tests/parser_unittest.cc

+ 1 - 0
doc/Makefile.am

@@ -36,6 +36,7 @@ nobase_dist_doc_DATA += examples/kea6/classify.json
 nobase_dist_doc_DATA += examples/kea6/dhcpv4-over-dhcpv6.json
 nobase_dist_doc_DATA += examples/kea6/duid.json
 nobase_dist_doc_DATA += examples/kea6/hooks.json
+nobase_dist_doc_DATA += examples/kea6/iPXE.json
 nobase_dist_doc_DATA += examples/kea6/leases-expiration.json
 nobase_dist_doc_DATA += examples/kea6/multiple-options.json
 nobase_dist_doc_DATA += examples/kea6/mysql-reservations.json

+ 37 - 28
doc/examples/kea6/iPXE.json

@@ -1,10 +1,11 @@
 // This is and example configuration for iPXE boot in Kea6.
 
 {
-   "Dhcp6":{
-// mandatory part of the config that list interfaces on which kea will listen to incoming traffic
-      "interfaces-config":{
-         "interfaces":[
+   "Dhcp6": {
+   // mandatory part of the config that list interfaces on which
+   //  kea will listen to incoming traffic
+      "interfaces-config": {
+         "interfaces": [
             "ethX"
          ]
       },
@@ -18,42 +19,50 @@
 //    option dhcp6.bootfile-url "http://[2001:db8::1]/ubuntu.cfg";
 // }
 //
-// In example shown below incoming packet will receive value http://[2001:db8::1]/ubuntu.cfg
-// if incoming packet will include user class option with "iPXE" in it and 
-// value http://[2001:db8::1]/ipxe.efi if option client architecture type will be 7.
-// If incoming packet will include both of those options with matching values it will be assigned 
-// to class "a-ipxe" because it was first matching class. If you want to change that order names 
-// of the classes have to have different alphabetical order. In Kea 1.3.0 (and previous versions)
-// alphabetical order is used in classification. 
-      "client-classes":[
+// In example shown below incoming packet will receive value
+// http://[2001:db8::1]/ubuntu.cfg if incoming packet will include user
+// class option with "iPXE" in it and value http://[2001:db8::1]/ipxe.efi
+// if option client architecture type will be 7.
+// If incoming packet will include both of those options with matching
+// values it will be assigned to class "a-ipxe" because it was first
+// matching class. If you want to change that order names of the classes
+// have to have different alphabetical order. In Kea 1.3.0 (and previous
+// versions) alphabetical order is used in classification. Note this
+// should change in next versions, for instance to keep the definition
+// order.
+      "client-classes": [
          {
-            "name":"a-ipxe",
-            "test":"substring(option[15].hex,2,4) == 'iPXE'",
-            "option-data":[
+            "name": "a-ipxe",
+            // user-class option (code 15) is a tuple array
+            // so we need to skip the length (tuple first element)
+            "test": "substring(option[15].hex, 2, 4) == 'iPXE'",
+            "option-data": [
                {
-                  "space":"dhcp6",
-                  "name":"bootfile-url",
-                  "code":59,
-                  "data":"http://[2001:db8::1]/ubuntu.cfg"
+                  "space": "dhcp6",
+                  "name": "bootfile-url",
+                  "code": 59,
+                  "data": "http://[2001:db8::1]/ubuntu.cfg"
                }
             ]
          },
          {
-            "name":"b-efi",
-            "test":"option[61].hex == 0x00000007",
-            "option-data":[
+            "name": "b-efi",
+            // please consider to add a not a-ipxe here to enforce
+            // the "else"?
+            "test": "option[61].hex == 0x0007",
+            "option-data": [
                {
-                  "space":"dhcp6",
-                  "name":"bootfile-url",
-                  "code":59,
-                  "data":"http://[2001:db8::1]/ipxe.efi"
+                  "space": "dhcp6",
+                  "name": "bootfile-url",
+                  "code": 59,
+                  "data": "http://[2001:db8::1]/ipxe.efi"
                }
             ]
          }
       ],
-      "subnet6":[
+      "subnet6": [
          {
-            "subnet":"2001:db8::/64"
+            "subnet": "2001:db8::/64"
          }
       ]
    }

+ 1 - 0
src/bin/dhcp6/tests/parser_unittest.cc

@@ -250,6 +250,7 @@ TEST(ParserTest, file) {
     configs.push_back("dhcpv4-over-dhcpv6.json");
     configs.push_back("duid.json");
     configs.push_back("hooks.json");
+    configs.push_back("iPXE.json");
     configs.push_back("leases-expiration.json");
     configs.push_back("multiple-options.json");
     configs.push_back("mysql-reservations.json");