From: Tomek Mrugalski Date: Thu, 23 Jun 2016 12:24:39 +0000 (+0200) Subject: renamed dscsql to cql X-Git-Tag: trac4283_base~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=162742b453d4adf8796842359a0ea06bae140073;p=thirdparty%2Fkea.git renamed dscsql to cql --- diff --git a/configure.ac b/configure.ac index 3f923939ac..8d0cf5b409 100755 --- a/configure.ac +++ b/configure.ac @@ -995,57 +995,57 @@ fi # ... and at the shell level, so Makefile.am can take action depending on this. AM_CONDITIONAL(HAVE_PGSQL, test "$PG_CONFIG" != "") -dsc_config="no" -AC_ARG_WITH([dhcp-dscsql], - AC_HELP_STRING([--with-dhcp-dscsql=PATH], - [path to the DataStaxCassandraSQL 'dsc_config' script]), - [dsc_config="$withval"]) - -if test "${dsc_config}" = "yes" ; then - DSC_CONFIG="/usr/bin/dsc_config" -elif test "${dsc_config}" != "no" ; then - DSC_CONFIG="${withval}" +cql_config="no" +AC_ARG_WITH([cql], + AC_HELP_STRING([--with-cql=PATH], + [path to the Cassandra CQL 'cql_config' script]), + [cql_config="$withval"]) + +if test "${cql_config}" = "yes" ; then + cql_config="/usr/bin/cql_config" +elif test "${cql_config}" != "no" ; then + CQL_CONFIG="${withval}" fi -if test "$DSC_CONFIG" != "" ; then - if test -d "$DSC_CONFIG" -o ! -x "$DSC_CONFIG" ; then - AC_MSG_ERROR([--with-dhcp-dscsql should point to a dsc_config program]) +if test "$CQL_CONFIG" != "" ; then + if test -d "$CQL_CONFIG" -o ! -x "$CQL_CONFIG" ; then + AC_MSG_ERROR([--with-cql should point to a cql_config program]) fi - DSCSQL_CPPFLAGS=`$DSC_CONFIG --cppflags` - DSCSQL_INCLUDEDIR=`$DSC_CONFIG --includedir` - DSCSQL_CPPFLAGS="$DSCSQL_CPPFLAGS -I$DSCSQL_INCLUDEDIR" - DSCSQL_LIBS=`$DSC_CONFIG --libdir` - DSCSQL_LIBS="-L$DSCSQL_LIBS -lcassandra_static -luv" - DSCSQL_VERSION=`$DSC_CONFIG --version` + CQL_CPPFLAGS=`$CQL_CONFIG --cppflags` + CQL_INCLUDEDIR=`$CQL_CONFIG --includedir` + CQL_CPPFLAGS="$CQL_CPPFLAGS -I$CQL_INCLUDEDIR" + CQL_LIBS=`$CQL_CONFIG --libdir` + CQL_LIBS="-L$CQL_LIBS -lcassandra_static -luv" + CQL_VERSION=`$CQL_CONFIG --version` - AC_SUBST(DSCSQL_CPPFLAGS) - AC_SUBST(DSCSQL_LIBS) + AC_SUBST(CQL_CPPFLAGS) + AC_SUBST(CQL_LIBS) - # Check that a simple program using DSCSQL functions can compile and link. + # Check that a simple program using CQL functions can compile and link. CPPFLAGS_SAVED="$CPPFLAGS" LIBS_SAVED="$LIBS" - CPPFLAGS="$DSCSQL_CPPFLAGS $CPPFLAGS" - LIBS="$DSCSQL_LIBS $LIBS" + CPPFLAGS="$CQL_CPPFLAGS $CPPFLAGS" + LIBS="$CQL_LIBS $LIBS" AC_LINK_IFELSE( [AC_LANG_PROGRAM([#include ], [CassCluster* cluster = cass_cluster_new(); cass_cluster_free(cluster);])], - [AC_MSG_RESULT([checking for DataStax Cassandra SQL headers and library... yes])], - [AC_MSG_RESULT([checking for DataStax Cassandra SQL headers and library... no]) - AC_MSG_ERROR([Needs DataStax Cassandra SQL library])] + [AC_MSG_RESULT([checking for Cassandra CQL headers and library... yes])], + [AC_MSG_RESULT([checking for Cassandra CQL headers and library... no]) + AC_MSG_ERROR([Needs Cassandra CQL library])] ) CPPFLAGS=$CPPFLAGS_SAVED LIBS=$LIBS_SAVED - # Note that DSCSQL is present in the config.h file - AC_DEFINE([HAVE_DSCSQL], [1], [DSCSQL is present]) + # Note that CQL is present in the config.h file + AC_DEFINE([HAVE_CQL], [1], [CQL is present]) fi # ... and at the shell level, so Makefile.am can take action depending on this. -AM_CONDITIONAL(HAVE_DSCSQL, test "$DSC_CONFIG" != "") +AM_CONDITIONAL(HAVE_CQL, test "$CQL_CONFIG" != "") # Check for log4cplus log4cplus_path="yes" @@ -1461,7 +1461,7 @@ AC_CONFIG_FILES([compatcheck/Makefile src/bin/admin/tests/memfile_tests.sh src/bin/admin/tests/mysql_tests.sh src/bin/admin/tests/pgsql_tests.sh - src/bin/admin/tests/dscsql_tests.sh + src/bin/admin/tests/cql_tests.sh src/hooks/Makefile src/hooks/dhcp/Makefile src/hooks/dhcp/user_chk/Makefile @@ -1539,7 +1539,7 @@ AC_CONFIG_FILES([compatcheck/Makefile src/share/database/scripts/pgsql/Makefile src/share/database/scripts/pgsql/upgrade_1.0_to_2.0.sh src/share/database/scripts/pgsql/upgrade_2.0_to_3.0.sh - src/share/database/scripts/dscsql/Makefile + src/share/database/scripts/cql/Makefile tools/Makefile tools/path_replacer.sh ]) @@ -1673,18 +1673,18 @@ PostgreSQL: END fi -if test "$DSCSQL_CPPFLAGS" != "" ; then +if test "$CQL_CPPFLAGS" != "" ; then cat >> config.report << END -DataStax Cassandra SQL: - DSCSQL_VERSION: ${DSCSQL_VERSION} - DSCSQL_CPPFLAGS: ${DSCSQL_CPPFLAGS} - DSCSQL_LIBS: ${DSCSQL_LIBS} +Cassandra CQL: + CQL_VERSION: ${CQL_VERSION} + CQL_CPPFLAGS: ${CQL_CPPFLAGS} + CQL_LIBS: ${CQL_LIBS} END else cat >> config.report << END -DataStax Cassandra SQL: +Cassandra CQL: no END fi diff --git a/src/bin/admin/admin-utils.sh b/src/bin/admin/admin-utils.sh index 21e58df9f7..1596c88a5f 100644 --- a/src/bin/admin/admin-utils.sh +++ b/src/bin/admin/admin-utils.sh @@ -87,7 +87,7 @@ pgsql_version() { return $? } -dscsql_execute() { +cql_execute() { QUERY=$1 shift if [ $# -gt 1 ]; then @@ -101,8 +101,8 @@ dscsql_execute() { return $retcode } -dscsql_version() { - version=`dscsql_execute "SELECT version, minor FROM schema_version" "$@"` +cql_version() { + version=`cql_execute "SELECT version, minor FROM schema_version" "$@"` version=`echo "$version" | grep -A 1 "+" | grep -v "+" | tr -d ' ' | cut -d "|" -f 1-2 --output-delimiter="."` echo $version return $? diff --git a/src/bin/admin/kea-admin.in b/src/bin/admin/kea-admin.in index 0323fb635e..84ac9efb07 100644 --- a/src/bin/admin/kea-admin.in +++ b/src/bin/admin/kea-admin.in @@ -55,7 +55,7 @@ usage() { printf " - lease-upgrade: Upgrades your lease database scheme\n" printf " - lease-dump: Dump current leases to a CSV file\n" printf "\n" - printf "BACKEND - one of the supported backends: memfile|mysql|pgsql|dscsql\n" + printf "BACKEND - one of the supported backends: memfile|mysql|pgsql|cql\n" printf "\n" printf "PARAMETERS: Parameters are optional in general, but may be required\n" printf " for specific operation.\n" @@ -200,12 +200,12 @@ pgsql_init() { exit 0 } -dscsql_init() { +cql_init() { printf "Checking if there is a database initialized already. Please ignore errors.\n" # Let's try to count the number of tables. Anything above 0 means that there # is some database in place. If there is anything, we abort. Note that - # dsc sql may spit out connection or access errors to stderr, we ignore those. + # cql may spit out connection or access errors to stderr, we ignore those. # We should not hide them as they may give hints to user what is wrong with # his setup. # @@ -213,7 +213,7 @@ dscsql_init() { ERRCODE=$? if [ $ERRCODE -ne 0 ] then - log_error "dscsql_init table query failed, cqlsh status = $ERRCODE" + log_error "cql_init table query failed, cqlsh status = $ERRCODE" exit 1 fi @@ -225,16 +225,16 @@ dscsql_init() { exit 1 fi - printf "Initializing database using script %s\n" $scripts_dir/dscsql/dhcpdb_create.cql + printf "Initializing database using script %s\n" $scripts_dir/cql/dhcpdb_create.cql cqlsh -u $db_user -p $db_password -e "CREATE KEYSPACE $db_name WITH replication = {'class' : 'SimpleStrategy','replication_factor' : 1};" - cqlsh -u $db_user -p $db_password -k $db_name -f $scripts_dir/dscsql/dhcpdb_create.cql + cqlsh -u $db_user -p $db_password -k $db_name -f $scripts_dir/cql/dhcpdb_create.cql ERRCODE=$? printf "cqlsh returned status code $ERRCODE\n" if [ "$ERRCODE" -eq 0 ]; then printf "Lease DB version reported after initialization: " - dscsql_version + cql_version printf "\n" fi @@ -323,30 +323,30 @@ pgsql_upgrade() { exit 0 } -dscsql_upgrade() { - version=`dscsql_version` +cql_upgrade() { + version=`cql_version` printf "Lease DB version reported before upgrade: $version\n" # Check if the scripts directory exists at all. - if [ ! -d ${scripts_dir}/dscsql ]; then - log_error "Invalid scripts directory: ${scripts_dir}/dscsql" + if [ ! -d ${scripts_dir}/cql ]; then + log_error "Invalid scripts directory: ${scripts_dir}/cql" exit 1 fi # Check if there are any files in it - num_files=$(find ${scripts_dir}/dscsql/upgrade*.sh -type f | wc -l) + num_files=$(find ${scripts_dir}/cql/upgrade*.sh -type f | wc -l) if [ $num_files -eq 0 ]; then - log_error "No scripts in ${scripts_dir}/dscsql or the directory is not readable or does not have any upgrade* scripts." + log_error "No scripts in ${scripts_dir}/cql or the directory is not readable or does not have any upgrade* scripts." exit 1 fi - for script in ${scripts_dir}/dscsql/upgrade*.sh + for script in ${scripts_dir}/cql/upgrade*.sh do echo "Processing $script file..." sh ${script} -u ${db_user} -p ${db_password} -k ${db_name} done - version=`dscsql_version` + version=`cql_version` printf "Lease DB version reported after upgrade: $version\n" exit 0 } @@ -384,7 +384,7 @@ get_dump_query() { pgsql) invoke="select * from" ;; - dscsql) + cql) invoke="select * from" ;; *) @@ -491,14 +491,14 @@ pgsql_dump() { exit 0 } -dscsql_dump() { +cql_dump() { # get the correct dump query - version=`dscsql_version` + version=`cql_version` retcode=$? if [ $retcode -ne 0 ] then - log_error "lease-dump: dscsql_version failed, exit code $retcode" + log_error "lease-dump: cql_version failed, exit code $retcode" exit 1; fi @@ -526,10 +526,10 @@ dscsql_dump() { # 'tr' to translate tabs to commas. We do not use MySQL's output # to file as that requires linux superuser privileges to execute # the select. - dscsql_execute "${dump_qry}" > $tmp_file + cql_execute "${dump_qry}" > $tmp_file retcode=$? if [ $retcode -ne 0 ]; then - log_error "lease-dump: dscsql_execute failed, exit code $retcode"; + log_error "lease-dump: cql_execute failed, exit code $retcode"; exit 1 fi @@ -569,7 +569,7 @@ if [ -z ${backend} ]; then usage exit 1 fi -is_in_list "${backend}" "memfile mysql pgsql dscsql" +is_in_list "${backend}" "memfile mysql pgsql cql" if [ ${_inlist} -eq 0 ]; then log_error "invalid backend: ${backend}" exit 1 @@ -669,8 +669,8 @@ case ${command} in pgsql) pgsql_init ;; - dscsql) - dscsql_init + cql) + cql_init ;; esac ;; @@ -686,8 +686,8 @@ case ${command} in pgsql) pgsql_version ;; - dscsql) - dscsql_version + cql) + cql_version ;; esac ;; @@ -702,8 +702,8 @@ case ${command} in pgsql) pgsql_upgrade ;; - dscsql) - dscsql_upgrade + cql) + cql_upgrade ;; esac ;; @@ -718,8 +718,8 @@ case ${command} in pgsql) pgsql_dump ;; - dscsql) - dscsql_dump + cql) + cql_dump ;; esac ;; diff --git a/src/bin/admin/tests/Makefile.am b/src/bin/admin/tests/Makefile.am index 2c2fa8c32d..ea0f4370e6 100644 --- a/src/bin/admin/tests/Makefile.am +++ b/src/bin/admin/tests/Makefile.am @@ -10,8 +10,8 @@ if HAVE_PGSQL SHTESTS += pgsql_tests.sh endif -if HAVE_DSCSQL -SHTESTS += dscsql_tests.sh +if HAVE_CQL +SHTESTS += cql_tests.sh endif noinst_SCRIPTS = $(SHTESTS) @@ -20,7 +20,7 @@ EXTRA_DIST += dhcpdb_create_1.0.pgsql EXTRA_DIST += dhcpdb_create_1.0.cql CLEANFILES = *.log -DISTCLEANFILES = memfile_tests.sh mysql_tests.sh pgsql_tests.sh dscsql_tests.sh +DISTCLEANFILES = memfile_tests.sh mysql_tests.sh pgsql_tests.sh cql_tests.sh # Execute all test scripts. check-local: diff --git a/src/bin/admin/tests/cql_tests.sh b/src/bin/admin/tests/cql_tests.sh new file mode 100644 index 0000000000..5919d6005d --- /dev/null +++ b/src/bin/admin/tests/cql_tests.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Include common test library. +. /home/andrei/work/git/isc-kea-integration/kea/src/lib/testutils/dhcp_test_lib.sh + +cql_init_test() { + test_start "cql.init" + + # @todo: Implement this + + test_finish 0 +} + +cql_version_test() { + test_start "cql.version" + + # @todo: Implement this + + test_finish 0 +} + +cql_upgrade_test() { + test_start "cql.upgrade" + + # @todo: Implement this + + test_finish 0 +} + +cql_init_test +cql_version_test +cql_upgrade_test diff --git a/src/bin/admin/tests/dscsql_tests.sh.in b/src/bin/admin/tests/cql_tests.sh.in similarity index 70% rename from src/bin/admin/tests/dscsql_tests.sh.in rename to src/bin/admin/tests/cql_tests.sh.in index d7cc195d80..c65121da3d 100644 --- a/src/bin/admin/tests/dscsql_tests.sh.in +++ b/src/bin/admin/tests/cql_tests.sh.in @@ -9,30 +9,30 @@ # Include common test library. . @abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh -dscsql_init_test() { - test_start "dscsql.init" +cql_init_test() { + test_start "cql.init" # @todo: Implement this test_finish 0 } -dscsql_version_test() { - test_start "dscsql.version" +cql_version_test() { + test_start "cql.version" # @todo: Implement this test_finish 0 } -dscsql_upgrade_test() { - test_start "dscsql.upgrade" +cql_upgrade_test() { + test_start "cql.upgrade" # @todo: Implement this test_finish 0 } -dscsql_init_test -dscsql_version_test -dscsql_upgrade_test +cql_init_test +cql_version_test +cql_upgrade_test diff --git a/src/bin/admin/tests/data/Makefile.am b/src/bin/admin/tests/data/Makefile.am index 56796f9505..f95d694ebb 100644 --- a/src/bin/admin/tests/data/Makefile.am +++ b/src/bin/admin/tests/data/Makefile.am @@ -2,5 +2,5 @@ EXTRA_DIST = mysql.lease4_dump_test.reference.csv \ mysql.lease6_dump_test.reference.csv \ pgsql.lease4_dump_test.reference.csv \ pgsql.lease6_dump_test.reference.csv \ - dscsql.lease4_dump_test.reference.csv \ - dscsql.lease6_dump_test.reference.csv + cql.lease4_dump_test.reference.csv \ + cql.lease6_dump_test.reference.csv diff --git a/src/bin/admin/tests/data/dscsql.lease4_dump_test.reference.csv b/src/bin/admin/tests/data/cql.lease4_dump_test.reference.csv similarity index 100% rename from src/bin/admin/tests/data/dscsql.lease4_dump_test.reference.csv rename to src/bin/admin/tests/data/cql.lease4_dump_test.reference.csv diff --git a/src/bin/admin/tests/data/dscsql.lease6_dump_test.reference.csv b/src/bin/admin/tests/data/cql.lease6_dump_test.reference.csv similarity index 100% rename from src/bin/admin/tests/data/dscsql.lease6_dump_test.reference.csv rename to src/bin/admin/tests/data/cql.lease6_dump_test.reference.csv diff --git a/src/bin/admin/tests/dhcpdb_create_1.0.cql b/src/bin/admin/tests/dhcpdb_create_1.0.cql index 303d437c05..8104859cfb 100644 --- a/src/bin/admin/tests/dhcpdb_create_1.0.cql +++ b/src/bin/admin/tests/dhcpdb_create_1.0.cql @@ -14,24 +14,24 @@ -- See the License for the specific language governing permissions and -- limitations under the License. --- This is the Kea schema 1.0 specification for DataStax Cassandra SQL. +-- This is the Kea schema 1.0 specification for Cassandra CQL. -- Note: this is outdated version on purpose and it used to test upgrade -- process. Do not update this file to 2.0 or any later. -- The schema is reasonably portable (with the exception of the engine --- specification, which is Datastax Cassandra SQL-specific). Minor changes might be needed for +-- specification, which is Cassandra CQL-specific). Minor changes might be needed for -- other databases. -- To create the schema, either type the command: -- cqlsh -u -p -k -f dhcpdb_create.cql --- ... at the command prompt, or log in to the DSC SQL database and at the "cqlsh>" +-- ... at the command prompt, or log in to the CQL database and at the "cqlsh>" -- prompt, issue the command: -- SOURCE dhcpdb_create.cql --- This script is also called from kea-admin, see kea-admin init dscsql +-- This script is also called from kea-admin, see kea-admin init cql -- Over time, Kea database schema will evolve. Each version is marked with -- major.minor version. This file is organized sequentially, i.e. database diff --git a/src/bin/d2/Makefile.am b/src/bin/d2/Makefile.am index 3fe204cb0a..df266ad4a1 100644 --- a/src/bin/d2/Makefile.am +++ b/src/bin/d2/Makefile.am @@ -9,8 +9,8 @@ endif if HAVE_PGSQL AM_CPPFLAGS += $(PGSQL_CPPFLAGS) endif -if HAVE_DSCSQL -AM_CPPFLAGS += $(DSCSQL_CPPFLAGS) +if HAVE_CQL +AM_CPPFLAGS += $(CQL_CPPFLAGS) endif AM_CXXFLAGS = $(KEA_CXXFLAGS) @@ -122,8 +122,8 @@ endif if HAVE_PGSQL kea_dhcp_ddns_LDFLAGS += $(PGSQL_LIBS) endif -if HAVE_DSCSQL -kea_dhcp_ddns_LDFLAGS += $(DSCSQL_LIBS) +if HAVE_CQL +kea_dhcp_ddns_LDFLAGS += $(CQL_LIBS) endif kea_dhcp_ddnsdir = $(pkgdatadir) diff --git a/src/bin/d2/d_controller.cc b/src/bin/d2/d_controller.cc index e521ba1462..fc12cb683c 100644 --- a/src/bin/d2/d_controller.cc +++ b/src/bin/d2/d_controller.cc @@ -21,8 +21,8 @@ #ifdef HAVE_PGSQL #include #endif -#ifdef HAVE_DSCSQL -#include +#ifdef HAVE_CQL +#include #endif #include @@ -488,8 +488,8 @@ DControllerBase::getVersion(bool extended) { #ifdef HAVE_PGSQL tmp << isc::dhcp::PgSqlLeaseMgr::getDBVersion() << std::endl; #endif -#ifdef HAVE_DSCSQL - tmp << isc::dhcp::DSCSqlLeaseMgr::getDBVersion() << std::endl; +#ifdef HAVE_CQL + tmp << isc::dhcp::CqlLeaseMgr::getDBVersion() << std::endl; #endif tmp << isc::dhcp::Memfile_LeaseMgr::getDBVersion(); diff --git a/src/bin/d2/tests/Makefile.am b/src/bin/d2/tests/Makefile.am index 0bba93b967..6c5dbe4866 100644 --- a/src/bin/d2/tests/Makefile.am +++ b/src/bin/d2/tests/Makefile.am @@ -75,8 +75,8 @@ endif if HAVE_PGSQL d2_unittests_LDFLAGS += $(PGSQL_LIBS) endif -if HAVE_DSCSQL -d2_unittests_LDFLAGS += $(DSCSQL_LIBS) +if HAVE_CQL +d2_unittests_LDFLAGS += $(CQL_LIBS) endif d2_unittests_LDFLAGS += $(GTEST_LDFLAGS) diff --git a/src/bin/dhcp4/Makefile.am b/src/bin/dhcp4/Makefile.am index daaed242e1..53423e149d 100644 --- a/src/bin/dhcp4/Makefile.am +++ b/src/bin/dhcp4/Makefile.am @@ -10,8 +10,8 @@ endif if HAVE_PGSQL AM_CPPFLAGS += $(PGSQL_CPPFLAGS) endif -if HAVE_DSCSQL -AM_CPPFLAGS += $(DSCSQL_CPPFLAGS) +if HAVE_CQL +AM_CPPFLAGS += $(CQL_CPPFLAGS) endif AM_CXXFLAGS = $(KEA_CXXFLAGS) @@ -102,8 +102,8 @@ endif if HAVE_PGSQL kea_dhcp4_LDFLAGS += $(PGSQL_LIBS) endif -if HAVE_DSCSQL -kea_dhcp4_LDFLAGS += $(DSCSQL_LIBS) +if HAVE_CQL +kea_dhcp4_LDFLAGS += $(CQL_LIBS) endif kea_dhcp4dir = $(pkgdatadir) diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 2042a020f5..8373ac6b01 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -49,8 +49,8 @@ #ifdef HAVE_PGSQL #include #endif -#ifdef HAVE_DSCSQL -#include +#ifdef HAVE_CQL +#include #endif #include @@ -2538,8 +2538,8 @@ Dhcpv4Srv::getVersion(bool extended) { #ifdef HAVE_PGSQL tmp << PgSqlLeaseMgr::getDBVersion() << endl; #endif -#ifdef HAVE_DSCSQL - tmp << DSCSqlLeaseMgr::getDBVersion() << endl; +#ifdef HAVE_CQL + tmp << CqlLeaseMgr::getDBVersion() << endl; #endif tmp << Memfile_LeaseMgr::getDBVersion(); diff --git a/src/bin/dhcp4/tests/Makefile.am b/src/bin/dhcp4/tests/Makefile.am index 6ee03e8eef..ffbf3a3d8d 100644 --- a/src/bin/dhcp4/tests/Makefile.am +++ b/src/bin/dhcp4/tests/Makefile.am @@ -106,8 +106,8 @@ endif if HAVE_PGSQL dhcp4_unittests_LDFLAGS += $(PGSQL_LIBS) endif -if HAVE_DSCSQL -dhcp4_unittests_LDFLAGS += $(DSCSQL_LIBS) +if HAVE_CQL +dhcp4_unittests_LDFLAGS += $(CQL_LIBS) endif dhcp4_unittests_LDFLAGS += $(GTEST_LDFLAGS) diff --git a/src/bin/dhcp6/Makefile.am b/src/bin/dhcp6/Makefile.am index e6e58af2f3..baaf1eae73 100644 --- a/src/bin/dhcp6/Makefile.am +++ b/src/bin/dhcp6/Makefile.am @@ -10,8 +10,8 @@ endif if HAVE_PGSQL AM_CPPFLAGS += $(PGSQL_CPPFLAGS) endif -if HAVE_DSCSQL -AM_CPPFLAGS += $(DSCSQL_CPPFLAGS) +if HAVE_CQL +AM_CPPFLAGS += $(CQL_CPPFLAGS) endif AM_CXXFLAGS = $(KEA_CXXFLAGS) @@ -103,8 +103,8 @@ endif if HAVE_PGSQL kea_dhcp6_LDFLAGS += $(PGSQL_LIBS) endif -if HAVE_DSCSQL -kea_dhcp6_LDFLAGS += $(DSCSQL_LIBS) +if HAVE_CQL +kea_dhcp6_LDFLAGS += $(CQL_LIBS) endif kea_dhcp6dir = $(pkgdatadir) diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index dda273325c..0948cb1e2e 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -58,8 +58,8 @@ #ifdef HAVE_PGSQL #include #endif -#ifdef HAVE_DSCSQL -#include +#ifdef HAVE_CQL +#include #endif #include @@ -2986,8 +2986,8 @@ Dhcpv6Srv::getVersion(bool extended) { #ifdef HAVE_PGSQL tmp << PgSqlLeaseMgr::getDBVersion() << endl; #endif -#ifdef HAVE_DSCSQL - tmp << DSCSqlLeaseMgr::getDBVersion() << endl; +#ifdef HAVE_CQL + tmp << CqlLeaseMgr::getDBVersion() << endl; #endif tmp << Memfile_LeaseMgr::getDBVersion(); diff --git a/src/bin/dhcp6/tests/Makefile.am b/src/bin/dhcp6/tests/Makefile.am index 5bbbf5bc21..3573b4ad63 100644 --- a/src/bin/dhcp6/tests/Makefile.am +++ b/src/bin/dhcp6/tests/Makefile.am @@ -107,8 +107,8 @@ endif if HAVE_PGSQL dhcp6_unittests_LDFLAGS += $(PGSQL_LIBS) endif -if HAVE_DSCSQL -dhcp6_unittests_LDFLAGS += $(DSCSQL_LIBS) +if HAVE_CQL +dhcp6_unittests_LDFLAGS += $(CQL_LIBS) endif dhcp6_unittests_LDFLAGS += $(GTEST_LDFLAGS) diff --git a/src/bin/lfc/Makefile.am b/src/bin/lfc/Makefile.am index e54294adfa..9cdd5bae78 100644 --- a/src/bin/lfc/Makefile.am +++ b/src/bin/lfc/Makefile.am @@ -83,8 +83,8 @@ endif if HAVE_PGSQL kea_lfc_LDFLAGS += $(PGSQL_LIBS) endif -if HAVE_DSCSQL -kea_lfc_LDFLAGS += $(DSCSQL_LIBS) +if HAVE_CQL +kea_lfc_LDFLAGS += $(CQL_LIBS) endif kea_lfcdir = $(pkgdatadir) diff --git a/src/bin/lfc/tests/Makefile.am b/src/bin/lfc/tests/Makefile.am index 545d38c19e..208f970520 100644 --- a/src/bin/lfc/tests/Makefile.am +++ b/src/bin/lfc/tests/Makefile.am @@ -52,8 +52,8 @@ endif if HAVE_PGSQL lfc_unittests_LDFLAGS += $(PGSQL_LIBS) endif -if HAVE_DSCSQL -lfc_unittests_LDFLAGS += $(DSCSQL_LIBS) +if HAVE_CQL +lfc_unittests_LDFLAGS += $(CQL_LIBS) endif lfc_unittests_LDFLAGS += $(GTEST_LDFLAGS) diff --git a/src/lib/dhcpsrv/Makefile.am b/src/lib/dhcpsrv/Makefile.am index 12f3584fda..362169052d 100755 --- a/src/lib/dhcpsrv/Makefile.am +++ b/src/lib/dhcpsrv/Makefile.am @@ -16,8 +16,8 @@ endif if HAVE_PGSQL AM_CPPFLAGS += $(PGSQL_CPPFLAGS) endif -if HAVE_DSCSQL -AM_CPPFLAGS += $(DSCSQL_CPPFLAGS) +if HAVE_CQL +AM_CPPFLAGS += $(CQL_CPPFLAGS) endif AM_CXXFLAGS = $(KEA_CXXFLAGS) @@ -141,9 +141,9 @@ libkea_dhcpsrv_la_SOURCES += pgsql_connection.cc pgsql_connection.h libkea_dhcpsrv_la_SOURCES += pgsql_exchange.cc pgsql_exchange.h libkea_dhcpsrv_la_SOURCES += pgsql_lease_mgr.cc pgsql_lease_mgr.h endif -if HAVE_DSCSQL -libkea_dhcpsrv_la_SOURCES += dscsql_lease_mgr.cc dscsql_lease_mgr.h -libkea_dhcpsrv_la_SOURCES += dscsql_connection.cc dscsql_connection.h +if HAVE_CQL +libkea_dhcpsrv_la_SOURCES += cql_lease_mgr.cc cql_lease_mgr.h +libkea_dhcpsrv_la_SOURCES += cql_connection.cc cql_connection.h endif libkea_dhcpsrv_la_SOURCES += pool.cc pool.h libkea_dhcpsrv_la_SOURCES += srv_config.cc srv_config.h @@ -204,8 +204,8 @@ endif if HAVE_PGSQL libkea_dhcpsrv_la_LDFLAGS += $(PGSQL_LIBS) endif -if HAVE_DSCSQL -libkea_dhcpsrv_la_LDFLAGS += $(DSCSQL_LIBS) +if HAVE_CQL +libkea_dhcpsrv_la_LDFLAGS += $(CQL_LIBS) endif if USE_CLANGPP diff --git a/src/lib/dhcpsrv/dscsql_connection.cc b/src/lib/dhcpsrv/cql_connection.cc similarity index 88% rename from src/lib/dhcpsrv/dscsql_connection.cc rename to src/lib/dhcpsrv/cql_connection.cc index 8c260650c0..13795105f8 100644 --- a/src/lib/dhcpsrv/dscsql_connection.cc +++ b/src/lib/dhcpsrv/cql_connection.cc @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include #include using namespace std; @@ -22,11 +22,11 @@ using namespace std; namespace isc { namespace dhcp { -DSCSqlConnection::DSCSqlConnection(const ParameterMap& parameters) : DatabaseConnection(parameters), +CqlConnection::CqlConnection(const ParameterMap& parameters) : DatabaseConnection(parameters), cluster_(NULL), session_(NULL), tagged_statements_(NULL) { } -DSCSqlConnection::~DSCSqlConnection() { +CqlConnection::~CqlConnection() { CassError rc; for (int i = 0; i < statements_.size(); i++) { @@ -51,7 +51,7 @@ DSCSqlConnection::~DSCSqlConnection() { } void -DSCSqlConnection::openDatabase() { +CqlConnection::openDatabase() { CassError rc; // Set up the values of the parameters const char* contact_points = "127.0.0.1"; @@ -135,7 +135,7 @@ DSCSqlConnection::openDatabase() { } void -DSCSqlConnection::prepareStatements(DSCSqlTaggedStatement *statements) { +CqlConnection::prepareStatements(CqlTaggedStatement *statements) { CassError rc = CASS_OK; CassFuture* future = NULL; uint32_t size = 0; @@ -163,7 +163,7 @@ DSCSqlConnection::prepareStatements(DSCSqlTaggedStatement *statements) { } string -DSCSqlConnection::getName() const { +CqlConnection::getName() const { string name = ""; try { name = getParameter("name"); @@ -174,14 +174,14 @@ DSCSqlConnection::getName() const { } string -DSCSqlConnection::getDescription() const { - return (string("DataStax Cassandra Database")); +CqlConnection::getDescription() const { + return (string("Cassandra Database")); } pair -DSCSqlConnection::getVersion() const { +CqlConnection::getVersion() const { LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, - DHCPSRV_DSCSQL_GET_VERSION); + DHCPSRV_CQL_GET_VERSION); uint32_t version = CASS_VERSION_MAJOR; uint32_t minor = CASS_VERSION_MINOR; @@ -190,18 +190,18 @@ DSCSqlConnection::getVersion() const { } void -DSCSqlConnection::commit() { - LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_DSCSQL_COMMIT); +CqlConnection::commit() { + LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_CQL_COMMIT); } void -DSCSqlConnection::rollback() { - LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_DSCSQL_ROLLBACK); +CqlConnection::rollback() { + LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_CQL_ROLLBACK); } void -DSCSqlConnection::checkStatementError(std::string& error, CassFuture* future, uint32_t stindex, const char* what) const +CqlConnection::checkStatementError(std::string& error, CassFuture* future, uint32_t stindex, const char* what) const { CassError rc; const char* errorMessage; @@ -221,7 +221,7 @@ DSCSqlConnection::checkStatementError(std::string& error, CassFuture* future, ui } void -DSCSqlConnection::checkStatementError(std::string& error, CassFuture* future, const char* what) const +CqlConnection::checkStatementError(std::string& error, CassFuture* future, const char* what) const { CassError rc; const char* errorMessage; diff --git a/src/lib/dhcpsrv/dscsql_connection.h b/src/lib/dhcpsrv/cql_connection.h similarity index 82% rename from src/lib/dhcpsrv/dscsql_connection.h rename to src/lib/dhcpsrv/cql_connection.h index a2fd4d13f3..ad3caa3148 100644 --- a/src/lib/dhcpsrv/dscsql_connection.h +++ b/src/lib/dhcpsrv/cql_connection.h @@ -14,8 +14,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef DSCSQL_CONNECTION_H -#define DSCSQL_CONNECTION_H +#ifndef CQL_CONNECTION_H +#define CQL_CONNECTION_H #include #include @@ -27,7 +27,7 @@ namespace isc { namespace dhcp { /// @brief Defines a single query -struct DSCSqlTaggedStatement { +struct CqlTaggedStatement { /// Param name. const char** params_; @@ -38,31 +38,31 @@ struct DSCSqlTaggedStatement { const char* text_; }; -/// Defines DSC SQL backend version: 1.0 -const uint32_t DSCSQL_CURRENT_VERSION = 1; -const uint32_t DSCSQL_CURRENT_MINOR = 0; +/// Defines CQL backend version: 1.0 +const uint32_t CQL_CURRENT_VERSION = 1; +const uint32_t CQL_CURRENT_MINOR = 0; -class DSCSqlConnection : public DatabaseConnection { +class CqlConnection : public DatabaseConnection { public: /// @brief Constructor /// - /// Initialize DSCSqlConnection object with parameters needed for connection. - DSCSqlConnection(const ParameterMap& parameters); + /// Initialize CqlConnection object with parameters needed for connection. + CqlConnection(const ParameterMap& parameters); /// @brief Destructor - virtual ~DSCSqlConnection(); + virtual ~CqlConnection(); /// @brief Prepare statements /// /// Creates the prepared statements for all of the SQL statements used - /// by the PostgreSQL backend. + /// by the CQL backend. /// /// @throw isc::dhcp::DbOperationError An operation on the open database has /// failed. /// @throw isc::InvalidParameter 'index' is not valid for the vector. This /// represents an internal error within the code. - void prepareStatements(DSCSqlTaggedStatement *statements); + void prepareStatements(CqlTaggedStatement *statements); /// @brief Open Database /// @@ -107,7 +107,7 @@ public: /// /// Commits all pending database operations. /// - /// @throw DbOperationError Iif the commit failed. + /// @throw DbOperationError If the commit failed. virtual void commit(); /// @brief Rollback Transactions @@ -120,21 +120,23 @@ public: /// @brief Check Error /// /// Chech error for current database operation. - void checkStatementError(std::string& error, CassFuture* future, uint32_t stindex, const char* what) const; + void checkStatementError(std::string& error, CassFuture* future, + uint32_t stindex, const char* what) const; /// @brief Check Error /// /// Chech error for current database operation. - void checkStatementError(std::string& error, CassFuture* future, const char* what) const; + void checkStatementError(std::string& error, CassFuture* future, + const char* what) const; - /// DSC SQL connection handle + /// CQL connection handle CassCluster* cluster_; CassSession* session_; std::vector statements_; ///< Prepared statements - DSCSqlTaggedStatement *tagged_statements_; + CqlTaggedStatement *tagged_statements_; }; }; // end of isc::dhcp namespace }; // end of isc namespace -#endif // DSCSQL_CONNECTION_H +#endif // CQL_CONNECTION_H diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.mes b/src/lib/dhcpsrv/dhcpsrv_messages.mes index 7a499fc669..97cbc170ef 100644 --- a/src/lib/dhcpsrv/dhcpsrv_messages.mes +++ b/src/lib/dhcpsrv/dhcpsrv_messages.mes @@ -809,105 +809,105 @@ indicate an error in the source code, please submit a bug report. The database access string specified a database type (given in the message) that is unknown to the software. This is a configuration error. -% DHCPSRV_DSCSQL_ADD_ADDR4 adding IPv4 lease with address %1 +% DHCPSRV_CQL_ADD_ADDR4 adding IPv4 lease with address %1 A debug message issued when the server is about to add an IPv4 lease -with the specified address to the DataStax Cassandra backend database. +with the specified address to the Cassandra backend database. -% DHCPSRV_DSCSQL_ADD_ADDR6 adding IPv6 lease with address %1 +% DHCPSRV_CQL_ADD_ADDR6 adding IPv6 lease with address %1 A debug message issued when the server is about to add an IPv6 lease -with the specified address to the DataStax Cassandra backend database. +with the specified address to the Cassandra backend database. -% DHCPSRV_DSCSQL_COMMIT committing to DataStax Cassandra database +% DHCPSRV_CQL_COMMIT committing to Cassandra database The code has issued a commit call. -% DHCPSRV_DSCSQL_DB opening DataStax Cassandra lease database: %1 +% DHCPSRV_CQL_DB opening Cassandra lease database: %1 This informational message is logged when a DHCP server (either V4 or -V6) is about to open a DataStax Cassandra lease database. The parameters of +V6) is about to open a Cassandra lease database. The parameters of the connection including database name and username needed to access it (but not the password if any) are logged. -% DHCPSRV_DSCSQL_DELETE_ADDR deleting lease for address %1 +% DHCPSRV_CQL_DELETE_ADDR deleting lease for address %1 A debug message issued when the server is attempting to delete a lease -for the specified address from the DataStax Cassandra database for the specified +for the specified address from the Cassandra database for the specified address. -% DHCPSRV_DSCSQL_DELETE_EXPIRED_RECLAIMED4 deleting reclaimed IPv4 leases that expired more than %1 seconds ago +% DHCPSRV_CQL_DELETE_EXPIRED_RECLAIMED4 deleting reclaimed IPv4 leases that expired more than %1 seconds ago A debug message issued when the server is removing reclaimed DHCPv4 leases which have expired longer than a specified period of time. The argument is the amount of time Kea waits after a reclaimed lease expires before considering its removal. -% DHCPSRV_DSCSQL_DELETE_EXPIRED_RECLAIMED6 deleting reclaimed IPv6 leases that expired more than %1 seconds ago +% DHCPSRV_CQL_DELETE_EXPIRED_RECLAIMED6 deleting reclaimed IPv6 leases that expired more than %1 seconds ago A debug message issued when the server is removing reclaimed DHCPv6 leases which have expired longer than a specified period of time. The argument is the amount of time Kea waits after a reclaimed lease expires before considering its removal. -% DHCPSRV_DSCSQL_GET_ADDR4 obtaining IPv4 lease for address %1 +% DHCPSRV_CQL_GET_ADDR4 obtaining IPv4 lease for address %1 A debug message issued when the server is attempting to obtain an IPv4 -lease from the DataStax Cassandra database for the specified address. +lease from the Cassandra database for the specified address. -% DHCPSRV_DSCSQL_GET_ADDR6 obtaining IPv6 lease for address %1 and lease type %2 +% DHCPSRV_CQL_GET_ADDR6 obtaining IPv6 lease for address %1 and lease type %2 A debug message issued when the server is attempting to obtain an IPv6 -lease from the DataStax Cassandra database for the specified address. +lease from the Cassandra database for the specified address. -% DHCPSRV_DSCSQL_GET_CLIENTID obtaining IPv4 leases for client ID %1 +% DHCPSRV_CQL_GET_CLIENTID obtaining IPv4 leases for client ID %1 A debug message issued when the server is attempting to obtain a set of -IPv4 leases from the DataStax Cassandra database for a client with the specified +IPv4 leases from the Cassandra database for a client with the specified client identification. -% DHCPSRV_DSCSQL_GET_CLIENTID_HWADDR_SUBID obtaining IPv4 lease for client ID %1, hardware address %2 and subnet ID %3 +% DHCPSRV_CQL_GET_CLIENTID_HWADDR_SUBID obtaining IPv4 lease for client ID %1, hardware address %2 and subnet ID %3 A debug message issued when the server is attempting to obtain an IPv4 -lease from the DataStax Cassandra database for a client with the specified +lease from the Cassandra database for a client with the specified client ID, hardware address and subnet ID. -% DHCPSRV_DSCSQL_GET_EXPIRED4 obtaining maximum %1 of expired IPv4 leases +% DHCPSRV_CQL_GET_EXPIRED4 obtaining maximum %1 of expired IPv4 leases A debug message issued when the server is attempting to obtain expired IPv4 leases to reclaim them. The maximum number of leases to be retrieved is logged in the message. -% DHCPSRV_DSCSQL_GET_EXPIRED6 obtaining maximum %1 of expired IPv6 leases +% DHCPSRV_CQL_GET_EXPIRED6 obtaining maximum %1 of expired IPv6 leases A debug message issued when the server is attempting to obtain expired IPv6 leases to reclaim them. The maximum number of leases to be retrieved is logged in the message. -% DHCPSRV_DSCSQL_GET_HWADDR obtaining IPv4 leases for hardware address %1 +% DHCPSRV_CQL_GET_HWADDR obtaining IPv4 leases for hardware address %1 A debug message issued when the server is attempting to obtain a set of -IPv4 leases from the DataStax Cassandra database for a client with the specified +IPv4 leases from the Cassandra database for a client with the specified hardware address. -% DHCPSRV_DSCSQL_GET_IAID_DUID obtaining IPv6 leases for IAID %1 and DUID %2 and lease type %3 +% DHCPSRV_CQL_GET_IAID_DUID obtaining IPv6 leases for IAID %1 and DUID %2 and lease type %3 A debug message issued when the server is attempting to obtain a set of -IPv6 lease from the DataStax Cassandra database for a client with the specified +IPv6 lease from the Cassandra database for a client with the specified IAID (Identity Association ID) and DUID (DHCP Unique Identifier). -% DHCPSRV_DSCSQL_GET_IAID_SUBID_DUID obtaining IPv6 leases for IAID %1, Subnet ID %2, DUID %3 and lease type %4 +% DHCPSRV_CQL_GET_IAID_SUBID_DUID obtaining IPv6 leases for IAID %1, Subnet ID %2, DUID %3 and lease type %4 A debug message issued when the server is attempting to obtain an IPv6 -lease from the DataStax Cassandra database for a client with the specified IAID +lease from the Cassandra database for a client with the specified IAID (Identity Association ID), Subnet ID and DUID (DHCP Unique Identifier). -% DHCPSRV_DSCSQL_GET_SUBID_CLIENTID obtaining IPv4 lease for subnet ID %1 and client ID %2 +% DHCPSRV_CQL_GET_SUBID_CLIENTID obtaining IPv4 lease for subnet ID %1 and client ID %2 A debug message issued when the server is attempting to obtain an IPv4 -lease from the DataStax Cassandra database for a client with the specified +lease from the Cassandra database for a client with the specified subnet ID and client ID. -% DHCPSRV_DSCSQL_GET_SUBID_HWADDR obtaining IPv4 lease for subnet ID %1 and hardware address %2 +% DHCPSRV_CQL_GET_SUBID_HWADDR obtaining IPv4 lease for subnet ID %1 and hardware address %2 A debug message issued when the server is attempting to obtain an IPv4 -lease from the DataStax Cassandra database for a client with the specified +lease from the Cassandra database for a client with the specified subnet ID and hardware address. -% DHCPSRV_DSCSQL_GET_VERSION obtaining schema version information +% DHCPSRV_CQL_GET_VERSION obtaining schema version information A debug message issued when the server is about to obtain schema version -information from the DataStax Cassandra database. +information from the Cassandra database. -% DHCPSRV_DSCSQL_ROLLBACK rolling back DataStax Cassandra database +% DHCPSRV_CQL_ROLLBACK rolling back Cassandra database The code has issued a rollback call. -% DHCPSRV_DSCSQL_UPDATE_ADDR4 updating IPv4 lease for address %1 +% DHCPSRV_CQL_UPDATE_ADDR4 updating IPv4 lease for address %1 A debug message issued when the server is attempting to update IPv4 -lease from the DataStax Cassandra database for the specified address. +lease from the Cassandra database for the specified address. -% DHCPSRV_DSCSQL_UPDATE_ADDR6 updating IPv6 lease for address %1 +% DHCPSRV_CQL_UPDATE_ADDR6 updating IPv6 lease for address %1 A debug message issued when the server is attempting to update IPv6 -lease from the DataStax Cassandra database for the specified address. +lease from the Cassandra database for the specified address. diff --git a/src/lib/dhcpsrv/host_data_source_factory.cc b/src/lib/dhcpsrv/host_data_source_factory.cc index 4b9a89b1b8..b60e47f311 100644 --- a/src/lib/dhcpsrv/host_data_source_factory.cc +++ b/src/lib/dhcpsrv/host_data_source_factory.cc @@ -68,9 +68,9 @@ HostDataSourceFactory::create(const std::string& dbaccess) { } #endif -#ifdef HAVE_DSCSQL - if (db_type == "dscsql") { - isc_throw(NotImplemented, "Sorry, DSCSQL backend for host reservations " +#ifdef HAVE_CQL + if (db_type == "cql") { + isc_throw(NotImplemented, "Sorry, CQL backend for host reservations " "is not implemented yet."); } #endif diff --git a/src/lib/dhcpsrv/lease_mgr_factory.cc b/src/lib/dhcpsrv/lease_mgr_factory.cc index 62698c93df..0d18d6fa5d 100755 --- a/src/lib/dhcpsrv/lease_mgr_factory.cc +++ b/src/lib/dhcpsrv/lease_mgr_factory.cc @@ -15,8 +15,8 @@ #ifdef HAVE_PGSQL #include #endif -#ifdef HAVE_DSCSQL -#include +#ifdef HAVE_CQL +#include #endif #include @@ -71,10 +71,10 @@ LeaseMgrFactory::create(const std::string& dbaccess) { return; } #endif -#ifdef HAVE_DSCSQL - if (parameters[type] == string("dscsql")) { - LOG_INFO(dhcpsrv_logger, DHCPSRV_DSCSQL_DB).arg(redacted); - getLeaseMgrPtr().reset(new DSCSqlLeaseMgr(parameters)); +#ifdef HAVE_CQL + if (parameters[type] == string("cql")) { + LOG_INFO(dhcpsrv_logger, DHCPSRV_CQL_DB).arg(redacted); + getLeaseMgrPtr().reset(new CQLLeaseMgr(parameters)); return; } #endif diff --git a/src/lib/dhcpsrv/parsers/dbaccess_parser.cc b/src/lib/dhcpsrv/parsers/dbaccess_parser.cc index 528ea07fe6..5386e9d2d6 100644 --- a/src/lib/dhcpsrv/parsers/dbaccess_parser.cc +++ b/src/lib/dhcpsrv/parsers/dbaccess_parser.cc @@ -89,7 +89,7 @@ DbAccessParser::build(isc::data::ConstElementPtr config_value) { // b. Check if the 'type' keyword known and throw an exception if not. string dbtype = type_ptr->second; - if ((dbtype != "memfile") && (dbtype != "mysql") && (dbtype != "postgresql") && (dbtype != "dscsql")) { + if ((dbtype != "memfile") && (dbtype != "mysql") && (dbtype != "postgresql") && (dbtype != "cql")) { isc_throw(BadValue, "unknown backend database type: " << dbtype << " (" << config_value->getPosition() << ")"); } diff --git a/src/lib/dhcpsrv/tests/Makefile.am b/src/lib/dhcpsrv/tests/Makefile.am index c124c449c6..aea9898f7c 100755 --- a/src/lib/dhcpsrv/tests/Makefile.am +++ b/src/lib/dhcpsrv/tests/Makefile.am @@ -122,8 +122,8 @@ if HAVE_PGSQL libdhcpsrv_unittests_SOURCES += pgsql_exchange_unittest.cc libdhcpsrv_unittests_SOURCES += pgsql_lease_mgr_unittest.cc endif -if HAVE_DSCSQL -libdhcpsrv_unittests_SOURCES += dscsql_lease_mgr_unittest.cc +if HAVE_CQL +libdhcpsrv_unittests_SOURCES += cql_lease_mgr_unittest.cc endif libdhcpsrv_unittests_SOURCES += pool_unittest.cc libdhcpsrv_unittests_SOURCES += srv_config_unittest.cc @@ -140,8 +140,8 @@ endif if HAVE_PGSQL libdhcpsrv_unittests_CPPFLAGS += $(PGSQL_CPPFLAGS) endif -if HAVE_DSCSQL -libdhcpsrv_unittests_CPPFLAGS += $(DSCSQL_CPPFLAGS) +if HAVE_CQL +libdhcpsrv_unittests_CPPFLAGS += $(CQL_CPPFLAGS) endif libdhcpsrv_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS) @@ -151,8 +151,8 @@ endif if HAVE_PGSQL libdhcpsrv_unittests_LDFLAGS += $(PGSQL_LIBS) endif -if HAVE_DSCSQL -libdhcpsrv_unittests_LDFLAGS += $(DSCSQL_LIBS) +if HAVE_CQL +libdhcpsrv_unittests_LDFLAGS += $(CQL_LIBS) endif libdhcpsrv_unittests_CXXFLAGS = $(AM_CXXFLAGS) diff --git a/src/lib/dhcpsrv/tests/dscsql_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc similarity index 76% rename from src/lib/dhcpsrv/tests/dscsql_lease_mgr_unittest.cc rename to src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc index e35f7c0e4e..7b62bd23d0 100644 --- a/src/lib/dhcpsrv/tests/dscsql_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc @@ -8,11 +8,11 @@ #include #include -#include -#include +#include +#include #include #include -#include +#include #include #include @@ -32,29 +32,29 @@ using namespace std; namespace { -/// @brief Test fixture class for testing DataStax Cassandra Lease Manager +/// @brief Test fixture class for testing Cassandra Lease Manager /// /// Opens the database prior to each test and closes it afterwards. /// All pending transactions are deleted prior to closure. -class DSCSqlLeaseMgrTest : public GenericLeaseMgrTest { +class CqlLeaseMgrTest : public GenericLeaseMgrTest { public: /// @brief Constructor /// /// Deletes everything from the database and opens it. - DSCSqlLeaseMgrTest() { + CqlLeaseMgrTest() { // Ensure schema is the correct one. - destroyDSCSQLSchema(); - createDSCSQLSchema(); + destroyCqlSchema(); + createCqlSchema(); // Connect to the database try { - LeaseMgrFactory::create(validDSCSQLConnectionString()); + LeaseMgrFactory::create(validCqlConnectionString()); } catch (...) { std::cerr << "*** ERROR: unable to open database. The test\n" "*** environment is broken and must be fixed before\n" - "*** the DSC SQL tests will run correctly.\n" + "*** the CQL tests will run correctly.\n" "*** The reason for the problem is described in the\n" "*** accompanying exception output.\n"; throw; @@ -66,10 +66,10 @@ public: /// /// Rolls back all pending transactions. The deletion of lmptr_ will close /// the database. Then reopen it and delete everything created by the test. - virtual ~DSCSqlLeaseMgrTest() { + virtual ~CqlLeaseMgrTest() { lmptr_->rollback(); LeaseMgrFactory::destroy(); - destroyDSCSQLSchema(); + destroyCqlSchema(); } /// @brief Reopen the database @@ -77,11 +77,11 @@ public: /// Closes the database and re-open it. Anything committed should be /// visible. /// - /// Parameter is ignored for DSC SQL backend as the v4 and v6 leases share + /// Parameter is ignored for CQL backend as the v4 and v6 leases share /// the same database. void reopen(Universe) { LeaseMgrFactory::destroy(); - LeaseMgrFactory::create(validConnectionString()); + LeaseMgrFactory::create(validCqlConnectionString()); lmptr_ = &(LeaseMgrFactory::instance()); } @@ -89,28 +89,28 @@ public: /// @brief Check that database can be opened /// -/// This test checks if the DSCSqlLeaseMgr can be instantiated. This happens +/// This test checks if the CqlLeaseMgr can be instantiated. This happens /// only if the database can be opened. Note that this is not part of the -/// DSCSqlLeaseMgr test fixure set. This test checks that the database can be +/// CqlLeaseMgr test fixure set. This test checks that the database can be /// opened: the fixtures assume that and check basic operations. -TEST(DSCSqlOpenTest, OpenDatabase) { +TEST(CQLOpenTest, OpenDatabase) { // Schema needs to be created for the test to work. - destroyDSCSQLSchema(); - createDSCSQLSchema(); + destroyCqlSchema(); + createCqlSchema(); // Check that lease manager open the database opens correctly and tidy up. // If it fails, print the error message. try { - LeaseMgrFactory::create(validDSCSQLConnectionString()); + LeaseMgrFactory::create(validCqlConnectionString()); EXPECT_NO_THROW((void) LeaseMgrFactory::instance()); LeaseMgrFactory::destroy(); } catch (const isc::Exception& ex) { FAIL() << "*** ERROR: unable to open database, reason:\n" << " " << ex.what() << "\n" << "*** The test environment is broken and must be fixed\n" - << "*** before the DSC SQL tests will run correctly.\n"; + << "*** before the CQL tests will run correctly.\n"; } // Check that attempting to get an instance of the lease manager when @@ -129,32 +129,32 @@ TEST(DSCSqlOpenTest, OpenDatabase) { // Check that invalid login data causes an exception. EXPECT_THROW(LeaseMgrFactory::create(connectionString( - DSCSQL_VALID_TYPE, INVALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD)), + CQL_VALID_TYPE, INVALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD)), DbOpenError); EXPECT_THROW(LeaseMgrFactory::create(connectionString( - DSCSQL_VALID_TYPE, VALID_NAME, INVALID_HOST, VALID_USER, VALID_PASSWORD)), + CQL_VALID_TYPE, VALID_NAME, INVALID_HOST, VALID_USER, VALID_PASSWORD)), DbOpenError); EXPECT_THROW(LeaseMgrFactory::create(connectionString( - DSCSQL_VALID_TYPE, VALID_NAME, VALID_HOST, INVALID_USER, VALID_PASSWORD)), + CQL_VALID_TYPE, VALID_NAME, VALID_HOST, INVALID_USER, VALID_PASSWORD)), DbOpenError); EXPECT_THROW(LeaseMgrFactory::create(connectionString( - DSCSQL_VALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER, INVALID_PASSWORD)), + CQL_VALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER, INVALID_PASSWORD)), DbOpenError); // Check for missing parameters EXPECT_THROW(LeaseMgrFactory::create(connectionString( - DSCSQL_VALID_TYPE, NULL, VALID_HOST, INVALID_USER, VALID_PASSWORD)), + CQL_VALID_TYPE, NULL, VALID_HOST, INVALID_USER, VALID_PASSWORD)), NoDatabaseName); // Tidy up after the test - destroyDSCSQLSchema(); + destroyCqlSchema(); } /// @brief Check the getType() method /// /// getType() returns a string giving the type of the backend, which should /// always be "cassandra". -TEST_F(DSCSqlLeaseMgrTest, getType) { +TEST_F(CqlLeaseMgrTest, getType) { EXPECT_EQ(std::string("cassandra"), lmptr_->getType()); } @@ -167,7 +167,7 @@ TEST_F(DSCSqlLeaseMgrTest, getType) { /// expire_time = cltt + valid_lifetime /// /// This test checks that the conversion is correct. -TEST_F(DSCSqlLeaseMgrTest, checkTimeConversion) { +TEST_F(CqlLeaseMgrTest, checkTimeConversion) { const time_t cltt = time(NULL); time_t converted_cltt = 0; @@ -176,17 +176,17 @@ TEST_F(DSCSqlLeaseMgrTest, checkTimeConversion) { /// @brief Check getName() returns correct database name -TEST_F(DSCSqlLeaseMgrTest, getName) { +TEST_F(CqlLeaseMgrTest, getName) { EXPECT_EQ(std::string("keatest"), lmptr_->getName()); } /// @brief Check that getVersion() returns the expected version -TEST_F(DSCSqlLeaseMgrTest, checkVersion) { +TEST_F(CqlLeaseMgrTest, checkVersion) { // Check version pair version; ASSERT_NO_THROW(version = lmptr_->getVersion()); - EXPECT_EQ(CURRENT_VERSION_VERSION, version.first); - EXPECT_EQ(CURRENT_VERSION_MINOR, version.second); + EXPECT_EQ(CQL_CURRENT_VERSION, version.first); + EXPECT_EQ(CQL_CURRENT_MINOR, version.second); } //////////////////////////////////////////////////////////////////////////////// @@ -197,29 +197,29 @@ TEST_F(DSCSqlLeaseMgrTest, checkVersion) { /// /// Checks that the addLease, getLease4 (by address) and deleteLease (with an /// IPv4 address) works. -TEST_F(DSCSqlLeaseMgrTest, basicLease4) { +TEST_F(CqlLeaseMgrTest, basicLease4) { testBasicLease4(); } /// @brief Check that Lease4 code safely handles invalid dates. -TEST_F(DSCSqlLeaseMgrTest, maxDate4) { +TEST_F(CqlLeaseMgrTest, maxDate4) { testMaxDate4(); } /// @brief Lease4 update tests /// /// Checks that we are able to update a lease in the database. -TEST_F(DSCSqlLeaseMgrTest, updateLease4) { +TEST_F(CqlLeaseMgrTest, updateLease4) { testUpdateLease4(); } /// @brief Check GetLease4 methods - access by Hardware Address -TEST_F(DSCSqlLeaseMgrTest, getLease4HWAddr1) { +TEST_F(CqlLeaseMgrTest, getLease4HWAddr1) { testGetLease4HWAddr1(); } /// @brief Check GetLease4 methods - access by Hardware Address -TEST_F(DSCSqlLeaseMgrTest, getLease4HWAddr2) { +TEST_F(CqlLeaseMgrTest, getLease4HWAddr2) { testGetLease4HWAddr2(); } @@ -227,7 +227,7 @@ TEST_F(DSCSqlLeaseMgrTest, getLease4HWAddr2) { // // Check that the system can cope with getting a hardware address of // any size. -TEST_F(DSCSqlLeaseMgrTest, getLease4HWAddrSize) { +TEST_F(CqlLeaseMgrTest, getLease4HWAddrSize) { testGetLease4HWAddrSize(); } @@ -235,7 +235,7 @@ TEST_F(DSCSqlLeaseMgrTest, getLease4HWAddrSize) { /// /// Adds leases to the database and checks that they can be accessed via /// a combination of hardware address and subnet ID -TEST_F(DSCSqlLeaseMgrTest, getLease4HwaddrSubnetId) { +TEST_F(CqlLeaseMgrTest, getLease4HwaddrSubnetId) { testGetLease4HWAddrSubnetId(); } @@ -243,12 +243,12 @@ TEST_F(DSCSqlLeaseMgrTest, getLease4HwaddrSubnetId) { // // Check that the system can cope with getting a hardware address of // any size. -TEST_F(DSCSqlLeaseMgrTest, getLease4HWAddrSubnetIdSize) { +TEST_F(CqlLeaseMgrTest, getLease4HWAddrSubnetIdSize) { testGetLease4HWAddrSubnetIdSize(); } // This test was derived from memfile. -TEST_F(DSCSqlLeaseMgrTest, getLease4ClientId) { +TEST_F(CqlLeaseMgrTest, getLease4ClientId) { testGetLease4ClientId(); } @@ -256,14 +256,14 @@ TEST_F(DSCSqlLeaseMgrTest, getLease4ClientId) { /// /// Adds leases to the database and checks that they can be accessed via /// the Client ID. -TEST_F(DSCSqlLeaseMgrTest, getLease4ClientId2) { +TEST_F(CqlLeaseMgrTest, getLease4ClientId2) { testGetLease4ClientId2(); } // @brief Get Lease4 by client ID (2) // // Check that the system can cope with a client ID of any size. -TEST_F(DSCSqlLeaseMgrTest, getLease4ClientIdSize) { +TEST_F(CqlLeaseMgrTest, getLease4ClientIdSize) { testGetLease4ClientIdSize(); } @@ -271,7 +271,7 @@ TEST_F(DSCSqlLeaseMgrTest, getLease4ClientIdSize) { /// /// Adds leases to the database and checks that they can be accessed via /// a combination of client and subnet IDs. -TEST_F(DSCSqlLeaseMgrTest, getLease4ClientIdSubnetId) { +TEST_F(CqlLeaseMgrTest, getLease4ClientIdSubnetId) { testGetLease4ClientIdSubnetId(); } @@ -280,7 +280,7 @@ TEST_F(DSCSqlLeaseMgrTest, getLease4ClientIdSubnetId) { /// Checks that the addLease, getLease4(by address), getLease4(hwaddr,subnet_id), /// updateLease4() and deleteLease (IPv4 address) can handle NULL client-id. /// (client-id is optional and may not be present) -TEST_F(DSCSqlLeaseMgrTest, lease4NullClientId) { +TEST_F(CqlLeaseMgrTest, lease4NullClientId) { testLease4NullClientId(); } @@ -288,7 +288,7 @@ TEST_F(DSCSqlLeaseMgrTest, lease4NullClientId) { /// /// Checks that the it is not possible to create a lease when the hostname /// length exceeds 255 characters. -TEST_F(DSCSqlLeaseMgrTest, lease4InvalidHostname) { +TEST_F(CqlLeaseMgrTest, lease4InvalidHostname) { testLease4InvalidHostname(); } @@ -298,7 +298,7 @@ TEST_F(DSCSqlLeaseMgrTest, lease4InvalidHostname) { // Test checks whether simple add, get and delete operations are possible // on Lease6 -TEST_F(DSCSqlLeaseMgrTest, testAddGetDelete6) { +TEST_F(CqlLeaseMgrTest, testAddGetDelete6) { testAddGetDelete6(false); } @@ -306,12 +306,12 @@ TEST_F(DSCSqlLeaseMgrTest, testAddGetDelete6) { /// /// Checks that the addLease, getLease6 (by address) and deleteLease (with an /// IPv6 address) works. -TEST_F(DSCSqlLeaseMgrTest, basicLease6) { +TEST_F(CqlLeaseMgrTest, basicLease6) { testBasicLease6(); } /// @brief Check that Lease6 code safely handles invalid dates. -TEST_F(DSCSqlLeaseMgrTest, maxDate6) { +TEST_F(CqlLeaseMgrTest, maxDate6) { testMaxDate6(); } @@ -319,7 +319,7 @@ TEST_F(DSCSqlLeaseMgrTest, maxDate6) { /// /// Checks that the it is not possible to create a lease when the hostname /// length exceeds 255 characters. -TEST_F(DSCSqlLeaseMgrTest, lease6InvalidHostname) { +TEST_F(CqlLeaseMgrTest, lease6InvalidHostname) { testLease6InvalidHostname(); } @@ -327,12 +327,12 @@ TEST_F(DSCSqlLeaseMgrTest, lease6InvalidHostname) { /// /// Adds leases to the database and checks that they can be accessed via /// a combination of DUID and IAID. -TEST_F(DSCSqlLeaseMgrTest, getLeases6DuidIaid) { +TEST_F(CqlLeaseMgrTest, getLeases6DuidIaid) { testGetLeases6DuidIaid(); } // Check that the system can cope with a DUID of allowed size. -TEST_F(DSCSqlLeaseMgrTest, getLeases6DuidSize) { +TEST_F(CqlLeaseMgrTest, getLeases6DuidSize) { testGetLeases6DuidSize(); } @@ -342,7 +342,7 @@ TEST_F(DSCSqlLeaseMgrTest, getLeases6DuidSize) { /// with alternating subnet_ids. /// It then verifies that all of getLeases6() method variants correctly /// discriminate between the leases based on lease type alone. -TEST_F(DSCSqlLeaseMgrTest, lease6LeaseTypeCheck) { +TEST_F(CqlLeaseMgrTest, lease6LeaseTypeCheck) { testLease6LeaseTypeCheck(); } @@ -350,19 +350,19 @@ TEST_F(DSCSqlLeaseMgrTest, lease6LeaseTypeCheck) { /// /// Adds leases to the database and checks that they can be accessed via /// a combination of DIUID and IAID. -TEST_F(DSCSqlLeaseMgrTest, getLease6DuidIaidSubnetId) { +TEST_F(CqlLeaseMgrTest, getLease6DuidIaidSubnetId) { testGetLease6DuidIaidSubnetId(); } // Test checks that getLease6() works with different DUID sizes -TEST_F(DSCSqlLeaseMgrTest, getLease6DuidIaidSubnetIdSize) { +TEST_F(CqlLeaseMgrTest, getLease6DuidIaidSubnetIdSize) { testGetLease6DuidIaidSubnetIdSize(); } /// @brief Lease6 update tests /// /// Checks that we are able to update a lease in the database. -TEST_F(DSCSqlLeaseMgrTest, updateLease6) { +TEST_F(CqlLeaseMgrTest, updateLease6) { testUpdateLease6(); } @@ -371,7 +371,7 @@ TEST_F(DSCSqlLeaseMgrTest, updateLease6) { /// Checks that the lease can be created, deleted and recreated with /// different parameters. It also checks that the re-created lease is /// correctly stored in the lease database. -TEST_F(DSCSqlLeaseMgrTest, testRecreateLease4) { +TEST_F(CqlLeaseMgrTest, testRecreateLease4) { testRecreateLease4(); } @@ -380,22 +380,22 @@ TEST_F(DSCSqlLeaseMgrTest, testRecreateLease4) { /// Checks that the lease can be created, deleted and recreated with /// different parameters. It also checks that the re-created lease is /// correctly stored in the lease database. -TEST_F(DSCSqlLeaseMgrTest, testRecreateLease6) { +TEST_F(CqlLeaseMgrTest, testRecreateLease6) { testRecreateLease6(); } /// @brief Checks that null DUID is not allowed. -TEST_F(DSCSqlLeaseMgrTest, nullDuid) { +TEST_F(CqlLeaseMgrTest, nullDuid) { testNullDuid(); } /// @brief Tests whether memfile can store and retrieve hardware addresses -TEST_F(DSCSqlLeaseMgrTest, testLease6Mac) { +TEST_F(CqlLeaseMgrTest, testLease6Mac) { testLease6MAC(); } /// @brief Tests whether memfile can store and retrieve hardware addresses -TEST_F(DSCSqlLeaseMgrTest, testLease6HWTypeAndSource) { +TEST_F(CqlLeaseMgrTest, testLease6HWTypeAndSource) { testLease6HWTypeAndSource(); } @@ -406,7 +406,7 @@ TEST_F(DSCSqlLeaseMgrTest, testLease6HWTypeAndSource) { /// whether only expired leases are returned, and that they are returned in /// the order from most to least expired. It also checks that the lease /// which is marked as 'reclaimed' is not returned. -TEST_F(DSCSqlLeaseMgrTest, getExpiredLeases4) { +TEST_F(CqlLeaseMgrTest, getExpiredLeases4) { testGetExpiredLeases4(); } @@ -417,17 +417,17 @@ TEST_F(DSCSqlLeaseMgrTest, getExpiredLeases4) { /// whether only expired leases are returned, and that they are returned in /// the order from most to least expired. It also checks that the lease /// which is marked as 'reclaimed' is not returned. -TEST_F(DSCSqlLeaseMgrTest, getExpiredLeases6) { +TEST_F(CqlLeaseMgrTest, getExpiredLeases6) { testGetExpiredLeases6(); } /// @brief Check that expired reclaimed DHCPv6 leases are removed. -TEST_F(DSCSqlLeaseMgrTest, deleteExpiredReclaimedLeases6) { +TEST_F(CqlLeaseMgrTest, deleteExpiredReclaimedLeases6) { testDeleteExpiredReclaimedLeases6(); } /// @brief Check that expired reclaimed DHCPv4 leases are removed. -TEST_F(DSCSqlLeaseMgrTest, deleteExpiredReclaimedLeases4) { +TEST_F(CqlLeaseMgrTest, deleteExpiredReclaimedLeases4) { testDeleteExpiredReclaimedLeases4(); } diff --git a/src/lib/dhcpsrv/testutils/dscsql_schema.cc b/src/lib/dhcpsrv/testutils/cql_schema.cc similarity index 60% rename from src/lib/dhcpsrv/testutils/dscsql_schema.cc rename to src/lib/dhcpsrv/testutils/cql_schema.cc index 579dd28590..c0f602b563 100644 --- a/src/lib/dhcpsrv/testutils/dscsql_schema.cc +++ b/src/lib/dhcpsrv/testutils/cql_schema.cc @@ -7,8 +7,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -21,24 +21,24 @@ namespace isc { namespace dhcp { namespace test { -const char* DSCSQL_VALID_TYPE = "type=cassandra"; +const char* CQL_VALID_TYPE = "type=cassandra"; string -validDSCSQLConnectionString() { - return (connectionString(DSCSQL_VALID_TYPE, VALID_NAME, VALID_HOST, +validCqlConnectionString() { + return (connectionString(CQL_VALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD)); } -void destroyDSCSQLSchema(bool show_err) { - runDSCSQLScript(DATABASE_SCRIPTS_DIR, "dscsql/dhcpdb_drop.cql", show_err); +void destroyCqlSchema(bool show_err) { + runCqlScript(DATABASE_SCRIPTS_DIR, "cql/dhcpdb_drop.cql", show_err); } -void createDSCSQLSchema(bool show_err) { - runDSCSQLScript(DATABASE_SCRIPTS_DIR, "dscsql/dhcpdb_create.cql", +void createCqlSchema(bool show_err) { + runCqlScript(DATABASE_SCRIPTS_DIR, "cql/dhcpdb_create.cql", show_err); } -void runDSCSQLScript(const std::string& path, const std::string& script_name, +void runCqlScript(const std::string& path, const std::string& script_name, bool show_err) { std::ostringstream cmd; cmd << "cqlsh -u keatest -p keatest -k keatest -f"; @@ -53,7 +53,7 @@ void runDSCSQLScript(const std::string& path, const std::string& script_name, cmd << script_name; int retval = ::system(cmd.str().c_str()); - ASSERT_EQ(0, retval) << "runDSCSQLSchema failed:" << cmd.str(); + ASSERT_EQ(0, retval) << "runCqlSchema failed:" << cmd.str(); } diff --git a/src/lib/dhcpsrv/testutils/dscsql_schema.h b/src/lib/dhcpsrv/testutils/cql_schema.h similarity index 64% rename from src/lib/dhcpsrv/testutils/dscsql_schema.h rename to src/lib/dhcpsrv/testutils/cql_schema.h index 1f927c153a..cacb32cad3 100644 --- a/src/lib/dhcpsrv/testutils/dscsql_schema.h +++ b/src/lib/dhcpsrv/testutils/cql_schema.h @@ -4,8 +4,8 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -#ifndef TEST_DSCSQL_SCHEMA_H -#define TEST_DSCSQL_SCHEMA_H +#ifndef TEST_CQL_SCHEMA_H +#define TEST_CQL_SCHEMA_H #include #include @@ -15,42 +15,42 @@ namespace isc { namespace dhcp { namespace test { -extern const char* DSCSQL_VALID_TYPE; +extern const char* CQL_VALID_TYPE; /// Return valid connection string /// -/// @return valid DSCSQL connection string. -std::string validDSCSQLConnectionString(); +/// @return valid CQL connection string. +std::string validCqlConnectionString(); /// @brief Clear everything from the database /// /// Submits the current schema drop script: /// -/// /dscsql/dhcpdb_drop.cql +/// /cql/dhcpdb_drop.cql /// -/// to the unit test DSCSQL database. If the script fails, the invoking test +/// to the unit test CQL database. If the script fails, the invoking test /// will fail. The output of stderr is suppressed unless the parameter, /// show_err is true. /// /// @param show_err flag which governs whether or not stderr is suppressed. -void destroyDSCSQLSchema(bool show_err = false); +void destroyCqlSchema(bool show_err = false); -/// @brief Create the DSCSQL Schema +/// @brief Create the CQL Schema /// /// Submits the current schema creation script: /// -/// /dscsql/dhcpdb_create.cql +/// /cql/dhcpdb_create.cql /// -/// to the unit test DSCSQL database. If the script fails, the invoking test +/// to the unit test CQL database. If the script fails, the invoking test /// will fail. The output of stderr is suppressed unless the parameter, /// show_err is true. /// /// @param show_err flag which governs whether or not stderr is suppressed. -void createDSCSQLSchema(bool show_err = false); +void createCqlSchema(bool show_err = false); -/// @brief Run a DSCSQL SQL script against the DSCSQL unit test database +/// @brief Run a CQL SQL script against the CQL unit test database /// -/// Submits the given SQL script to DSCSQL via cqlsh CLI. The output of +/// Submits the given SQL script to CQL via cqlsh CLI. The output of /// stderr is suppressed unless the parameter, show_err is true. The is done /// to suppress warnings that might otherwise make test output needlessly /// noisy. A gtest assertion occurs if the script fails to execute. @@ -58,7 +58,7 @@ void createDSCSQLSchema(bool show_err = false); /// @param path - path (if not blank) of the script to execute /// @param script_name - file name of the path to execute /// @param show_err flag which governs whether or not stderr is suppressed. -void runDSCSQLScript(const std::string& path, const std::string& script_name, +void runCqlScript(const std::string& path, const std::string& script_name, bool show_err); }; diff --git a/src/share/database/scripts/Makefile.am b/src/share/database/scripts/Makefile.am index e5a96ba995..fae380778f 100644 --- a/src/share/database/scripts/Makefile.am +++ b/src/share/database/scripts/Makefile.am @@ -1 +1 @@ -SUBDIRS = mysql pgsql dscsql +SUBDIRS = mysql pgsql cql diff --git a/src/share/database/scripts/dscsql/.gitignore b/src/share/database/scripts/cql/.gitignore similarity index 100% rename from src/share/database/scripts/dscsql/.gitignore rename to src/share/database/scripts/cql/.gitignore diff --git a/src/share/database/scripts/dscsql/Makefile.am b/src/share/database/scripts/cql/Makefile.am similarity index 65% rename from src/share/database/scripts/dscsql/Makefile.am rename to src/share/database/scripts/cql/Makefile.am index 5c876bb046..400bcfcc6d 100644 --- a/src/share/database/scripts/dscsql/Makefile.am +++ b/src/share/database/scripts/cql/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS = . -sqlscriptsdir = ${datarootdir}/${PACKAGE_NAME}/scripts/dscsql +sqlscriptsdir = ${datarootdir}/${PACKAGE_NAME}/scripts/cql sqlscripts_DATA = dhcpdb_create.cql sqlscripts_DATA += dhcpdb_drop.cql diff --git a/src/share/database/scripts/dscsql/dhcpdb_create.cql b/src/share/database/scripts/cql/dhcpdb_create.cql similarity index 96% rename from src/share/database/scripts/dscsql/dhcpdb_create.cql rename to src/share/database/scripts/cql/dhcpdb_create.cql index c8924ca4af..bf0a95d715 100644 --- a/src/share/database/scripts/dscsql/dhcpdb_create.cql +++ b/src/share/database/scripts/cql/dhcpdb_create.cql @@ -14,22 +14,22 @@ -- See the License for the specific language governing permissions and -- limitations under the License. --- This is the Kea schema specification for DataStax Cassandra SQL. +-- This is the Kea schema specification for Cassandra CQL. -- The schema is reasonably portable (with the exception of the engine --- specification, which is Datastax Cassandra SQL-specific). Minor changes might be needed for +-- specification, which is Cassandra CQL-specific). Minor changes might be needed for -- other databases. -- To create the schema, either type the command: -- cqlsh -u -p -k -f dhcpdb_create.cql --- ... at the command prompt, or log in to the DSC SQL database and at the "cqlsh>" +-- ... at the command prompt, or log in to the CQL database and at the "cqlsh>" -- prompt, issue the command: -- SOURCE dhcpdb_create.cql --- This script is also called from kea-admin, see kea-admin init dscsql +-- This script is also called from kea-admin, see kea-admin init cql -- Over time, Kea database schema will evolve. Each version is marked with -- major.minor version. This file is organized sequentially, i.e. database diff --git a/src/share/database/scripts/dscsql/dhcpdb_drop.cql b/src/share/database/scripts/cql/dhcpdb_drop.cql similarity index 100% rename from src/share/database/scripts/dscsql/dhcpdb_drop.cql rename to src/share/database/scripts/cql/dhcpdb_drop.cql