This section provides a sample of downloading files from the file server to a switch.
Operation |
XPATH |
|---|---|
rpc |
/huawei-system-load/load-file |
Data Requirements
Item |
Data |
Description |
|---|---|---|
File name |
test.cc |
Set the name of the file to be downloaded. |
File type |
sys-load:cc-packet |
Set the type of the file to be downloaded. |
File size |
60301028 byte |
Set the size of the file to be downloaded. |
Authentication mode |
sha256 |
Set the file authentication mode used by the controller. |
Verification value of the target file |
ff0fd0701a5ab80ee406816be4f8ea4d61c798a7ed503ece6e25f0b569b73369 |
Set the verification value of the file to be downloaded. |
File processing mode |
download |
Download a file. |
SFTP server IP address |
192.168.1.5 |
Set the file server IP address. |
File directory of the server |
/ |
Specify the file directory of the server. |
SFTP server user name |
admin |
Set the SFTP server user name. |
SFTP server password |
huawei123 |
Set the SFTP server password. |
Request Example
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="f3f112f0-d33f-11e9-98a0-00d8318e00e2">
<sys-load:load-file xmlns:sys-load="urn:huawei:params:xml:ns:yang:huawei-system-load">
<sys-load:loadfile>
<sys-load:files>
<sys-load:name>test.cc</sys-load:name>
<sys-load:file-parameters>
<sys-load:type>sys-load:cc-packet</sys-load:type>
<sys-load:size>60301028</sys-load:size>
<sys-load:checksum>
<sys-load:digest-algorithm>sha256</sys-load:digest-algorithm>
<sys-load:digest>ff0fd0701a5ab80ee406816be4f8ea4d61c798a7ed503ece6e25f0b569b73369</sys-load:digest>
</sys-load:checksum>
</sys-load:file-parameters>
<sys-load:direction>download</sys-load:direction>
<sys-load:file-load-peers>
<sys-load:file-location>
<sys-load:fileserver-address>192.168.1.5</sys-load:fileserver-address>
<sys-load:file-directory>/</sys-load:file-directory>
</sys-load:file-location>
</sys-load:file-load-peers>
<sys-load:sftp>
<sys-load:username>admin</sys-load:username>
<sys-load:password>huawei123</sys-load:password>
</sys-load:sftp>
</sys-load:files>
</sys-load:loadfile>
</sys-load:load-file>
</rpc>
Response Example
Sample of successful response
<?xml version="1.0" encoding="UTF-8"?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1001"> <ok/> </rpc-reply>
Sample of failed response
<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="5">
<rpc-error>
<error-type>application</error-type>
<error-tag>operation-failed</error-tag>
<error-severity>error</error-severity>
<error-message>parse rpc config error.</error-message>
</rpc-error>
</rpc-reply>