cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3681
Views
0
Helpful
4
Replies

Saving configuration via NETCONF

valglinskiy
Level 1
Level 1

I did "NETCONF/YANG on Nexus" labs and noticed that changes do not get saved to startup-config. NETCONF capabilities of NXOS sandbox do not include ":startup", so <copy-config> operation can not copy running-config to startup-config. What is the other way to save configuration via NETCONF operation?

reported capabilities:

urn:ietf:params:netconf:capability:writable-running:1.0

urn:ietf:params:netconf:capability:rollback-on-error:1.0

urn:ietf:params:netconf:capability:confirmed-commit:1.1

urn:ietf:params:netconf:capability:validate:1.1

http://cisco.com/ns/yang/cisco-nx-os-device?revision=2017-08-31&module=Cisco-NX-OS-device&deviations=Cisco-NX-OS-device-deviations

urn:ietf:params:netconf:base:1.0

urn:ietf:params:netconf:base:1.1

urn:ietf:params:netconf:capability:candidate:1.0

http://openconfig.net/yang/bgp?revision=2016-06-06&module=openconfig-bgp&deviations=openconfig-bgp-deviations

http://openconfig.net/yang/interfaces?revision=2016-05-26&module=openconfig-interfaces&deviations=openconfig-interfaces-deviations

http://openconfig.net/yang/interfaces/ip?revision=2016-05-26&module=openconfig-if-ip&deviations=openconfig-if-ip-deviations

4 Replies 4

sacthoma
Cisco Employee
Cisco Employee

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<save-config xmlns="http://cisco.com/yang/cisco-ia"/>
</rpc>

bcerny
Level 1
Level 1

I'd like to snapshot the running config for use as a checkpoint:

 

<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <copy-config>
  <source>
   <running/>
  </source>
  <target>
   <url>file://20231031_Run.txt</url>
  </target>
 </copy-config>
</rpc>]]>]]>

 

However, the <url> isn't understood:

<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <copy-config>
  <source>
   <running/>
  </source>
  <target>
   <url>file://20231031_Run.txt</url>
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101"><rpc-error>
<error-type>protocol</error-type>
<error-tag>invalid-value</error-tag>
<error-severity>error</error-severity>
<error-message xml:lang="en">Unsupported capability :url</error-message><error-info><bad-element>url</bad-element>
</error-info>
</rpc-error>
</rpc-reply>]]>]]>  </target>
 </copy-config>
</rpc>]]>]]>

 Is there another way to save the running config into a text file?

Hi

<copy-config> is for coping (replacing) configurations between NETCONF datastores, so you can't use this RPC to copy a configuration to the filesystem of your box.  

If you want to create a checkpoint and save it to a file - try the "checkpoint" RPC from the Cisco-NX-OS-device model (https://raw.githubusercontent.com/YangModels/yang/main/vendor/cisco/nx/10.4-1/Cisco-NX-OS-device.yang)

I don't have access to a NX-box at the moment, but it should look something like this:

 

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
  <checkpoint xmlns="http://cisco.com/ns/yang/cisco-nx-os-device">
    <action>create</action>
    <file>bootflash:</file>
  </checkpoint>
</rpc>

 

HTH
Marcel


 

Marcel Zehnder
Spotlight
Spotlight

Or do you use another network operating system (XR, XE)?