openconfig / ygot

A YANG-centric Go toolkit - Go/Protobuf Code Generation; Validation; Marshaling/Unmarshaling
Apache License 2.0
286 stars 107 forks source link

No go struct generated if yang has rpc #211

Open msahu-rvbd opened 6 years ago

msahu-rvbd commented 6 years ago

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";
              }
          }
       }
}
robshakir commented 6 years ago

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:

  1. 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).
  2. Extend findMappableEntities to consider RPC nodes.
  3. 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.