NetconfAccess: Use <edit-data> instead of <edit-config>
We're already using <get-data>, so it makes sense to do this. It also
makes it easier to work with datastores, because it uses the NMDA
datastores.
Change-Id: Ie4d5acdf45e1394ea3c0c0398384e855a53b4500
diff --git a/src/netconf-client.cpp b/src/netconf-client.cpp
index 8cf034e..4638bcb 100644
--- a/src/netconf-client.cpp
+++ b/src/netconf-client.cpp
@@ -314,6 +314,8 @@
return "ietf-datastores:startup";
case NmdaDatastore::Running:
return "ietf-datastores:running";
+ case NmdaDatastore::Candidate:
+ return "ietf-datastores:candidate";
case NmdaDatastore::Operational:
return "ietf-datastores:operational";
}
@@ -329,6 +331,15 @@
return impl::do_get(this, std::move(rpc));
}
+void Session::editData(const NmdaDatastore datastore, const std::string& data)
+{
+ auto rpc = impl::guarded(nc_rpc_editdata(datastoreToString(datastore), NC_RPC_EDIT_DFLTOP_MERGE, data.c_str(), NC_PARAMTYPE_CONST));
+ if (!rpc) {
+ throw std::runtime_error("Cannot create get RPC");
+ }
+ return impl::do_rpc_ok(this, std::move(rpc));
+}
+
std::string Session::getSchema(const std::string_view identifier, const std::optional<std::string_view> version)
{
auto rpc = impl::guarded(nc_rpc_getschema(identifier.data(), version ? version.value().data() : nullptr, nullptr, NC_PARAMTYPE_CONST));