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/tests/datastore_access.cpp b/tests/datastore_access.cpp
index 8a7a9f5..57871c0 100644
--- a/tests/datastore_access.cpp
+++ b/tests/datastore_access.cpp
@@ -1114,6 +1114,19 @@
         catching<OnExec>([&] { REQUIRE(proxyDatastore.execute() == output); });
     }
 
+    SECTION("parsed info in yang context")
+    {
+        auto schema = datastore->schema();
+        auto leafTypeName = schema->leafTypeName("/example-schema:typedefedLeaf");
+
+#if defined(sysrepo_BACKEND)
+        // Sysrepo is not available yet, with libyang parsed info context
+        REQUIRE(leafTypeName == std::nullopt);
+#else
+        REQUIRE(leafTypeName == "myType");
+#endif
+    }
+
     waitForCompletionAndBitMore(seq1);
 }