mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-03 07:25:18 +00:00
[5061] contact_points converted to contact-points
This commit is contained in:
@@ -70,7 +70,7 @@
|
|||||||
# "lease-database": {
|
# "lease-database": {
|
||||||
# "type": "cql",
|
# "type": "cql",
|
||||||
# "keyspace": "keatest",
|
# "keyspace": "keatest",
|
||||||
# "contact_points": "192.0.2.1,192.0.2.2,192.0.2.3",
|
# "contact-points": "192.0.2.1,192.0.2.2,192.0.2.3",
|
||||||
# "port": 9042
|
# "port": 9042
|
||||||
# },
|
# },
|
||||||
|
|
||||||
|
64
doc/examples/kea4/cassandra.json
Normal file
64
doc/examples/kea4/cassandra.json
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
// This is an example configuration file for the DHCPv4 server in Kea.
|
||||||
|
// It is a basic scenario with one IPv4 subnet configured. It demonstrates
|
||||||
|
// how to configure Kea to use CQL (Cassandra) backend
|
||||||
|
|
||||||
|
{ "Dhcp4":
|
||||||
|
|
||||||
|
{
|
||||||
|
// Kea is told to listen on ethX interface only.
|
||||||
|
"interfaces-config": {
|
||||||
|
"interfaces": [ "ethX" ]
|
||||||
|
},
|
||||||
|
|
||||||
|
// 4. CQL (Cassandra) backend. Leases will be stored in Cassandra database. Make
|
||||||
|
// sure it is up, running and properly initialized. See kea-admin documentation
|
||||||
|
// for details on how to initialize the database. The only strictly required
|
||||||
|
// parameters are type, keyspace and contact_points. At least one contact point
|
||||||
|
// must be specified, but more than one is required for redundancy. Make sure
|
||||||
|
// you specify the contact points without spaces. Kea must be compiled with
|
||||||
|
// --with-cql option to use this backend.
|
||||||
|
"lease-database": {
|
||||||
|
"type": "cql",
|
||||||
|
"keyspace": "keatest",
|
||||||
|
"contact-points": "192.0.2.1,192.0.2.2,192.0.2.3",
|
||||||
|
"port": 9042
|
||||||
|
},
|
||||||
|
|
||||||
|
// Addresses will be assigned with a lifetime of 4000 seconds.
|
||||||
|
"valid-lifetime": 4000,
|
||||||
|
|
||||||
|
// Renew and rebind timers are commented out. This implies that options
|
||||||
|
// 58 and 59 will not be sent to the client. In this case it is up to
|
||||||
|
// the client to pick the timer values according to RFC2131. Uncomment the
|
||||||
|
// timers to send these options to the client.
|
||||||
|
// "renew-timer": 1000,
|
||||||
|
// "rebind-timer": 2000,
|
||||||
|
|
||||||
|
// The following list defines subnets. We have only one subnet
|
||||||
|
// here. We tell Kea that it is directly available over local interface.
|
||||||
|
"subnet4": [
|
||||||
|
{
|
||||||
|
"pools": [ { "pool": "192.0.2.1 - 192.0.2.200" } ],
|
||||||
|
"subnet": "192.0.2.0/24",
|
||||||
|
"interface": "ethX"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// The following configures logging. It assumes that messages with at least
|
||||||
|
// informational level (info, warn, error and fatal) should be logged to stdout.
|
||||||
|
"Logging": {
|
||||||
|
"loggers": [
|
||||||
|
{
|
||||||
|
"name": "kea-dhcp4",
|
||||||
|
"output_options": [
|
||||||
|
{
|
||||||
|
"output": "stdout"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"severity": "INFO"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -70,7 +70,7 @@
|
|||||||
# "lease-database": {
|
# "lease-database": {
|
||||||
# "type": "cql",
|
# "type": "cql",
|
||||||
# "keyspace": "keatest",
|
# "keyspace": "keatest",
|
||||||
# "contact_points": "192.0.2.1,192.0.2.2,192.0.2.3",
|
# "contact-points": "192.0.2.1,192.0.2.2,192.0.2.3",
|
||||||
# "port": 9042
|
# "port": 9042
|
||||||
# },
|
# },
|
||||||
|
|
||||||
|
66
doc/examples/kea6/cassandra.json
Normal file
66
doc/examples/kea6/cassandra.json
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
// This is an example configuration file for the DHCPv6 server in Kea.
|
||||||
|
// It is a basic scenario with one IPv6 subnet configured. It demonstrates
|
||||||
|
// how to configure Kea to use CQL (Cassandra) backend.
|
||||||
|
|
||||||
|
{ "Dhcp6":
|
||||||
|
|
||||||
|
{
|
||||||
|
// Kea is told to listen on ethX interface only.
|
||||||
|
"interfaces-config": {
|
||||||
|
"interfaces": [ "ethX" ]
|
||||||
|
},
|
||||||
|
|
||||||
|
// CQL (Cassandra) backend. Leases will be stored in Cassandra database. Make
|
||||||
|
// sure it is up, running and properly initialized. See kea-admin documentation
|
||||||
|
// for details on how to initialize the database. The only strictly required
|
||||||
|
// parameters are type, keyspace and contact_points. At least one contact point
|
||||||
|
// must be specified, but more than one is required for redundancy. Make sure
|
||||||
|
// you specify the contact points without spaces. Kea must be compiled with
|
||||||
|
// --with-cql option to use this backend.
|
||||||
|
"lease-database": {
|
||||||
|
"type": "cql",
|
||||||
|
"keyspace": "keatest",
|
||||||
|
"contact_points": "192.0.2.1,192.0.2.2,192.0.2.3",
|
||||||
|
"port": 9042
|
||||||
|
},
|
||||||
|
|
||||||
|
// Addresses will be assigned with preferred and valid lifetimes
|
||||||
|
// being 3000 and 4000, respectively. Client is told to start
|
||||||
|
// renewing after 1000 seconds. If the server does not respond
|
||||||
|
// after 2000 seconds since the lease was granted, client is supposed
|
||||||
|
// to start REBIND procedure (emergency renewal that allows switching
|
||||||
|
// to a different server).
|
||||||
|
"preferred-lifetime": 3000,
|
||||||
|
"valid-lifetime": 4000,
|
||||||
|
"renew-timer": 1000,
|
||||||
|
"rebind-timer": 2000,
|
||||||
|
|
||||||
|
// The following list defines subnets. Each subnet consists of at
|
||||||
|
// least subnet and pool entries.
|
||||||
|
"subnet6": [
|
||||||
|
{
|
||||||
|
"pools": [ { "pool": "2001:db8:1::/80" } ],
|
||||||
|
"subnet": "2001:db8:1::/64",
|
||||||
|
"interface": "ethX"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// The following configures logging. It assumes that messages with at least
|
||||||
|
// informational level (info, warn, error and fatal) should be logged to stdout.
|
||||||
|
"Logging": {
|
||||||
|
"loggers": [
|
||||||
|
{
|
||||||
|
"name": "kea-dhcp6",
|
||||||
|
"output_options": [
|
||||||
|
{
|
||||||
|
"output": "stdout"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"debuglevel": 0,
|
||||||
|
"severity": "INFO"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -380,16 +380,6 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
\"contact_points\" {
|
|
||||||
switch(driver.ctx_) {
|
|
||||||
case isc::dhcp::Parser4Context::LEASE_DATABASE:
|
|
||||||
case isc::dhcp::Parser4Context::HOSTS_DATABASE:
|
|
||||||
return isc::dhcp::Dhcp4Parser::make_CONTACT_POINTS(driver.loc_);
|
|
||||||
default:
|
|
||||||
return isc::dhcp::Dhcp4Parser::make_STRING("contact_points", driver.loc_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
\"contact-points\" {
|
\"contact-points\" {
|
||||||
switch(driver.ctx_) {
|
switch(driver.ctx_) {
|
||||||
case isc::dhcp::Parser4Context::LEASE_DATABASE:
|
case isc::dhcp::Parser4Context::LEASE_DATABASE:
|
||||||
|
@@ -77,7 +77,7 @@ using namespace std;
|
|||||||
LFC_INTERVAL "lfc-interval"
|
LFC_INTERVAL "lfc-interval"
|
||||||
READONLY "readonly"
|
READONLY "readonly"
|
||||||
CONNECT_TIMEOUT "connect-timeout"
|
CONNECT_TIMEOUT "connect-timeout"
|
||||||
CONTACT_POINTS "contact_points"
|
CONTACT_POINTS "contact-points"
|
||||||
KEYSPACE "keyspace"
|
KEYSPACE "keyspace"
|
||||||
|
|
||||||
VALID_LIFETIME "valid-lifetime"
|
VALID_LIFETIME "valid-lifetime"
|
||||||
@@ -601,7 +601,7 @@ contact_points: CONTACT_POINTS {
|
|||||||
ctx.enter(ctx.NO_KEYWORD);
|
ctx.enter(ctx.NO_KEYWORD);
|
||||||
} COLON STRING {
|
} COLON STRING {
|
||||||
ElementPtr cp(new StringElement($4, ctx.loc2pos(@4)));
|
ElementPtr cp(new StringElement($4, ctx.loc2pos(@4)));
|
||||||
ctx.stack_.back()->set("contact_points", cp);
|
ctx.stack_.back()->set("contact-points", cp);
|
||||||
ctx.leave();
|
ctx.leave();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -242,6 +242,7 @@ TEST(ParserTest, file) {
|
|||||||
vector<string> configs = { "advanced.json" ,
|
vector<string> configs = { "advanced.json" ,
|
||||||
"backends.json",
|
"backends.json",
|
||||||
"classify.json",
|
"classify.json",
|
||||||
|
"cassandra.json",
|
||||||
"dhcpv4-over-dhcpv6.json",
|
"dhcpv4-over-dhcpv6.json",
|
||||||
"hooks.json",
|
"hooks.json",
|
||||||
"leases-expiration.json",
|
"leases-expiration.json",
|
||||||
|
@@ -581,16 +581,6 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
\"contact_points\" {
|
|
||||||
switch(driver.ctx_) {
|
|
||||||
case isc::dhcp::Parser6Context::LEASE_DATABASE:
|
|
||||||
case isc::dhcp::Parser6Context::HOSTS_DATABASE:
|
|
||||||
return isc::dhcp::Dhcp6Parser::make_CONTACT_POINTS(driver.loc_);
|
|
||||||
default:
|
|
||||||
return isc::dhcp::Dhcp6Parser::make_STRING("contact_points", driver.loc_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
\"contact-points\" {
|
\"contact-points\" {
|
||||||
switch(driver.ctx_) {
|
switch(driver.ctx_) {
|
||||||
case isc::dhcp::Parser6Context::LEASE_DATABASE:
|
case isc::dhcp::Parser6Context::LEASE_DATABASE:
|
||||||
|
@@ -68,7 +68,7 @@ using namespace std;
|
|||||||
LFC_INTERVAL "lfc-interval"
|
LFC_INTERVAL "lfc-interval"
|
||||||
READONLY "readonly"
|
READONLY "readonly"
|
||||||
CONNECT_TIMEOUT "connect-timeout"
|
CONNECT_TIMEOUT "connect-timeout"
|
||||||
CONTACT_POINTS "contact_points"
|
CONTACT_POINTS "contact-points"
|
||||||
KEYSPACE "keyspace"
|
KEYSPACE "keyspace"
|
||||||
|
|
||||||
PREFERRED_LIFETIME "preferred-lifetime"
|
PREFERRED_LIFETIME "preferred-lifetime"
|
||||||
@@ -586,7 +586,7 @@ contact_points: CONTACT_POINTS {
|
|||||||
ctx.enter(ctx.NO_KEYWORD);
|
ctx.enter(ctx.NO_KEYWORD);
|
||||||
} COLON STRING {
|
} COLON STRING {
|
||||||
ElementPtr cp(new StringElement($4, ctx.loc2pos(@4)));
|
ElementPtr cp(new StringElement($4, ctx.loc2pos(@4)));
|
||||||
ctx.stack_.back()->set("contact_points", cp);
|
ctx.stack_.back()->set("contact-points", cp);
|
||||||
ctx.leave();
|
ctx.leave();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -69,7 +69,7 @@ CqlConnection::openDatabase() {
|
|||||||
const char* contact_points = "127.0.0.1";
|
const char* contact_points = "127.0.0.1";
|
||||||
string scontact_points;
|
string scontact_points;
|
||||||
try {
|
try {
|
||||||
scontact_points = getParameter("contact_points");
|
scontact_points = getParameter("contact-points");
|
||||||
contact_points = scontact_points.c_str();
|
contact_points = scontact_points.c_str();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
// No host. Fine, we'll use "localhost".
|
// No host. Fine, we'll use "localhost".
|
||||||
|
Reference in New Issue
Block a user