The input data from an RPC operation is parsed by the server into val_value_t structures and can be accessed during Validate (for validation) and Invoke (for handling) RPC callbacks calls.
In the attached YANG module example, the <set-my-session> operation takes multiple input parameters:
The <set-my-session> SIL callback code does not need to do any validation other than the YANG validation done by the server, so there is no RPC validate callback needed in this case. However, there may be Validate callback if there is a need to enforce more validation on parameters. The RPC invoke function is also allowed to return an error (e.g., resource not available). This function gets the input parameters from the message and then modifies the current session with these parameters.
Please refer to the attached modified SIL code for sample-mysession YANG module that illustrates how Invoke callback for the <set-my-session> RPC operation may look like. The SIL library is ready to be compiled and it is modified to support <set-my-session> and <get-my-session> RPC operations. What is left is to compile the SIL code first:
> cd sample-mysession > make > make install
And then start the server with --module=sample-mysession CLI parameter:
> netconfd-pro --module=sample-mysession log-level=debug4
After that a client application can send RPC requests. The input of the <set-my-session> RPC request may look as follows:
<?xml version="1.0" encoding="UTF-8"?> <rpc message-id="6" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <set-my-session xmlns="http://netconfcentral.org/ns/sample-mysession"> <indent>5</indent> <message-indent>5</message-indent> </set-my-session> </rpc>