mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 05:55:28 +00:00
[284-need-dhcp6-example-for-netconf] Removed simple config and add simple DHCPv6 one
This commit is contained in:
@@ -74,7 +74,7 @@ nobase_dist_doc_DATA += examples/netconf/kea-dhcp6-operations/twopools.xml
|
||||
nobase_dist_doc_DATA += examples/netconf/kea-dhcp6-operations/twosubnets.xml
|
||||
nobase_dist_doc_DATA += examples/netconf/comments.json
|
||||
nobase_dist_doc_DATA += examples/netconf/simple-dhcp4.json
|
||||
nobase_dist_doc_DATA += examples/netconf/simple.json
|
||||
nobase_dist_doc_DATA += examples/netconf/simple-dhcp6.json
|
||||
|
||||
# These are files that document our APIs. They're not really needed as the
|
||||
# content is included in the api.xml, but may be useful for people who
|
||||
|
@@ -53,7 +53,7 @@
|
||||
// - "unix" which uses the local control channel supported by
|
||||
// "dhcp4" and "dhcp6" servers ("d2" support is coming in Kea 1.5)
|
||||
// - "http" which uses the Control Agent (CA) to manage itself or
|
||||
// to forward commands to "dhcp4" or "dhcp6".
|
||||
// to forward commands to "dhcp4" or "dhcp6" (not yet supported).
|
||||
"control-socket":
|
||||
{
|
||||
"socket-type": "unix",
|
||||
|
122
doc/examples/netconf/simple-dhcp6.json
Normal file
122
doc/examples/netconf/simple-dhcp6.json
Normal file
@@ -0,0 +1,122 @@
|
||||
// This is a simple example of a configuration for Netconf that handles
|
||||
// DHCPv6 configuration. This example provides YANG interface for
|
||||
// DHCPv6 server only.
|
||||
{
|
||||
"Netconf":
|
||||
{
|
||||
// Three flags control netconf (default values are true):
|
||||
// - "boot-update" about the YANG configuration load when
|
||||
// netconf boots.
|
||||
// - "subscribe-changes" about the subscription to notifications
|
||||
// when the running YANG module is changed.
|
||||
// - "validate-changes" alloes to validate or not changes.
|
||||
"boot-update": true,
|
||||
"subscribe-changes": true,
|
||||
"validate-changes": true,
|
||||
|
||||
// This map specifies how each server is managed:
|
||||
// the YANG model to use and the control channel.
|
||||
"managed-servers":
|
||||
{
|
||||
// This is how Netconf can communicate with the DHCPv6 server.
|
||||
"dhcp6":
|
||||
{
|
||||
// Eventually, the kea-netconf will be able to handle multiple
|
||||
// models. However, for the time being the choices for
|
||||
// DHCPv6 server are kea-dhcp6-server and
|
||||
/// ietf-dhcpv6-server models but only the first is usable.
|
||||
"model": "kea-dhcp6-server",
|
||||
|
||||
// The three control flags can be defined in this scope too
|
||||
// and takes precedence over global and default values.
|
||||
// boot-update determines whether the initial configuration
|
||||
// should be retrieved from netconf during kea-netconf startup.
|
||||
// You almost always want to set this to yes.
|
||||
"boot-update": true,
|
||||
|
||||
// This flag control whether the kea-netconf daemon should
|
||||
// subscribe to any changes. If set to true, kea-netconf will
|
||||
// monitor sysrepo and will pick up any changes that may be
|
||||
// introduced, either using netconf clients or sysrepocfg.
|
||||
"subscribe-changes": true,
|
||||
|
||||
// This parameters specifies whether kea-netconf will attempt
|
||||
// to verify if the upcoming NETCONF configuration is sane. The
|
||||
// verification is done by calling config-test. Depending on
|
||||
// Kea response, the new configuration is accepted or rejected.
|
||||
"validate-changes": false,
|
||||
|
||||
// Currently three control channel types are supported:
|
||||
// - "stdout" which output the configuration on the standard
|
||||
// output (this is mainly for testing purposes, but you can
|
||||
// use simple script (such as curl or socat) to pass that
|
||||
// information to the server.
|
||||
// - "unix" which uses the local control channel supported by
|
||||
// "dhcp4" and "dhcp6" servers ("d2" support is coming in Kea 1.5)
|
||||
// - "http" which uses the Control Agent (CA) to manage itself or
|
||||
// to forward commands to "dhcp4" or "dhcp6" (not yest supported).
|
||||
"control-socket":
|
||||
{
|
||||
"socket-type": "unix",
|
||||
"socket-name": "/tmp/kea6-ctrl-socket"
|
||||
},
|
||||
|
||||
// Comment is optional. You can put some notes here.
|
||||
"comment": "Kea DHCP6 server serving network on floor 13"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Netconf is able to load hook libraries that augment its operation.
|
||||
// The primary functionality is the ability to add new commands.
|
||||
//
|
||||
// Uncomment this section to load a hook library.
|
||||
//
|
||||
// "hooks-libraries": [
|
||||
// // Hook libraries list may contain more than one library.
|
||||
// {
|
||||
// // The only necessary parameter is the library filename.
|
||||
// "library": "/opt/local/netconf-commands.so",
|
||||
//
|
||||
// // Some libraries may support parameters. Make sure you
|
||||
// // type this section carefully, as the CA does not validate
|
||||
// // it (because the format is library specific).
|
||||
// "parameters": {
|
||||
// "param1": "foo"
|
||||
// }
|
||||
// }
|
||||
//]
|
||||
|
||||
},
|
||||
|
||||
// Similar to other Kea components, Netconf also uses logging.
|
||||
"Logging":
|
||||
{
|
||||
"loggers": [
|
||||
{
|
||||
"name": "kea-netconf",
|
||||
"output_options": [
|
||||
{
|
||||
//"output": "/var/log/kea-netconf.log",
|
||||
"output": "stdout",
|
||||
// Several additional parameters are possible in addition
|
||||
// to the typical output. Flush determines whether logger
|
||||
// flushes output to a file. Maxsize determines maximum
|
||||
// filesize before the file is being rotated. maxver
|
||||
// specifies the maximum number of rotated files being
|
||||
// kept.
|
||||
"flush": true,
|
||||
"maxsize": 204800,
|
||||
"maxver": 4
|
||||
}
|
||||
],
|
||||
// You can change the severity to DEBUG, INFO, WARN, ERROR or
|
||||
// CRIT. For DEBUG level, you can also additionally specify
|
||||
// debuglevel (0-99, higher = more verbose). All configurations
|
||||
// are logged on DEBUG/55.
|
||||
"severity": "INFO",
|
||||
"debuglevel": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -1,120 +0,0 @@
|
||||
// This is a simple example of a configuration for Netconf.
|
||||
// This server provides YANG interface for all Kea servers and agent.
|
||||
{
|
||||
"Netconf":
|
||||
{
|
||||
// Control flags can be defined in the global scope or
|
||||
// in a managed server scope. Precedence are:
|
||||
// - use the default value (true)
|
||||
// - use the global value
|
||||
// - use the local value.
|
||||
// So this overwrites the default value:
|
||||
"boot-update": false,
|
||||
|
||||
// This map specifies how each server is managed. For each server there
|
||||
// is a name of the YANG model to be used and the control channel.
|
||||
//
|
||||
// Currently three control channel types are supported:
|
||||
// "stdout" which output the configuration on the standard output,
|
||||
// "unix" which uses the local control channel supported by
|
||||
// "dhcp4" and "dhcp6" servers ("d2" support is not yet available),
|
||||
// and "http" which uses the Control agent "ca" to manage itself or
|
||||
// to forward commands to "dhcp4" or "dhcp6" (in the future also
|
||||
// to d2).
|
||||
"managed-servers":
|
||||
{
|
||||
// This is how Netconf can communicate with the DHCPv4 server.
|
||||
"dhcp4":
|
||||
{
|
||||
"comment": "DHCP4 server",
|
||||
"model": "kea-dhcp4-server",
|
||||
"control-socket":
|
||||
{
|
||||
"socket-type": "unix",
|
||||
"socket-name": "/tmp/kea4-ctrl-socket"
|
||||
}
|
||||
},
|
||||
|
||||
// DHCPv6 parameters.
|
||||
"dhcp6":
|
||||
{
|
||||
"model": "kea-dhcp6-server",
|
||||
"control-socket":
|
||||
{
|
||||
"socket-type": "unix",
|
||||
"socket-name": "/tmp/kea6-ctrl-socket"
|
||||
}
|
||||
},
|
||||
|
||||
// Currently the DHCP-DDNS (nicknamed D2) server does not support
|
||||
// command channel yet.
|
||||
"d2":
|
||||
{
|
||||
"model": "kea-dhcp-ddns",
|
||||
"control-socket":
|
||||
{
|
||||
"socket-type": "stdout",
|
||||
"user-context": { "in-use": false }
|
||||
}
|
||||
},
|
||||
|
||||
// Of course the Control Agent (nicknamed CA) supports HTTP.
|
||||
"ca":
|
||||
{
|
||||
"model": "kea-ctrl-agent",
|
||||
"control-socket":
|
||||
{
|
||||
"socket-type": "http",
|
||||
"socket-url": "http://127.0.0.1:8000/"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Netconf is able to load hook libraries that augment its operation.
|
||||
// Currently there are no hook points defined in kea-netconf
|
||||
// processing.
|
||||
"hooks-libraries": [
|
||||
// Hook libraries list may contain more than one library.
|
||||
{
|
||||
// The only necessary parameter is the library filename.
|
||||
"library": "/opt/local/netconf-commands.so",
|
||||
|
||||
// Some libraries may support parameters. Make sure you
|
||||
// type this section carefully, as the kea-netconf does not
|
||||
// validate it (because the format is library specific).
|
||||
"parameters": {
|
||||
"param1": "foo"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
|
||||
// Similar to other Kea components, Netconf also uses logging.
|
||||
"Logging":
|
||||
{
|
||||
"loggers": [
|
||||
{
|
||||
"name": "kea-netconf",
|
||||
"output_options": [
|
||||
{
|
||||
"output": "/var/log/kea-netconf.log",
|
||||
// Several additional parameters are possible in
|
||||
// addition to the typical output.
|
||||
// Flush determines whether logger flushes output
|
||||
// to a file.
|
||||
// Maxsize determines maximum filesize before
|
||||
// the file is being rotated.
|
||||
// Maxver specifies the maximum number of
|
||||
// rotated files being kept.
|
||||
"flush": true,
|
||||
"maxsize": 204800,
|
||||
"maxver": 4
|
||||
}
|
||||
],
|
||||
"severity": "INFO",
|
||||
"debuglevel": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -230,7 +230,7 @@ public:
|
||||
TEST_F(NetconfGetCfgTest, simple) {
|
||||
|
||||
// get the simple configuration
|
||||
std::string simple_file = string(CFG_EXAMPLES) + "/" + "simple.json";
|
||||
std::string simple_file = string(CFG_EXAMPLES) + "/" + "simple-dhcp4.json";
|
||||
std::string config;
|
||||
ASSERT_NO_THROW(config = readFile(simple_file));
|
||||
|
||||
|
@@ -376,8 +376,8 @@ void testFile(const std::string& fname) {
|
||||
TEST(ParserTest, file) {
|
||||
vector<string> configs;
|
||||
configs.push_back("comments.json");
|
||||
configs.push_back("simple.json");
|
||||
configs.push_back("simple-dhcp4.json");
|
||||
configs.push_back("simple-dhcp6.json");
|
||||
|
||||
for (int i = 0; i<configs.size(); i++) {
|
||||
testFile(string(CFG_EXAMPLES) + "/" + configs[i]);
|
||||
@@ -464,7 +464,7 @@ TEST(ParserTest, errors) {
|
||||
testError("<?include\n",
|
||||
ParserContext::PARSER_JSON,
|
||||
"Directive not closed.");
|
||||
string file = string(CFG_EXAMPLES) + "/" + "simple.json";
|
||||
string file = string(CFG_EXAMPLES) + "/" + "simple-dhcp4.json";
|
||||
testError("<?include \"" + file + "\"\n",
|
||||
ParserContext::PARSER_JSON,
|
||||
"Directive not closed.");
|
||||
|
57
src/bin/netconf/tests/testdata/get_config.json
vendored
57
src/bin/netconf/tests/testdata/get_config.json
vendored
@@ -1,43 +1,11 @@
|
||||
{
|
||||
"Netconf": {
|
||||
"boot-update": false,
|
||||
"hooks-libraries": [
|
||||
{
|
||||
"library": "/tmp/ky/src/bin/netconf/tests/.libs/libbasic.so",
|
||||
"parameters": {
|
||||
"param1": "foo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"boot-update": true,
|
||||
"hooks-libraries": [ ],
|
||||
"managed-servers": {
|
||||
"ca": {
|
||||
"boot-update": false,
|
||||
"control-socket": {
|
||||
"socket-name": "",
|
||||
"socket-type": "http",
|
||||
"socket-url": "http://127.0.0.1:8000/"
|
||||
},
|
||||
"model": "kea-ctrl-agent",
|
||||
"subscribe-changes": true,
|
||||
"validate-changes": true
|
||||
},
|
||||
"d2": {
|
||||
"boot-update": false,
|
||||
"control-socket": {
|
||||
"socket-name": "",
|
||||
"socket-type": "stdout",
|
||||
"socket-url": "http://127.0.0.1:8000/",
|
||||
"user-context": {
|
||||
"in-use": false
|
||||
}
|
||||
},
|
||||
"model": "kea-dhcp-ddns",
|
||||
"subscribe-changes": true,
|
||||
"validate-changes": true
|
||||
},
|
||||
"dhcp4": {
|
||||
"comment": "DHCP4 server",
|
||||
"boot-update": false,
|
||||
"comment": "Kea DHCP4 server serving network on floor 13",
|
||||
"boot-update": true,
|
||||
"control-socket": {
|
||||
"socket-name": "/tmp/kea4-ctrl-socket",
|
||||
"socket-type": "unix",
|
||||
@@ -45,19 +13,10 @@
|
||||
},
|
||||
"model": "kea-dhcp4-server",
|
||||
"subscribe-changes": true,
|
||||
"validate-changes": true
|
||||
},
|
||||
"dhcp6": {
|
||||
"boot-update": false,
|
||||
"control-socket": {
|
||||
"socket-name": "/tmp/kea6-ctrl-socket",
|
||||
"socket-type": "unix",
|
||||
"socket-url": "http://127.0.0.1:8000/"
|
||||
},
|
||||
"model": "kea-dhcp6-server",
|
||||
"subscribe-changes": true,
|
||||
"validate-changes": true
|
||||
"validate-changes": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"subscribe-changes": true,
|
||||
"validate-changes": true
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user