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/grammars.hpp b/src/grammars.hpp
index 742115b..ee808d5 100644
--- a/src/grammars.hpp
+++ b/src/grammars.hpp
@@ -29,6 +29,9 @@
 x3::rule<copy_class, copy_> const copy = "copy";
 x3::rule<move_class, move_> const move = "move";
 x3::rule<dump_class, dump_> const dump = "dump";
+x3::rule<rpc_class, rpc_> const rpc = "rpc";
+x3::rule<exec_class, exec_> const exec = "exec";
+x3::rule<cancel_class, cancel_> const cancel = "cancel";
 x3::rule<command_class, command_> const command = "command";
 
 x3::rule<createCommandSuggestions_class, x3::unused_type> const createCommandSuggestions = "createCommandSuggestions";
@@ -52,7 +55,7 @@
     ls_::name >> *(space_separator >> ls_options) >> -(space_separator >> (anyPath | (module >> "*")));
 
 auto const cd_def =
-    cd_::name >> space_separator > dataPath;
+    cd_::name >> space_separator > cdPath;
 
 auto const create_def =
     create_::name >> space_separator > (presenceContainerPath | listInstancePath | leafListElementPath);
@@ -255,6 +258,15 @@
     }
 } const dump_args;
 
+auto const rpc_def =
+    rpc_::name > space_separator > rpcPath;
+
+auto const exec_def =
+    exec_::name >> x3::attr(exec_{});
+
+auto const cancel_def =
+    cancel_::name >> x3::attr(cancel_{});
+
 auto const dump_def =
     dump_::name > space_separator >> dump_args;
 
@@ -262,7 +274,7 @@
     x3::eps;
 
 auto const command_def =
-    createCommandSuggestions >> x3::expect[cd | copy | create | delete_rule | set | commit | get | ls | discard | describe | help | move | dump];
+    createCommandSuggestions >> x3::expect[cd | copy | create | delete_rule | set | commit | get | ls | discard | describe | help | move | dump | rpc | exec | cancel];
 
 #if __clang__
 #pragma GCC diagnostic pop
@@ -281,5 +293,8 @@
 BOOST_SPIRIT_DEFINE(copy)
 BOOST_SPIRIT_DEFINE(move)
 BOOST_SPIRIT_DEFINE(dump)
+BOOST_SPIRIT_DEFINE(rpc)
+BOOST_SPIRIT_DEFINE(exec)
+BOOST_SPIRIT_DEFINE(cancel)
 BOOST_SPIRIT_DEFINE(command)
 BOOST_SPIRIT_DEFINE(createCommandSuggestions)