Parcourir la source

[master] Finishing merge of trac5121 (HRMode in flex/bison)

Francis Dupont il y a 7 ans
Parent
commit
512390eaa8

+ 6 - 1
doc/examples/kea4/reservations.json

@@ -61,7 +61,12 @@
        "pools": [ { "pool":  "192.0.2.1 - 192.0.2.200" } ],
        "subnet": "192.0.2.0/24",
         "interface": "eth0",
-        "reservation-mode": "out-of-pool",
+        // 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".
+        // Kea will then be able to skip querying for host reservations when
+        // assigning leases from dynamic pool.
+        "reservation-mode": "all",
         "reservations": [
 
 // This is a reservation for a specific hardware/MAC address. It's a very

+ 7 - 2
doc/examples/kea6/reservations.json

@@ -43,6 +43,13 @@
     {
       "subnet": "2001:db8:1::/48",
 
+      // 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".
+      // Kea will then be able to skip querying for host reservations when
+      // assigning leases from dynamic pool.
+      "reservation-mode": "all",
+
       "pools": [ { "pool": "2001:db8:1::/120" } ],
 
       "pd-pools": [
@@ -54,8 +61,6 @@
       ],
       "interface": "ethX",
 
-      "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

+ 36 - 0
src/bin/dhcp4/dhcp4_lexer.ll

@@ -577,6 +577,42 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
+\"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_);
+    }
+}
+
+\"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_);
+    }
+}
+
 \"code\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser4Context::OPTION_DEF:

+ 12 - 4
src/bin/dhcp4/dhcp4_parser.yy

@@ -110,6 +110,9 @@ using namespace std;
   ID "id"
   RAPID_COMMIT "rapid-commit"
   RESERVATION_MODE "reservation-mode"
+  DISABLED "disabled"
+  OUT_OF_POOL "out-of-pool"
+  ALL "all"
 
   HOST_RESERVATION_IDENTIFIERS "host-reservation-identifiers"
 
@@ -205,6 +208,7 @@ using namespace std;
 %type <ElementPtr> map_value
 %type <ElementPtr> socket_type
 %type <ElementPtr> db_type
+%type <ElementPtr> hr_mode
 %type <ElementPtr> ncr_protocol_value
 %type <ElementPtr> replace_client_name_value
 
@@ -926,13 +930,17 @@ client_class: CLIENT_CLASS {
 };
 
 reservation_mode: RESERVATION_MODE {
-    ctx.enter(ctx.NO_KEYWORD);
-} COLON STRING {
-    ElementPtr rm(new StringElement($4, ctx.loc2pos(@4)));
-    ctx.stack_.back()->set("reservation-mode", rm);
+    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))); }
+       | ALL { $$ = ElementPtr(new StringElement("all", ctx.loc2pos(@1))); }
+       ;
+
 id: ID COLON INTEGER {
     ElementPtr id(new IntElement($3, ctx.loc2pos(@3)));
     ctx.stack_.back()->set("id", id);

+ 1 - 1
src/bin/dhcp4/location.hh

@@ -1,4 +1,4 @@
-// Generated 201707051253
+// Generated 201701262348
 // A Bison parser, made by GNU Bison 3.0.4.
 
 // Locations for Bison parsers in C++

+ 2 - 0
src/bin/dhcp4/parser_context.cc

@@ -141,6 +141,8 @@ Parser4Context::contextName()
         return ("hooks-librairies");
     case SUBNET4:
         return ("subnet4");
+    case RESERVATION_MODE:
+        return ("reservation-mode");
     case OPTION_DEF:
         return ("option-def");
     case OPTION_DATA:

+ 3 - 0
src/bin/dhcp4/parser_context.h

@@ -216,6 +216,9 @@ public:
         /// Used while parsing Dhcp4/Subnet4 structures.
         SUBNET4,
 
+        /// Used while parsing Dhcp4/Subnet4/reservation-mode.
+        RESERVATION_MODE,
+
         /// Used while parsing Dhcp4/option-def structures.
         OPTION_DEF,
 

+ 1 - 1
src/bin/dhcp4/position.hh

@@ -1,4 +1,4 @@
-// Generated 201707051253
+// Generated 201701262348
 // A Bison parser, made by GNU Bison 3.0.4.
 
 // Positions for Bison parsers in C++

+ 1 - 1
src/bin/dhcp4/stack.hh

@@ -1,4 +1,4 @@
-// Generated 201707051253
+// Generated 201701262348
 // A Bison parser, made by GNU Bison 3.0.4.
 
 // Stack handling for Bison parsers in C++

+ 36 - 0
src/bin/dhcp6/dhcp6_lexer.ll

@@ -835,6 +835,42 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
+\"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_);
+    }
+}
+
+\"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_);
+    }
+}
+
 \"code\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser6Context::OPTION_DEF:

+ 12 - 4
src/bin/dhcp6/dhcp6_parser.yy

@@ -105,6 +105,9 @@ using namespace std;
   ID "id"
   RAPID_COMMIT "rapid-commit"
   RESERVATION_MODE "reservation-mode"
+  DISABLED "disabled"
+  OUT_OF_POOL "out-of-pool"
+  ALL "all"
 
   MAC_SOURCES "mac-sources"
   RELAY_SUPPLIED_OPTIONS "relay-supplied-options"
@@ -212,6 +215,7 @@ using namespace std;
 %type <ElementPtr> value
 %type <ElementPtr> map_value
 %type <ElementPtr> db_type
+%type <ElementPtr> hr_mode
 %type <ElementPtr> duid_type
 %type <ElementPtr> ncr_protocol_value
 %type <ElementPtr> replace_client_name_value
@@ -914,13 +918,17 @@ client_class: CLIENT_CLASS {
 };
 
 reservation_mode: RESERVATION_MODE {
-    ctx.enter(ctx.NO_KEYWORD);
-} COLON STRING {
-    ElementPtr rm(new StringElement($4, ctx.loc2pos(@4)));
-    ctx.stack_.back()->set("reservation-mode", rm);
+    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))); }
+       | ALL { $$ = ElementPtr(new StringElement("all", ctx.loc2pos(@1))); }
+       ;
+
 id: ID COLON INTEGER {
     ElementPtr id(new IntElement($3, ctx.loc2pos(@3)));
     ctx.stack_.back()->set("id", id);

+ 1 - 1
src/bin/dhcp6/location.hh

@@ -1,4 +1,4 @@
-// Generated 201707051254
+// Generated 201701262349
 // A Bison parser, made by GNU Bison 3.0.4.
 
 // Locations for Bison parsers in C++

+ 2 - 0
src/bin/dhcp6/parser_context.cc

@@ -141,6 +141,8 @@ Parser6Context::contextName()
         return ("hooks-librairies");
     case SUBNET6:
         return ("subnet6");
+    case RESERVATION_MODE:
+        return ("reservation-mode");
     case OPTION_DEF:
         return ("option-def");
     case OPTION_DATA:

+ 3 - 0
src/bin/dhcp6/parser_context.h

@@ -219,6 +219,9 @@ public:
         /// Used while parsing Dhcp6/Subnet6 structures.
         SUBNET6,
 
+        /// Used while parsing Dhcp6/Subnet6/reservation-mode.
+        RESERVATION_MODE,
+
         /// Used while parsing Dhcp6/option-def structures.
         OPTION_DEF,
 

+ 1 - 1
src/bin/dhcp6/position.hh

@@ -1,4 +1,4 @@
-// Generated 201707051254
+// Generated 201701262349
 // A Bison parser, made by GNU Bison 3.0.4.
 
 // Positions for Bison parsers in C++

+ 1 - 1
src/bin/dhcp6/stack.hh

@@ -1,4 +1,4 @@
-// Generated 201707051254
+// Generated 201701262349
 // A Bison parser, made by GNU Bison 3.0.4.
 
 // Stack handling for Bison parsers in C++