From: Francis Dupont Date: Wed, 28 Nov 2018 22:21:24 +0000 (+0100) Subject: [284-need-dhcp6-example-for-netconf] Removed simple config and add simple DHCPv6 one X-Git-Tag: 343-put-socket-control-buffer-in-the-stack_base~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1294a55fc06a6748ce53b8d2a8fc442835f87a32;p=thirdparty%2Fkea.git [284-need-dhcp6-example-for-netconf] Removed simple config and add simple DHCPv6 one --- diff --git a/doc/Makefile.am b/doc/Makefile.am index ad4192f779..6e1f768dce 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -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 diff --git a/doc/examples/netconf/simple-dhcp4.json b/doc/examples/netconf/simple-dhcp4.json index 42f06214ce..8f7fab69c4 100644 --- a/doc/examples/netconf/simple-dhcp4.json +++ b/doc/examples/netconf/simple-dhcp4.json @@ -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", diff --git a/doc/examples/netconf/simple-dhcp6.json b/doc/examples/netconf/simple-dhcp6.json new file mode 100644 index 0000000000..9ff8674412 --- /dev/null +++ b/doc/examples/netconf/simple-dhcp6.json @@ -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 + } + ] + } +} diff --git a/doc/examples/netconf/simple.json b/doc/examples/netconf/simple.json deleted file mode 100644 index a64008caee..0000000000 --- a/doc/examples/netconf/simple.json +++ /dev/null @@ -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 - } - ] - } -} diff --git a/src/bin/netconf/tests/get_config_unittest.cc b/src/bin/netconf/tests/get_config_unittest.cc index 26a96af7b7..77dd2ab6cd 100644 --- a/src/bin/netconf/tests/get_config_unittest.cc +++ b/src/bin/netconf/tests/get_config_unittest.cc @@ -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)); diff --git a/src/bin/netconf/tests/parser_unittests.cc b/src/bin/netconf/tests/parser_unittests.cc index f3d8ff2b5b..01cdd0ce4f 100644 --- a/src/bin/netconf/tests/parser_unittests.cc +++ b/src/bin/netconf/tests/parser_unittests.cc @@ -376,8 +376,8 @@ void testFile(const std::string& fname) { TEST(ParserTest, file) { vector 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