ygot
ygot copied to clipboard
No go struct generated if yang has rpc
I dont see any go-struct generated if a yang has rpc? It this supported?
rpc ping {
description "Check networking connectivity with particular node";
input {
leaf ip {
type string;
default "8.8.8.8";
description "IP address of Node to check reachability";
}
}
output {
leaf reachability {
type string;
default "non-reachable";
description "returns reachabale or non-reachable";
}
}
}
}
Hi,
Apologies -- I thought I had responded to this issue.
Today, there is no support for generating structs for RPCs. The tasks that would be required to add such support are:
- Figure out what the output structs should look like -- should there be some new RPC package that is created, or should it be messages within the existing package (likely easier)? How will the schema be represented in the SchemaTree (which currently assumes a single root -- so one needs to have some way to distinguish RPCs within the yang.Entry that is used there).
- Extend
findMappableEntitiesto consider RPC nodes. - Depending on the outcome of the design - potentially extend the directory definitions to have any new code output. This will probably need to include some new schema path mapping tag so that other functions are able to understand where to find the schema for particular fields of the RPC.
If this is something that you'd like to pursue - we'd definitely welcome code contributions. I can provide some input on the design, and code reviews.
Thanks, r.