]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[65-libyang-class] Fixed rebased errors
authorFrancis Dupont <fdupont@isc.org>
Fri, 19 Oct 2018 22:10:53 +0000 (00:10 +0200)
committerFrancis Dupont <fdupont@isc.org>
Mon, 22 Oct 2018 11:22:21 +0000 (07:22 -0400)
src/lib/yang/tests/translator_class_unittests.cc
src/lib/yang/translator_class.cc

index 3b2a218331a90a0dcaa48fdd0fccbc3fe9752117..d6eea31ffdb3cc2de43776ed06abbc254c0d3031 100644 (file)
@@ -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";
index 265d8e1fd6654ef7c900097eef947c3bd50be8d5..de0ec9a8ad0be07a45befcd40582b735bca4df63 100644 (file)
@@ -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,