]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[65-libyang-option-def] Renamed models
authorFrancis Dupont <fdupont@isc.org>
Thu, 13 Sep 2018 23:32:54 +0000 (01:32 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 14 Sep 2018 14:15:46 +0000 (16:15 +0200)
src/lib/yang/tests/translator_option_def_unittests.cc
src/lib/yang/translator_option_def.cc

index 6d8a897bd9d68d35c772a2d66310e64a952247fa..2dfa434fc9de497f7f63a2718fd18e68d5e782af 100644 (file)
@@ -27,11 +27,11 @@ TEST(TranslatorOptionDefListTest, getEmpty) {
     boost::scoped_ptr<TranslatorOptionDefList> 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<TranslatorOptionDefList> 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<TranslatorOptionDefList> 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<TranslatorOptionDefList> 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"
index ca7d80a5302d8fa2b09e081984503d8e3a27042b..ddc53ccd8f7693a504656c86a6e2a3c9d576df55 100644 (file)
@@ -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,