yangcli-pro allows very complex NETCONF operations to be constructed by the user in interactive mode.
The user is prompted for all mandatory fields, or all fields if the $$optional global variable is set to "true".
Complex data (e.g., containers, lists, choices) cannot easily be entered from the command line without prompting for input from the user. Leaf parameters can be easily entered from the command line, but not complex data structures.
In order to send complete commands to the server without yangcli-pro stopping and prompting for missing data, all the data must be provided in one command line. This can be done 2 different ways:
- Complete XML Operation Files
- Inline XML Text
XML File Locations:
The YUMAPRO_DATAPATH and --datapath CLI parameter control where yangcli-pro looks for data files such as XML files. The $HOME/data directory is in the default path and is checked first, if it exists.
The --use-rawxml Parameter
Sometimes yangcli-pro will not accept the XML data from a file because it is not schema valid, or the schema is not correct or available. By default, the XML file is converted to the internal "val_value_t" format before it is used. To use the raw XML file without conversion, set the "use-rawxml" parameter to "true". There are 3 ways this can be done.
Set in CLI parameter in command invocation:
> yangcli-pro --use-rawxml=true
Set configuration parameter in config file:
yangcli-pro { use-rawxml true }
Set global variable at yangcli-pro command prompt:
> $$use-rawxml = true
Example Operation
Example: o-ran-file-management:file-download operation
This RPC operation has some complex content so it used for this example. A container with a leaf in it is sent, which is not supported as a plain command line parameter. The container must be provided some other way.
+---x file-download +---w input | +---w local-logical-file-path string | +---w remote-file-path string | +---w (credentials)? | +--:(password) | | +---w password! | | | +---w password string | | +---w server | | +---w keys* [algorithm] | | +---w algorithm iasa:asymmetric-algorithm-type | | +---w public-key-format identityref | | +---w public-key binary | +--:(certificate) | +---w certificate! +--ro output +--ro status? enumeration +--ro reject-reason? string
Method 1: Complete XML Operation Files
It is possible to capture the entire RPC operation into one XML file and send it to the server.
The entire XML contents except for the outer "rpc" element must be present in the file
The "xmlns" attribute for the RPC operation namespace should be present in the top element.
Example: complete1.xml
<file-download xmlns="urn:o-ran:file-management:1.0"> <local-logical-file-path>xxx-path</local-logical-file-path> <remote-file-path>yyy-path</remote-file-path> <password> <password>new-password</password> </password> </file-download>
Example: yangcli-pro command
> file-download @complete1.xml
Method 2: Inline XML Text
Inline XML can be provided on the command line or multiple lines within a script. No XML file is needed.
Example: yangcli-pro command
file-download local-logical-file-path=xxx-path remote-file-path=yyy-path password="""<password><password>new-password</password></password>"""
Example: The XML that is sent to the server:
<rpc message-id="7" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <file-download xmlns="urn:o-ran:file-management:1.0"> <local-logical-file-path>xxx-path</local-logical-file-path> <remote-file-path>yyy-path</remote-file-path> <password> <password>new-password</password> </password> </file-download> </rpc>