Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Pavel Zhukov
Kea
Commits
570ec438
Commit
570ec438
authored
Oct 24, 2018
by
Tomek Mrugalski
🛰
Committed by
Francis Dupont
Oct 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#65,!30] Unnecessary keaexample model removed.
parent
89dad52a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
93 deletions
+32
-93
src/lib/yang/pretests/sysrepo_setup_tests.cc
src/lib/yang/pretests/sysrepo_setup_tests.cc
+1
-10
src/lib/yang/tests/Makefile.am
src/lib/yang/tests/Makefile.am
+1
-1
src/lib/yang/tests/keaexample-module.yang
src/lib/yang/tests/keaexample-module.yang
+0
-32
src/lib/yang/tests/keatest-module.yang
src/lib/yang/tests/keatest-module.yang
+16
-0
src/lib/yang/tests/translator_unittests.cc
src/lib/yang/tests/translator_unittests.cc
+8
-8
src/lib/yang/tests/translator_utils_unittests.cc
src/lib/yang/tests/translator_utils_unittests.cc
+4
-34
src/lib/yang/tests/yang_configs.h
src/lib/yang/tests/yang_configs.h
+2
-8
No files found.
src/lib/yang/pretests/sysrepo_setup_tests.cc
View file @
570ec438
...
...
@@ -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
;
...
...
src/lib/yang/tests/Makefile.am
View file @
570ec438
...
...
@@ -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
...
...
src/lib/yang/tests/keaexample-module.yang
deleted
100644 → 0
View file @
89dad52a
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"
;
}
}
}
src/lib/yang/tests/keatest-module.yang
View file @
570ec438
...
...
@@ -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
{
...
...
src/lib/yang/tests/translator_unittests.cc
View file @
570ec438
...
...
@@ -150,11 +150,11 @@ TEST(TranslatorBasicTest, getItem) {
ASSERT_NO_THROW
(
t_obj
.
reset
(
new
TranslatorBasic
(
sess
)));
// Container.
string
xpath
=
"/kea
example
-module:container/list"
;
string
xpath
=
"/kea
test
-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
(
"/kea
example
-module:containe"
));
EXPECT_NO_THROW
(
elem
=
t_obj
->
getItem
(
"/kea
test
-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
=
"/kea
example
-module:containe"
;
string
xpath
=
"/kea
test
-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
=
"/kea
example
-module:container/list"
;
xpath
=
"/kea
test
-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
(
"/kea
example
-module:container/list"
));
EXPECT_NO_THROW
(
iter
=
t_obj
->
getIter
(
"/kea
test
-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
=
"/kea
example
-module:container/list[key1='key1'][key2='key2']/leaf"
;
xpath
=
"/kea
test
-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
(
"/kea
example
-module:container/list"
));
EXPECT_NO_THROW
(
iter
=
t_obj
->
getIter
(
"/kea
test
-module:container/list"
));
ASSERT_TRUE
(
iter
);
EXPECT_NO_THROW
(
xpath
=
t_obj
->
getNext
(
iter
));
EXPECT_EQ
(
"/kea
example
-module:container/list[key1='key1'][key2='key2']"
,
EXPECT_EQ
(
"/kea
test
-module:container/list[key1='key1'][key2='key2']"
,
xpath
);
EXPECT_NO_THROW
(
xpath
=
t_obj
->
getNext
(
iter
));
EXPECT_TRUE
(
xpath
.
empty
());
...
...
src/lib/yang/tests/translator_utils_unittests.cc
View file @
570ec438
...
...
@@ -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.
...
...
src/lib/yang/tests/yang_configs.h
View file @
570ec438
...
...
@@ -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
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment