Allow immediately executing RPC with no input
Story: https://tree.taiga.io/project/jktjkt-netconf-cli/us/189
Change-Id: I876437b798e995c4484e97b409117a2bb207e864
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 7f27711..d6c0bd8 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -485,6 +485,17 @@
}
}
+bool YangSchema::hasInputNodes(const std::string& path) const
+{
+ auto node = getSchemaNode(path.c_str());
+ if (auto type = node->nodetype(); type != LYS_ACTION && type != LYS_RPC) {
+ throw std::logic_error("StaticSchema::hasInputNodes called with non-RPC/action path");
+ }
+
+ // The first child gives the /input node and then I check whether it has a child.
+ return node->child()->child().get();
+}
+
bool YangSchema::isConfig(const std::string& path) const
{
auto node = getSchemaNode(path.c_str());