Copy-config <target as url> : Error " <bad-element>url</bad-element>"

Hi,

When NetConf “copy-config” operation is issued with target as “url” , the operation failed with the below Error Message.
Can someone help to solve this problem?

Error Message:

<?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>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-path>
    /rpc/copy-config/target/url
  </error-path>
    <error-message xml:lang="en">syntax error in url element</error-message>
    <error-info>
      <bad-element>url</bad-element>
    </error-info>
  </rpc-error>
</rpc-reply>

Operation:

    <copy-config>
    <target>
      <url>file://checkpoint.config</url>
    </target>
    <source>
    <running>
    </source>
    </copy-config>      

Capabilities

<?xml version="1.0" encoding="UTF-8"?> urn:ietf:params:netconf:base:1.0 urn:ietf:params:netconf:base:1.1 urn:ietf:params:netconf:capability:writable-running:1.0 urn:ietf:params:netconf:capability:candidate:1.0 urn:ietf:params:netconf:capability:confirmed-commit:1.0 urn:ietf:params:netconf:capability:confirmed-commit:1.1 urn:ietf:params:netconf:capability:xpath:1.0 urn:ietf:params:netconf:capability:url:1.0?scheme=ftp,sftp,file

Hi Ramith,

First enable the url capability in your confd.conf ConfD configuration file by adding the following in the <capabilities> section of the <netconf> section:

 <url>
   <enabled>true</enabled>
   <file>
      <rootDir>/tmp</rootDir>
   </file>
 </url>

See https://tools.ietf.org/html/rfc6241#section-8.8 for more on the url capability.

Then you send a NETCONF <copy-config> operation like this:

<?xml version="1.0" encoding="UTF-8"?>
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <capabilities>
    <capability>urn:ietf:params:netconf:base:1.0</capability>
  </capabilities>
</hello>
]]>]]>
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <copy-config>
    <target>
      <url>file:///checkpoint.config</url>
    </target>
    <source>
      <running/>
    </source>
  </copy-config>
</rpc>
]]>]]>
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
  <close-session/>
</rpc>
]]>]]>

The above operation will copy the config in the running datastore to /tmp/checkpoint.config

Thanks a lot Conny.

copy-config with additional “/” for the target url solved the problem.

<target>
  <url>file:///checkpoint.config</url>
</target>

Regards,
Ramith