Fix `prepare`
The parsing algorithm was broken and prepare couldn't recognize RPC
nodes. The mistake probably happened when I added Action support, but
with no tests. Tests are now included.
Change-Id: I1b4eb2eb76a30c4495e2aacbb6848f449eba3abb
diff --git a/src/static_schema.cpp b/src/static_schema.cpp
index e54ca68..af1004a 100644
--- a/src/static_schema.cpp
+++ b/src/static_schema.cpp
@@ -43,6 +43,15 @@
m_nodes.emplace(key, std::unordered_map<std::string, NodeInfo>());
}
+void StaticSchema::addAction(const std::string& location, const std::string& name)
+{
+ m_nodes.at(location).emplace(name, NodeInfo{yang::action{}, yang::AccessType::Writable});
+
+ //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>());
+}
+
bool StaticSchema::listHasKey(const schemaPath_& listPath, const std::string& key) const
{
return listKeys(listPath).count(key);
@@ -215,6 +224,11 @@
{
return yang::NodeTypes::Rpc;
}
+
+ yang::NodeTypes operator()(const yang::action)
+ {
+ return yang::NodeTypes::Action;
+ }
};
yang::NodeTypes StaticSchema::nodeType(const schemaPath_& location, const ModuleNodePair& node) const