URL Capability examples

Hi.

I have ISIS and LDP configured on my device.
Can anyone please give me examples of how i can test URL Capability with below operataions:

‘edit-config’
‘delete-config’
‘copy-config’
‘validate’

Not sure how this relates to what is configured on your device, but you can try something like this:

confd.conf example :url setting:

...
</capabilities>
...
  <url>
    <enabled>true</enabled>
    <file>
      <enabled>true</enabled>
      <rootDir>/my/dir</rootDir>
    </file>
    <ftp>
      <enabled>true</enabled>
    </ftp>
    <sftp>
      <enabled>true</enabled>
    </sftp>
  </url>
</capabilities>
...

edit-config from file to running:

<edit-config>
  <target>
    <running/>	
  </target>
  <url>file:///my-new-cfg.xml</url>
</edit-config>

edit-config from ftp server file to running:

<edit-config>
  <target>
    <running/>	
  </target>
  <url>ftp://myusr:mypass@localhost/my-new-cfg.xml</url>
</edit-config>

copy-config from running to file:

<copy-config>
  <target>
    <url>file:///my-backup.xml</url>
  </target>
  <source>
    <running/>	
  </source>
</copy-config>

copy-config from file to running:

<copy-config>
  <target>
    <running/>	
  </target>
  <source>
    <url>file:///my-new-config.xml</url>
  </source>
</copy-config>

copy-config from running to ftp server file

<copy-config>
  <target>
    <url>ftp://myusr:mypass@localhost/my-backup.xml</url>
  </target>
  <source>
    <running/>
  </source>
</copy-config>

copy-config from ftp server file to running:

<copy-config>
  <target>
    <running/>
  </target>
  <source>
    <url>ftp://myusr:mypass@localhost/my-new-config.xml</url>
  </source>
</copy-config>

delete-config file:

<delete-config>
  <target>
    <url>file:///my-config.xml</url>
  </target>
</delete-config>

delete-config ftp server file:

<delete-config>
  <target>
    <url>ftp://myusr:mypass@localhost/my-config.xml</url>
  </target>
</delete-config>

ConfD does not support validate from an URL. See “:url” in ConfD UG Chapter 15.2. Capabilities for details.

Thanks for the examples

Hello Cohult,

I have done few configurations like ISIS,BGP on my device from NETCONF client.
Now , i want to check Copy-config operation. Can you please help me what should be in my target parameter in below XML:
my router ip is: 192.168.171.44 (to login i do ssh root@192.168.171.44)
CASE I: to copy on the same router
CASE II: to copy on different server

Thanks in advance

Hi,

When referring to

  • “copy on the same router” are you referring to the above example on “copy-config from running to file” or something else?
  • “copy on different server” are you referring to the above example on “copy-config from running to ftp server file” or something different?

Note that file-to-file copying/transfers are not supported. For those scenarios there are multiple options you can use from for example a NETCONF/YANG 1.1 action implementation.

hi Cohult,

i am referring to the example you posted on sep17 reply.

copy-config from running to file:

hi Cohult ,

can you please reply:
i am trying to copy from running to ftp server (in my case 192.168.171.44 at location sdboot/up)

Are you looking for something like this?:

$ # We enable the netconf trace log
$ cat confd.conf | grep -B 2 -A 2 netconf.trace
    <netconfTraceLog>
      <enabled>true</enabled>
      <filename>./netconf.trace</filename>
      <format>pretty</format>
    </netconfTraceLog>

$ # Start ConfD
$ confd -c confd.conf --addloadpath $CONFD_DIR/etc/confd
$ cat copy-running-to-ftp-url.xml 
<copy-config>
  <target>
    <url>ftp://root:mypassword@192.168.171.44/my-running-config.xml</url>
  </target>
  <source>
    <running/>
  </source>
</copy-config>

$ # Now let's say ConfD is running on my local host and I have the user and password set to admin/admin
$ netconf-console --host=127.0.0.1 --user=admin --password=admin --rpc=copy-running-to-ftp-url.xml
<?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>
$ # ConfD's running datastore has now copied to a my-running-config.xml file on the 192.168.171.44 FTP server home dir
$ # The NETCONF communication that was handled by the netconf-console tool (that comes with ConfD):
$ cat netconf.trace
**> sess:28 new session

13-Jan-2018::04:10:07.798 **< sess:28 write:
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <capabilities>
    <capability>urn:ietf:params:netconf:base:1.0</capability>
    <capability>urn:ietf:params:netconf:base:1.1</capability>
...
    <capability>urn:ietf:params:netconf:capability:url:1.0?scheme=ftp,sftp,file</capability>
...
  </capabilities>
  <session-id>28</session-id>
</hello>

13-Jan-2018::04:10:07.808 **> sess:28 read:
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <capabilities>
    <capability>urn:ietf:params:netconf:base:1.0</capability>
    <capability>urn:ietf:params:netconf:base:1.1</capability>
  </capabilities>
</hello>
]]>]]>
#144
<rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
#147
  <copy-config>
    <target>
      <url>ftp://root:mypassword@192.168.171.44/my-running-config.xml</url>
    </target>
    <source>
      <running/>
    </source>
  </copy-config>


#6
</rpc>

13-Jan-2018::04:10:07.904 **< sess:28 write:
<rpc-reply message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <ok/>
</rpc-reply>

##

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

13-Jan-2018::04:10:07.907 **< sess:28 write:
<rpc-reply message-id="0" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <ok/>
</rpc-reply>

**< sess:28 session closed 

can anyone tell me from where ConfD Netconf server returns capabilities ??? is there any folder for storage all the capabilities???

You typically control the NETCONF capabilities from the ConfD configuration file, confd.conf, and the YANG models you add.
See the confd.conf(5) man page under confdConfig/netconf/capabilities, confdc(1) man page export flag, and the tailf extensions man page under tailf:export