Requirements:


Overview:


  • The backup and restore operations are used together to save and restore the <running> configuration.
  • The delete-backup operation is used to cleanup unwanted back files.
  • These operations use the 'nacm:default-deny-all' extension so they can only be used under these conditions:
    • --access-control=off is used
    • --superuser=user and 'user' is invoking the operation
    • NACM rules are configured to allow the operation to be used
    • By default, no session can invoke these operations
  • Backups are located in a specific location:
    • --fileloc-fhs=true
      • /var/lib/netconfd-pro/backups/ directory
    • --fileloc-fhs=false
      • $HOME/.yumapro/backups/ directory
    • The filename can have an .xml extension but this is not required.

    • Directory names are not allowed.



Create a Backup


Create a backup named 'backup1. 



yangcli-pro request:


admin@server1> backup filename=backup1


XML request:


<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="4"
 xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <backup xmlns="http://yumaworks.com/ns/yumaworks-system">
  <filename>backup1</filename>
 </backup>
</rpc>


The server will send back an <ok> element if the operation succeeded.


The server will return an error if the backup directory does not exist or is not writable, or if the filename already exists.



Overwrite a Backup


If the backup file already exists the server will return an <rpc-error> such as follows:


<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply message-id="10" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"
 xmlns:ysys="http://yumaworks.com/ns/yumaworks-system"
 xmlns:ncx="http://netconfcentral.org/ns/yuma-ncx"
 xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <rpc-error>
  <error-type>protocol</error-type>
  <error-tag>data-exists</error-tag>
  <error-severity>error</error-severity>
  <error-app-tag>no-access</error-app-tag>
  <error-path>/nc:rpc/ysys:backup/ysys:filename</error-path>
  <error-message xml:lang="en">data exists</error-message>
  <error-info>
   <error-number>271</error-number>
  </error-info>
 </rpc-error>
</rpc-reply>


In order to overwrite an existing file, the overwrite parameter must be set to 'true'


yangcli-pro request:


admin@server1> backup filename=backup1 overwrite=true


XML request:


<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="11"
 xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <backup xmlns="http://yumaworks.com/ns/yumaworks-system">
  <filename>backup1</filename>
  <overwrite>true</overwrite>
 </backup>
</rpc>



Retrieve the Backup File Status


In order to see what backup files already exist on the server, retrieve the backup-files container


yangcli-pro request:


> admin@server1> sget /netconf-state/backup-files


XML request:


<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="12"
 xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <get>
  <filter type="subtree">
   <netconf-state xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
    <backup-files xmlns="http://yumaworks.com/ns/yumaworks-system"/>
   </netconf-state>
  </filter>
 </get>
</rpc>


XML response:


<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply message-id="12"
 xmlns:ncx="http://netconfcentral.org/ns/yuma-ncx"
 ncx:last-modified="2019-08-23T18:44:17Z" ncx:etag="775"
 xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <data>
  <netconf-state xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
   <backup-files xmlns="http://yumaworks.com/ns/yumaworks-system">
    <backup-file>
     <name>backup1</name>
     <backup-time>2019-08-23T18:27:28Z</backup-time>
    </backup-file>
   </backup-files>
  </netconf-state>
 </data>
</rpc-reply>



Restore the <running> Datastore From A Backup


The restore operation will overwrite the <running> configuration with the contents of a saved backup.

You must make sure the modules currently loaded match the confiration or else the validation may fail.


yangcli-pro request:


> admin@server1> restore filename=backup1


XML Request:


<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="13"
 xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <restore xmlns="http://yumaworks.com/ns/yumaworks-system">
  <filename>backup1</filename>
 </restore>
</rpc>




Deleting a backup File


The delete-backup operation is used to remove an unwanted backup file.


yangcli-pro request:


admin@server1> delete-backup filename=backup1


XML Request:


<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="14"
 xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <delete-backup xmlns="http://yumaworks.com/ns/yumaworks-system">
  <filename>backup1</filename>
 </delete-backup>
</rpc>