]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3931] addressed reviw comments
authorRazvan Becheriu <razvan@isc.org>
Thu, 24 Jul 2025 10:32:18 +0000 (13:32 +0300)
committerAndrei Pavel <andrei@isc.org>
Tue, 12 Aug 2025 09:19:35 +0000 (12:19 +0300)
changelog_unreleased/3931-update-netconf-dependencies-to-v3 [new file with mode: 0644]
src/lib/yang/tests/translator_unittests.cc
src/lib/yang/testutils/translator_test.cc
src/lib/yang/translator.cc

diff --git a/changelog_unreleased/3931-update-netconf-dependencies-to-v3 b/changelog_unreleased/3931-update-netconf-dependencies-to-v3
new file mode 100644 (file)
index 0000000..6acd099
--- /dev/null
@@ -0,0 +1,3 @@
+[func]*                andrei, razvan
+       Updated kea-netconf to libyang and sysrepo version 3.
+       (Gitlab #3931)
index 4d0cccae351e18443f24a80ac816428d13d267bb..2976cd75fe85911981e40e7bf292fed7aa9c1ba1 100644 (file)
@@ -35,6 +35,7 @@ private:
     void cleanUp() {
         Session session(sysrepo::Connection{}.sessionStart());
         session.switchDatastore(sysrepo::Datastore::Candidate);
+        // remove the 'if' statement when a fix is provided in sysrepo branch.
         if (session.getData("/keatest-module:container/list")) {
             session.deleteItem("/keatest-module:container/list");
         }
@@ -844,7 +845,7 @@ TEST_F(TranslatorTest, container) {
 
     // Container with no data apparently throws.
     EXPECT_THROW_MSG(element = translator.getItemFromAbsoluteXpath("/keatest-module:container"), NotImplemented,
-                     "getting node of type 1 not supported, xpath is '/keatest-module:container'");
+                     "getting node of type container not supported, xpath is '/keatest-module:container'");
     EXPECT_FALSE(element);
     element.reset();
 
@@ -860,12 +861,19 @@ TEST_F(TranslatorTest, container) {
     element.reset();
     EXPECT_THROW_MSG(
         element = translator.getItemFromAbsoluteXpath("/keatest-module:container"), NotImplemented,
-        "getting node of type 1 not supported, xpath is '/keatest-module:container'");
+        "getting node of type container not supported, xpath is '/keatest-module:container'");
     EXPECT_FALSE(element);
     element.reset();
     optional<DataNode> const& container(translator.findXPath("/keatest-module:container"));
+    EXPECT_THROW_MSG(element = translator.getItemFromAbsoluteXpath(
+                         "/keatest-module:container/list[key1='key1'][key2='key2']"),
+                     NotImplemented,
+                     "getting node of type list not supported, xpath is "
+                     "'/keatest-module:container/list[key1='key1'][key2='key2']'");
+    EXPECT_FALSE(element);
+    element.reset();
     try {
-        libyang::Set<libyang::DataNode> const& nodes((*container).findXPath("/keatest-module:container/list"));
+        libyang::Set<libyang::DataNode> const& nodes(container->findXPath("/keatest-module:container/list"));
         element = isc::data::Element::createList();
         for (libyang::DataNode const& i : nodes) {
             ElementPtr result = Element::createMap();
@@ -878,7 +886,7 @@ TEST_F(TranslatorTest, container) {
         ADD_FAILURE() << "failed to retrieve keatest-module:container/list[key1='key1][key2='key2']. error: " << ex.what();
     }
     ASSERT_TRUE(element);
-    ASSERT_EQ("[ { \"key1\": \"key1\", \"key2\": \"key2\", \"leaf\": \"Leaf value\" } ]", element->str());
+    EXPECT_EQ("[ { \"key1\": \"key1\", \"key2\": \"key2\", \"leaf\": \"Leaf value\" } ]", element->str());
 }
 
 // Test YANG list retrieval.
@@ -902,12 +910,12 @@ TEST_F(TranslatorTest, list) {
     element.reset();
     EXPECT_THROW_MSG(
         element = translator.getItemFromAbsoluteXpath("/keatest-module:container/list"), NotImplemented,
-        "getting node of type 16 not supported, xpath is '/keatest-module:container/list'");
+        "getting node of type list not supported, xpath is '/keatest-module:container/list'");
     EXPECT_FALSE(element);
     element.reset();
     EXPECT_THROW_MSG(element = translator.getItemFromAbsoluteXpath(
                          "/keatest-module:container/list[key1='key1'][key2='key2']"), NotImplemented,
-                     "getting node of type 16 not supported, xpath is "
+                     "getting node of type list not supported, xpath is "
                      "'/keatest-module:container/list[key1='key1'][key2='key2']'");
     EXPECT_FALSE(element);
 }
index 92b2bf2a64b99581da56009fea0ce238610ef8cd..7befdb7b9df5c12b59c87b9ec358cbedf61835f9 100644 (file)
@@ -252,7 +252,7 @@ operator<<(ostream& os, LeafBaseType type) {
         os << "unknown";
         break;
     default:
-        isc_throw(BadValue, "unsupported type " << int(type));
+        isc_throw(BadValue, "unsupported type " << type);
     }
     return (os);
 }
index 7857143d6658da85576c7a6cd2479ca36f1a2f8a..cec38508e48e906c9eefadabaff5acc789241955 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2025 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -175,7 +175,7 @@ Translator::getItem(DataNode const& data_node,
             return result;
         } else {
             isc_throw(NotImplemented, "getting node of type "
-                                          << int(node_type) << " not supported, xpath is '" << xpath
+                                          << node_type << " not supported, xpath is '" << xpath
                                           << "'");
         }