Batch Command Execution
This section describes the configuration model of batch command execution and provides examples of XML packets.
Data Model
The configuration model file matching batch command execution is huawei-execute-cli.yang.
Object |
Description |
Value Range |
Remarks |
---|---|---|---|
/huawei-execute-cli:clis/cli/name |
Indicates the name of the command set to be executed. |
The value is a string of characters. |
N/A |
/huawei-execute-cli:clis/cli/execute-cli |
Indicates the commands to be executed. |
The value is a string of characters in the following format: x y ... x and y indicate commands to be executed. For example, the following command set indicates that the return command is executed to return to the user view, the system-view command is executed to enter the system view, and then the vlan 1000 command is executed to create VLAN 1000. return system-view vlan 1000 |
The command to be executed cannot be undo netconf. |
Executing Commands in a Batch
This section describes how to execute commands in a batch using the rpc method.
Operation |
XPATH |
---|---|
rpc |
|
Data requirement
Item |
Data |
Description |
---|---|---|
Name of the command set to be executed |
cli001 |
Name of the command set to be executed is cli001. |
Commands to be executed |
return system-view vlan 1000 |
Execute the return command to return to the user view, execute the system-view command to enter the system view, and then execute the vlan 1000 command to create VLAN 1000. |
Request example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <hw-execute-cli:clis xmlns:hw-execute-cli="urn:huawei:params:xml:ns:yang:huawei-execute-cli"> <hw-execute-cli:cli> <hw-execute-cli:name>cli001</hw-execute-cli:name> <hw-execute-cli:execute-cli>return system-view vlan 1000</hw-execute-cli:execute-cli> </hw-execute-cli:cli> </hw-execute-cli:clis> </config> </edit-config> </rpc>
Response example
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <ok/> </rpc-reply>
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <rpc-error> <error-app-tag>3</error-app-tag> <error-message>Wrong parameter.</error-message> <error-info>Error on node /huawei-execute-cli:clis/cli[name="cli001"]/execute-cli</error-info> </rpc-error> </rpc-reply>