Fix availableNodes behavior when dealing with submodules
Before this, nodes that are part of a submodule would get returned with
the name of the submodule. However, libyang requires this type of nodes
to be prefixed with the main module.
Change-Id: I6654f0efba0f0ffffd805e7718809067bf88c5c5
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index b243fd2..96fc744 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -352,7 +352,7 @@
} else {
ModuleNodePair toInsert;
if (topLevelModule.empty() || topLevelModule != node->module()->name()) {
- toInsert.first = node->module()->name();
+ toInsert.first = node->module()->type() == 0 ? node->module()->name() : libyang::Submodule(node->module()).belongsto()->name();
}
toInsert.second = node->name();
res.insert(toInsert);