Allow immediately executing RPC with no input
Story: https://tree.taiga.io/project/jktjkt-netconf-cli/us/189
Change-Id: I876437b798e995c4484e97b409117a2bb207e864
diff --git a/tests/yang.cpp b/tests/yang.cpp
index 1ec6507..c5ae62a 100644
--- a/tests/yang.cpp
+++ b/tests/yang.cpp
@@ -317,6 +317,22 @@
rpc myRpc {}
+ rpc rpcOneOutput {
+ output {
+ leaf ahoj {
+ type string;
+ }
+ }
+ }
+
+ rpc rpcOneInput {
+ input {
+ leaf ahoj {
+ type string;
+ }
+ }
+ }
+
leaf numberOrString {
type union {
type int32;
@@ -776,6 +792,8 @@
{"example-schema"s, "obsoleteLeafWithDeprecatedType"},
{"example-schema"s, "obsoleteLeafWithObsoleteType"},
{"example-schema"s, "myRpc"},
+ {"example-schema"s, "rpcOneOutput"},
+ {"example-schema"s, "rpcOneInput"},
{"example-schema"s, "systemStats"},
{"example-schema"s, "dummyLeaf"},
{"example-schema"s, "addresses"},
@@ -855,6 +873,8 @@
{"example-schema"s, "length"},
{"example-schema"s, "loopback"},
{"example-schema"s, "myRpc"},
+ {"example-schema"s, "rpcOneOutput"},
+ {"example-schema"s, "rpcOneInput"},
{"example-schema"s, "numberOrString"},
{"example-schema"s, "obsoleteLeaf"},
{"example-schema"s, "obsoleteLeafWithDeprecatedType"},
@@ -920,6 +940,14 @@
{boost::none, "/example-schema:myRpc"},
{boost::none, "/example-schema:myRpc/input"},
{boost::none, "/example-schema:myRpc/output"},
+ {boost::none, "/example-schema:rpcOneOutput"},
+ {boost::none, "/example-schema:rpcOneOutput/input"},
+ {boost::none, "/example-schema:rpcOneOutput/output"},
+ {boost::none, "/example-schema:rpcOneOutput/output/ahoj"},
+ {boost::none, "/example-schema:rpcOneInput"},
+ {boost::none, "/example-schema:rpcOneInput/input"},
+ {boost::none, "/example-schema:rpcOneInput/input/ahoj"},
+ {boost::none, "/example-schema:rpcOneInput/output"},
{boost::none, "/example-schema:numberOrString"},
{boost::none, "/example-schema:obsoleteLeaf"},
{boost::none, "/example-schema:obsoleteLeafWithDeprecatedType"},
@@ -1135,6 +1163,30 @@
REQUIRE(ys.dataPathToSchemaPath("/example-schema:portSettings[port='eth0']") == "/example-schema:portSettings");
REQUIRE(ys.dataPathToSchemaPath("/example-schema:portSettings[port='eth0']/shutdown") == "/example-schema:portSettings/shutdown");
}
+
+ SECTION("has input nodes")
+ {
+ bool expected;
+ SECTION("example-schema:myRpc")
+ {
+ path.m_nodes.emplace_back(module_{"example-schema"}, rpcNode_{"myRpc"});
+ expected = false;
+ }
+
+ SECTION("example-schema:rpcOneInput")
+ {
+ path.m_nodes.emplace_back(module_{"example-schema"}, rpcNode_{"rpcOneInput"});
+ expected = true;
+ }
+
+ SECTION("example-schema:rpcOneOutput")
+ {
+ path.m_nodes.emplace_back(module_{"example-schema"}, rpcNode_{"rpcOneOutput"});
+ expected = false;
+ }
+
+ REQUIRE(ys.hasInputNodes(pathToSchemaString(path, Prefixes::WhenNeeded)) == expected);
+ }
}
SECTION("negative")