Merge Schema::childNodes and Schema::moduleNodes

Change-Id: I30c7120fdba6c0089108599e5ab48d8dcd47f277
diff --git a/src/static_schema.cpp b/src/static_schema.cpp
index c86b232..2f1dcb2 100644
--- a/src/static_schema.cpp
+++ b/src/static_schema.cpp
@@ -135,12 +135,28 @@
     return boost::get<yang::leaf>(children(locationString).at(node)).m_type;
 }
 
-// We do not test StaticSchema, so we don't need to implement recursive childNodes
-// for this class.
-std::set<std::string> StaticSchema::childNodes(const schemaPath_& path, const Recursion) const
+std::set<std::string> StaticSchema::availableNodes(const boost::variant<dataPath_, schemaPath_, module_>& path, const Recursion recursion) const
 {
-    std::string locationString = pathToSchemaString(path, Prefixes::Always);
+    if (recursion == Recursion::Recursive) {
+        throw std::logic_error("Recursive StaticSchema::availableNodes is not implemented. It shouldn't be used in tests.");
+    }
+
     std::set<std::string> res;
+    if (path.type() == typeid(module_)) {
+        auto topLevelNodes = m_nodes.at("");
+        auto modulePlusColon = boost::get<module_>(path).m_name + ":";
+        for (const auto& it : topLevelNodes) {
+            if (boost::algorithm::starts_with(it.first, modulePlusColon)) {
+                res.insert(it.first);
+            }
+        }
+        return res;
+    }
+
+    std::string locationString =
+        path.type() == typeid(schemaPath_) ?
+        pathToSchemaString(boost::get<schemaPath_>(path), Prefixes::Always) :
+        pathToSchemaString(boost::get<dataPath_>(path), Prefixes::Always);
 
     auto childrenRef = children(locationString);
 
@@ -148,21 +164,6 @@
     return res;
 }
 
-// We do not test StaticSchema, so we don't need to implement recursive moduleNodes
-// for this class.
-std::set<std::string> StaticSchema::moduleNodes(const module_& module, const Recursion) const
-{
-    std::set<std::string> res;
-    auto topLevelNodes = m_nodes.at("");
-    auto modulePlusColon = module.m_name + ":";
-    for (const auto& it : topLevelNodes) {
-        if (boost::algorithm::starts_with(it.first, modulePlusColon)) {
-            res.insert(it.first);
-        }
-    }
-    return res;
-}
-
 yang::NodeTypes StaticSchema::nodeType(const schemaPath_& location, const ModuleNodePair& node) const
 {
     std::string locationString = pathToSchemaString(location, Prefixes::Always);