2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[#145] addressed review comments

This commit is contained in:
Razvan Becheriu
2023-05-26 18:19:25 +03:00
parent 6d7caed9b7
commit 7fd93cb0c0
3 changed files with 98 additions and 44 deletions

View File

@@ -1,3 +1,29 @@
2143. [func] razvan
Added v4 statistic counters per pool:
subnet[id].pool[id].assigned-addresses
subnet[id].pool[id].cumulative-assigned-addresses
subnet[id].pool[id].declined-addresses
subnet[id].pool[id].reclaimed-declined-addresses
subnet[id].pool[id].reclaimed-leases
subnet[id].pool[id].total-addresses
Added v6 statistic counters per pool:
subnet[id].pool[id].assigned-nas
subnet[id].pd-pool[id].assigned-pds
subnet[id].pool[id].cumulative-assigned-nas
subnet[id].pd-pool[id].cumulative-assigned-pds
subnet[id].pool[id].declined-addresses
subnet[id].pool[id].reclaimed-declined-addresses
subnet[id].pool[id].reclaimed-leases
subnet[id].pd-pool[id].reclaimed-leases
subnet[id].pool[id].total-nas
subnet[id].pd-pool[id].total-pds
Counters are stored in the lease storage and after schema
upgrade all existing leases are considered to be part of pool
ID 0. On lease update, the counters will be updated accordingly
including pool IDs and statistics will converge to real values
over time.
(Gitlab #145)
2142. [func] piotrek
New command option was added to perfdhcp: --or.
It allows to insert extra option(s) to relayed DHCPv6 message

View File

@@ -82,7 +82,26 @@ const uint8_t MAX_IDENTIFIER_TYPE = static_cast<uint8_t>(Host::LAST_IDENTIFIER_T
/// of 0 to null before inserting a host to the database.
class MySqlHostExchange {
private:
/// @brief Column numbers for each column in the hosts table.
/// These are used for both retrieving data and for looking up
/// column labels for logging. Note that their numeric order
/// MUST match that of the column order in the hosts table.
//@{
static const size_t HOST_ID_COL = 0;
static const size_t DHCP_IDENTIFIER_COL = 1;
static const size_t DHCP_IDENTIFIER_TYPE_COL = 2;
static const size_t DHCP4_SUBNET_ID_COL = 3;
static const size_t DHCP6_SUBNET_ID_COL = 4;
static const size_t IPV4_ADDRESS_COL = 5;
static const size_t HOSTNAME_COL = 6;
static const size_t DHCP4_CLIENT_CLASSES_COL = 7;
static const size_t DHCP6_CLIENT_CLASSES_COL = 8;
static const size_t USER_CONTEXT_COL = 9;
static const size_t DHCP4_NEXT_SERVER_COL = 10;
static const size_t DHCP4_SERVER_HOSTNAME_COL = 11;
static const size_t DHCP4_BOOT_FILE_NAME_COL = 12;
static const size_t AUTH_KEY_COL = 13;
//@}
/// @brief Number of columns returned for SELECT queries sent by this class.
static const size_t HOST_COLUMNS = 14;
@@ -132,20 +151,20 @@ public:
// Set the column names for use by this class. This only comprises
// names used by the MySqlHostExchange class. Derived classes will
// need to set names for the columns they use.
columns_[0] = "host_id";
columns_[1] = "dhcp_identifier";
columns_[2] = "dhcp_identifier_type";
columns_[3] = "dhcp4_subnet_id";
columns_[4] = "dhcp6_subnet_id";
columns_[5] = "ipv4_address";
columns_[6] = "hostname";
columns_[7] = "dhcp4_client_classes";
columns_[8] = "dhcp6_client_classes";
columns_[9] = "user_context";
columns_[10] = "dhcp4_next_server";
columns_[11] = "dhcp4_server_hostname";
columns_[12] = "dhcp4_boot_file_name";
columns_[13] = "auth_key";
columns_[HOST_ID_COL] = "host_id";
columns_[DHCP_IDENTIFIER_COL] = "dhcp_identifier";
columns_[DHCP_IDENTIFIER_TYPE_COL] = "dhcp_identifier_type";
columns_[DHCP4_SUBNET_ID_COL] = "dhcp4_subnet_id";
columns_[DHCP6_SUBNET_ID_COL] = "dhcp6_subnet_id";
columns_[IPV4_ADDRESS_COL] = "ipv4_address";
columns_[HOSTNAME_COL] = "hostname";
columns_[DHCP4_CLIENT_CLASSES_COL] = "dhcp4_client_classes";
columns_[DHCP6_CLIENT_CLASSES_COL] = "dhcp6_client_classes";
columns_[USER_CONTEXT_COL] = "user_context";
columns_[DHCP4_NEXT_SERVER_COL] = "dhcp4_next_server";
columns_[DHCP4_SERVER_HOSTNAME_COL] = "dhcp4_server_hostname";
columns_[DHCP4_BOOT_FILE_NAME_COL] = "dhcp4_boot_file_name";
columns_[AUTH_KEY_COL] = "auth_key";
BOOST_STATIC_ASSERT(13 < HOST_COLUMNS);
};
@@ -1630,6 +1649,7 @@ public:
columns_[2] = "prefix_len";
columns_[3] = "type";
columns_[4] = "dhcp6_iaid";
BOOST_STATIC_ASSERT(4 < RESRV_COLUMNS);
}
@@ -1761,6 +1781,16 @@ private:
class MySqlOptionExchange {
private:
static const size_t OPTION_ID_COL = 0;
static const size_t CODE_COL = 1;
static const size_t VALUE_COL = 2;
static const size_t FORMATTED_VALUE_COL = 3;
static const size_t SPACE_COL = 4;
static const size_t PERSISTENT_COL = 5;
static const size_t CANCELLED_COL = 6;
static const size_t USER_CONTEXT_COL = 7;
static const size_t DHCP_SUBNET_ID_COL = 8;
static const size_t HOST_ID_COL = 9;
/// @brief Number of columns in the option tables holding bindable values.
static const size_t OPTION_COLUMNS = 10;

View File

@@ -91,20 +91,20 @@ private:
/// These are used for both retrieving data and for looking up
/// column labels for logging. Note that their numeric order
/// MUST match that of the column order in the hosts table.
static const int HOST_ID_COL = 0;
static const int DHCP_IDENTIFIER_COL = 1;
static const int DHCP_IDENTIFIER_TYPE_COL = 2;
static const int DHCP4_SUBNET_ID_COL = 3;
static const int DHCP6_SUBNET_ID_COL = 4;
static const int IPV4_ADDRESS_COL = 5;
static const int HOSTNAME_COL = 6;
static const int DHCP4_CLIENT_CLASSES_COL = 7;
static const int DHCP6_CLIENT_CLASSES_COL = 8;
static const int USER_CONTEXT_COL = 9;
static const int DHCP4_NEXT_SERVER_COL = 10;
static const int DHCP4_SERVER_HOSTNAME_COL = 11;
static const int DHCP4_BOOT_FILE_NAME_COL = 12;
static const int AUTH_KEY_COL = 13;
static const size_t HOST_ID_COL = 0;
static const size_t DHCP_IDENTIFIER_COL = 1;
static const size_t DHCP_IDENTIFIER_TYPE_COL = 2;
static const size_t DHCP4_SUBNET_ID_COL = 3;
static const size_t DHCP6_SUBNET_ID_COL = 4;
static const size_t IPV4_ADDRESS_COL = 5;
static const size_t HOSTNAME_COL = 6;
static const size_t DHCP4_CLIENT_CLASSES_COL = 7;
static const size_t DHCP6_CLIENT_CLASSES_COL = 8;
static const size_t USER_CONTEXT_COL = 9;
static const size_t DHCP4_NEXT_SERVER_COL = 10;
static const size_t DHCP4_SERVER_HOSTNAME_COL = 11;
static const size_t DHCP4_BOOT_FILE_NAME_COL = 12;
static const size_t AUTH_KEY_COL = 13;
/// @brief Number of columns returned for SELECT queries sent by this class.
static const size_t HOST_COLUMNS = 14;
@@ -1095,6 +1095,7 @@ public:
columns_[2] = "prefix_len";
columns_[3] = "type";
columns_[4] = "dhcp6_iaid";
BOOST_STATIC_ASSERT(5 < RESRV_COLUMNS);
}
@@ -1168,20 +1169,18 @@ private:
class PgSqlOptionExchange : public PgSqlExchange {
private:
static const int OPTION_ID_COL = 0;
static const int CODE_COL = 1;
static const int VALUE_COL = 2;
static const int FORMATTED_VALUE_COL = 3;
static const int SPACE_COL = 4;
static const int PERSISTENT_COL = 5;
static const int CANCELLED_COL = 6;
static const int USER_CONTEXT_COL = 7;
static const int DHCP_CLIENT_CLASS_COL = 8;
static const int DHCP_SUBNET_ID_COL = 9;
static const int HOST_ID_COL = 10;
static const size_t OPTION_ID_COL = 0;
static const size_t CODE_COL = 1;
static const size_t VALUE_COL = 2;
static const size_t FORMATTED_VALUE_COL = 3;
static const size_t SPACE_COL = 4;
static const size_t PERSISTENT_COL = 5;
static const size_t CANCELLED_COL = 6;
static const size_t USER_CONTEXT_COL = 7;
static const size_t DHCP_SUBNET_ID_COL = 8;
static const size_t HOST_ID_COL = 9;
/// @brief Number of columns in the option tables holding bindable values.
static const size_t OPTION_COLUMNS = 11;
static const size_t OPTION_COLUMNS = 10;
public:
@@ -1197,11 +1196,10 @@ public:
columns_[PERSISTENT_COL] = "persistent";
columns_[CANCELLED_COL] = "cancelled";
columns_[USER_CONTEXT_COL] = "user_context";
columns_[DHCP_CLIENT_CLASS_COL] = "dhcp_client_class";
columns_[DHCP_SUBNET_ID_COL] = "dhcp_subnet_id";
columns_[HOST_ID_COL] = "host_id";
BOOST_STATIC_ASSERT(11 <= OPTION_COLUMNS);
BOOST_STATIC_ASSERT(10 <= OPTION_COLUMNS);
}
/// @brief Creates binding array to insert option data into database.