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
Sebastian Schrader
Kea
Commits
8354fff5
Commit
8354fff5
authored
Oct 20, 2018
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[65-libyang-class] Fixed rebased errors
parent
67444792
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
src/lib/yang/tests/translator_class_unittests.cc
src/lib/yang/tests/translator_class_unittests.cc
+5
-4
src/lib/yang/translator_class.cc
src/lib/yang/translator_class.cc
+11
-10
No files found.
src/lib/yang/tests/translator_class_unittests.cc
View file @
8354fff5
...
...
@@ -7,6 +7,7 @@
#include <config.h>
#include <yang/translator_class.h>
#include <yang/yang_models.h>
#include <yang/tests/sysrepo_setup.h>
#include <gtest/gtest.h>
...
...
@@ -38,7 +39,7 @@ public:
// This test verifies that an empty client class list can be properly
// translated from YANG to JSON.
TEST_F
(
TranslatorClassesTest
,
getEmpty
)
{
useModel
(
"kea-dhcp4-server"
);
useModel
(
KEA_DHCP4_SERVER
);
// Get the client class list and checks it is empty.
const
string
&
xpath
=
"/kea-dhcp4-server:config/client-classes"
;
...
...
@@ -50,7 +51,7 @@ TEST_F(TranslatorClassesTest, getEmpty) {
// This test verifies that one client class can be properly translated
// from YANG to JSON.
TEST_F
(
TranslatorClassesTest
,
get
)
{
useModel
(
"kea-dhcp6-server"
);
useModel
(
KEA_DHCP6_SERVER
);
// Create the client class.
const
string
&
xpath
=
"/kea-dhcp6-server:config/client-classes"
;
...
...
@@ -80,7 +81,7 @@ TEST_F(TranslatorClassesTest, get) {
// This test verifies that an empty client class list can be properly
// translated from JSON to YANG.
TEST_F
(
TranslatorClassesTest
,
setEmpty
)
{
useModel
(
"kea-dhcp4-server"
);
useModel
(
KEA_DHCP4_SERVER
);
// Set empty list.
const
string
&
xpath
=
"/kea-dhcp4-server:config/client-classes"
;
...
...
@@ -101,7 +102,7 @@ TEST_F(TranslatorClassesTest, setEmpty) {
// This test verifies that one client class can be properly translated
// from JSON to YANG.
TEST_F
(
TranslatorClassesTest
,
set
)
{
useModel
(
"kea-dhcp6-server"
);
useModel
(
KEA_DHCP6_SERVER
);
// Set one client class.
const
string
&
xpath
=
"/kea-dhcp6-server:config/client-classes"
;
...
...
src/lib/yang/translator_class.cc
View file @
8354fff5
...
...
@@ -6,6 +6,7 @@
#include <yang/translator_class.h>
#include <yang/adaptor.h>
#include <yang/yang_models.h>
#include <sstream>
using
namespace
std
;
...
...
@@ -29,8 +30,8 @@ TranslatorClass::~TranslatorClass() {
ElementPtr
TranslatorClass
::
getClass
(
const
string
&
xpath
)
{
try
{
if
((
model_
==
"kea-dhcp4-server"
)
||
(
model_
==
"kea-dhcp6-server"
))
{
if
((
model_
==
KEA_DHCP4_SERVER
)
||
(
model_
==
KEA_DHCP6_SERVER
))
{
return
(
getClassKea
(
xpath
));
}
}
catch
(
const
sysrepo_exception
&
ex
)
{
...
...
@@ -63,7 +64,7 @@ TranslatorClass::getClassKea(const string& xpath) {
if
(
options
&&
(
options
->
size
()
>
0
))
{
result
->
set
(
"option-data"
,
options
);
}
if
(
model_
==
"kea-dhcp4-server"
)
{
if
(
model_
==
KEA_DHCP4_SERVER
)
{
ConstElementPtr
defs
=
getOptionDefList
(
xpath
+
"/option-def-list"
);
if
(
defs
&&
(
defs
->
size
()
>
0
))
{
result
->
set
(
"option-def"
,
defs
);
...
...
@@ -91,8 +92,8 @@ TranslatorClass::getClassKea(const string& xpath) {
void
TranslatorClass
::
setClass
(
const
string
&
xpath
,
ConstElementPtr
elem
)
{
try
{
if
((
model_
==
"kea-dhcp4-server"
)
||
(
model_
==
"kea-dhcp6-server"
))
{
if
((
model_
==
KEA_DHCP4_SERVER
)
||
(
model_
==
KEA_DHCP6_SERVER
))
{
setClassKea
(
xpath
,
elem
);
}
else
{
isc_throw
(
NotImplemented
,
...
...
@@ -124,7 +125,7 @@ TranslatorClass::setClassKea(const string& xpath, ConstElementPtr elem) {
setOptionDataList
(
xpath
+
"/option-data-list"
,
options
);
created
=
true
;
}
if
(
model_
==
"kea-dhcp4-server"
)
{
if
(
model_
==
KEA_DHCP4_SERVER
)
{
ConstElementPtr
defs
=
elem
->
get
(
"option-def"
);
if
(
defs
)
{
setOptionDefList
(
xpath
+
"/option-def-list"
,
defs
);
...
...
@@ -175,8 +176,8 @@ TranslatorClasses::~TranslatorClasses() {
ConstElementPtr
TranslatorClasses
::
getClasses
(
const
string
&
xpath
)
{
try
{
if
((
model_
==
"kea-dhcp4-server"
)
||
(
model_
==
"kea-dhcp6-server"
))
{
if
((
model_
==
KEA_DHCP4_SERVER
)
||
(
model_
==
KEA_DHCP6_SERVER
))
{
return
(
getClassesKea
(
xpath
));
}
}
catch
(
const
sysrepo_exception
&
ex
)
{
...
...
@@ -213,8 +214,8 @@ TranslatorClasses::getClassesKea(const string& xpath) {
void
TranslatorClasses
::
setClasses
(
const
string
&
xpath
,
ConstElementPtr
elem
)
{
try
{
if
((
model_
==
"kea-dhcp4-server"
)
||
(
model_
==
"kea-dhcp6-server"
))
{
if
((
model_
==
KEA_DHCP4_SERVER
)
||
(
model_
==
KEA_DHCP6_SERVER
))
{
setClassesKea
(
xpath
,
elem
);
}
else
{
isc_throw
(
NotImplemented
,
...
...
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