Add Schema::leafIsKey
Will be used in the upcoming describe command.
Change-Id: Ifed7b959b235dc9cf00c896df9c9321fb155a756
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 254f8a9..0795b2b 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -175,6 +175,15 @@
return keys.find(key) != keys.end();
}
+bool YangSchema::leafIsKey(const std::string& leafPath) const
+{
+ auto node = getSchemaNode(leafPath);
+ if (!node || node->nodetype() != LYS_LEAF)
+ return false;
+
+ return libyang::Schema_Node_Leaf{node}.is_key().get();
+}
+
libyang::S_Schema_Node YangSchema::impl_getSchemaNode(const std::string& node) const
{
// If no node is found find_path prints an error message, so we have to