#include <config.h>
#include <yang/translator_class.h>
+#include <yang/yang_models.h>
#include <yang/tests/sysrepo_setup.h>
#include <gtest/gtest.h>
// 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";
// 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";
// 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";
// 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";
#include <yang/translator_class.h>
#include <yang/adaptor.h>
+#include <yang/yang_models.h>
#include <sstream>
using namespace std;
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) {
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);
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,
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);
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) {
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,