Appendix A Supported NETCONF operations

Table 13 lists the NETCONF operations available with Comware 7.

Table 13: NETCONF operations

Operation

Description

XML example

get

Retrieves device configuration and state information.

To retrieve device configuration and state information for the Syslog module:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:xc="http://www.hp.com/netconf/base:1.0">
  <get>
    <filter type="subtree">
      <top xmlns="http://www.hp.com/netconf/data:1.0">
        <Syslog>
        </Syslog>
      </top>
    </filter>
  </get>
</rpc>

get-config

Retrieves the non-default configuration data. If non-default configuration data does not exist, the device returns a response with empty data.

To retrieve non-default configuration data for the interface table:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:xc="http://www.hp.com/netconf/base:1.0">
  <get-config>
    <source>
      <running/>
    </source>
    <filter type="subtree">
      <top xmlns="http://www.hp.com/netconf/config:1.0">
        <Ifmgr>
          <Interfaces>
            <Interface/>
           </Interfaces>
        </Ifmgr>
      </top>
    </filter>
  </get-config>
</rpc>

get-bulk

Retrieves a number of data entries (including device configuration and state information) starting from the data entry next to the one with the specified index.

To retrieve device configuration and state information for all interface:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <get-bulk>
    <filter type="subtree">
      <top xmlns="http://www.hp.com/netconf/data:1.0">
        <Ifmgr>
          <Interfaces xc:count="5" xmlns:xc=" http://www.hp.com/netconf/base:1.0">
           <Interface/>
          </Interfaces>
        </Ifmgr>
      </top>
    </filter>
  </get-bulk>
</rpc>

get-bulk-config

Retrieves a number of non-default configuration data entries starting from the data entry next to the one with the specified index.

To retrieve non-default configuration for all interfaces:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <get-bulk-config>
    <source>
      <running/>
    </source>
    <filter type="subtree">
      <top xmlns="http://www.hp.com/netconf/config:1.0">
        <Ifmgr>
        </Ifmgr>
      </top>
    </filter>
  </get-bulk-config>
</rpc>

edit-config: incremental

Adds configuration data to a column without affecting the original data.

The incremental attribute applies to a list column such as the vlan permitlist column.

You can use the incremental attribute for <edit-config> operations except for the replace operation.

Support for the incremental attribute varies by module. For more information, see NETCONF XML API documents.

To add VLANs 1 through 10 to an untagged VLAN list that has untagged VLANs 12 through 15:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
xmlns:hp="http://www.hp.com/netconf/base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>  
    <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
      <top xmlns="http://www.hp.com/netconf/config:1.0">
        <VLAN xc:operation="merge">
          <HybridInterfaces>
            <Interface>
              <IfIndex>262</IfIndex>
              <UntaggedVlanList  hp: incremental="true">1-10</UntaggedVlanList>
               </Interface>
          </HybridInterfaces>
        </VLAN>
      </top>
    </config>
  </edit-config>
</rpc>

edit-config: merge

Changes the running configuration.

To use the merge attribute in an <edit-config> operation, you must specify the operation target (on a specified level):

  • If the specified target exists, the operation directly changes the configuration for the target.

  • If the specified target does not exist, the operation creates and configures the target.

  • If the specified target does not exist and it cannot be created, an error message is returned.

To change the buffer size to 120:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"  xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target> 
    <config>
      <top xmlns="http://www.hp.com/netconf/config:1.0">
        <Syslog xmlns="http://www.hp.com/netconf/config:1.0" xc:operation="merge">
           <LogBuffer>
            <BufferSize>120</BufferSize>
          </LogBuffer>
        </Syslog>
      </top>
    </config>
  </edit-config>
</rpc>

edit-config: create

Creates a specified target. To use the create attribute in an <edit-config> operation, you must specify the operation target.

  • If the table supports target creation and the specified target does not exist, the operation creates and then configures the target.

  • If the specified target exists, a data-exist error message is returned.

The XML data format is the same as the edit-config message with the merge attribute. Change the operation attribute from merge to create.

edit-config: replace

Replaces the specified target.

  • If the specified target exists, the operation replaces the configuration of the target with the configuration carried in the message.

  • If the specified target does not exist but is allowed to be created, create the target and then apply the configuration of the target.

  • If the specified target does not exist and is not allowed to be created, the operation is not conducted and an invalid-value error message is returned.

The syntax is the same as the edit-config message with the merge attribute. Change the operation attribute from merge to replace.

edit-config: remove

Removes the specified configuration.

  • If the specified target has only the table index, the operation removes all configuration of the specified target, and the target itself.

  • If the specified target has the table index and configuration data, the operation removes the specified configuration data of this target.

  • If the specified target does not exist, or the XML message does not specify any targets, a success message is returned.

The syntax is the same as the edit-config message with the merge attribute. Change the operation attribute from merge to remove.

edit-config: delete

Deletes the specified configuration.

  • If the specified target has only the table index, the operation removes all configuration of the specified target, and the target itself.

  • If the specified target has the table index and configuration data, the operation removes the specified configuration data of this target.

  • If the specified target does not exist, an error message is returned, showing that the target does not exist.

The syntax is the same as the edit-config message with the merge attribute. Change the operation attribute from merge to delete.

edit-config: default-operation

Modifies the current configuration of the device using the default operation method.

If you do not specify an operation attribute for an <edit-config> message, NETCONF uses one of the following default operation attributes: merge, create, delete, and replace. Your setting of the value for the <default-operation> element takes effect only once. If you do not specify an operation attribute and the default operation method for an <edit-config> message, merge is always applied.

  • merge—The default value for the <default-operation> element.

  • replace—Value used when the operation attribute is not specified and the default operation method is specified as replace.

  • none—Value used when the operation attribute is not specified and the default operation method is specified as none. If this value is specified, the <edit-config> operation is used only for schema verification rather than issuing a configuration. If the schema verification is passed, a successful message is returned. Otherwise, an error message is returned.

To issue an empty operation for schema verification purposes:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <default-operation>none</default-operation>
    <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
      <top xmlns="http://www.hp.com/netconf/config:1.0">
        <Ifmgr>
          <Interfaces>
            <Interface>
              <IfIndex>262</IfIndex>
              <Description>222222</Description>
            </Interface>
          </Interfaces>
        </Ifmgr>
      </top>
    </config>
  </edit-config>
</rpc>

edit-config: error-option

Determines the action to take in case of a configuration error.

The error-option element has one of the following values:

  • stop-on-error—Stops the operation on error and returns an error message. This is the default error-option value.

  • continue-on-error—Continues the operation on error and returns an error message.

  • rollback-on-error—Rolls back the configuration.

To issue the configuration for two interfaces with the error-option element value as continue-on-error:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>   <error-option>continue-on-error</error-option>
    <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
      <top xmlns="http://www.hp.com/netconf/config:1.0">
        <Ifmgr xc:operation="merge">
          <Interfaces>
            <Interface>
              <IfIndex>262</IfIndex>
              <Description>222</Description>
                <ConfigSpeed>1024</ConfigSpeed>
                <ConfigDuplex>1</ConfigDuplex>
            </Interface>
            <Interface>
              <IfIndex>263</IfIndex>
              <Description>333</Description>
                <ConfigSpeed>1024</ConfigSpeed>
                <ConfigDuplex>1</ConfigDuplex>
            </Interface>
          </Interfaces>
        </Ifmgr>
      </top>
    </config>
  </edit-config>
</rpc>

edit-config: test-option

Determines whether to issue a configuration item in an <edit-config> operation. The test-option element has one of the following values:

  • test-then-set—Performs a validation test before attempting to set. If the validation test fails, the <edit-config> operation is not performed. This is the default test-option value.

  • set—Directly performs the set operation without the validation test.

  • test-only—Performs only a validation test without attempting to set. If the validation test succeeds, a successful message is returned. Otherwise, an error message is returned.

To issue the configuration for an interface for test purposes:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>  
    <test-option>test-only</test-option> 
    <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
      <top xmlns="http://www.hp.com/netconf/config:1.0">
        <Ifmgr xc:operation="merge">
          <Interfaces>
            <Interface>
              <IfIndex>262</IfIndex>
              <Description>222</Description>
                <ConfigSpeed>1000000</ConfigSpeed>
                <ConfigDuplex>1</ConfigDuplex>
               </Interface>
          </Interfaces>
        </Ifmgr>
      </top>
    </config>
  </edit-config>
</rpc>

action

Issues actions that are not for configuring data, for example, reset action.

To clear statistics information for all interfaces:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <action>
    <top xmlns="http://www.hp.com/netconf/action:1.0">
      <Ifmgr>
            <ClearAllIfStatistics>
                <Clear>
                </Clear>
        </ClearAllIfStatistics>
      </Ifmgr>
    </top>
  </action>
</rpc>

lock

Locks configuration data that can be changed by <edit-config> operations. Other configuration data are not limited by the lock operation.

After a user locks the configuration, other users cannot use NETCONF or other configuration methods such as CLI and SNMP to configure the device.

To lock the configuration:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <lock>
    <target>
        <running/>
    </target>
</lock>
</rpc>

unlock

Unlocks the configuration, so NETCONF sessions can change device configuration.

When a NETCONF session is terminated, the related locked configuration is also unlocked.

To unlock the configuration:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> 
<unlock>
    <target>
        <running/>
    </target>
</unlock>
</rpc>

get-sessions

Retrieves information about all NETCONF sessions in the system.

To retrieve information about all NETCONF sessions in the system:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> 
<get-sessions/>
</rpc>

close-session

Terminates the NETCONF session for the current user, to unlock the configuration and release the resources (for example, memory) of this session. This operation logs the current user off the XML view.

To terminate the NETCONF session for the current user:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> 
<close-session/>
</rpc>

kill-session

Terminates the NETCONF session for another user. This operation cannot terminate the NETCONF session for the current user.

To terminate the NETCONF session with session-id 1:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> 
  <kill-session>
    <session-id>1</session-id>
  </kill-session>
</rpc>

CLI

Executes CLI operations. A request message encloses commands in the <CLI> element, and a response message encloses the command output in the <CLI> element.

NETCONF supports the following views:

  • Execution—User view.

  • Configuration—System view.

To execute a command in other views, specify the command for entering the specified view, and then the desired command.

To execute the display this command in system view:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <CLI>
    <Configuration>display this</Configuration>
  </CLI>
</rpc>

save

Saves the running configuration. You can use the <file> element to specify a file for saving the configuration. If the text does not include the file column, the running configuration is automatically saved to the main next-startup configuration file.

The OverWrite attribute determines whether the current configuration overwrites the original configuration file when the specified file already exists.

To save the running configuration to file test.cfg:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <save OverWrite="false">
    <file>test.cfg</file>
  </save>
</rpc>

load

Loads the configuration. After the device finishes the <load> operation, the configuration in the specified file is merged into the current configuration of the device.

To merge the configuration in file a1.cfg to the current configuration of the device:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <load>
    <file>a1.cfg</file>
  </load>
</rpc>

rollback

Rolls back the configuration. To do so, you must specify the configuration file in the <file> element. After the device finishes the <rollback> operation, the current device configuration is totally replaced with the configuration in the specified configuration file.

To roll back the current configuration to the configuration in file 1A.cfg:

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> 
<rollback>
    <file>1A.cfg</file>
</rollback>
</rpc>