]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#65,!30] Unnecessary keaexample model removed.
authorTomek Mrugalski <tomasz@isc.org>
Wed, 24 Oct 2018 10:03:50 +0000 (12:03 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 24 Oct 2018 13:50:51 +0000 (15:50 +0200)
src/lib/yang/pretests/sysrepo_setup_tests.cc
src/lib/yang/tests/Makefile.am
src/lib/yang/tests/keaexample-module.yang [deleted file]
src/lib/yang/tests/keatest-module.yang
src/lib/yang/tests/translator_unittests.cc
src/lib/yang/tests/translator_utils_unittests.cc
src/lib/yang/tests/yang_configs.h

index 5a51bfe0adbc4f8f162f7ce2dad4612692697928..4a97127a78d632290ab17d4958caf24ecc5d1849 100644 (file)
@@ -14,7 +14,6 @@ using namespace std;
 /// Not using libyang headers, e.g. yang_models.h.
 
 const string TEST_MODULE = "keatest-module";
-const string EXAMPLE_MODULE = "keaexample-module";
 const string IETF_TYPES = "ietf-inet-types";
 const string YANG_TYPES = "ietf-yang-types";
 const string IETF_MODULE = "ietf-dhcpv6-server";
@@ -75,7 +74,6 @@ int main() {
     }
 
     bool found_test = false;
-    bool found_example = false;
     bool found_ietf_types = false;
     bool found_yang_types =false;
     bool found_ietf = false;
@@ -91,8 +89,6 @@ int main() {
         }
         if (module == TEST_MODULE) {
             found_test = true;
-        } else if (module == EXAMPLE_MODULE) {
-            found_example = true;
         } else if (module == IETF_TYPES) {
             found_ietf_types = true;
         } else if (module == YANG_TYPES) {
@@ -112,7 +108,7 @@ int main() {
 
     int exit_code = 0;
 
-    if (!found_test || !found_example ||
+    if (!found_test || 
         !found_ietf_types || !found_yang_types ||
         !found_ietf || !found_kea4 || !found_kea6 || !found_keaca ||
         !found_kea2) {
@@ -124,11 +120,6 @@ int main() {
         --exit_code;
     }
 
-    if (!found_example) {
-        cerr << missingModuleText(EXAMPLE_MODULE);
-        --exit_code;
-    }
-
     if (!found_ietf_types) {
         cerr << missingModuleText(IETF_TYPES);
         --exit_code;
index e76a8b9a8df457e5f7209975b6a8a5b464c9f631..4a8f091ece4147e4839560d496e126a53954989c 100644 (file)
@@ -12,7 +12,7 @@ CLEANFILES = *.gcno *.gcda
 TESTS_ENVIRONMENT = \
        $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
 
-EXTRA_DIST = keatest-module.yang keaexample-module.yang
+EXTRA_DIST = keatest-module.yang
 
 TESTS =
 if HAVE_GTEST
diff --git a/src/lib/yang/tests/keaexample-module.yang b/src/lib/yang/tests/keaexample-module.yang
deleted file mode 100644 (file)
index 6e0eb84..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-module keaexample-module {
-  yang-version 1.1;
-  namespace "urn:ietf:params:xml:ns:yang:keaexample-module";
-  prefix tm;
-
-  import ietf-inet-types {
-    prefix inet;
-  }
-
-  organization "Sysrepo and ISC";
-  description
-    "ISC imported an example module from Sysrepo tests and adapted it
-     to kea testing regime.";
-  contact
-    "kea-dev@lists.isc.org";
-
-   container container {
-      config true;
-      list list {
-         leaf leaf {
-            type string;
-         }
-         leaf key1 {
-            type string;
-         }
-         leaf key2 {
-            type string;
-         }
-         key "key1 key2";
-      }
-   }
-}
index 4a0bb74938c21f38beb4fb334e6154da8fdcfc42..0d09a667efa522799e983ca80ed1a235a2563b66 100644 (file)
@@ -28,6 +28,22 @@ module keatest-module {
     description "Power in dBm";
   }
 
+  container container {
+      config true;
+      list list {
+         leaf leaf {
+            type string;
+         }
+         leaf key1 {
+            type string;
+         }
+         leaf key2 {
+            type string;
+         }
+         key "key1 key2";
+      }
+  }
+
   container main {
     leaf enum {
       type enumeration {
index 08ed2666f780f36f9a93b9097becee568922eaf7..7639b129dba6a093462ce6246d5878ca3b5e740e 100644 (file)
@@ -150,11 +150,11 @@ TEST(TranslatorBasicTest, getItem) {
     ASSERT_NO_THROW(t_obj.reset(new TranslatorBasic(sess)));
 
     // Container.
-    string xpath = "/keaexample-module:container/list";
+    string xpath = "/keatest-module:container/list";
     S_Val s_val;
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
     ConstElementPtr elem;
-    EXPECT_NO_THROW(elem = t_obj->getItem("/keaexample-module:containe"));
+    EXPECT_NO_THROW(elem = t_obj->getItem("/keatest-module:containe"));
     EXPECT_FALSE(elem);
     elem.reset();
 
@@ -452,14 +452,14 @@ TEST(TranslatorBasicTest, setItem) {
     ASSERT_NO_THROW(t_obj.reset(new TranslatorBasic(sess)));
 
     // Container.
-    string xpath = "/keaexample-module:containe";
+    string xpath = "/keatest-module:containe";
     ConstElementPtr elem = Element::createMap();
     EXPECT_THROW(t_obj->setItem(xpath, elem, SR_CONTAINER_T), NotImplemented);
     EXPECT_THROW(t_obj->setItem(xpath, elem, SR_CONTAINER_PRESENCE_T),
                  NotImplemented);
 
     // List.
-    xpath = "/keaexample-module:container/list";
+    xpath = "/keatest-module:container/list";
     elem = Element::createList();
     EXPECT_NO_THROW(t_obj->setItem(xpath, elem, SR_LIST_T));
     S_Val s_val;
@@ -657,20 +657,20 @@ TEST(TranslatorBasicTest, list) {
 
     // Empty list.
     S_Iter_Value iter;
-    EXPECT_NO_THROW(iter = t_obj->getIter("/keaexample-module:container/list"));
+    EXPECT_NO_THROW(iter = t_obj->getIter("/keatest-module:container/list"));
     ASSERT_TRUE(iter);
     string xpath;
     EXPECT_NO_THROW(xpath = t_obj->getNext(iter));
     EXPECT_TRUE(xpath.empty());
 
     // Retried with a filled list.
-    xpath = "/keaexample-module:container/list[key1='key1'][key2='key2']/leaf";
+    xpath = "/keatest-module:container/list[key1='key1'][key2='key2']/leaf";
     S_Val s_val(new Val("Leaf value"));
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
-    EXPECT_NO_THROW(iter = t_obj->getIter("/keaexample-module:container/list"));
+    EXPECT_NO_THROW(iter = t_obj->getIter("/keatest-module:container/list"));
     ASSERT_TRUE(iter);
     EXPECT_NO_THROW(xpath = t_obj->getNext(iter));
-    EXPECT_EQ("/keaexample-module:container/list[key1='key1'][key2='key2']",
+    EXPECT_EQ("/keatest-module:container/list[key1='key1'][key2='key2']",
               xpath);
     EXPECT_NO_THROW(xpath = t_obj->getNext(iter));
     EXPECT_TRUE(xpath.empty());
index cea5081d121ff71114554de3dd81d304360fdd44..bf5d4525b4a5c2b805ccf2a9edd24d35d6ae7237 100644 (file)
@@ -56,26 +56,6 @@ TEST(YangReprTest, item) {
     EXPECT_EQ(item2, item1);
 }
 
-// Test get with example module.
-TEST(YangReprTest, getExample) {
-    // Get a translator object to play with.
-    S_Connection conn(new Connection("utils unittests"));
-    S_Session sess(new Session(conn, SR_DS_CANDIDATE));
-
-    // Create a list.
-    string xpath = "/keaexample-module:container/list";
-    S_Val s_val;
-    EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
-
-    // Get it.
-    YangRepr repr(exampleModel);
-    YRTree tree;
-    EXPECT_NO_THROW(tree = repr.get(sess));
-
-    // Verify.
-    EXPECT_TRUE(repr.verify(exampleTree, sess, cerr));
-}
-
 // Test get with test module.
 TEST(YangReprTest, getTest) {
     // Get a translator object to play with.
@@ -86,6 +66,10 @@ TEST(YangReprTest, getTest) {
     string xpath;
     S_Val s_val;
 
+    // Create a list.
+    xpath = "/keatest-module:container/list";
+    EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
+
     xpath = "/keatest-module:main/string";
     s_val.reset(new Val("str", SR_STRING_T));
     EXPECT_NO_THROW(sess->set_item(xpath.c_str(), s_val));
@@ -174,20 +158,6 @@ TEST(YangReprTest, getTest) {
     EXPECT_FALSE(repr.verify(badextra, sess, cerr));
 }
 
-// Test set with example module.
-TEST(YangReprTest, setExample) {
-    // Get a translator object to play with.
-    S_Connection conn(new Connection("utils unittests"));
-    S_Session sess(new Session(conn, SR_DS_CANDIDATE));
-
-    // Set the module content.
-    YangRepr repr(exampleModel);
-    EXPECT_NO_THROW(repr.set(exampleTree, sess));
-
-    // Verify it.
-    EXPECT_TRUE(repr.verify(exampleTree, sess, cerr));
-}
-
 // Test set with test module.
 TEST(YangReprTest, setTest) {
     // Get a translator object to play with.
index 0720077b8bdbef9de8bacbeba4e3fff97b1b127d..afdd98a8155b78221ef7e716d4bac92d2e178b55 100644 (file)
@@ -14,16 +14,11 @@ namespace isc {
 namespace yang {
 namespace test {
 
-/// @brief The example module from sysrepo tests.
-const std::string exampleModel = "keaexample-module";
-const YRTree exampleTree = {
-    { "/keaexample-module:container",      "", SR_CONTAINER_T, false },
-    { "/keaexample-module:container/list", "", SR_LIST_T,      true }
-};
-
 /// @brief The test module from sysrepo tests.
 const std::string testModel = "keatest-module";
 const YRTree testTree = {
+    { "/keatest-module:container",      "", SR_CONTAINER_T, false },
+    { "/keatest-module:container/list", "", SR_LIST_T,      true },
     { "/keatest-module:main", "", SR_CONTAINER_T, false },
     { "/keatest-module:main/string", "str", SR_STRING_T, true },
     { "/keatest-module:main/boolean", "true", SR_BOOL_T, true },
@@ -445,7 +440,6 @@ const YRTree designExampleTree = {
 /// @brief Set of example configurations.
 const std::vector<std::pair<std::string, YRTree> > test_configs =
 {
-    { exampleModel,                exampleTree },
     { testModel,                   testTree },
     { subnetTwoPoolsModelIetf6,    subnetTwoPoolsTreeIetf6 },
     { subnetTimersModel,           subnetTimersIetf6 },