Commit fe232dab authored by Francis Dupont's avatar Francis Dupont
Browse files

[5533a] Rebased

parents b4f3640c 48088cdb
[submodule "premium"]
path = premium
url = ssh://fdupont@repo.isc.org/proj/git/prod/kea-premium.git
......@@ -54,13 +54,17 @@
// reservations list, within the subnet (configuration file). If there are
// no reservations there, the server will try to retrieve reservations
// from this database.
"hosts-database": {
"type": "postgresql",
"name": "kea",
"user": "kea",
"password": "kea",
"host": "localhost"
},
// The database specification can go into one hosts-database entry for
// backward compatibility or be listed in hosts-databases list.
"hosts-databases": [
{
"type": "postgresql",
"name": "kea",
"user": "kea",
"password": "kea",
"host": "localhost"
}
],
// Define a subnet with a single pool of dynamic addresses. Addresses from
// this pool will be assigned to clients which don't have reservations in the
......
......@@ -41,13 +41,17 @@
// reservations list, within the subnet (configuration file). If there are
// no reservations there, the server will try to retrieve reservations
// from this database.
"hosts-database": {
"type": "postgresql",
"name": "kea",
"user": "kea",
"password": "kea",
"host": "localhost"
},
// The database specification can go into one hosts-database entry for
// backward compatibility or be listed in hosts-databases list.
"hosts-databases": [
{
"type": "postgresql",
"name": "kea",
"user": "kea",
"password": "kea",
"host": "localhost"
}
],
// Define a subnet with a pool of dynamic addresses and a pool of dynamic
// prefixes. Addresses and prefixes from those pools will be assigned to
......
......@@ -529,7 +529,13 @@ If a timeout is given though, it should be an integer greater than zero.
from the configuration file are checked first and external storage is checked
later, if necessary.</para>
<section xml:id="hosts-database-configuration4">
<para>Version 1.4 extends the host storage to multiple storages. Operations
are performed on host storages in the configuration order with a special
case for addition: read-only storages must be configured after a
required read-write storage, or host reservation addition will
always fail.</para>
<section xml:id="hosts-databases-configuration4">
<title>DHCPv4 Hosts Database Configuration</title>
<para>Hosts database configuration is controlled through the Dhcp4/hosts-database
......@@ -572,6 +578,16 @@ If a timeout is given though, it should be an integer greater than zero.
</screen>
If there is no password to the account, set the password to the empty string
"". (This is also the default.)</para>
<para>The multiple storage extension uses a similar syntax: a configuration
is placed into a "hosts-databases" list instead of into a "hosts-database"
entry as in:
<screen>
"Dhcp4": { "hosts-databases": [ { <userinput>"type": "mysql"</userinput>, ... }, ... ], ... }
</screen>
</para>
</section>
<section xml:id="read-only-database-configuration4">
......
......@@ -525,7 +525,13 @@ If a timeout is given though, it should be an integer greater than zero.
from the configuration file are checked first and external storage is checked
later, if necessary.</para>
<section xml:id="hosts-database-configuration6">
<para>Version 1.4 extends the host storage to multiple storages. Operations
are performed on host storages in the configuration order with a special
case for addition: read-only storages must be configured after a
required read-write storage, or host reservation addition will
always fail.</para>
<section xml:id="hosts-databases-configuration6">
<title>DHCPv6 Hosts Database Configuration</title>
<para>Hosts database configuration is controlled through the Dhcp6/hosts-database
......@@ -565,6 +571,16 @@ If a timeout is given though, it should be an integer greater than zero.
</screen>
If there is no password to the account, set the password to the empty string
"". (This is also the default.)</para>
<para>The multiple storage extension uses a similar syntax: a configuration
is placed into a "hosts-databases" list instead of into a "hosts-database"
entry as in:
<screen>
"Dhcp6": { "hosts-databases": [ { <userinput>"type": "mysql"</userinput>, ... }, ... ], ... }
</screen>
</para>
</section>
<section xml:id="read-only-database-configuration6">
......
......@@ -1083,9 +1083,9 @@ $
criteria). To use commands that change the reservation information
(currently these are reservation-add and reservation-del, but this
rule applies to other commands that may be implemented in the future),
hosts database must be specified (see hosts-database description in
<xref linkend="hosts-database-configuration4"/> and <xref linkend="hosts-database-configuration6"/>) and it must not operate in
read-only mode. If the hosts-database is not specified or is running
hosts database must be specified (see hosts-databases description in
<xref linkend="hosts-databases-configuration4"/> and <xref linkend="hosts-databases-configuration6"/>) and it must not operate in
read-only mode. If the hosts-databases are not specified or are running
in read-only mode, the host_cmds library will load, but any attempts
to use reservation-add or reservation-del will fail.
</para>
......@@ -1204,8 +1204,8 @@ Here is an example of complex IPv6 reservation:
<para>
As <command>reservation-add</command> is expected to store the host,
hosts-database parameter must be specified in your configuration and
the database must not run in read-only mode. In the future versions
hosts-databases parameter must be specified in your configuration and
databases must not run in read-only mode. In the future versions
it will be possible to modify the reservations read from a
configuration file. Please contact ISC if you are interested in this
functionality.
......
premium @ 7eae81e9
Subproject commit 7eae81e92f9ea28349f0c933a5123c20483bc078
This diff is collapsed.
/* Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
/* Copyright (C) 2016-2018 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
......@@ -294,6 +294,15 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"hosts-databases\" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::DHCP4:
return isc::dhcp::Dhcp4Parser::make_HOSTS_DATABASES(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("hosts-databases", driver.loc_);
}
}
\"readonly\" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::HOSTS_DATABASE:
......
This diff is collapsed.
......@@ -372,131 +372,132 @@ namespace isc { namespace dhcp {
TOKEN_BOOT_FILE_NAME = 279,
TOKEN_LEASE_DATABASE = 280,
TOKEN_HOSTS_DATABASE = 281,
TOKEN_TYPE = 282,
TOKEN_MEMFILE = 283,
TOKEN_MYSQL = 284,
TOKEN_POSTGRESQL = 285,
TOKEN_CQL = 286,
TOKEN_USER = 287,
TOKEN_PASSWORD = 288,
TOKEN_HOST = 289,
TOKEN_PORT = 290,
TOKEN_PERSIST = 291,
TOKEN_LFC_INTERVAL = 292,
TOKEN_READONLY = 293,
TOKEN_CONNECT_TIMEOUT = 294,
TOKEN_CONTACT_POINTS = 295,
TOKEN_KEYSPACE = 296,
TOKEN_VALID_LIFETIME = 297,
TOKEN_RENEW_TIMER = 298,
TOKEN_REBIND_TIMER = 299,
TOKEN_DECLINE_PROBATION_PERIOD = 300,
TOKEN_SUBNET4 = 301,
TOKEN_SUBNET_4O6_INTERFACE = 302,
TOKEN_SUBNET_4O6_INTERFACE_ID = 303,
TOKEN_SUBNET_4O6_SUBNET = 304,
TOKEN_OPTION_DEF = 305,
TOKEN_OPTION_DATA = 306,
TOKEN_NAME = 307,
TOKEN_DATA = 308,
TOKEN_CODE = 309,
TOKEN_SPACE = 310,
TOKEN_CSV_FORMAT = 311,
TOKEN_ALWAYS_SEND = 312,
TOKEN_RECORD_TYPES = 313,
TOKEN_ENCAPSULATE = 314,
TOKEN_ARRAY = 315,
TOKEN_SHARED_NETWORKS = 316,
TOKEN_POOLS = 317,
TOKEN_POOL = 318,
TOKEN_USER_CONTEXT = 319,
TOKEN_COMMENT = 320,
TOKEN_SUBNET = 321,
TOKEN_INTERFACE = 322,
TOKEN_INTERFACE_ID = 323,
TOKEN_ID = 324,
TOKEN_RAPID_COMMIT = 325,
TOKEN_RESERVATION_MODE = 326,
TOKEN_DISABLED = 327,
TOKEN_OUT_OF_POOL = 328,
TOKEN_ALL = 329,
TOKEN_HOST_RESERVATION_IDENTIFIERS = 330,
TOKEN_CLIENT_CLASSES = 331,
TOKEN_TEST = 332,
TOKEN_CLIENT_CLASS = 333,
TOKEN_RESERVATIONS = 334,
TOKEN_DUID = 335,
TOKEN_HW_ADDRESS = 336,
TOKEN_CIRCUIT_ID = 337,
TOKEN_CLIENT_ID = 338,
TOKEN_HOSTNAME = 339,
TOKEN_FLEX_ID = 340,
TOKEN_RELAY = 341,
TOKEN_IP_ADDRESS = 342,
TOKEN_HOOKS_LIBRARIES = 343,
TOKEN_LIBRARY = 344,
TOKEN_PARAMETERS = 345,
TOKEN_EXPIRED_LEASES_PROCESSING = 346,
TOKEN_RECLAIM_TIMER_WAIT_TIME = 347,
TOKEN_FLUSH_RECLAIMED_TIMER_WAIT_TIME = 348,
TOKEN_HOLD_RECLAIMED_TIME = 349,
TOKEN_MAX_RECLAIM_LEASES = 350,
TOKEN_MAX_RECLAIM_TIME = 351,
TOKEN_UNWARNED_RECLAIM_CYCLES = 352,
TOKEN_DHCP4O6_PORT = 353,
TOKEN_CONTROL_SOCKET = 354,
TOKEN_SOCKET_TYPE = 355,
TOKEN_SOCKET_NAME = 356,
TOKEN_DHCP_DDNS = 357,
TOKEN_ENABLE_UPDATES = 358,
TOKEN_QUALIFYING_SUFFIX = 359,
TOKEN_SERVER_IP = 360,
TOKEN_SERVER_PORT = 361,
TOKEN_SENDER_IP = 362,
TOKEN_SENDER_PORT = 363,
TOKEN_MAX_QUEUE_SIZE = 364,
TOKEN_NCR_PROTOCOL = 365,
TOKEN_NCR_FORMAT = 366,
TOKEN_ALWAYS_INCLUDE_FQDN = 367,
TOKEN_OVERRIDE_NO_UPDATE = 368,
TOKEN_OVERRIDE_CLIENT_UPDATE = 369,
TOKEN_REPLACE_CLIENT_NAME = 370,
TOKEN_GENERATED_PREFIX = 371,
TOKEN_TCP = 372,
TOKEN_JSON = 373,
TOKEN_WHEN_PRESENT = 374,
TOKEN_NEVER = 375,
TOKEN_ALWAYS = 376,
TOKEN_WHEN_NOT_PRESENT = 377,
TOKEN_LOGGING = 378,
TOKEN_LOGGERS = 379,
TOKEN_OUTPUT_OPTIONS = 380,
TOKEN_OUTPUT = 381,
TOKEN_DEBUGLEVEL = 382,
TOKEN_SEVERITY = 383,
TOKEN_FLUSH = 384,
TOKEN_MAXSIZE = 385,
TOKEN_MAXVER = 386,
TOKEN_DHCP6 = 387,
TOKEN_DHCPDDNS = 388,
TOKEN_CONTROL_AGENT = 389,
TOKEN_TOPLEVEL_JSON = 390,
TOKEN_TOPLEVEL_DHCP4 = 391,
TOKEN_SUB_DHCP4 = 392,
TOKEN_SUB_INTERFACES4 = 393,
TOKEN_SUB_SUBNET4 = 394,
TOKEN_SUB_POOL4 = 395,
TOKEN_SUB_RESERVATION = 396,
TOKEN_SUB_OPTION_DEFS = 397,
TOKEN_SUB_OPTION_DEF = 398,
TOKEN_SUB_OPTION_DATA = 399,
TOKEN_SUB_HOOKS_LIBRARY = 400,
TOKEN_SUB_DHCP_DDNS = 401,
TOKEN_SUB_LOGGING = 402,
TOKEN_STRING = 403,
TOKEN_INTEGER = 404,
TOKEN_FLOAT = 405,
TOKEN_BOOLEAN = 406
TOKEN_HOSTS_DATABASES = 282,
TOKEN_TYPE = 283,
TOKEN_MEMFILE = 284,
TOKEN_MYSQL = 285,
TOKEN_POSTGRESQL = 286,
TOKEN_CQL = 287,
TOKEN_USER = 288,
TOKEN_PASSWORD = 289,
TOKEN_HOST = 290,
TOKEN_PORT = 291,
TOKEN_PERSIST = 292,
TOKEN_LFC_INTERVAL = 293,
TOKEN_READONLY = 294,
TOKEN_CONNECT_TIMEOUT = 295,
TOKEN_CONTACT_POINTS = 296,
TOKEN_KEYSPACE = 297,
TOKEN_VALID_LIFETIME = 298,
TOKEN_RENEW_TIMER = 299,
TOKEN_REBIND_TIMER = 300,
TOKEN_DECLINE_PROBATION_PERIOD = 301,
TOKEN_SUBNET4 = 302,
TOKEN_SUBNET_4O6_INTERFACE = 303,
TOKEN_SUBNET_4O6_INTERFACE_ID = 304,
TOKEN_SUBNET_4O6_SUBNET = 305,
TOKEN_OPTION_DEF = 306,
TOKEN_OPTION_DATA = 307,
TOKEN_NAME = 308,
TOKEN_DATA = 309,
TOKEN_CODE = 310,
TOKEN_SPACE = 311,
TOKEN_CSV_FORMAT = 312,
TOKEN_ALWAYS_SEND = 313,
TOKEN_RECORD_TYPES = 314,
TOKEN_ENCAPSULATE = 315,
TOKEN_ARRAY = 316,
TOKEN_SHARED_NETWORKS = 317,
TOKEN_POOLS = 318,
TOKEN_POOL = 319,
TOKEN_USER_CONTEXT = 320,
TOKEN_COMMENT = 321,
TOKEN_SUBNET = 322,
TOKEN_INTERFACE = 323,
TOKEN_INTERFACE_ID = 324,
TOKEN_ID = 325,
TOKEN_RAPID_COMMIT = 326,
TOKEN_RESERVATION_MODE = 327,
TOKEN_DISABLED = 328,
TOKEN_OUT_OF_POOL = 329,
TOKEN_ALL = 330,
TOKEN_HOST_RESERVATION_IDENTIFIERS = 331,
TOKEN_CLIENT_CLASSES = 332,
TOKEN_TEST = 333,
TOKEN_CLIENT_CLASS = 334,
TOKEN_RESERVATIONS = 335,
TOKEN_DUID = 336,
TOKEN_HW_ADDRESS = 337,
TOKEN_CIRCUIT_ID = 338,
TOKEN_CLIENT_ID = 339,
TOKEN_HOSTNAME = 340,
TOKEN_FLEX_ID = 341,
TOKEN_RELAY = 342,
TOKEN_IP_ADDRESS = 343,
TOKEN_HOOKS_LIBRARIES = 344,
TOKEN_LIBRARY = 345,
TOKEN_PARAMETERS = 346,
TOKEN_EXPIRED_LEASES_PROCESSING = 347,
TOKEN_RECLAIM_TIMER_WAIT_TIME = 348,
TOKEN_FLUSH_RECLAIMED_TIMER_WAIT_TIME = 349,
TOKEN_HOLD_RECLAIMED_TIME = 350,
TOKEN_MAX_RECLAIM_LEASES = 351,
TOKEN_MAX_RECLAIM_TIME = 352,
TOKEN_UNWARNED_RECLAIM_CYCLES = 353,
TOKEN_DHCP4O6_PORT = 354,
TOKEN_CONTROL_SOCKET = 355,
TOKEN_SOCKET_TYPE = 356,
TOKEN_SOCKET_NAME = 357,
TOKEN_DHCP_DDNS = 358,
TOKEN_ENABLE_UPDATES = 359,
TOKEN_QUALIFYING_SUFFIX = 360,
TOKEN_SERVER_IP = 361,
TOKEN_SERVER_PORT = 362,
TOKEN_SENDER_IP = 363,
TOKEN_SENDER_PORT = 364,
TOKEN_MAX_QUEUE_SIZE = 365,
TOKEN_NCR_PROTOCOL = 366,
TOKEN_NCR_FORMAT = 367,
TOKEN_ALWAYS_INCLUDE_FQDN = 368,
TOKEN_OVERRIDE_NO_UPDATE = 369,
TOKEN_OVERRIDE_CLIENT_UPDATE = 370,
TOKEN_REPLACE_CLIENT_NAME = 371,
TOKEN_GENERATED_PREFIX = 372,
TOKEN_TCP = 373,
TOKEN_JSON = 374,
TOKEN_WHEN_PRESENT = 375,
TOKEN_NEVER = 376,
TOKEN_ALWAYS = 377,
TOKEN_WHEN_NOT_PRESENT = 378,
TOKEN_LOGGING = 379,
TOKEN_LOGGERS = 380,
TOKEN_OUTPUT_OPTIONS = 381,
TOKEN_OUTPUT = 382,
TOKEN_DEBUGLEVEL = 383,
TOKEN_SEVERITY = 384,
TOKEN_FLUSH = 385,
TOKEN_MAXSIZE = 386,
TOKEN_MAXVER = 387,
TOKEN_DHCP6 = 388,
TOKEN_DHCPDDNS = 389,
TOKEN_CONTROL_AGENT = 390,
TOKEN_TOPLEVEL_JSON = 391,
TOKEN_TOPLEVEL_DHCP4 = 392,
TOKEN_SUB_DHCP4 = 393,
TOKEN_SUB_INTERFACES4 = 394,
TOKEN_SUB_SUBNET4 = 395,
TOKEN_SUB_POOL4 = 396,
TOKEN_SUB_RESERVATION = 397,
TOKEN_SUB_OPTION_DEFS = 398,
TOKEN_SUB_OPTION_DEF = 399,
TOKEN_SUB_OPTION_DATA = 400,
TOKEN_SUB_HOOKS_LIBRARY = 401,
TOKEN_SUB_DHCP_DDNS = 402,
TOKEN_SUB_LOGGING = 403,
TOKEN_STRING = 404,
TOKEN_INTEGER = 405,
TOKEN_FLOAT = 406,
TOKEN_BOOLEAN = 407
};
};
......@@ -711,6 +712,10 @@ namespace isc { namespace dhcp {
symbol_type
make_HOSTS_DATABASE (const location_type& l);
static inline
symbol_type
make_HOSTS_DATABASES (const location_type& l);
static inline
symbol_type
make_TYPE (const location_type& l);
......@@ -1416,12 +1421,12 @@ namespace isc { namespace dhcp {
enum
{
yyeof_ = 0,
yylast_ = 886, ///< Last index in yytable_.
yynnts_ = 338, ///< Number of nonterminal symbols.
yylast_ = 903, ///< Last index in yytable_.
yynnts_ = 344, ///< Number of nonterminal symbols.
yyfinal_ = 28, ///< Termination state number.
yyterror_ = 1,
yyerrcode_ = 256,
yyntokens_ = 152 ///< Number of tokens.
yyntokens_ = 153 ///< Number of tokens.
};
......@@ -1478,9 +1483,9 @@ namespace isc { namespace dhcp {
115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
145, 146, 147, 148, 149, 150, 151
145, 146, 147, 148, 149, 150, 151, 152
};
const unsigned int user_token_number_max_ = 406;
const unsigned int user_token_number_max_ = 407;
const token_number_type undef_token_ = 2;
if (static_cast<int>(t) <= yyeof_)
......@@ -1513,30 +1518,30 @@ namespace isc { namespace dhcp {
{
switch (other.type_get ())
{
case 167: // value
case 171: // map_value
case 209: // socket_type
case 212: // outbound_interface_value
case 222: // db_type
case 299: // hr_mode
case 445: // ncr_protocol_value
case 453: // replace_client_name_value
case 168: // value
case 172: // map_value
case 210: // socket_type
case 213: // outbound_interface_value
case 229: // db_type
case 306: // hr_mode
case 452: // ncr_protocol_value
case 460: // replace_client_name_value
value.copy< ElementPtr > (other.value);
break;
case 151: // "boolean"
case 152: // "boolean"
value.copy< bool > (other.value);
break;
case 150: // "floating point"
case 151: // "floating point"
value.copy< double > (other.value);
break;
case 149: // "integer"
case 150: // "integer"
value.copy< int64_t > (other.value);
break;
case 148: // "constant string"
case 149: // "constant string"
value.copy< std::string > (other.value);
break;
......@@ -1557,30 +1562,30 @@ namespace isc { namespace dhcp {
(void) v;
switch (this->type_get ())
{
case 167: // value
case 171: // map_value
case 209: // socket_type
case 212: // outbound_interface_value
case 222: // db_type
case 299: // hr_mode
case 445: // ncr_protocol_value
case 453: // replace_client_name_value
case 168: // value
case 172: // map_value
case 210: // socket_type
case 213: // outbound_interface_value
case 229: // db_type
case 306: // hr_mode
case 452: // ncr_protocol_value
case 460: // replace_client_name_value
value.copy< ElementPtr > (v);
break;
case 151: // "boolean"
case 152: // "boolean"
value.copy< bool > (v);
break;
case 150: // "floating point"
case 151: // "floating point"
value.copy< double > (v);
break;
case 149: // "integer"
case 150: // "integer"
value.copy< int64_t > (v);
break;
case 148: // "constant string"
case 149: // "constant string"
value.copy< std::string > (v);
break;
......@@ -1660,30 +1665,30 @@ namespace isc { namespace dhcp {
// Type destructor.
switch (yytype)
{
case 167: // value
case 171: // map_value
case 209: // socket_type
case 212: // outbound_interface_value
case 222: // db_type
case 299: // hr_mode
case 445: // ncr_protocol_value
case 453: // replace_client_name_value
case 168: // value
case 172: // map_value
case 210: // socket_type
case 213: // outbound_interface_value
case 229: // db_type
case 306: // hr_mode
case 452: // ncr_protocol_value
case 460: // replace_client_name_value
value.template destroy< ElementPtr > ();
break;
case 151: // "boolean"
case 152: // "boolean"
value.template destroy< bool > ();
break;
case 150: // "floating point"
case 151: // "floating point"
value.template destroy< double > ();
break;
case 149: // "integer"
case 150: // "integer"
value.template destroy< int64_t > ();
break;
case 148: // "constant string"
case 149: // "constant string"
value.template destroy< std::string > ();
break;
......@@ -1710,30 +1715,30 @@ namespace isc { namespace dhcp {
super_type::move(s);
switch (this->type_get ())
{
case 167: // value
case 171: // map_value
case 209: // socket_type
case 212: // outbound_interface_value
case 222: // db_type
case 299: // hr_mode
case 445: // ncr_protocol_value
case 453: // replace_client_name_value