]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3907] Progressed some more with YANG modules
authorAndrei Pavel <andrei@isc.org>
Fri, 20 Jun 2025 12:36:15 +0000 (15:36 +0300)
committerRazvan Becheriu <razvan@isc.org>
Fri, 20 Jun 2025 13:29:10 +0000 (13:29 +0000)
doc/examples/kea4/all-keys-netconf.json
doc/examples/kea6/all-keys-netconf.json
src/lib/yang/tests/config_unittests.cc
src/lib/yang/translator_control_socket.cc
src/share/yang/modules/hashes/kea-types@2025-06-25.hash
src/share/yang/modules/kea-types@2025-06-25.yang

index 92b09359cadcaf95dd0dc1163dfe0d74c4b5479e..e350af1bd2d0cd6d17d385b6ce57de791fc6aa16 100644 (file)
 
                             // If password is not specified an empty
                             // password is used.
-                            "password": "1234",
-                            "password-file": "",
-                            "user-file": ""
+                            "password": "1234"
                         },
 
                         // This specifies a hidden client.
                             // The user id is the content of the
                             // file /usr/local/share/kea/kea-creds/hiddenu.
                             "user-file": "hiddenu",
-                            "user": "",
 
                             // The password is the content of the
                             // file /usr/local/share/kea/kea-creds/hiddenp.
-                            "password-file": "hiddenp",
-                            "password": ""
+                            "password-file": "hiddenp"
                         },
 
                         // This specifies a hidden client using a
                             // The secret is the content of the file
                             // /usr/local/share/kea/kea-creds/hiddens which must be in
                             // the <user-id>:<password> format.
-                            "password-file": "hiddens",
-                            "user-file": "",
-                            "user": "",
-                            "password": ""
+                            "password-file": "hiddens"
                         }
                     ]
                 }
index ccb8ccde0a8f069010d2d52579013c91f94affb4..e070989d04af4297e782b013145b446173fcde50 100644 (file)
 
                             // If password is not specified an empty
                             // password is used.
-                            "password": "1234",
-                            "password-file": "",
-                            "user-file": ""
+                            "password": "1234"
                         },
 
                         // This specifies a hidden client.
                             // The user id is the content of the
                             // file /usr/local/share/kea/kea-creds/hiddenu.
                             "user-file": "hiddenu",
-                            "user": "",
 
                             // The password is the content of the
                             // file /usr/local/share/kea/kea-creds/hiddenp.
-                            "password-file": "hiddenp",
-                            "password": ""
+                            "password-file": "hiddenp"
                         },
 
                         // This specifies a hidden client using a
                             // The secret is the content of the file
                             // /usr/local/share/kea/kea-creds/hiddens which must be in
                             // the <user-id>:<password> format.
-                            "password-file": "hiddens",
-                            "user-file": "",
-                            "user": "",
-                            "password": ""
+                            "password-file": "hiddens"
                         }
                     ]
                 }
index 4aa0ccf2f2aa5c2352e9169d1f2fb28cf5582377..7a264b273ec05a2ae7c461c31a26683a1e35957a 100644 (file)
@@ -280,14 +280,14 @@ TEST_F(ConfigTestKeaV4, examples4) {
         "backends.json",
         "classify.json",
         "classify2.json",
-        //"comments.json",
+        "comments.json",
         "config-backend.json",
         "dhcpv4-over-dhcpv6.json",
         "global-reservations.json",
         "ha-load-balancing-server1-mt-with-tls.json",
         "ha-load-balancing-server2-mt.json",
         "hooks.json",
-        //"hooks-radius.json",
+        "hooks-radius.json",
         "leases-expiration.json",
         "multiple-options.json",
         "mysql-reservations.json",
@@ -320,7 +320,7 @@ TEST_F(ConfigTestKeaV6, examples6) {
         "backends.json",
         "classify.json",
         "classify2.json",
-        //"comments.json",
+        "comments.json",
         "config-backend.json",
         "dhcpv4-over-dhcpv6.json",
         "duid.json",
index b997ae7f47ca8044ed112ae53b9e0723dab94ae8..b208f94b7b8ef2b9ea40aa25d0167a87471efda1 100644 (file)
@@ -89,6 +89,7 @@ TranslatorControlSocket::getControlSocketKea(DataNode const& data_node) {
                         checkAndGetDivergingLeaf(authentication, node, "type", "auth-type");
                         checkAndGetLeaf(authentication, node, "realm");
                         checkAndGetLeaf(authentication, node, "directory");
+                        checkAndGetAndJsonifyLeaf(authentication, node, "user-context");
                         ConstElementPtr clients = getControlSocketAuthenticationClients(node);
                         if (clients) {
                             authentication->set("clients", clients);
@@ -132,6 +133,8 @@ TranslatorControlSocket::getControlSocketAuthenticationClient(DataNode const& da
     getMandatoryLeaf(result, data_node, "password");
     getMandatoryLeaf(result, data_node, "user-file");
     getMandatoryLeaf(result, data_node, "password-file");
+    checkAndGetAndJsonifyLeaf(result, data_node, "user-context");
+
     return (result->empty() ? ElementPtr() : result);
 }
 
@@ -235,6 +238,7 @@ TranslatorControlSocket::setControlSocketKea(string const& xpath,
             setMandatoryDivergingLeaf(authentication, xpath +"/authentication" , "type", "auth-type", LeafBaseType::String);
             checkAndSetLeaf(authentication, xpath + "/authentication", "realm", LeafBaseType::String);
             checkAndSetLeaf(authentication, xpath + "/authentication", "directory", LeafBaseType::String);
+            checkAndSetUserContext(authentication, xpath + "/authentication");
             ConstElementPtr clients = authentication->get("clients");
             setControlSocketAuthenticationClients(xpath + "/authentication/clients", clients);
         }
@@ -285,8 +289,9 @@ TranslatorControlSocket::setControlSocketAuthenticationClients(string const& xpa
 
 void
 TranslatorControlSocket::setControlSocketAuthenticationClient(string const& xpath,
-                                                              ConstElementPtr /* elem */) {
+                                                              ConstElementPtr elem) {
     setItem(xpath, ElementPtr(), LeafBaseType::Unknown);
+    checkAndSetUserContext(elem, xpath);
 }
 
 void
index d5437bc1beaf902c70ba69d1494576862d188969..c708553205135503aa60c3bacdace601d656c61f 100644 (file)
@@ -1 +1 @@
-160eb58d10c1c29ab40763f69b9d905644ee767badfdceee6bdd730e9a6071f6
+b5f9e40815ea19641d64eefaf4acd429526e5f58c7ac8154fa89cd6c0033722e
index 0442731b21ff0d3133a7d398c9ba9d900241bd0d..639baef170848db0629e24fde23477b5474d050c 100644 (file)
@@ -155,6 +155,10 @@ module kea-types {
         type string;
         description "HTTP password file.";
       }
+      leaf user-context {
+        type user-context;
+        description "Logger user context.";
+      }
       key "user password user-file password-file";
     }
   }
@@ -181,6 +185,10 @@ module kea-types {
         description "HTTP authentication directory.";
       }
       uses clients;
+      leaf user-context {
+        type user-context;
+        description "Logger user context.";
+      }
     }
   }