Commit 7eda6cd9 authored by Francis Dupont's avatar Francis Dupont Committed by Tomek Mrugalski

[65-libyang-option-data] Renamed models

parent 63d5e666
......@@ -27,11 +27,11 @@ TEST(TranslatorOptionDataListTest, getEmpty) {
boost::scoped_ptr<TranslatorOptionDataList> todl_obj;
// Use the ad hoc model.
const string& model = "kea-dhcp4";
const string& model = "kea-dhcp4-server";
EXPECT_NO_THROW(todl_obj.reset(new TranslatorOptionDataList(sess, model)));
// Get the option data list and checks it is empty.
const string& xpath = "/kea-dhcp4:config/option-data-list";
const string& xpath = "/kea-dhcp4-server:config/option-data-list";
ConstElementPtr options;
EXPECT_NO_THROW(options = todl_obj->getOptionDataList(xpath));
ASSERT_TRUE(options);
......@@ -47,11 +47,11 @@ TEST(TranslatorOptionDataListTest, get) {
boost::scoped_ptr<TranslatorOptionDataList> todl_obj;
// Use the ad hoc model.
const string& model = "kea-dhcp6";
const string& model = "kea-dhcp6-server";
EXPECT_NO_THROW(todl_obj.reset(new TranslatorOptionDataList(sess, model)));
// Create the option code 100.
const string& xpath = "/kea-dhcp6:config/option-data-list";
const string& xpath = "/kea-dhcp6-server:config/option-data-list";
const string& xoption = xpath + "/option-data[code='100'][space='dns']";
const string& xformat = xoption + "/csv-format";
const string& xdata = xoption + "/data";
......@@ -86,11 +86,11 @@ TEST(TranslatorOptionDataListTest, setEmpty) {
boost::scoped_ptr<TranslatorOptionDataList> todl_obj;
// Use the ad hoc model.
const string& model = "kea-dhcp4";
const string& model = "kea-dhcp4-server";
EXPECT_NO_THROW(todl_obj.reset(new TranslatorOptionDataList(sess, model)));
// Set empty list.
const string& xpath = "/kea-dhcp4:config/option-data-list";
const string& xpath = "/kea-dhcp4-server:config/option-data-list";
ConstElementPtr options = Element::createList();
EXPECT_NO_THROW(todl_obj->setOptionDataList(xpath, options));
......@@ -109,11 +109,11 @@ TEST(TranslatorOptionDataListTest, set) {
boost::scoped_ptr<TranslatorOptionDataList> todl_obj;
// Use the ad hoc model.
const string& model = "kea-dhcp6";
const string& model = "kea-dhcp6-server";
EXPECT_NO_THROW(todl_obj.reset(new TranslatorOptionDataList(sess, model)));
// Set one option data.
const string& xpath = "/kea-dhcp6:config/option-data-list";
const string& xpath = "/kea-dhcp6-server:config/option-data-list";
ElementPtr options = Element::createList();
ElementPtr option = Element::createMap();
option->set("code", Element::create(100));
......@@ -133,10 +133,10 @@ TEST(TranslatorOptionDataListTest, set) {
// Check the tree representation.
S_Tree tree;
EXPECT_NO_THROW(tree = sess->get_subtree("/kea-dhcp6:config"));
EXPECT_NO_THROW(tree = sess->get_subtree("/kea-dhcp6-server:config"));
ASSERT_TRUE(tree);
string expected =
"kea-dhcp6:config (container)\n"
"kea-dhcp6-server:config (container)\n"
" |\n"
" -- option-data-list (container)\n"
" |\n"
......
......@@ -25,7 +25,8 @@ TranslatorOptionData::~TranslatorOptionData() {
ElementPtr
TranslatorOptionData::getOptionData(const string& xpath) {
try {
if ((model_ == "kea-dhcp4") || (model_ == "kea-dhcp6")) {
if ((model_ == "kea-dhcp4-server") ||
(model_ == "kea-dhcp6-server")) {
return (getOptionDataKea(xpath));
}
} catch (const sysrepo_exception& ex) {
......@@ -74,7 +75,8 @@ void
TranslatorOptionData::setOptionData(const string& xpath,
ConstElementPtr elem) {
try {
if ((model_ == "kea-dhcp4") || (model_ == "kea-dhcp6")) {
if ((model_ == "kea-dhcp4-server") ||
(model_ == "kea-dhcp6-server")) {
setOptionDataKea(xpath, elem);
} else {
isc_throw(NotImplemented,
......@@ -126,7 +128,8 @@ TranslatorOptionDataList::~TranslatorOptionDataList() {
ConstElementPtr
TranslatorOptionDataList::getOptionDataList(const string& xpath) {
try {
if ((model_ == "kea-dhcp4") || (model_ == "kea-dhcp6")) {
if ((model_ == "kea-dhcp4-server") ||
(model_ == "kea-dhcp6-server")) {
return (getOptionDataListKea(xpath));
}
} catch (const sysrepo_exception& ex) {
......@@ -159,7 +162,8 @@ void
TranslatorOptionDataList::setOptionDataList(const string& xpath,
ConstElementPtr elem) {
try {
if ((model_ == "kea-dhcp4") || (model_ == "kea-dhcp6")) {
if ((model_ == "kea-dhcp4-server") ||
(model_ == "kea-dhcp6-server")) {
setOptionDataListKea(xpath, elem);
} else {
isc_throw(NotImplemented,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment