Fix Parser::availableNodes not caring about absolute paths
Issue: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/129
Change-Id: I73294b2cbd22ddfc4d5c34d4ef766279a0a5f249
diff --git a/src/parser.cpp b/src/parser.cpp
index 420db27..26e186a 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -100,7 +100,11 @@
auto pathArg = dataPathToSchemaPath(m_curDir);
if (path) {
auto schemaPath = boost::apply_visitor(getSchemaPathVisitor(), *path);
- pathArg.m_nodes.insert(pathArg.m_nodes.end(), schemaPath.m_nodes.begin(), schemaPath.m_nodes.end());
+ if (schemaPath.m_scope == Scope::Absolute) {
+ pathArg = schemaPath;
+ } else {
+ pathArg.m_nodes.insert(pathArg.m_nodes.end(), schemaPath.m_nodes.begin(), schemaPath.m_nodes.end());
+ }
}
return m_schema->childNodes(pathArg, option);
}
diff --git a/src/static_schema.cpp b/src/static_schema.cpp
index 6d28626..280f0da 100644
--- a/src/static_schema.cpp
+++ b/src/static_schema.cpp
@@ -91,7 +91,8 @@
{
m_nodes.at(location).emplace(name, yang::list{keys});
- m_nodes.emplace(name, std::unordered_map<std::string, NodeType>());
+ std::string key = joinPaths(location, name);
+ m_nodes.emplace(key, std::unordered_map<std::string, NodeType>());
}
bool StaticSchema::isPresenceContainer(const schemaPath_& location, const ModuleNodePair& node) const