Browse Source

[5061] contact_points converted to contact-points

Tomek Mrugalski 8 years ago
parent
commit
5ab41adb7a

+ 1 - 1
doc/examples/kea4/backends.json

@@ -70,7 +70,7 @@
 #  "lease-database": {
 #      "type": "cql",
 #      "keyspace": "keatest",
-#      "contact_points": "192.0.2.1,192.0.2.2,192.0.2.3",
+#      "contact-points": "192.0.2.1,192.0.2.2,192.0.2.3",
 #      "port": 9042
 #  },
 

+ 64 - 0
doc/examples/kea4/cassandra.json

@@ -0,0 +1,64 @@
+// This is an example configuration file for the DHCPv4 server in Kea.
+// It is a basic scenario with one IPv4 subnet configured. It demonstrates
+// how to configure Kea to use CQL (Cassandra) backend
+
+{ "Dhcp4":
+
+{
+// Kea is told to listen on ethX interface only.
+  "interfaces-config": {
+    "interfaces": [ "ethX" ]
+  },
+
+// 4. CQL (Cassandra) backend. Leases will be stored in Cassandra database. Make
+// sure it is up, running and properly initialized. See kea-admin documentation
+// for details on how to initialize the database. The only strictly required
+// parameters are type, keyspace and contact_points. At least one contact point
+// must be specified, but more than one is required for redundancy. Make sure
+// you specify the contact points without spaces. Kea must be compiled with
+// --with-cql option to use this backend.
+  "lease-database": {
+      "type": "cql",
+      "keyspace": "keatest",
+      "contact-points": "192.0.2.1,192.0.2.2,192.0.2.3",
+      "port": 9042
+  },
+
+// Addresses will be assigned with a lifetime of 4000 seconds.
+  "valid-lifetime": 4000,
+
+// Renew and rebind timers are commented out. This implies that options
+// 58 and 59 will not be sent to the client. In this case it is up to
+// the client to pick the timer values according to RFC2131. Uncomment the
+// timers to send these options to the client.
+//  "renew-timer": 1000,
+//  "rebind-timer": 2000,
+
+// The following list defines subnets. We have only one subnet
+// here. We tell Kea that it is directly available over local interface.
+  "subnet4": [
+    {
+       "pools": [ { "pool":  "192.0.2.1 - 192.0.2.200" } ],
+       "subnet": "192.0.2.0/24",
+       "interface": "ethX"
+    }
+  ]
+},
+
+// 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-dhcp4",
+            "output_options": [
+                {
+                    "output": "stdout"
+                }
+            ],
+            "severity": "INFO"
+        }
+    ]
+}
+
+}

+ 1 - 1
doc/examples/kea6/backends.json

@@ -70,7 +70,7 @@
 #  "lease-database": {
 #      "type": "cql",
 #      "keyspace": "keatest",
-#      "contact_points": "192.0.2.1,192.0.2.2,192.0.2.3",
+#      "contact-points": "192.0.2.1,192.0.2.2,192.0.2.3",
 #      "port": 9042
 #  },
 

+ 66 - 0
doc/examples/kea6/cassandra.json

@@ -0,0 +1,66 @@
+// This is an example configuration file for the DHCPv6 server in Kea.
+// It is a basic scenario with one IPv6 subnet configured. It demonstrates
+// how to configure Kea to use CQL (Cassandra) backend.
+
+{ "Dhcp6":
+
+{
+// Kea is told to listen on ethX interface only.
+  "interfaces-config": {
+    "interfaces": [ "ethX" ]
+  },
+
+// CQL (Cassandra) backend. Leases will be stored in Cassandra database. Make
+// sure it is up, running and properly initialized. See kea-admin documentation
+// for details on how to initialize the database. The only strictly required
+// parameters are type, keyspace and contact_points. At least one contact point
+// must be specified, but more than one is required for redundancy. Make sure
+// you specify the contact points without spaces. Kea must be compiled with
+// --with-cql option to use this backend.
+  "lease-database": {
+      "type": "cql",
+      "keyspace": "keatest",
+      "contact_points": "192.0.2.1,192.0.2.2,192.0.2.3",
+      "port": 9042
+  },
+
+// Addresses will be assigned with preferred and valid lifetimes
+// being 3000 and 4000, respectively. Client is told to start
+// renewing after 1000 seconds. If the server does not respond
+// after 2000 seconds since the lease was granted, client is supposed
+// to start REBIND procedure (emergency renewal that allows switching
+// to a different server).
+  "preferred-lifetime": 3000,
+  "valid-lifetime": 4000,
+  "renew-timer": 1000,
+  "rebind-timer": 2000,
+
+// The following list defines subnets. Each subnet consists of at
+// least subnet and pool entries.
+  "subnet6": [
+    {
+      "pools": [ { "pool": "2001:db8:1::/80" } ],
+      "subnet": "2001:db8:1::/64",
+      "interface": "ethX"
+    }
+  ]
+},
+
+// 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"
+        }
+    ]
+}
+
+}

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

@@ -380,16 +380,6 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
-\"contact_points\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser4Context::LEASE_DATABASE:
-    case isc::dhcp::Parser4Context::HOSTS_DATABASE:
-        return isc::dhcp::Dhcp4Parser::make_CONTACT_POINTS(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp4Parser::make_STRING("contact_points", driver.loc_);
-    }
-}
-
 \"contact-points\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser4Context::LEASE_DATABASE:

+ 2 - 2
src/bin/dhcp4/dhcp4_parser.yy

@@ -77,7 +77,7 @@ using namespace std;
   LFC_INTERVAL "lfc-interval"
   READONLY "readonly"
   CONNECT_TIMEOUT "connect-timeout"
-  CONTACT_POINTS "contact_points"
+  CONTACT_POINTS "contact-points"
   KEYSPACE "keyspace"
 
   VALID_LIFETIME "valid-lifetime"
@@ -601,7 +601,7 @@ contact_points: CONTACT_POINTS {
     ctx.enter(ctx.NO_KEYWORD);
 } COLON STRING {
     ElementPtr cp(new StringElement($4, ctx.loc2pos(@4)));
-    ctx.stack_.back()->set("contact_points", cp);
+    ctx.stack_.back()->set("contact-points", cp);
     ctx.leave();
 };
 

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

@@ -242,6 +242,7 @@ TEST(ParserTest, file) {
     vector<string> configs = { "advanced.json" ,
                                "backends.json",
                                "classify.json",
+                               "cassandra.json",
                                "dhcpv4-over-dhcpv6.json",
                                "hooks.json",
                                "leases-expiration.json",

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

@@ -581,16 +581,6 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
-\"contact_points\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser6Context::LEASE_DATABASE:
-    case isc::dhcp::Parser6Context::HOSTS_DATABASE:
-        return isc::dhcp::Dhcp6Parser::make_CONTACT_POINTS(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp6Parser::make_STRING("contact_points", driver.loc_);
-    }
-}
-
 \"contact-points\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser6Context::LEASE_DATABASE:

+ 2 - 2
src/bin/dhcp6/dhcp6_parser.yy

@@ -68,7 +68,7 @@ using namespace std;
   LFC_INTERVAL "lfc-interval"
   READONLY "readonly"
   CONNECT_TIMEOUT "connect-timeout"
-  CONTACT_POINTS "contact_points"
+  CONTACT_POINTS "contact-points"
   KEYSPACE "keyspace"
 
   PREFERRED_LIFETIME "preferred-lifetime"
@@ -586,7 +586,7 @@ contact_points: CONTACT_POINTS {
     ctx.enter(ctx.NO_KEYWORD);
 } COLON STRING {
     ElementPtr cp(new StringElement($4, ctx.loc2pos(@4)));
-    ctx.stack_.back()->set("contact_points", cp);
+    ctx.stack_.back()->set("contact-points", cp);
     ctx.leave();
 };
 

+ 1 - 1
src/lib/dhcpsrv/cql_connection.cc

@@ -69,7 +69,7 @@ CqlConnection::openDatabase() {
     const char* contact_points = "127.0.0.1";
     string scontact_points;
     try {
-        scontact_points = getParameter("contact_points");
+        scontact_points = getParameter("contact-points");
         contact_points = scontact_points.c_str();
     } catch (...) {
         // No host. Fine, we'll use "localhost".