2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-28 20:47:48 +00:00

172 Commits

Author SHA1 Message Date
Tomek Mrugalski
5db1f8ff5f [github88] Removed remaining instances of getLeases6(DUID) 2018-07-23 16:04:30 +02:00
mayya
2ff46b2dd5 [extend_host_struct] Fix review comments 2018-07-23 13:40:31 +02:00
mayya
2090af48c1 [lib] Extend host structure to support auth keys for reconfiguration.
See issue #83
2018-07-23 13:31:03 +02:00
Marcin Siodelski
b056828212 [master] Merge branch 'trac5651'
# Conflicts:
#	doc/guide/hooks.xml
#	src/lib/dhcpsrv/cql_lease_mgr.cc
2018-07-09 14:37:16 +02:00
Marcin Siodelski
ed42dddca9 [5651] Removed unused SQL/CQL queries. 2018-06-28 16:50:07 +02:00
Marcin Siodelski
1911064d76 [5651] Removed lease queries by ranges and total lease count. 2018-06-28 14:02:32 +02:00
Marcin Siodelski
74e13e92fe [5651] Guard against invalid address family. 2018-06-26 14:49:36 +02:00
Marcin Siodelski
25595be427 [5651] Implemented fetching IPv6 leases by address ranges.
Except Cassandra.
2018-06-26 13:53:01 +02:00
Marcin Siodelski
99da64ffd5 [5651] Implemented fetching IPv6 leases with paging. 2018-06-26 10:27:07 +02:00
Marcin Siodelski
122bb75a7a [5651] Implemented LeaseMgr methods retrieving ranges/pages of IPv4 leases. 2018-06-25 21:47:20 +02:00
Francis Dupont
fe5098fdb3 [5584] Checkpoint: updated schema, code and partially tests 2018-06-21 11:15:48 +02:00
Thomas Markwalder
3a4e989317 [5629] MySQL and PostgreSQL host backends now verify schema version
src/lib/dhcpsrv/mysql_host_data_source.cc
    MySqlHostDataSourceImpl::getVersion() - new function to
    fetch version accessible to impl constructor

    MySqlHostDataSourceImpl() - added schema validation after
    connecting

    MySqlHostDataSource::getVersion() - new uses impl method

src/lib/dhcpsrv/pgsql_host_data_source.cc
    PgSqlHostDataSourceImpl()) - added schema validation after
    connecting

    PgSqlHostDataSourceImpl::getVersion() - no longer uses
    pre-prepared statement
2018-05-31 11:51:19 -04:00
Thomas Markwalder
7614eb8d2b [5629] MySQL Lease back end now validates schema after connecting
src/lib/dhcpsrv/mysql_lease_mgr.*
    MySqlLeaseMgr::MySqlLeaseMgr() - now validates schema
    after connecting

    MySqlLeaseMgr::getVersion()  - no longer relies on
    pre-prepared statement or formal statement execution
    error handling

src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
    LeaseMgrDbLostCallbackTest::testDbLostCallback() - replaced
    use of getVersion() with getLease4() for testing DB usability
2018-05-31 09:41:46 -04:00
Marcin Siodelski
3ade7065e0 [5586] Corrected some little typos as a result of review. 2018-05-07 16:13:00 +02:00
Thomas Markwalder
a662ab45d9 [5586] MySQL shared leases stats implemented
src/share/database/scripts/mysql/dhcpdb_create.mysql
    src/share/database/scripts/mysql/dhcpdb_drop.mysql
    src/share/database/scripts/mysql/upgrade_5.2_to_6.0.sh.in
        Added MySQL v4/6 stat tables and triggers

    src/lib/dhcpsrv/memfile_lease_mgr.cc
        Suppress output of of rows with count values of 0

    src/lib/dhcpsrv/mysql_lease_mgr.*
        Added v4/v6 lease stat SQL statements

        MySqlLeaseStatsQuery
        - Added ctor variants that accomodate selection criteria
        - Modified start() to handle three variants of selection

        MySqlLeaseMgr
        - Added start***Query4/6 variants

    src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc
        Added tests:
        - TEST_F(MySqlLeaseMgrTest, leaseStatsQuery4)
        - TEST_F(MySqlLeaseMgrTest, leaseStatsQuery6)
2018-05-02 13:36:02 -04:00
Thomas Markwalder
f09bf17e2e [5556a] MySQL lease and host backends now support configurable auto-reconnect
src/lib/dhcpsrv/mysql_connection.h
        MySqlConnection::checkError<>() - modified to invoke
        db lost callback

    src/lib/dhcpsrv/dhcpsrv_messages.mes
        Updated log messages

    src/lib/dhcpsrv/mysql_lease_mgr.cc
        MySqlLeaseMgr::getVersion() - updated to use checkError()

    src/lib/dhcpsrv/pgsql_connection.*
        PgSqlResult::PgSqlResult(PGresult *result) - now supports
        construction with null PGresult. This is to accomodate rare
        cases when PQ* statements can return NULL.

    src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.*
        class LeaseMgrDbLostCallbackTest - new test fixture for
        testing LeaseMgr DBLostCallback behavior

    src/lib/dhcpsrv/tests/host_mgr_unittest.cc
        class HostMgrDbLostCallbackTest
        class MySQLHostMgrDbLostCallbackTest
        class PostgreSQLHostMgrDbLostCallbackTest
        - new test fixtures for testing HostMgr DBLostCallback behavior

    src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc
        class MySQLLeaseMgrDbLostCallbackTest - new test fixture for
        testing MySQL LeaseMgr DBLostCallback behavior

    src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc
        class PgSqlLeaseMgrDbLostCallbackTest - new test fixture for
        testing Postgresql LeaseMgr DBLostCallback behavior

    src/lib/dhcpsrv/tests/test_utils.*
        int findLastSocketFd() - new function used for finding what
        should be the fd of the SQL client socket

    doc/guide/dhcp4-srv.xml
    doc/guide/dhcp6-srv.xml
        Updated lease and host database parameter sections
2018-04-06 15:16:24 -04:00
Francis Dupont
a0bb7188df [master] Finishing merge of trac5469 (lease6-get-all) 2018-03-31 16:49:15 +02:00
Francis Dupont
d6a49e1f2f Checkpoint: addressed final comment but not yet tested 2018-03-16 14:42:24 +01:00
Razvan Becheriu
60b7ca2bd7 minor changes 2018-02-19 20:50:14 +02:00
Razvan Becheriu
89f9332e68 minor changes 2018-02-19 19:28:03 +02:00
Razvan Becheriu
e9e8389d45 enabled more tests, implemented hwaddr, hwtype and hwaddr_source in pgsql 2018-02-19 16:14:38 +02:00
Razvan Becheriu
761f2823a1 minor changes 2018-02-15 10:41:47 +02:00
Razvan Becheriu
e409c164a6 added missing tables, columns and values in cql schema, ordered declarations and definitions in lease and host managers 2018-02-13 18:28:40 +02:00
Francis Dupont
e0abc5ac7c [5469] Moved to composite index in C++ code too 2018-01-17 19:28:57 +01:00
Francis Dupont
cfe529dff1 [5469] checkpoint (copied with 4 -> 6) 2018-01-13 00:24:41 +01:00
Francis Dupont
369ff55081 [5468] A few trivial fixes 2018-01-12 06:11:04 +01:00
Marcin Siodelski
2732257202 [5468] Implemented getting leases by subnet id and all leases.
This change affects Memfile, MySQL and Postgres backend. These functions
aren't implemented for CQL at this time.
2018-01-09 14:49:14 +01:00
Tomek Mrugalski
574356fa9e [5280] leaseWipe4,6 implemented in lease managers (base and memfile) 2017-08-07 18:25:27 +02:00
Wlodek Wencel
9e3ca83d07 [v_1_2_0] copy right dates updated 2017-04-12 15:47:26 +02:00
Andrei Pavel
9082500187 Corrected typos 2016-12-14 16:57:44 +02:00
Marcin Siodelski
8cce1aa713 [5009] Implemented get6(subnet_id, address) function for SQL backends.
Also removed uint32_t cast operator from IOAddress to remove
ambiguity when calling this new function.
2016-09-20 09:29:06 +02:00
Marcin Siodelski
97ae6373fb [3161] Explicitly initialize uninitialized variables.
Reported by cpp-check.
2016-09-13 15:07:57 +02:00
Thomas Markwalder
bb040d046a [master] Fixed doxygen errors introduced by 4294.
modified:   src/lib/dhcpsrv/mysql_lease_mgr.cc
modified:   src/lib/dhcpsrv/pgsql_lease_mgr.cc
2016-08-25 13:37:46 -04:00
Thomas Markwalder
0abdcf15f8 [master] kea-dhcp4 and kea-dhcp6 now recalculate lease stats after reconfigure
Merges in trac4294
2016-08-25 11:42:54 -04:00
Thomas Markwalder
569b5a87dc [4294] Minor clean ups 2016-08-24 10:40:34 -04:00
Thomas Markwalder
0833798a33 [4294] Refactored MySql stats classes
src/lib/dhcpsrv/mysql_lease_mgr.h
src/lib/dhcpsrv/mysql_lease_mgr.cc
    Replaced this class heirarchy:
        AddressStatsQuery4 <-- MySqlAddressStatsQuery4
        AddressStatsQuery6 <-- MySqlAddressStatsQuery6

    With this one:
        LeaseStatsQuery <-- MySqlLeaseStatsQuery
2016-08-24 08:50:47 -04:00
Thomas Markwalder
86411b64ad [4294] Reverted Lease states back to uin32_t per review comments
I had replaced the uint32_t constants for lease states with an enum.
Tomek stated that they should remain uin32_t as they may eventually be bitmasks.
2016-08-23 14:16:46 -04:00
Thomas Markwalder
d619d5e38b [4294] More clean up 2016-08-17 09:48:32 -04:00
Marcin Siodelski
4a8efcb45a [4489] Addressed review comments.
The only review item not addressed with this commit is the
implementation of unit test that operates on the read only
database, i.e. the database containing tables on which the
given user only has SELECT privileges.
2016-08-17 11:22:24 +02:00
Thomas Markwalder
45d4cdc689 [4294] Minor cleanup 2016-08-16 15:23:33 -04:00
Thomas Markwalder
efbf437f6d [4294] PostgreSQL now supports IPv6 lease stats recounting
src/lib/dhcpsrv/pgsql_lease_mgr.h
src/lib/dhcpsrv/pgsql_lease_mgr.cc
    - Added TaggedStatement RECOUNT_LEASE6_STATS
    - PgSqlAddressStatsQuery6 - new class PgSql derivation of the IPv6
    statistical lease data query
    - PgSqlLeaseMgr::startAddressStatsQuery6() - new virtual method which
    creates and runs the IPv6 lease stats query

src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc
    TEST_F(PgSqlLeaseMgrTest, recountAddressStats6) - new test
2016-08-16 12:01:21 -04:00
Thomas Markwalder
6f56be5aa2 [4294] Unit tests and MySql now support IPv6 lease stat recounting
src/lib/dhcpsrv/cfg_subnets6.cc
    - CfgSubnets6::removeStatistics() - added removal of declined stats
    - CfgSubnets6::updateStatistics() - added call to recountAddressStats6()

src/lib/dhcpsrv/mysql_lease_mgr.h
src/lib/dhcpsrv/mysql_lease_mgr.cc
    - Added TaggedStatement RECOUNT_LEASE6_STATS
    - MySqlAddressStatsQuery6 - new MySql derivation of AddressStatsQuery6
    - MySqlLeaseMgr::startAddressStatsQuery6() - new virtual method which
    creates and starts a MySqlAddressStatsQuery6

src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
    - GenericLeaseMgrTest::checkAddressStats4 renamed to checkAddressStats as
    it applies to either v4 or v6
    - GenericLeaseMgrTest::makeLease6() - new method which creates a minimal
    IPv6 lease and adds it to lease storage
    - GenericLeaseMgrTest::testRecountAddressStats6() - new method which
    checks IPv6 lease stats recounting

src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc
    - TEST_F(MySqlLeaseMgrTest, recountAddressStats6) - new test
2016-08-16 11:13:17 -04:00
Thomas Markwalder
64c23c76ca [4294] PostgreSQL now supports IPv4 lease stats recount
src/lib/dhcpsrv/cfg_subnets4.cc
    CfgSubnets4::updateStatistics() - removed lease mgr instance check

src/lib/dhcpsrv/mysql_lease_mgr.cc
    Added "ORDER by subnet_id" to RECOUNT_LEASE4_STATS

src/lib/dhcpsrv/pgsql_lease_mgr.cc
    Added tagged statement RECOUNT_LEASE4_STATS
    PgSqlAddressStatsQuery4 - new class, PostgreSQL derivation of AddressStatsQuery4
    PgSqlLeaseMgr::startAddressStatsQuery4() - PostgreSQL impl of virtual method

src/lib/dhcpsrv/srv_config.cc -
    SrvConfig::updateStatistics() - Added LeaseMgr singleton check around
    calls subnet statistics updates

src/lib/dhcpsrv/tests/cfgmgr_unittest.cc
    CfgMgrTest:
       ~CfgMgrTest() - now destroys LeaseMgr singleton
       startBackend(int family = AF_INET) -  new method to create memfile lease mgr

        TEST_F(CfgMgrTest, commitStats4)
        TEST_F(CfgMgrTest, commitStats6)
    - added call to startBackend()

src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc
    TEST_F(PgSqlLeaseMgrTest, recountAddressStats4) - new test
2016-08-15 10:25:25 -04:00
Thomas Markwalder
a8f85f2508 [4294] Memfile and MySql now support recalulating IPv4 lease statistics
src/lib/dhcpsrv/cfg_subnets4.cc
    CfgSubnets4::removeStatistics()
    - added removal of all lease statistics per subnet, and global declined address
    stats

    CfgSubnets4::updateStatistics()
    - added call to LeaseMgr::recountAddressStats4

src/lib/dhcpsrv/lease.cc
src/lib/dhcpsrv/lease.h
    Replaces lease state constants with LeaseState enumeration.

src/lib/dhcpsrv/lease_mgr.cc
src/lib/dhcpsrv/lease_mgr.h
    struct AddressStatsRow4 - contains the content of one row of the IPv4
    lease statistical data result set

    class AddressStatsQuery4 - base class for constructing the IPv4
    lease statistical data result set for an IPv4 lease storage

    LeaseMgr::recountAddressStats4() -  new method which recalculates
    per-subnet and global stats for IPv4 leases

    LeaseMgr::startAddressStatsQuery4() - new virtual method that fetches
    the IPv4 lease statistical data result set

src/lib/dhcpsrv/lease_mgr_factory.h
src/lib/dhcpsrv/lease_mgr_factory.cc
    LeaseMgrFactory::haveInstance() - new static method which indicates
    whether or not the lease manager singleton exists

src/lib/dhcpsrv/memfile_lease_mgr.h
src/lib/dhcpsrv/memfile_lease_mgr.cc
    MemfileAddressStatsQuery4 - Derivation of AddressStatsQuery4, it constructs
    the IPv4 lease statistical data by iterating over IPv4 lease storage

    Memfile_LeaseMgr::startAddressStatsQuery4() - new virtual method which
    creates, starts, and returns a MemfileAddressStatsQuery4

src/lib/dhcpsrv/memfile_lease_storage.h
    Added an a per subnet_ID index to IPv4 storage

src/lib/dhcpsrv/mysql_lease_mgr.h
src/lib/dhcpsrv/mysql_lease_mgr.cc
    - Added RECOUNT_LEASE4_STATS query

    MySqlAddressStatsQuery4 Derivation of AddressStatsQuery4, it constructs
    the IPv4 lease statistical data by executing RECOUNT_LEASE4_STATS

    MySqlLeaseMgr::startAddressStatsQuery4() - new virtual method which
    creates, starts, and returns a MySqlAddressStatsQuery4

src/lib/dhcpsrv/tests/alloc_engine_utils.cc
    AllocEngine6Test::AllocEngine6Test()
    AllocEngine4Test::AllocEngine4Test()
    - moved lease mgr create up above configuration commit

src/lib/dhcpsrv/tests/cfg_db_access_unittest.cc
     ~CfgMySQLDbAccessTest() - added destruction of lease manager singleton,
    otherwise subsequent tests can fail

src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
    GenericLeaseMgrTest::checkStat() - new method for comparing a stat
    GenericLeaseMgrTest::checkAddressStats4() - new method for comparing a list
    of stats
    GenericLeaseMgrTest::makeLease4() - new method for making a minimal lease
    GenericLeaseMgrTest::testRecountAddressStats4() - new method which tests
    a lease manager's ability to recalculate the IPv4 lease statistics

src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
    TEST_F(MemfileLeaseMgrTest, recountAddressStats4) - new test which tests
    Memfile_LeaseMgr's ability to recalculate IPv4 lease statistics

src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc
    TEST_F(MySqlLeaseMgrTest, recountAddressStats4) - new test which tests
    MySqlLeaseMgr's ability to recalculate IPv4 lease statistics
2016-08-12 14:02:35 -04:00
Marcin Siodelski
65d3817db8 [4489] Added support for read only mode in MySQL HR backend. 2016-07-28 12:56:58 +02:00
Francis Dupont
75a8350485 [master] Fixed rights of non-executable regular files 2016-07-08 20:38:15 +02:00
Tomek Mrugalski
c629300a70 fixed compilation issues for cql unittests
# Conflicts:
#	src/lib/dhcpsrv/pgsql_lease_mgr.h
2016-06-23 14:32:06 +02:00
Marcin Siodelski
61ca023498 [4281] Addressed further review comments.
- Always invoke mysql_insert_id to retrieve host_id value
- exit if connection with  MySql database is lost
2016-05-30 11:30:26 +02:00
Marcin Siodelski
fe9dd86d20 [4236] Replaced license text in all files containing it. 2015-12-16 13:37:29 +01:00
Tomek Mrugalski
65efc0da7f [3682_rebase] Merge branch 'trac3682' into trac3682_rebase
# Conflicts:
#	src/lib/dhcpsrv/mysql_lease_mgr.cc
#	src/lib/dhcpsrv/mysql_lease_mgr.h
2015-11-30 21:26:25 +01:00