Fix NetconfAccess not being able to fetch submodules
When I implemented SysrepoAccess, I ignored the submoduleRevision
argument in the "libyang missing schema callback" as Sysrepo seemed to
work just fine without supplying it. However, libnetconf needs it
because one can't supply both module name and submodule name to a
<get-schema> request. Now, if a submodule is being requested by libyang
from NetconfAccess, I pass the submodule name to libnetconf rather
than the module name.
Issue: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/123
Change-Id: I0e5f6b82b1598ecc9f27732f450b1a204ee500f9
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 9868c63..5de3b9e 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -377,11 +377,11 @@
m_context->get_module(moduleName.c_str())->feature_enable(featureName.c_str());
}
-void YangSchema::registerModuleCallback(const std::function<std::string(const char*, const char*, const char*)>& clb)
+void YangSchema::registerModuleCallback(const std::function<std::string(const char*, const char*, const char*, const char*)>& clb)
{
auto lambda = [clb](const char* mod_name, const char* mod_revision, const char* submod_name, const char* submod_revision) {
(void)submod_revision;
- auto moduleSource = clb(mod_name, mod_revision, submod_name);
+ auto moduleSource = clb(mod_name, mod_revision, submod_name, submod_revision);
if (moduleSource.empty()) {
return libyang::Context::mod_missing_cb_return{LYS_IN_YANG, nullptr};
}