From: Francis Dupont Date: Thu, 13 Sep 2018 23:32:54 +0000 (+0200) Subject: [65-libyang-option-def] Renamed models X-Git-Tag: 65-libyang-class_base^2^2~6^2~5^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=941bbc5126b2415aa93cd83226044003fc588dac;p=thirdparty%2Fkea.git [65-libyang-option-def] Renamed models --- diff --git a/src/lib/yang/tests/translator_option_def_unittests.cc b/src/lib/yang/tests/translator_option_def_unittests.cc index 6d8a897bd9..2dfa434fc9 100644 --- a/src/lib/yang/tests/translator_option_def_unittests.cc +++ b/src/lib/yang/tests/translator_option_def_unittests.cc @@ -27,11 +27,11 @@ TEST(TranslatorOptionDefListTest, getEmpty) { boost::scoped_ptr 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 TranslatorOptionDefList(sess, model))); // Get the option definition list and checks it is empty. - const string& xpath = "/kea-dhcp4:config/option-def-list"; + const string& xpath = "/kea-dhcp4-server:config/option-def-list"; ConstElementPtr options; EXPECT_NO_THROW(options = todl_obj->getOptionDefList(xpath)); ASSERT_TRUE(options); @@ -47,11 +47,11 @@ TEST(TranslatorOptionDefListTest, get) { boost::scoped_ptr 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 TranslatorOptionDefList(sess, model))); // Create the option code 100. - const string& xpath = "/kea-dhcp6:config/option-def-list"; + const string& xpath = "/kea-dhcp6-server:config/option-def-list"; const string& xdef = xpath + "/option-def[code='100'][space='isc']"; const string& xname = xdef + "/name"; const string& xtype = xdef + "/type"; @@ -87,11 +87,11 @@ TEST(TranslatorOptionDefListTest, setEmpty) { boost::scoped_ptr 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 TranslatorOptionDefList(sess, model))); // Set empty list. - const string& xpath = "/kea-dhcp4:config/option-def-list"; + const string& xpath = "/kea-dhcp4-server:config/option-def-list"; ConstElementPtr defs = Element::createList(); EXPECT_NO_THROW(todl_obj->setOptionDefList(xpath, defs)); @@ -110,11 +110,11 @@ TEST(TranslatorOptionDefListTest, set) { boost::scoped_ptr 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 TranslatorOptionDefList(sess, model))); // Set one option def. - const string& xpath = "/kea-dhcp6:config/option-def-list"; + const string& xpath = "/kea-dhcp6-server:config/option-def-list"; ElementPtr defs = Element::createList(); ElementPtr def = Element::createMap(); def->set("code", Element::create(100)); @@ -134,10 +134,10 @@ TEST(TranslatorOptionDefListTest, 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-def-list (container)\n" " |\n" diff --git a/src/lib/yang/translator_option_def.cc b/src/lib/yang/translator_option_def.cc index ca7d80a530..ddc53ccd8f 100644 --- a/src/lib/yang/translator_option_def.cc +++ b/src/lib/yang/translator_option_def.cc @@ -25,7 +25,8 @@ TranslatorOptionDef::~TranslatorOptionDef() { ElementPtr TranslatorOptionDef::getOptionDef(const string& xpath) { try { - if ((model_ == "kea-dhcp4") || (model_ == "kea-dhcp6")) { + if ((model_ == "kea-dhcp4-server") || + (model_ == "kea-dhcp6-server")) { return (getOptionDefKea(xpath)); } } catch (const sysrepo_exception& ex) { @@ -73,7 +74,8 @@ TranslatorOptionDef::getOptionDefKea(const string& xpath) { void TranslatorOptionDef::setOptionDef(const string& xpath, ConstElementPtr elem) { try { - if ((model_ == "kea-dhcp4") || (model_ == "kea-dhcp6")) { + if ((model_ == "kea-dhcp4-server") || + (model_ == "kea-dhcp6-server")) { setOptionDefKea(xpath, elem); } else { isc_throw(NotImplemented, @@ -131,7 +133,8 @@ TranslatorOptionDefList::~TranslatorOptionDefList() { ConstElementPtr TranslatorOptionDefList::getOptionDefList(const string& xpath) { try { - if ((model_ == "kea-dhcp4") || (model_ == "kea-dhcp6")) { + if ((model_ == "kea-dhcp4-server") || + (model_ == "kea-dhcp6-server")) { return (getOptionDefListKea(xpath)); } } catch (const sysrepo_exception& ex) { @@ -164,7 +167,8 @@ void TranslatorOptionDefList::setOptionDefList(const string& xpath, ConstElementPtr elem) { try { - if ((model_ == "kea-dhcp4") || (model_ == "kea-dhcp6")) { + if ((model_ == "kea-dhcp4-server") || + (model_ == "kea-dhcp6-server")) { setOptionDefListKea(xpath, elem); } else { isc_throw(NotImplemented,