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/static_schema.cpp b/src/static_schema.cpp
index a75f471..c1d4417 100644
--- a/src/static_schema.cpp
+++ b/src/static_schema.cpp
@@ -41,6 +41,8 @@
//create a new set of children for the new node
std::string key = joinPaths(location, name);
m_nodes.emplace(key, std::unordered_map<std::string, NodeInfo>());
+ m_nodes.emplace(joinPaths(key, "input"), std::unordered_map<std::string, NodeInfo>());
+ m_nodes.emplace(joinPaths(key, "output"), std::unordered_map<std::string, NodeInfo>());
}
void StaticSchema::addAction(const std::string& location, const std::string& name)
@@ -272,6 +274,15 @@
throw std::runtime_error{"Internal error: StaticSchema::status(std::string) not implemented. The tests should not have called this overload."};
}
+bool StaticSchema::hasInputNodes(const std::string& path) const
+{
+ if (nodeType(path) != yang::NodeTypes::Action && nodeType(path) != yang::NodeTypes::Rpc) {
+ throw std::logic_error("StaticSchema::hasInputNodes called with non-RPC/action path");
+ }
+
+ return m_nodes.at(joinPaths(path, "input")).size() != 0;
+}
+
yang::NodeTypes StaticSchema::nodeType(const std::string& path) const
{
auto locationString = stripLastNodeFromPath(path);