Add parser support for YANG actions
Change-Id: I9e96ae15cee3f990dfa5ec3fac433faf71348e11
diff --git a/src/interpreter.cpp b/src/interpreter.cpp
index 26e2be4..a39167e 100644
--- a/src/interpreter.cpp
+++ b/src/interpreter.cpp
@@ -210,24 +210,28 @@
std::cout << m_datastore.dump(dump.m_format) << "\n";
}
-void Interpreter::operator()(const rpc_& rpc) const
+void Interpreter::operator()(const prepare_& prepare) const
{
- m_datastore.initiateRpc(pathToString(toCanonicalPath(rpc.m_path)));
- m_parser.changeNode(rpc.m_path);
+ if (std::holds_alternative<rpcNode_>(prepare.m_path.m_nodes.back().m_suffix)) {
+ m_datastore.initiateRpc(pathToString(toCanonicalPath(prepare.m_path)));
+ } else {
+ m_datastore.initiateAction(pathToString(toCanonicalPath(prepare.m_path)));
+ }
+ m_parser.changeNode(prepare.m_path);
}
void Interpreter::operator()(const exec_&) const
{
m_parser.changeNode({Scope::Absolute, {}});
- auto output = m_datastore.executeRpc();
- std::cout << "RPC output:\n";
+ auto output = m_datastore.execute();
+ std::cout << "RPC/action output:\n";
printTree(output);
}
void Interpreter::operator()(const cancel_&) const
{
m_parser.changeNode({Scope::Absolute, {}});
- m_datastore.cancelRpc();
+ m_datastore.cancel();
}
struct commandLongHelpVisitor : boost::static_visitor<const char*> {