ConfD User Community

Copy-config operation


#1

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 at path: /sdboot/up
CASE II: to copy on different server at path: /bgf/sdh-home


#2

Hello,

seems like you did not paste XML content.

Here is example of <copy-config> copying from startup to running (change according to your scenario)

<?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>
]]>]]>
<rpc message-id="101"
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<copy-config>
    <target>
        <startup/>
    </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>
]]>]]>


#3

hi mnovak,

I am looking for example where my target is URL.
the example given in RFC is not in detail.

so can you give me XML for copy-config where my source is “running”
and target is:

  1. URL to copy in same router (192.168.171.44) at /sdboot/up
  2. URL to copy on different server (172.18.111.146) at /sdh_home/bgf

#4

Hello,

please see answer here:

Do not forget to enable url capability in confd.conf and add 3 times slash / in the url, e./g.

     <url>
        <enabled>true</enabled>
        <file>
           <rootDir>/tmp</rootDir>
        </file>
      </url>
<?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>
]]>]]>
<rpc message-id="101"
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<copy-config>
    <target>
        <url>file:///config.xml</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>
]]>]]>

#5

hi ,

I Tried with 3 slash ‘/’ , but my session is getting disconnected:
copy-config
target
url ftp:///admin:admin1@192.168.171.44/sdboot/up/new-1.xml/url
/target
source
running/
/source
/copy-config

When i try with 2 slash, copy is successful . i.e. i am able to see the file in right path but i also see error message after the copy-config XML is sent:
copy-config
target
url ftp://admin:admin1@192.168.171.44/sdboot/up/new-1.xml/url
/target
source
running/
/source
/copy-config

Error:

rpc-reply xmlns=“urn:ietf:params:xml:ns:netconf:base:1.0” message-id=“5”
rpc-error
error-type application /error-type
error-tag operation-failed /error-tag
error-severity error /error-severity
error-app-tag url-write-failed /error-app-tag
error-path
/rpc/copy-config/source/config/running
/error-path
error-message xml:lang=“en” application protocol error /error-message
error-info
bad-element url /bad-element
/error-info
/rpc-error
/rpc-reply

Please assist


#6

Was there anything unclear in my replies in the other topic you have on the URL capability?


#7
url ftp:///admin:admin1@192.168.171.44/sdboot/up/new-1.xml/url

maybe, you can test with file url first, not ftp, to see if it works in your env.
Once file is working, you may look into ftp issue.


#8

hi
I tried with file, but it failed.
With FTP, it copies correctly but also gives error as rpc-reply,
rpc-reply must be OK


#9

Please, can you try following example in your environment (steps in README):
https://cisco.box.com/s/7pphouazrs03wxiqh1ug9ce6ud4zp2xm

It creates file /tmp/config.xml with copy-config

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

#10

Yes , It created the file config.xml.
But again, I see error message also saying BAD URL ELEMENT


#11

Please, can you paste the error message? Which ConfD version do you use?

I have ok reponse (ConfD 6.5):

 netconf-console netconf-copy-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
  <ok/>
</rpc-reply>

#12

"<?xml version="1.0" encoding="utf-8"?>


application
operation-failed
error
url-write-failed

/rpc/copy-config/source/config/running

application protocol error

url


"


#13

Ok, you got different response. Which ConfD version is it? Do you have any chance to try on plain Linux 64bit (I’m using Xubuntu 17.10).


#14

I would be more interested in what your developer log (with developerLogLevel set to trace in confd.conf) say.
The “application protocol error” indicates that you may have an external database (config data outside of CDB) that is supposed to serve a tailf:callpoint callback but fail to do so when ConfD asks for the data to be transfered to the file on the remote ftp server.