Unify item creation/deletion in datastore access

All of our implementations are using the same implementation; all of the
smartness is actually in sysrepo or in libyang. As a bonus, this should
make it possible to remove regular leafs as well (backend-wise at
least).

Change-Id: I177cd233b4b699f66475eae735a659b7c8577534
diff --git a/src/datastore_access.hpp b/src/datastore_access.hpp
index 05c1296..0856d41 100644
--- a/src/datastore_access.hpp
+++ b/src/datastore_access.hpp
@@ -46,12 +46,8 @@
     virtual ~DatastoreAccess() = 0;
     virtual Tree getItems(const std::string& path) = 0;
     virtual void setLeaf(const std::string& path, leaf_data_ value) = 0;
-    virtual void createPresenceContainer(const std::string& path) = 0;
-    virtual void deletePresenceContainer(const std::string& path) = 0;
-    virtual void createListInstance(const std::string& path) = 0;
-    virtual void deleteListInstance(const std::string& path) = 0;
-    virtual void createLeafListInstance(const std::string& path) = 0;
-    virtual void deleteLeafListInstance(const std::string& path) = 0;
+    virtual void createItem(const std::string& path) = 0;
+    virtual void deleteItem(const std::string& path) = 0;
     virtual void moveItem(const std::string& path, std::variant<yang::move::Absolute, yang::move::Relative> move) = 0;
     virtual Tree executeRpc(const std::string& path, const Tree& input) = 0;
 
diff --git a/src/interpreter.cpp b/src/interpreter.cpp
index 3543e93..8ee2b55 100644
--- a/src/interpreter.cpp
+++ b/src/interpreter.cpp
@@ -87,22 +87,12 @@
 
 void Interpreter::operator()(const create_& create) const
 {
-    if (std::holds_alternative<listElement_>(create.m_path.m_nodes.back().m_suffix))
-        m_datastore.createListInstance(pathToString(toCanonicalPath(create.m_path)));
-    else if (std::holds_alternative<leafListElement_>(create.m_path.m_nodes.back().m_suffix))
-        m_datastore.createLeafListInstance(pathToString(toCanonicalPath(create.m_path)));
-    else
-        m_datastore.createPresenceContainer(pathToString(toCanonicalPath(create.m_path)));
+    m_datastore.createItem(pathToString(toCanonicalPath(create.m_path)));
 }
 
 void Interpreter::operator()(const delete_& delet) const
 {
-    if (std::holds_alternative<container_>(delet.m_path.m_nodes.back().m_suffix))
-        m_datastore.deletePresenceContainer(pathToString(toCanonicalPath(delet.m_path)));
-    else if (std::holds_alternative<leafListElement_>(delet.m_path.m_nodes.back().m_suffix))
-        m_datastore.deleteLeafListInstance(pathToString(toCanonicalPath(delet.m_path)));
-    else
-        m_datastore.deleteListInstance(pathToString(toCanonicalPath(delet.m_path)));
+    m_datastore.deleteItem(pathToString(toCanonicalPath(delet.m_path)));
 }
 
 void Interpreter::operator()(const ls_& ls) const
diff --git a/src/netconf_access.cpp b/src/netconf_access.cpp
index 15b79a8..a7cd6b4 100644
--- a/src/netconf_access.cpp
+++ b/src/netconf_access.cpp
@@ -65,13 +65,13 @@
     doEditFromDataNode(node);
 }
 
-void NetconfAccess::createPresenceContainer(const std::string& path)
+void NetconfAccess::createItem(const std::string& path)
 {
     auto node = m_schema->dataNodeFromPath(path);
     doEditFromDataNode(node);
 }
 
-void NetconfAccess::deletePresenceContainer(const std::string& path)
+void NetconfAccess::deleteItem(const std::string& path)
 {
     auto node = m_schema->dataNodeFromPath(path);
     auto container = *(node->find_path(path.c_str())->data().begin());
@@ -79,33 +79,6 @@
     doEditFromDataNode(node);
 }
 
-void NetconfAccess::createListInstance(const std::string& path)
-{
-    auto node = m_schema->dataNodeFromPath(path);
-    doEditFromDataNode(node);
-}
-
-void NetconfAccess::deleteListInstance(const std::string& path)
-{
-    auto node = m_schema->dataNodeFromPath(path);
-    auto list = *(node->find_path(path.c_str())->data().begin());
-    list->insert_attr(m_schema->getYangModule("ietf-netconf"), "operation", "delete");
-    doEditFromDataNode(node);
-}
-
-void NetconfAccess::createLeafListInstance(const std::string& path)
-{
-    auto node = m_schema->dataNodeFromPath(path);
-    doEditFromDataNode(node);
-}
-void NetconfAccess::deleteLeafListInstance(const std::string& path)
-{
-    auto node = m_schema->dataNodeFromPath(path);
-    auto list = *(node->find_path(path.c_str())->data().begin());
-    list->insert_attr(m_schema->getYangModule("ietf-netconf"), "operation", "delete");
-    doEditFromDataNode(node);
-}
-
 struct impl_toYangInsert {
     std::string operator()(yang::move::Absolute& absolute)
     {
diff --git a/src/netconf_access.hpp b/src/netconf_access.hpp
index 3875911..3f45a27 100644
--- a/src/netconf_access.hpp
+++ b/src/netconf_access.hpp
@@ -35,12 +35,8 @@
     ~NetconfAccess() override;
     Tree getItems(const std::string& path) override;
     void setLeaf(const std::string& path, leaf_data_ value) override;
-    void createPresenceContainer(const std::string& path) override;
-    void deletePresenceContainer(const std::string& path) override;
-    void createListInstance(const std::string& path) override;
-    void deleteListInstance(const std::string& path) override;
-    void createLeafListInstance(const std::string& path) override;
-    void deleteLeafListInstance(const std::string& path) override;
+    void createItem(const std::string& path) override;
+    void deleteItem(const std::string& path) override;
     void moveItem(const std::string& path, std::variant<yang::move::Absolute, yang::move::Relative> move) override;
     void commitChanges() override;
     void discardChanges() override;
diff --git a/src/python_netconf.cpp b/src/python_netconf.cpp
index 76dc559..19c096f 100644
--- a/src/python_netconf.cpp
+++ b/src/python_netconf.cpp
@@ -68,10 +68,8 @@
                     "server"_a, "port"_a=830, "username"_a, "interactive_auth"_a)
             .def("getItems", &NetconfAccess::getItems, "xpath"_a)
             .def("setLeaf", &NetconfAccess::setLeaf, "xpath"_a, "value"_a)
-            .def("createPresenceContainer", &NetconfAccess::createPresenceContainer, "xpath"_a)
-            .def("deletePresenceContainer", &NetconfAccess::deletePresenceContainer, "xpath"_a)
-            .def("createListInstance", &NetconfAccess::createListInstance, "xpath"_a)
-            .def("deleteListInstance", &NetconfAccess::deleteListInstance, "xpath"_a)
+            .def("createItem", &NetconfAccess::createItem, "xpath"_a)
+            .def("deleteItem", &NetconfAccess::deleteItem, "xpath"_a)
             .def("executeRpc", &NetconfAccess::executeRpc, "rpc"_a, "input"_a=DatastoreAccess::Tree{})
             .def("commitChanges", &NetconfAccess::commitChanges)
             ;
diff --git a/src/sysrepo_access.cpp b/src/sysrepo_access.cpp
index 7b9cb7a..70b8823 100644
--- a/src/sysrepo_access.cpp
+++ b/src/sysrepo_access.cpp
@@ -235,7 +235,7 @@
     }
 }
 
-void SysrepoAccess::createPresenceContainer(const std::string& path)
+void SysrepoAccess::createItem(const std::string& path)
 {
     try {
         m_session->set_item(path.c_str());
@@ -244,43 +244,7 @@
     }
 }
 
-void SysrepoAccess::deletePresenceContainer(const std::string& path)
-{
-    try {
-        m_session->delete_item(path.c_str());
-    } catch (sysrepo::sysrepo_exception& ex) {
-        reportErrors();
-    }
-}
-
-void SysrepoAccess::createLeafListInstance(const std::string& path)
-{
-    try {
-        m_session->set_item(path.c_str());
-    } catch (sysrepo::sysrepo_exception& ex) {
-        reportErrors();
-    }
-}
-
-void SysrepoAccess::deleteLeafListInstance(const std::string& path)
-{
-    try {
-        m_session->delete_item(path.c_str());
-    } catch (sysrepo::sysrepo_exception& ex) {
-        reportErrors();
-    }
-}
-
-void SysrepoAccess::createListInstance(const std::string& path)
-{
-    try {
-        m_session->set_item(path.c_str());
-    } catch (sysrepo::sysrepo_exception& ex) {
-        reportErrors();
-    }
-}
-
-void SysrepoAccess::deleteListInstance(const std::string& path)
+void SysrepoAccess::deleteItem(const std::string& path)
 {
     try {
         m_session->delete_item(path.c_str());
diff --git a/src/sysrepo_access.hpp b/src/sysrepo_access.hpp
index 6e66eea..4d87847 100644
--- a/src/sysrepo_access.hpp
+++ b/src/sysrepo_access.hpp
@@ -30,12 +30,8 @@
     SysrepoAccess(const std::string& appname, const Datastore datastore);
     Tree getItems(const std::string& path) override;
     void setLeaf(const std::string& path, leaf_data_ value) override;
-    void createPresenceContainer(const std::string& path) override;
-    void deletePresenceContainer(const std::string& path) override;
-    void createListInstance(const std::string& path) override;
-    void deleteListInstance(const std::string& path) override;
-    void createLeafListInstance(const std::string& path) override;
-    void deleteLeafListInstance(const std::string& path) override;
+    void createItem(const std::string& path) override;
+    void deleteItem(const std::string& path) override;
     void moveItem(const std::string& source, std::variant<yang::move::Absolute, yang::move::Relative> move) override;
     Tree executeRpc(const std::string& path, const Tree& input) override;
 
diff --git a/tests/data_query.cpp b/tests/data_query.cpp
index 5adc661..f075b4b 100644
--- a/tests/data_query.cpp
+++ b/tests/data_query.cpp
@@ -46,9 +46,9 @@
 
         SECTION("example-schema:person")
         {
-            datastore.createListInstance("/example-schema:person[name='Vaclav']");
-            datastore.createListInstance("/example-schema:person[name='Tomas']");
-            datastore.createListInstance("/example-schema:person[name='Jan Novak']");
+            datastore.createItem("/example-schema:person[name='Vaclav']");
+            datastore.createItem("/example-schema:person[name='Tomas']");
+            datastore.createItem("/example-schema:person[name='Jan Novak']");
             listPath.m_nodes.push_back(dataNode_{{"example-schema"}, list_{"person"}});
             expected = {
                 {{"name", std::string{"Jan Novak"}}},
@@ -66,9 +66,9 @@
 
         SECTION("example-schema:selectedNumbers")
         {
-            datastore.createListInstance("/example-schema:selectedNumbers[value='45']");
-            datastore.createListInstance("/example-schema:selectedNumbers[value='99']");
-            datastore.createListInstance("/example-schema:selectedNumbers[value='127']");
+            datastore.createItem("/example-schema:selectedNumbers[value='45']");
+            datastore.createItem("/example-schema:selectedNumbers[value='99']");
+            datastore.createItem("/example-schema:selectedNumbers[value='127']");
             listPath.m_nodes.push_back(dataNode_{{"example-schema"}, list_{"selectedNumbers"}});
             expected = {
                 {{"value", int8_t{127}}},
@@ -79,9 +79,9 @@
 
         SECTION("example-schema:animalWithColor")
         {
-            datastore.createListInstance("/example-schema:animalWithColor[name='Dog'][color='brown']");
-            datastore.createListInstance("/example-schema:animalWithColor[name='Dog'][color='white']");
-            datastore.createListInstance("/example-schema:animalWithColor[name='Cat'][color='grey']");
+            datastore.createItem("/example-schema:animalWithColor[name='Dog'][color='brown']");
+            datastore.createItem("/example-schema:animalWithColor[name='Dog'][color='white']");
+            datastore.createItem("/example-schema:animalWithColor[name='Cat'][color='grey']");
             listPath.m_nodes.push_back(dataNode_{{"example-schema"}, list_{"animalWithColor"}});
             expected = {
                 {{"name", std::string{"Cat"}}, {"color", std::string{"grey"}}},
@@ -92,7 +92,7 @@
 
         SECTION("example-schema:animalWithColor - quotes in values")
         {
-            datastore.createListInstance("/example-schema:animalWithColor[name='D\"o\"g'][color=\"b'r'own\"]");
+            datastore.createItem("/example-schema:animalWithColor[name='D\"o\"g'][color=\"b'r'own\"]");
             listPath.m_nodes.push_back(dataNode_{{"example-schema"}, list_{"animalWithColor"}});
             expected = {
                 {{"name", std::string{"D\"o\"g"}}, {"color", std::string{"b'r'own"}}}
@@ -101,9 +101,9 @@
 
         SECTION("example-schema:ports")
         {
-            datastore.createListInstance("/example-schema:ports[name='A']");
-            datastore.createListInstance("/example-schema:ports[name='B']");
-            datastore.createListInstance("/example-schema:ports[name='E']");
+            datastore.createItem("/example-schema:ports[name='A']");
+            datastore.createItem("/example-schema:ports[name='B']");
+            datastore.createItem("/example-schema:ports[name='E']");
             listPath.m_nodes.push_back(dataNode_{{"example-schema"}, list_{"ports"}});
             expected = {
                 {{"name", enum_{"A"}}},
@@ -114,17 +114,17 @@
 
         SECTION("example-schema:org/example:people - nested list")
         {
-            datastore.createListInstance("/example-schema:org[department='accounting']");
-            datastore.createListInstance("/example-schema:org[department='sales']");
-            datastore.createListInstance("/example-schema:org[department='programmers']");
-            datastore.createListInstance("/example-schema:org[department='accounting']/people[name='Alice']");
-            datastore.createListInstance("/example-schema:org[department='accounting']/people[name='Bob']");
-            datastore.createListInstance("/example-schema:org[department='sales']/people[name='Alice']");
-            datastore.createListInstance("/example-schema:org[department='sales']/people[name='Cyril']");
-            datastore.createListInstance("/example-schema:org[department='sales']/people[name='Alice']/computers[type='laptop']");
-            datastore.createListInstance("/example-schema:org[department='sales']/people[name='Alice']/computers[type='server']");
-            datastore.createListInstance("/example-schema:org[department='sales']/people[name='Cyril']/computers[type='PC']");
-            datastore.createListInstance("/example-schema:org[department='sales']/people[name='Cyril']/computers[type='server']");
+            datastore.createItem("/example-schema:org[department='accounting']");
+            datastore.createItem("/example-schema:org[department='sales']");
+            datastore.createItem("/example-schema:org[department='programmers']");
+            datastore.createItem("/example-schema:org[department='accounting']/people[name='Alice']");
+            datastore.createItem("/example-schema:org[department='accounting']/people[name='Bob']");
+            datastore.createItem("/example-schema:org[department='sales']/people[name='Alice']");
+            datastore.createItem("/example-schema:org[department='sales']/people[name='Cyril']");
+            datastore.createItem("/example-schema:org[department='sales']/people[name='Alice']/computers[type='laptop']");
+            datastore.createItem("/example-schema:org[department='sales']/people[name='Alice']/computers[type='server']");
+            datastore.createItem("/example-schema:org[department='sales']/people[name='Cyril']/computers[type='PC']");
+            datastore.createItem("/example-schema:org[department='sales']/people[name='Cyril']/computers[type='server']");
 
             SECTION("outer list")
             {
@@ -215,8 +215,8 @@
 
         SECTION("/other-module:parking-lot/example-schema:cars - list coming from an augment")
         {
-            datastore.createListInstance("/other-module:parking-lot/example-schema:cars[id='1']");
-            datastore.createListInstance("/other-module:parking-lot/example-schema:cars[id='2']");
+            datastore.createItem("/other-module:parking-lot/example-schema:cars[id='1']");
+            datastore.createItem("/other-module:parking-lot/example-schema:cars[id='2']");
 
             listPath.m_nodes.push_back(dataNode_{{"other-module"}, container_{"parking-lot"}});
             listPath.m_nodes.push_back(dataNode_{{"example-schema"}, list_{"cars"}});
diff --git a/tests/datastore_access.cpp b/tests/datastore_access.cpp
index e9030db..bab7fac 100644
--- a/tests/datastore_access.cpp
+++ b/tests/datastore_access.cpp
@@ -133,7 +133,7 @@
     SECTION("create presence container")
     {
         REQUIRE_CALL(mock, write("/example-schema:pContainer", std::nullopt, ""s));
-        datastore.createPresenceContainer("/example-schema:pContainer");
+        datastore.createItem("/example-schema:pContainer");
         datastore.commitChanges();
     }
 
@@ -142,13 +142,13 @@
         {
             REQUIRE_CALL(mock, write("/example-schema:person[name='Nguyen']", std::nullopt, ""s));
             REQUIRE_CALL(mock, write("/example-schema:person[name='Nguyen']/name", std::nullopt, "Nguyen"s));
-            datastore.createListInstance("/example-schema:person[name='Nguyen']");
+            datastore.createItem("/example-schema:person[name='Nguyen']");
             datastore.commitChanges();
         }
         {
             REQUIRE_CALL(mock, write("/example-schema:person[name='Nguyen']", ""s, std::nullopt));
             REQUIRE_CALL(mock, write("/example-schema:person[name='Nguyen']/name", "Nguyen"s, std::nullopt));
-            datastore.deleteListInstance("/example-schema:person[name='Nguyen']");
+            datastore.deleteItem("/example-schema:person[name='Nguyen']");
             datastore.commitChanges();
         }
     }
@@ -156,15 +156,15 @@
     SECTION("deleting non-existing list keys")
     {
         tryThis<THROWS_ON_NONEXISTING_KEYS>([&]{
-            datastore.deleteListInstance("/example-schema:person[name='non existing']");
+            datastore.deleteItem("/example-schema:person[name='non existing']");
             datastore.commitChanges();
         });
     }
 
-    SECTION("accessing non-existing schema nodes")
+    SECTION("deleting non-existing schema nodes as a list")
     {
         tryThis<THROWS_ON_INVALID_SCHEMA_PATHS>([&]{
-            datastore.deleteListInstance("/example-schema:non-existing-list[xxx='non existing']");
+            datastore.deleteItem("/example-schema:non-existing-list[xxx='non existing']");
             datastore.commitChanges();
         });
     }
@@ -178,9 +178,9 @@
             REQUIRE_CALL(mock, write("/example-schema:person[name='Elfi']/name", std::nullopt, "Elfi"s));
             REQUIRE_CALL(mock, write("/example-schema:person[name='Kolafa']", std::nullopt, ""s));
             REQUIRE_CALL(mock, write("/example-schema:person[name='Kolafa']/name", std::nullopt, "Kolafa"s));
-            datastore.createListInstance("/example-schema:person[name='Dan']");
-            datastore.createListInstance("/example-schema:person[name='Elfi']");
-            datastore.createListInstance("/example-schema:person[name='Kolafa']");
+            datastore.createItem("/example-schema:person[name='Dan']");
+            datastore.createItem("/example-schema:person[name='Elfi']");
+            datastore.createItem("/example-schema:person[name='Kolafa']");
             datastore.commitChanges();
         }
 
@@ -269,9 +269,9 @@
             REQUIRE_CALL(mock, write("/example-schema:person[name='Michal']/name", std::nullopt, "Michal"s));
             REQUIRE_CALL(mock, write("/example-schema:person[name='Petr']", std::nullopt, ""s));
             REQUIRE_CALL(mock, write("/example-schema:person[name='Petr']/name", std::nullopt, "Petr"s));
-            datastore.createListInstance("/example-schema:person[name='Jan']");
-            datastore.createListInstance("/example-schema:person[name='Michal']");
-            datastore.createListInstance("/example-schema:person[name='Petr']");
+            datastore.createItem("/example-schema:person[name='Jan']");
+            datastore.createItem("/example-schema:person[name='Michal']");
+            datastore.createItem("/example-schema:person[name='Petr']");
             datastore.commitChanges();
         }
         DatastoreAccess::Tree expected{
@@ -294,7 +294,7 @@
 
         {
             REQUIRE_CALL(mock, write("/example-schema:pContainer", std::nullopt, ""s));
-            datastore.createPresenceContainer("/example-schema:pContainer");
+            datastore.createItem("/example-schema:pContainer");
             datastore.commitChanges();
         }
         expected = {
@@ -305,17 +305,17 @@
         // Make sure it's not there after we delete it
         {
             REQUIRE_CALL(mock, write("/example-schema:pContainer", ""s, std::nullopt));
-            datastore.deletePresenceContainer("/example-schema:pContainer");
+            datastore.deleteItem("/example-schema:pContainer");
             datastore.commitChanges();
         }
         expected = {};
         REQUIRE(datastore.getItems("/example-schema:pContainer") == expected);
     }
 
-    SECTION("non-existing persistent container schema node")
+    SECTION("deleting a non-existing schema node as a container or leaf")
     {
         tryThis<THROWS_ON_INVALID_SCHEMA_PATHS>([&]{
-            datastore.deletePresenceContainer("/example-schema:non-existing-presence-container");
+            datastore.deleteItem("/example-schema:non-existing-presence-container");
             datastore.commitChanges();
         });
     }
@@ -328,7 +328,7 @@
         {
             REQUIRE_CALL(mock, write("/example-schema:inventory", std::nullopt, ""s));
             REQUIRE_CALL(mock, write("/example-schema:inventory/stuff", std::nullopt, ""s));
-            datastore.createPresenceContainer("/example-schema:inventory/stuff");
+            datastore.createItem("/example-schema:inventory/stuff");
             datastore.commitChanges();
         }
         expected = {
@@ -338,7 +338,7 @@
         {
             REQUIRE_CALL(mock, write("/example-schema:inventory", ""s, std::nullopt));
             REQUIRE_CALL(mock, write("/example-schema:inventory/stuff", ""s, std::nullopt));
-            datastore.deletePresenceContainer("/example-schema:inventory/stuff");
+            datastore.deleteItem("/example-schema:inventory/stuff");
             datastore.commitChanges();
         }
         expected = {};
@@ -428,8 +428,8 @@
         DatastoreAccess::Tree expected;
         REQUIRE_CALL(mock, write("/example-schema:addresses", std::nullopt, "0.0.0.0"s));
         REQUIRE_CALL(mock, write("/example-schema:addresses", std::nullopt, "127.0.0.1"s));
-        datastore.createLeafListInstance("/example-schema:addresses[.='0.0.0.0']");
-        datastore.createLeafListInstance("/example-schema:addresses[.='127.0.0.1']");
+        datastore.createItem("/example-schema:addresses[.='0.0.0.0']");
+        datastore.createItem("/example-schema:addresses[.='127.0.0.1']");
         datastore.commitChanges();
         expected = {
             {"/example-schema:addresses", special_{SpecialValue::LeafList}},
@@ -439,7 +439,7 @@
         REQUIRE(datastore.getItems("/example-schema:addresses") == expected);
 
         REQUIRE_CALL(mock, write("/example-schema:addresses", "0.0.0.0"s, std::nullopt));
-        datastore.deleteLeafListInstance("/example-schema:addresses[.='0.0.0.0']");
+        datastore.deleteItem("/example-schema:addresses[.='0.0.0.0']");
         datastore.commitChanges();
         expected = {
             {"/example-schema:addresses", special_{SpecialValue::LeafList}},
@@ -448,24 +448,24 @@
         REQUIRE(datastore.getItems("/example-schema:addresses") == expected);
 
         REQUIRE_CALL(mock, write("/example-schema:addresses", "127.0.0.1"s, std::nullopt));
-        datastore.deleteLeafListInstance("/example-schema:addresses[.='127.0.0.1']");
+        datastore.deleteItem("/example-schema:addresses[.='127.0.0.1']");
         datastore.commitChanges();
         expected = {};
         REQUIRE(datastore.getItems("/example-schema:addresses") == expected);
     }
 
-    SECTION("non-existing leaf-list")
+    SECTION("deleting a non-existing leaf-list")
     {
         tryThis<THROWS_ON_NONEXISTING_KEYS>([&]{
-            datastore.deleteLeafListInstance("/example-schema:addresses[.='non-existing']");
+            datastore.deleteItem("/example-schema:addresses[.='non-existing']");
             datastore.commitChanges();
         });
     }
 
-    SECTION("non-existing leaf-list schema node")
+    SECTION("deleting a non-existing schema node as a leaf-list")
     {
         tryThis<THROWS_ON_INVALID_SCHEMA_PATHS>([&]{
-            datastore.deleteLeafListInstance("/example-schema:non-existing[.='non-existing']");
+            datastore.deleteItem("/example-schema:non-existing[.='non-existing']");
             datastore.commitChanges();
         });
     }
@@ -494,9 +494,9 @@
             REQUIRE_CALL(mock, write("/example-schema:protocols", std::nullopt, "pop3"s));
             REQUIRE_CALL(mock, write("/example-schema:protocols", "http"s, "ftp"s));
             REQUIRE_CALL(mock, write("/example-schema:protocols", "ftp"s, "pop3"s));
-            datastore.createLeafListInstance("/example-schema:protocols[.='http']");
-            datastore.createLeafListInstance("/example-schema:protocols[.='ftp']");
-            datastore.createLeafListInstance("/example-schema:protocols[.='pop3']");
+            datastore.createItem("/example-schema:protocols[.='http']");
+            datastore.createItem("/example-schema:protocols[.='ftp']");
+            datastore.createItem("/example-schema:protocols[.='pop3']");
             datastore.commitChanges();
             expected = {
                 {"/example-schema:protocols", special_{SpecialValue::LeafList}},
@@ -582,9 +582,9 @@
             REQUIRE_CALL(mock, write("/example-schema:players[name='Adam']", std::nullopt, ""s));
             REQUIRE_CALL(mock, write("/example-schema:players[name='Adam']/name", std::nullopt, "Adam"s));
             REQUIRE_CALL(mock, write("/example-schema:players[name='Adam']", ""s, ""s));
-            datastore.createListInstance("/example-schema:players[name='John']");
-            datastore.createListInstance("/example-schema:players[name='Eve']");
-            datastore.createListInstance("/example-schema:players[name='Adam']");
+            datastore.createItem("/example-schema:players[name='John']");
+            datastore.createItem("/example-schema:players[name='Eve']");
+            datastore.createItem("/example-schema:players[name='Adam']");
             datastore.commitChanges();
             expected = {
                 {"/example-schema:players[name='John']", special_{SpecialValue::List}},
diff --git a/tests/datastoreaccess_mock.hpp b/tests/datastoreaccess_mock.hpp
index 354dd44..8252d04 100644
--- a/tests/datastoreaccess_mock.hpp
+++ b/tests/datastoreaccess_mock.hpp
@@ -21,12 +21,8 @@
 class MockDatastoreAccess : public trompeloeil::mock_interface<DatastoreAccess> {
     IMPLEMENT_MOCK1(getItems);
     IMPLEMENT_MOCK2(setLeaf);
-    IMPLEMENT_MOCK1(createPresenceContainer);
-    IMPLEMENT_MOCK1(deletePresenceContainer);
-    IMPLEMENT_MOCK1(createLeafListInstance);
-    IMPLEMENT_MOCK1(deleteLeafListInstance);
-    IMPLEMENT_MOCK1(createListInstance);
-    IMPLEMENT_MOCK1(deleteListInstance);
+    IMPLEMENT_MOCK1(createItem);
+    IMPLEMENT_MOCK1(deleteItem);
     IMPLEMENT_MOCK2(moveItem);
     IMPLEMENT_MOCK2(executeRpc);
 
diff --git a/tests/interpreter.cpp b/tests/interpreter.cpp
index 3acef2b..15a268e 100644
--- a/tests/interpreter.cpp
+++ b/tests/interpreter.cpp
@@ -335,22 +335,22 @@
         SECTION("list instance")
         {
             inputPath.m_nodes = {dataNode_{{"mod"}, listElement_{"department", {{"name", "engineering"s}}}}};
-            expectations.push_back(NAMED_REQUIRE_CALL(datastore, createListInstance("/mod:department[name='engineering']")));
-            expectations.push_back(NAMED_REQUIRE_CALL(datastore, deleteListInstance("/mod:department[name='engineering']")));
+            expectations.push_back(NAMED_REQUIRE_CALL(datastore, createItem("/mod:department[name='engineering']")));
+            expectations.push_back(NAMED_REQUIRE_CALL(datastore, deleteItem("/mod:department[name='engineering']")));
         }
 
         SECTION("leaflist instance")
         {
             inputPath.m_nodes = {dataNode_{{"mod"}, leafListElement_{"addresses", "127.0.0.1"s}}};
-            expectations.push_back(NAMED_REQUIRE_CALL(datastore, createLeafListInstance("/mod:addresses[.='127.0.0.1']")));
-            expectations.push_back(NAMED_REQUIRE_CALL(datastore, deleteLeafListInstance("/mod:addresses[.='127.0.0.1']")));
+            expectations.push_back(NAMED_REQUIRE_CALL(datastore, createItem("/mod:addresses[.='127.0.0.1']")));
+            expectations.push_back(NAMED_REQUIRE_CALL(datastore, deleteItem("/mod:addresses[.='127.0.0.1']")));
         }
 
         SECTION("presence container")
         {
             inputPath.m_nodes = {dataNode_{{"mod"}, container_{"pContainer"}}};
-            expectations.push_back(NAMED_REQUIRE_CALL(datastore, createPresenceContainer("/mod:pContainer")));
-            expectations.push_back(NAMED_REQUIRE_CALL(datastore, deletePresenceContainer("/mod:pContainer")));
+            expectations.push_back(NAMED_REQUIRE_CALL(datastore, createItem("/mod:pContainer")));
+            expectations.push_back(NAMED_REQUIRE_CALL(datastore, deleteItem("/mod:pContainer")));
         }
 
         create_ createCmd;