The NETCONF protocol does not officially provide an operation that can delete all instances of a YANG list or leaf-list at once.

Instead, all instances have to be explicitly deleted by name.


Solution 1: Use YANG: Define the list or leaf-list in its own container and delete the container


container nodes {
  list node {
    ...
  }
}


Problems with solution 1:

  1. What if the YANG is defined already and it is not defined this way
  2. What if the container has other nodes in it? They will all get deleted as well.


Solution 2: Use the 'delete-all' or 'remove-all' operations supported by netconfd-pro and yangcli-pro

  • Use the --allow-list-delete-all CLI parameter to enable delete-all for YANG list instances
  • Use the --allow-leaflist-delete-all CLI parameter to enable delete-all for YANG leaf-list instances
  • Set the operation attribute to "delete-all" for NETCONF 1.0 sessions
  • Set the operation attribute to "delete-all" or "remove-all" for NETCONF 1.1 sessions
  • For yangcli-pro, the delete-all or remove-all commands will send the proper <edit-config> request for these edit operations


The <edit-config> operation for netconfd-pro supports the following values for the "nc:operation" attribute:

  • merge
  • replace
  • create
  • delete
  • delete-all
  • remove
  • remove-all


As an illustration of the delete-all operation used in an <edit-config> refer to the following <edit-config>:


  <edit-config>
    <target>
      <candidate/>
    </target>
    <config>
      <nodes xmlns="http://netconfcentral.org/ns/example">
        <node xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"
              nc:operation="delete-all"/>
      </nodes>
    </config>
  </edit-config>


Yangcli-pro delete-all operation example:


yangcli-pro> delete-all target=/nodes/node