Commit 570ec438 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰 Committed by Francis Dupont

[#65,!30] Unnecessary keaexample model removed.

parent 89dad52a
......@@ -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;
......
......@@ -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
......
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";
}
}
}
......@@ -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 {
......
......@@ -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());
......
......@@ -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.
......
......@@ -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 },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment