Fix working with libyang parsed info
Before now, yang_schema expected that parsed info was available,
however, in most cases it was not:
For YangAccess, we directly manage the context, so we'll just use the
flag needed.
For NetconfAccess, we need to create our custom context and supply it.
This context is treated by libnetconf2 as shared and it won't try to
free it. We will hold a reference to this context via a new member
variable inside NetconfAccess so that it stays alive for the whole
netconf client session.
sysrepo does not support this flag as of now. Simply patching sysrepo to
always use this flag doesn't work (it gives internal errors), so it
needs an upstream patch.
Change-Id: Ie7e4567a779a09daa7b3a8b3923e73a3dfd6ba1d
diff --git a/src/netconf_access.hpp b/src/netconf_access.hpp
index eb678d5..1534dba 100644
--- a/src/netconf_access.hpp
+++ b/src/netconf_access.hpp
@@ -8,6 +8,7 @@
#pragma once
#include <libnetconf2/log.h>
+#include <libyang-cpp/Context.hpp>
#include <string>
#include "datastore_access.hpp"
@@ -59,6 +60,7 @@
bool m_serverHasNMDA;
+ libyang::Context m_context;
std::unique_ptr<libnetconf::client::Session> m_session;
std::shared_ptr<YangSchema> m_schema;
};