]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#65,!44] Minor changes after review.
authorTomek Mrugalski <tomasz@isc.org>
Fri, 5 Oct 2018 15:03:09 +0000 (17:03 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Fri, 5 Oct 2018 15:03:25 +0000 (17:03 +0200)
src/lib/yang/Makefile.am
src/lib/yang/translator_pool.cc
src/lib/yang/translator_pool.h

index 05164cd16bd7c051615c5c9ede300172f2517851..bc7d227481b8830a6180724b4951f3ea481c1101 100644 (file)
@@ -13,6 +13,7 @@ libkea_yang_la_SOURCES += translator_option_data.h
 libkea_yang_la_SOURCES += translator_option_def.cc
 libkea_yang_la_SOURCES += translator_option_def.h
 libkea_yang_la_SOURCES += translator_pool.cc translator_pool.h
+libkea_yang_la_SOURCES += yang_models.h
 
 libkea_yang_la_LIBADD =  $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
 libkea_yang_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
index 4d55f53b4b446ad677cb043f41bf2d7835ae4998..ca4988ae289e99fa39003d15cce21f96e989ae72 100644 (file)
@@ -8,6 +8,7 @@
 #include <asiolink/addr_utilities.h>
 #include <yang/adaptor.h>
 #include <yang/translator_pool.h>
+#include <yang/yang_models.h>
 #include <boost/lexical_cast.hpp>
 #include <sstream>
 
@@ -32,10 +33,10 @@ TranslatorPool::~TranslatorPool() {
 ElementPtr
 TranslatorPool::getPool(const string& xpath) {
     try {
-        if (model_ == "ietf-dhcpv6-server") {
+        if (model_ == IETF_DHCPV6_SERVER) {
             return (getPoolIetf6(xpath));
-        } else if ((model_ == "kea-dhcp4-server") ||
-                   (model_ == "kea-dhcp6-server")) {
+        } else if ((model_ == KEA_DHCP4_SERVER) ||
+                   (model_ == KEA_DHCP6_SERVER)) {
             return (getPoolKea(xpath));
         }
     } catch (const sysrepo_exception& ex) {
@@ -125,10 +126,10 @@ TranslatorPool::getPoolKea(const string& xpath) {
 void
 TranslatorPool::setPool(const string& xpath, ConstElementPtr elem) {
     try {
-        if (model_ == "ietf-dhcpv6-server") {
+        if (model_ == IETF_DHCPV6_SERVER) {
             setPoolIetf6(xpath, elem);
-        } else if ((model_ == "kea-dhcp4-server") ||
-                   (model_ == "kea-dhcp6-server")) {
+        } else if ((model_ == KEA_DHCP4_SERVER) ||
+                   (model_ == KEA_DHCP6_SERVER)) {
             setPoolKea(xpath, elem);
         } else {
             isc_throw(NotImplemented,
@@ -299,10 +300,10 @@ TranslatorPools::getPools(const string& xpath) {
 void
 TranslatorPools::setPools(const string& xpath, ConstElementPtr elem) {
     try {
-        if (model_ == "ietf-dhcpv6-server") {
+        if (model_ == IETF_DHCPV6_SERVER) {
             setPoolsbyId(xpath, elem);
-        } else if ((model_ == "kea-dhcp4-server") ||
-                   (model_ == "kea-dhcp6-server")) {
+        } else if ((model_ == KEA_DHCP4_SERVER) ||
+                   (model_ == KEA_DHCP6_SERVER)) {
             setPoolsbyAddresses(xpath, elem);
         } else {
             isc_throw(NotImplemented,
index e3277f5c1ca04a9982a7ffa09c0aca7a7123d346..0a8e3421c276b700d1c0b6ce2eebeba204a70b05 100644 (file)
@@ -13,7 +13,9 @@
 namespace isc {
 namespace yang {
 
-/// Address pool translation between YANG and JSON
+/// @brief A translator class for converting a pool between YANG and JSON.
+///
+/// Currently supports on kea-dhcp[46]-server and partially ietf-dhcpv6-server.
 ///
 /// JSON syntax for both kea-dhcp4 and kea-dhcp6 is:
 /// @code
@@ -121,10 +123,6 @@ namespace yang {
 ///     pool[start-address='2001:db8::1'][end-address='2001:db8::100']/
 ///     end-address = 2001:db8::100
 /// @endcode
-
-/// @brief A translator class for converting a pool between YANG and JSON.
-///
-/// Currently supports on kea-dhcp[46]-server and partially ietf-dhcpv6-server.
 class TranslatorPool : virtual public TranslatorOptionDataList {
 public: