Add support for executing RPCs

Creating a temporary YangAccess for RPC input means I need to somehow
give the right libyang schemas. For that reason I supply a callable
which is able to fetch the schema and create a YangAccess instance for
ProxyDatastore.

The ProxyDatastore class now has a simple mechanism for deciding whether
to use the normal datastore and the temporary based on a path prefix.

Change-Id: Ib455f53237598bc2620161a44fb89c48ddfeb6e3
diff --git a/src/static_schema.cpp b/src/static_schema.cpp
index 75ccb4f..e54ca68 100644
--- a/src/static_schema.cpp
+++ b/src/static_schema.cpp
@@ -34,6 +34,15 @@
     m_nodes.emplace(key, std::unordered_map<std::string, NodeInfo>());
 }
 
+void StaticSchema::addRpc(const std::string& location, const std::string& name)
+{
+    m_nodes.at(location).emplace(name, NodeInfo{yang::rpc{}, 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);
@@ -201,6 +210,11 @@
     {
         return yang::NodeTypes::LeafList;
     }
+
+    yang::NodeTypes operator()(const yang::rpc)
+    {
+        return yang::NodeTypes::Rpc;
+    }
 };
 
 yang::NodeTypes StaticSchema::nodeType(const schemaPath_& location, const ModuleNodePair& node) const