-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leaf-list does not seem to work as RPC input #17
Comments
This looks good. Before I start reproducing this locally, what is the error message that you're getting and what is the expected behavior? |
{ "ietf-restconf:errors": { "error": [ { "error-type": "application", "error-tag": "operation-failed", "error-message": "Validation failed. Invalid input data." } ] } } Expected behavior: To be able to set a sorted leaf-list, that will be handled for the callback to work on. |
I succeeded to call the RPC using sysrepo, but RESTCONF still fails. admin@ix-00-00-00:~$ sysrepocfg -f json -R { "infix-system:set-boot-order": { "boot-order": [ "primary" ] } } admin@ix-00-00-00:~$ admin@ix-00-00-00:~$ curl -k -u admin:admin -H "Content-Type: application/yang-data+json" -X POST --data '{ "infix-system:input": { "boot-order": [ "primary", "secondary" ] } }' https://localhost:443/restconf/operations/infix-system:set-boot-order { "ietf-restconf:errors": { "error": [ { "error-type": "protocol", "error-tag": "invalid-value", "error-message": "Validation failure: Can't parse into operation data tree: LY_EVALID" } ] } } |
I tried to reproduce this with the latest diff --git a/tests/restconf-rpc.cpp b/tests/restconf-rpc.cpp
index c4229a0..68a5d33 100644
--- a/tests/restconf-rpc.cpp
+++ b/tests/restconf-rpc.cpp
@@ -123,6 +123,15 @@ TEST_CASE("invoking actions and rpcs")
REQUIRE_CALL(rpcCall, rpcCall("/example:test-rpc-no-input-no-output", std::map<std::string, std::string>({})));
REQUIRE(post(RESTCONF_OPER_ROOT "/example:test-rpc-no-input-no-output", {AUTH_ROOT, CONTENT_TYPE_JSON}, "") == Response{204, noContentTypeHeaders, ""});
+
+ REQUIRE_CALL(rpcCall, rpcCall("/example:test-rpc", std::map<std::string, std::string>({{"/example:test-rpc/i", "ahoj"}, {"/example:test-rpc/ll[1]", "a"}, {"/example:test-rpc/ll[2]", "b"}})));
+ REQUIRE(post(RESTCONF_OPER_ROOT "/example:test-rpc", {AUTH_ROOT, CONTENT_TYPE_JSON}, R"({"example:input": {"i":"ahoj", "ll": ["a", "b"]}}")") == Response{200, jsonHeaders, R"({
+ "example:output": {
+ "out1": "some-output-string",
+ "out2": "some-output-string-2"
+ }
+}
+)"});
}
SECTION("Data format")
diff --git a/tests/yang/example.yang b/tests/yang/example.yang
index 5d586a0..43ca82b 100644
--- a/tests/yang/example.yang
+++ b/tests/yang/example.yang
@@ -172,6 +172,9 @@ module example {
type string;
mandatory true;
}
+ leaf-list ll {
+ type string;
+ }
}
output {
leaf out1 { type string; } ...and everything worked just fine. Could you please check whether this still happens with the following commits:
Note that there are some big changes in how the operational DS is implemented in these versions (which will become a release shortly). |
I can confirm that it works, we can close this issue. |
Where the RPC is defined in:
Am I doing anything wrong here? When looking at the RFC it looks like it is correct.
The text was updated successfully, but these errors were encountered: