From: Razvan Becheriu Date: Mon, 11 Mar 2019 10:18:25 +0000 (+0200) Subject: updated examples and models X-Git-Tag: Kea-1.6.0-beta~343 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4519a8c4eecc48e027f9ca9a4998a18d5047596;p=thirdparty%2Fkea.git updated examples and models --- diff --git a/doc/examples/kea4/cassandra.json b/doc/examples/kea4/cassandra.json index e26c79a352..a7595d56b6 100644 --- a/doc/examples/kea4/cassandra.json +++ b/doc/examples/kea4/cassandra.json @@ -46,7 +46,14 @@ // This parameter enables/disables Nagle's algorithm on connections. // The default is true. - "tcp-nodelay": true + "tcp-nodelay": true, + + // This parameter configures consistency level. The default is "quorum". + "consistency": "quorum", + + // This parameter configures serial consistency level which manages + // lightweight transaction isolation. The default is "serial". + "serial-consistency": "serial" }, // Addresses will be assigned with a lifetime of 4000 seconds. diff --git a/doc/examples/kea6/cassandra.json b/doc/examples/kea6/cassandra.json index 2733105913..bf7c2f2c85 100644 --- a/doc/examples/kea6/cassandra.json +++ b/doc/examples/kea6/cassandra.json @@ -45,7 +45,14 @@ // This parameter enables/disables Nagle's algorithm on connections. // The default is true. - "tcp-nodelay": true + "tcp-nodelay": true, + + // This parameter configures consistency level. The default is "quorum". + "consistency": "quorum", + + // This parameter configures serial consistency level which manages + // lightweight transaction isolation. The default is "serial". + "serial-consistency": "serial" }, // Addresses will be assigned with preferred and valid lifetimes diff --git a/doc/guide/dhcp4-srv.xml b/doc/guide/dhcp4-srv.xml index b044bdc5cb..e78bc73dc9 100644 --- a/doc/guide/dhcp4-srv.xml +++ b/doc/guide/dhcp4-srv.xml @@ -595,6 +595,17 @@ The default value for Cassandra is 2000 ms. algorithm on connections. The default is true. + + consistency - configures consistency level. + The default is "quorum". + + + + serial-consistency - configures serial consistency + level which manages lightweight transaction isolation. The default is + "serial". + + diff --git a/src/lib/cql/cql_connection.h b/src/lib/cql/cql_connection.h index cd526a6b36..cf92be9b6f 100644 --- a/src/lib/cql/cql_connection.h +++ b/src/lib/cql/cql_connection.h @@ -147,6 +147,8 @@ public: /// values specified in parentheses): /// - keyspace: name of the database to which to connect (keatest) /// - contact-points: IP addresses of the nodes to connect to (127.0.0.1) + /// - consistency: consistency level (quorum) + /// - serial-consistency: serial consistency level (serial) /// - port: The TCP port to use (9042) /// - user - credentials to use when connecting (no username) /// - password - credentials to use when connecting (no password) diff --git a/src/lib/dhcpsrv/cql_host_data_source.h b/src/lib/dhcpsrv/cql_host_data_source.h index c9f5a18512..cac22825f5 100644 --- a/src/lib/dhcpsrv/cql_host_data_source.h +++ b/src/lib/dhcpsrv/cql_host_data_source.h @@ -57,18 +57,21 @@ class CqlHostDataSource : public BaseHostDataSource { public: /// @brief Constructor /// - /// Uses the following keywords in the parameters passed to it to connect - /// to the database: - /// - keyspace - /// - host - /// - user - /// - password - /// - contact-points - /// - reconnect-wait-time - /// - connect-timeout - /// - request-timeout - /// - tcp-keepalive - /// - tcp-nodelay + /// Uses the following keywords in the parameters passed to it to + /// connect to the Cassandra cluster (if omitted, defaults specified in + /// parentheses): + /// - keyspace: name of the database to which to connect (keatest) + /// - contact-points: IP addresses of the nodes to connect to (127.0.0.1) + /// - consistency: consistency level (quorum) + /// - serial-consistency: serial consistency level (serial) + /// - port: The TCP port to use (9042) + /// - user - credentials to use when connecting (no username) + /// - password - credentials to use when connecting (no password) + /// - reconnect-wait-time 2000 + /// - connect-timeout 5000 + /// - request-timeout 12000 + /// - tcp-keepalive no + /// - tcp-nodelay no /// /// For details regarding those paraemters, see /// @ref isc::db::CqlConnection::openDatabase. diff --git a/src/lib/dhcpsrv/cql_lease_mgr.h b/src/lib/dhcpsrv/cql_lease_mgr.h index 9292bfe0e9..f8b8450a90 100644 --- a/src/lib/dhcpsrv/cql_lease_mgr.h +++ b/src/lib/dhcpsrv/cql_lease_mgr.h @@ -46,16 +46,18 @@ public: /// Uses the following keywords in the parameters passed to it to /// connect to the Cassandra cluster (if omitted, defaults specified in /// parentheses): - /// - name - Name of the keyspace to to connect to ("keatest") - /// - contact-points - IP addresses to connect ("127.0.0.1") - /// - user - Username under which to connect (empty) - /// - password - Password for "user" on the database (empty) - /// - port - TCP port (9042) - /// - reconnect-wait-time (2000) - /// - connect-timeout (5000) - /// - request-timeout (12000) - /// - tcp-keepalive (no) - /// - tcp-nodelay (no) + /// - keyspace: name of the database to which to connect (keatest) + /// - contact-points: IP addresses of the nodes to connect to (127.0.0.1) + /// - consistency: consistency level (quorum) + /// - serial-consistency: serial consistency level (serial) + /// - port: The TCP port to use (9042) + /// - user - credentials to use when connecting (no username) + /// - password - credentials to use when connecting (no password) + /// - reconnect-wait-time 2000 + /// - connect-timeout 5000 + /// - request-timeout 12000 + /// - tcp-keepalive no + /// - tcp-nodelay no /// /// Finally, all the CQL commands are pre-compiled. /// diff --git a/src/lib/yang/translator_database.cc b/src/lib/yang/translator_database.cc index cea73f9454..9bdabee61b 100644 --- a/src/lib/yang/translator_database.cc +++ b/src/lib/yang/translator_database.cc @@ -95,6 +95,14 @@ TranslatorDatabase::getDatabaseKea(const string& xpath) { if (keyspace) { result->set("keyspace", keyspace); } + ConstElementPtr consistency = getItem(xpath + "/consistency"); + if (consistency) { + result->set("consistency", consistency); + } + ConstElementPtr serial_consistency = getItem(xpath + "/serial-consistency"); + if (serial_consistency) { + result->set("serial-consistency", serial_consistency); + } ConstElementPtr max_reconnect = getItem(xpath + "/max-reconnect-tries"); if (max_reconnect) { result->set("max-reconnect-tries", max_reconnect); @@ -201,6 +209,14 @@ TranslatorDatabase::setDatabaseKea(const string& xpath, if (keyspace) { setItem(xpath + "/keyspace", keyspace, SR_STRING_T); } + ConstElementPtr consistency = elem->get("consistency"); + if (consistency) { + setItem(xpath + "/consistency", consistency, SR_STRING_T); + } + ConstElementPtr serial_consistency = elem->get("serial-consistency"); + if (serial_consistency) { + setItem(xpath + "/serial-consistency", serial_consistency, SR_STRING_T); + } ConstElementPtr max_reconnect = elem->get("max-reconnect-tries"); if (max_reconnect) { setItem(xpath + "/max-reconnect-tries", max_reconnect, SR_UINT32_T); diff --git a/src/lib/yang/translator_database.h b/src/lib/yang/translator_database.h index 228cbbb2a6..e3e4138b96 100644 --- a/src/lib/yang/translator_database.h +++ b/src/lib/yang/translator_database.h @@ -30,6 +30,8 @@ namespace yang { /// "connect-timeout": , /// "contact-points": , /// "keyspace": , +/// "consistency": , +/// "serial-consistency": , /// "max-reconnect-tries": , /// "reconnect-wait-time": , /// "request-timeout": , @@ -56,6 +58,8 @@ namespace yang { /// +--rw connect-timeout? uint32 /// +--rw contact-points? string /// +--rw keyspace? string +/// +--rw consistency? string +/// +--rw serial-consistency? string /// +--rw max-reconnect-tries? uint32 /// +--rw reconnect-wait-time? uint32 /// +--rw request-timeout? uint32 diff --git a/src/share/yang/modules/kea-dhcp-types@2018-11-20.yang b/src/share/yang/modules/kea-dhcp-types@2018-11-20.yang index 2bfc96f8e8..cfcf7696dd 100644 --- a/src/share/yang/modules/kea-dhcp-types@2018-11-20.yang +++ b/src/share/yang/modules/kea-dhcp-types@2018-11-20.yang @@ -145,6 +145,15 @@ module kea-dhcp-types { description "Cassandra database keyspace (this is Cassandra's equivalent of a database name)."; } + leaf consistency { + type string; + description "Consistency level."; + } + leaf serial-consistency { + type string; + description "Serial consistency level which manages lightweight + transaction isolation."; + } leaf max-reconnect-tries { type uint32; description "Maximum of recovery attempts before exit.";