diff --git a/doc/Makefile.am b/doc/Makefile.am index 43aa6a5160e8417e4e2c1556c1a3ce10151a1901..20c8463bceecaf02a82004dc3507c981ced3cf17 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -59,6 +59,7 @@ nobase_dist_doc_DATA += examples/kea6/stateless.json nobase_dist_doc_DATA += examples/kea6/with-ddns.json nobase_dist_doc_DATA += examples/netconf/comments.json nobase_dist_doc_DATA += examples/netconf/simple.json +nobase_dist_doc_DATA += examples/netconf/simple-dhcp4.json devel: mkdir -p html diff --git a/doc/examples/netconf/simple-dhcp4.json b/doc/examples/netconf/simple-dhcp4.json new file mode 100644 index 0000000000000000000000000000000000000000..5a869c5585b584b18c0a5958c766a5a5ee73ea25 --- /dev/null +++ b/doc/examples/netconf/simple-dhcp4.json @@ -0,0 +1,84 @@ +// This is a simple example of a configuration for Netconf that handles +// DHCPv4 configuration. This example provides YANG interface for +// DHCPv4 server only. +{ + "Netconf": + { + // 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 DHCPv4 server. + "dhcp4": + { + // Eventually, the kea-netconf will be able to handle multiple + // models. However, for the time being the only choice for + // DHCPv4 server is kea-dhcp4-server model. + "model": "kea-dhcp4-server", + + // 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". + "control-socket": + { + "socket-type": "unix", + "socket-name": "/tmp/kea4-ctrl-socket" + }, + + // Comment is optional. You can put some notes here. + "comment": "Kea DHCP4 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. + "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", + // 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 + } + ] + } +} diff --git a/src/bin/netconf/tests/parser_unittests.cc b/src/bin/netconf/tests/parser_unittests.cc index 7c50ea1c6f492a6465bb5f36d6683f64e8ae120c..0bcd33829d662a7c54f8a598e02f95ddb5bd4a8b 100644 --- a/src/bin/netconf/tests/parser_unittests.cc +++ b/src/bin/netconf/tests/parser_unittests.cc @@ -172,7 +172,7 @@ TEST(ParserTest, keywordNetconf) { TEST(ParserTest, keywordSubNetconf) { // This is similar to previous test, but note the lack of outer - // map and Netconf-agent. + // map and Netconf. string txt = "{\n" " \"managed-servers\": {" " \"dhcp4\": {" @@ -348,6 +348,7 @@ TEST(ParserTest, file) { vector configs; configs.push_back("comments.json"); configs.push_back("simple.json"); + configs.push_back("simple-dhcp4.json"); for (int i = 0; i