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
445
Issues
445
List
Boards
Labels
Service Desk
Milestones
Merge Requests
71
Merge Requests
71
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
ISC Open Source Projects
Kea
Commits
2fec3c3c
Commit
2fec3c3c
authored
Sep 24, 2018
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[65-libyang-option-data] Reviewed changes
parent
717c9a27
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
18 deletions
+47
-18
src/lib/yang/pretests/sysrepo_setup_tests.cc
src/lib/yang/pretests/sysrepo_setup_tests.cc
+40
-16
src/lib/yang/tests/translator_option_data_unittests.cc
src/lib/yang/tests/translator_option_data_unittests.cc
+7
-2
No files found.
src/lib/yang/pretests/sysrepo_setup_tests.cc
View file @
2fec3c3c
...
...
@@ -12,11 +12,15 @@
using
namespace
std
;
const
string
TEST_MODULE
=
"keatest-module"
;
const
string
IETF_TYPES
=
"ietf-inet-types"
;
const
string
YANG_TYPES
=
"ietf-yang-types"
;
const
string
IETF_MODULE
=
"ietf-dhcpv6-server"
;
const
string
KEA_DHCP4_MODULE
=
"kea-dhcp4-server"
;
const
string
KEA_DHCP6_MODULE
=
"kea-dhcp6-server"
;
const
string
KEA_CTRL_AGENT_MODULE
=
"kea-ctrl-agent"
;
const
string
KEA_D2_MODULE
=
"kea-dhcp-ddns"
;
// const string REPOSITORY = SYSREPO_REPO;
const
string
REPOSITORY
=
"<sysrepo repository>"
;
/// @brief Returns nicely formed error message if module is missing
///
...
...
@@ -26,15 +30,11 @@ string missingModuleText(const string& name) {
stringstream
tmp
;
tmp
<<
"ERROR: YANG model "
<<
name
<<
" is not installed."
<<
endl
<<
"The environment is not suitable for running unit-tests."
<<
endl
<<
"Please locate "
<<
name
<<
".yang and issue the following command:"
<<
endl
<<
endl
<<
"# sysrepoctl -i -g "
<<
name
<<
".yang"
<<
endl
<<
endl
<<
"If sysrepoctl complains about missing data model, you may need to specify "
<<
endl
<<
"the default Sysrepo schema directory with -s PATH. You can check it with:"
<<
endl
<<
endl
<<
"$ sysrepoctl -l"
<<
endl
<<
endl
;
<<
"Please locate "
<<
name
<<
".yang, change to its directory and "
<<
"issue the following command:"
<<
endl
<<
endl
<<
"# sysrepoctl -i -s "
<<
REPOSITORY
<<
"/yang "
<<
"-s . -g "
<<
name
<<
".yang"
<<
endl
<<
endl
<<
endl
;
return
(
tmp
.
str
());
}
...
...
@@ -43,6 +43,7 @@ string missingModuleText(const string& name) {
/// - daemon required
/// - session establishment
/// - test module
/// - type modules
/// - IETF module
/// - Kea modules.
int
main
()
{
...
...
@@ -67,7 +68,8 @@ int main() {
try
{
sess
.
reset
(
new
Session
(
conn
,
SR_DS_CANDIDATE
));
}
catch
(
const
sysrepo_exception
&
ex
)
{
cerr
<<
"ERROR: Can't establish a sysrepo session: "
<<
ex
.
what
()
<<
endl
;
cerr
<<
"ERROR: Can't establish a sysrepo session: "
<<
ex
.
what
()
<<
endl
;
exit
(
-
3
);
}
S_Yang_Schemas
schemas
;
...
...
@@ -78,6 +80,8 @@ int main() {
exit
(
-
4
);
}
bool
found_test
=
false
;
bool
found_ietf_types
=
false
;
bool
found_yang_types
=
false
;
bool
found_ietf
=
false
;
bool
found_kea4
=
false
;
bool
found_kea6
=
false
;
...
...
@@ -91,6 +95,10 @@ int main() {
}
if
(
module
==
TEST_MODULE
)
{
found_test
=
true
;
}
else
if
(
module
==
IETF_TYPES
)
{
found_ietf_types
=
true
;
}
else
if
(
module
==
YANG_TYPES
)
{
found_yang_types
=
true
;
}
else
if
(
module
==
IETF_MODULE
)
{
found_ietf
=
true
;
}
else
if
(
module
==
KEA_DHCP4_MODULE
)
{
...
...
@@ -107,34 +115,50 @@ int main() {
int
exit_code
=
0
;
if
(
!
found_test
||
!
found_ietf_types
||
!
found_yang_types
||
!
found_ietf
||
!
found_kea4
||
!
found_kea6
||
!
found_keaca
||
!
found_kea2
)
{
exit_code
=
4
;
}
if
(
!
found_test
)
{
cerr
<<
missingModuleText
(
TEST_MODULE
);
exit_code
=
-
5
;
--
exit_code
;
}
if
(
!
found_ietf_types
)
{
cerr
<<
missingModuleText
(
IETF_TYPES
);
--
exit_code
;
}
if
(
!
found_yang_types
)
{
cerr
<<
missingModuleText
(
YANG_TYPES
);
--
exit_code
;
}
if
(
!
found_ietf
)
{
cerr
<<
missingModuleText
(
IETF_MODULE
);
exit_code
=
-
6
;
--
exit_code
;
}
if
(
!
found_kea4
)
{
cerr
<<
missingModuleText
(
KEA_DHCP4_MODULE
);
exit_code
=
-
7
;
--
exit_code
;
}
if
(
!
found_kea6
)
{
cerr
<<
missingModuleText
(
KEA_DHCP6_MODULE
);
exit_code
=
-
8
;
--
exit_code
;
}
if
(
!
found_keaca
)
{
cerr
<<
missingModuleText
(
KEA_CTRL_AGENT_MODULE
);
exit_code
=
-
9
;
--
exit_code
;
}
if
(
!
found_kea2
)
{
cerr
<<
missingModuleText
(
KEA_D2_MODULE
);
exit_code
=
-
10
;
--
exit_code
;
}
exit
(
exit_code
);
...
...
src/lib/yang/tests/translator_option_data_unittests.cc
View file @
2fec3c3c
...
...
@@ -70,8 +70,13 @@ TEST_F(TranslatorOptionDataListTest, get) {
ConstElementPtr
option
;
EXPECT_NO_THROW
(
option
=
t_obj_
->
getOptionData
(
xoption
));
ASSERT_TRUE
(
option
);
EXPECT_EQ
(
"{
\"
always-send
\"
: false,
\"
code
\"
: 100,
\"
csv-format
\"
: false, "
"
\"
data
\"
:
\"
12121212
\"
,
\"
space
\"
:
\"
dns
\"
}"
,
EXPECT_EQ
(
"{"
"
\"
always-send
\"
: false,"
"
\"
code
\"
: 100,"
"
\"
csv-format
\"
: false,"
"
\"
data
\"
:
\"
12121212
\"
,"
"
\"
space
\"
:
\"
dns
\"
"
" }"
,
option
->
str
());
// Get the option data list.
...
...
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