< Home

Executing Commands in a Batch

This section describes how to execute commands in a batch using the rpc method.

Table 1 Executing commands in a batch

Operation

XPATH

rpc

  • /huawei-execute-cli:clis/cli/name
  • /huawei-execute-cli:clis/cli/execute-cli

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

# 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="1">
  <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="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>
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic