Add leafrefPath(const std::string&)
Will be useful in the upcoming describe command.
Change-Id: I480b93491f98c23eab6498503ca07d6b7c9c8e4f
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 4b4a8bb..254f8a9 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -304,6 +304,13 @@
return impl_leafrefBaseType(getSchemaNode(path));
}
+std::string YangSchema::leafrefPath(const std::string& leafrefPath) const
+{
+ using namespace std::string_literals;
+ libyang::Schema_Node_Leaf leaf(getSchemaNode(leafrefPath));
+ return leaf.type()->info()->lref()->target()->path(LYS_PATH_FIRST_PREFIX);
+}
+
std::set<std::string> YangSchema::modules() const
{
const auto& modules = m_context->get_module_iter();