Commit 65ce0078 authored by Marcin Siodelski's avatar Marcin Siodelski

[5108] Control agent's configuration can be shared with other components.

parent ea17790e
......@@ -467,6 +467,15 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"Control-agent\" {
switch(driver.ctx_) {
case isc::d2::D2ParserContext::CONFIG:
return isc::d2::D2Parser::make_CONTROL_AGENT(driver.loc_);
default:
return isc::d2::D2Parser::make_STRING("Control-agent", driver.loc_);
}
}
{JSONString} {
/* A string has been matched. It contains the actual string and single quotes.
......
......@@ -51,6 +51,7 @@ using namespace std;
DHCP6 "Dhcp6"
DHCP4 "Dhcp4"
CONTROL_AGENT "Control-agent"
DHCPDDNS "DhcpDdns"
IP_ADDRESS "ip-address"
......@@ -204,8 +205,8 @@ unknown_map_entry: STRING COLON {
};
// This defines the top-level { } that holds Dhcp6, Dhcp4, DhcpDdns or Logging
// objects.
// This defines the top-level { } that holds Control-agent, Dhcp6, Dhcp4,
// DhcpDdns or Logging objects.
syntax_map: LCURLY_BRACKET {
// This code is executed when we're about to start parsing
// the content of the map
......@@ -227,6 +228,7 @@ global_object: dhcp6_json_object
| logging_object
| dhcp4_json_object
| dhcpddns_object
| control_agent_json_object
| unknown_map_entry
;
......@@ -613,6 +615,13 @@ dhcp4_json_object: DHCP4 {
ctx.leave();
};
control_agent_json_object: CONTROL_AGENT {
ctx.enter(ctx.NO_KEYWORD);
} COLON value {
ctx.stack_.back()->set("Control-agent", $4);
ctx.leave();
};
// --- logging entry -----------------------------------------
// This defines the top level "Logging" object. It parses
......
......@@ -1246,6 +1246,15 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"Control-agent\" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::CONFIG:
return isc::dhcp::Dhcp4Parser::make_CONTROL_AGENT(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("Control-agent", driver.loc_);
}
}
\"4o6-interface\" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::SUBNET4:
......
......@@ -183,6 +183,7 @@ using namespace std;
DHCP6 "Dhcp6"
DHCPDDNS "DhcpDdns"
CONTROL_AGENT "Control-agent"
// Not real tokens, just a way to signal what the parser is expected to
// parse.
......@@ -338,8 +339,8 @@ unknown_map_entry: STRING COLON {
};
// This defines the top-level { } that holds Dhcp6, Dhcp4, DhcpDdns or Logging
// objects.
// This defines the top-level { } that holds Control-agent, Dhcp6, Dhcp4,
// DhcpDdns or Logging objects.
syntax_map: LCURLY_BRACKET {
// This code is executed when we're about to start parsing
// the content of the map
......@@ -351,7 +352,8 @@ syntax_map: LCURLY_BRACKET {
// for it.
};
// This represents top-level entries: Dhcp6, Dhcp4, DhcpDdns, Logging
// This represents top-level entries: Control-agent, Dhcp6, Dhcp4,
// DhcpDdns, Logging
global_objects: global_object
| global_objects COMMA global_object
;
......@@ -361,6 +363,7 @@ global_object: dhcp4_object
| logging_object
| dhcp6_json_object
| dhcpddns_json_object
| control_agent_json_object
| unknown_map_entry
;
......@@ -1656,6 +1659,13 @@ dhcpddns_json_object: DHCPDDNS {
ctx.leave();
};
control_agent_json_object: CONTROL_AGENT {
ctx.enter(ctx.NO_KEYWORD);
} COLON value {
ctx.stack_.back()->set("Control-agent", $4);
ctx.leave();
};
// --- logging entry -----------------------------------------
// This defines the top level "Logging" object. It parses
......
......@@ -1377,6 +1377,16 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"Control-agent\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::CONFIG:
return isc::dhcp::Dhcp6Parser::make_CONTROL_AGENT(driver.loc_);
default:
return isc::dhcp::Dhcp6Parser::make_STRING("Control-agent", driver.loc_);
}
}
{JSONString} {
/* A string has been matched. It contains the actual string and single quotes.
We need to get those quotes out of the way and just use its content, e.g.
......
......@@ -190,6 +190,7 @@ using namespace std;
DHCP4 "Dhcp4"
DHCPDDNS "DhcpDdns"
CONTROL_AGENT "Control-agent"
// Not real tokens, just a way to signal what the parser is expected to
// parse.
......@@ -347,8 +348,8 @@ unknown_map_entry: STRING COLON {
};
// This defines the top-level { } that holds Dhcp6, Dhcp4, DhcpDdns or Logging
// objects.
// This defines the top-level { } that holds Control-agent, Dhcp6, Dhcp4,
// DhcpDdns or Logging objects.
syntax_map: LCURLY_BRACKET {
// This code is executed when we're about to start parsing
// the content of the map
......@@ -370,6 +371,7 @@ global_object: dhcp6_object
| logging_object
| dhcp4_json_object
| dhcpddns_json_object
| control_agent_json_object
| unknown_map_entry
;
......@@ -1752,6 +1754,14 @@ dhcpddns_json_object: DHCPDDNS {
ctx.leave();
};
control_agent_json_object: CONTROL_AGENT {
ctx.enter(ctx.NO_KEYWORD);
} COLON value {
ctx.stack_.back()->set("Control-agent", $4);
ctx.leave();
};
// --- logging entry -----------------------------------------
// This defines the top level "Logging" object. It parses
......
// This is a basic configuration for the Kea DHCPv4 and DHCPv6 servers. Subnet
// declarations are mostly commented out and no interfaces are listed.
// Therefore, the servers will not listen or respond to any queries. The basic
// configuration must be extended to specify interfaces on which the servers
// should listen. There are a number of example options defined. These probably
// don't make any sense in your network. Make sure you at least update the
// following, before running this example in your network:
// This is a basic configuration for the Kea DHCP servers and Kea Control
// Agent. Subnet declarations are mostly commented out and no interfaces are
// listed. Therefore, the servers will not listen or respond to any queries.
// The basic configuration must be extended to specify interfaces on which
// the servers should listen. There are a number of example options defined.
// These probably don't make any sense in your network. Make sure you at least
// update the following, before running this example in your network:
// - change the network interface names
// - change the subnets to match your actual network
// - change the option values to match your network
......@@ -734,6 +734,41 @@
"reverse-ddns" : {}
},
// This is a basic configuraton for the Kea Control Agent.
// RESTful interface to be available at http://127.0.0.1:8080/
"Control-agent": {
"http-host": "127.0.0.1",
"http-port": 8080,
// Specify location of the files to which the Control Agent
// should connect to forward commands to the DHCPv4 and DHCPv6
// server via unix domain socket.
"control-sockets": {
"dhcp4": {
"socket-type": "unix",
"socket-name": "/tmp/kea-dhcp4-ctrl.sock"
},
"dhcp6": {
"socket-type": "unix",
"socket-name": "/tmp/kea-dhcp6-ctrl.sock"
}
},
// Specify hooks libraries that are attached to the Control Agent.
// Such hooks libraries should support 'control_command_receive'
// hook point. This is currently commented out because it has to
// point to the existing hooks library. Otherwise the Control
// Agent will fail to start.
"hooks-libraries": [
// {
// "library": "/opt/local/control-agent-commands.so",
// "parameters": {
// "param1": "foo"
// }
// }
]
},
// Logging configuration starts here. Kea uses different loggers to log various
// activities. For details (e.g. names of loggers), see Chapter 18.
"Logging":
......@@ -776,32 +811,39 @@
// of logs if told to do so.
"debuglevel": 0
},
{
// This specifies the logging for kea-dhcp6 logger, i.e. all logs
// generated by Kea DHCPv6 server.
"name": "kea-dhcp6",
"output_options": [
{
"output": "@localstatedir@/log/kea-dhcp6.log"
}
],
"severity": "INFO",
"debuglevel": 0
},
{
// This specifies the logging for D2 (DHCP-DDNS) daemon.
"name": "kea-dhcp-ddns",
"output_options": [
{
"output": "@localstatedir@/log/kea-ddns.log"
}
],
"severity": "INFO",
"debuglevel": 0
}
{
// This specifies the logging for kea-dhcp6 logger, i.e. all logs
// generated by Kea DHCPv6 server.
"name": "kea-dhcp6",
"output_options": [
{
"output": "@localstatedir@/log/kea-dhcp6.log"
}
],
"severity": "INFO",
"debuglevel": 0
},
{
// This specifies the logging for D2 (DHCP-DDNS) daemon.
"name": "kea-dhcp-ddns",
"output_options": [
{
"output": "@localstatedir@/log/kea-ddns.log"
}
],
"severity": "INFO",
"debuglevel": 0
},
{
"name": "kea-ctrl-agent",
"output_options": [
{
"output": "@localstatedir@/log/kea-ctrl-agent.log"
}
],
"severity": "INFO",
"debuglevel": 0
}
]
}
// In the future releases, also Control Agent configuration will be kept here.
// However, for the time being, it is kept in a separate file.
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment