The <edit-config> operation can be invoked from the yangcli-pro command line.
The contents of the <config> element can be stored in an XML file
edit-config target=candidate config=@my-data.xml
The XML file (e.g., my-data.xml) needs to be located in the data path used by yangcli-pro.
The default location is the $HOME/data directory
The contents of this file are the child nodes of the <config> container. E.g., set /int8.1 = 9
<int8.1 xmlns="http://netconfcentral.org/ns/test">9</int8.1>
By default, yangcli-pro will parse this XML file and match it to known objects for the current session.
If successful, then an <edit-config> operation will be sent:
<?xml version="1.0" encoding="UTF-8"?> <rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <candidate/> </target> <default-operation>merge</default-operation> <test-option>set</test-option> <config> <int8.1 xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="create" xmlns="http://netconfcentral.org/ns/test">9</int8.1> </config> </edit-config> </rpc>
If the XML file does not contain a valid XML instance document that yangcli-pro can parse, the operation will fail.
Invalid XML in this case includes:
- multiple top-level elements
- elements unknown to the server
- invalid XML syntax (such as a missing end tag)
In order to send this type of XML file the raw XML mode must be used
> $$use-rawxml = true System variable set OK > edit-config target=candidate config=@my-data.xml