]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[284-need-dhcp6-example-for-netconf] Removed simple config and add simple DHCPv6 one
authorFrancis Dupont <fdupont@isc.org>
Wed, 28 Nov 2018 22:21:24 +0000 (23:21 +0100)
committerFrancis Dupont <fdupont@isc.org>
Tue, 11 Dec 2018 20:43:36 +0000 (15:43 -0500)
doc/Makefile.am
doc/examples/netconf/simple-dhcp4.json
doc/examples/netconf/simple-dhcp6.json [new file with mode: 0644]
doc/examples/netconf/simple.json [deleted file]
src/bin/netconf/tests/get_config_unittest.cc
src/bin/netconf/tests/parser_unittests.cc
src/bin/netconf/tests/testdata/get_config.json

index ad4192f7791d0335c60f0db36143a705d129a068..6e1f768dceba2a6c8aa2c7807d13e17831d7a2f6 100644 (file)
@@ -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
index 42f06214ce3287fe07745094435a07b111d64ea4..8f7fab69c4f7a6e33c78e535d59d2f05e30ac8f7 100644 (file)
@@ -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 (file)
index 0000000..9ff8674
--- /dev/null
@@ -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 (file)
index a64008c..0000000
+++ /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
-            }
-        ]
-    }
-}
index 26a96af7b7c13644a18c8f06ac16f6b87b9d42a9..77dd2ab6cd11fdda8d310b78cd389b515c24345c 100644 (file)
@@ -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));
 
index f3d8ff2b5b4860cbaf3e544c3fd2d3d0482e8759..01cdd0ce4febf1adcc9c206519bcd4f31fc0ada1 100644 (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.");
index 42645769c30da6d8409f38b4a7a7fa78175eee32..38c6bceb7d1dccce07f62f4da40dfec79fa3d1d0 100644 (file)
@@ -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",
                 },
                 "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
     }
 }