# Copy-config operation

**URL:** <https://dmap-community.ductus.global/t/copy-config-operation/1719>\
**Category:** NETCONF\
**Created:** [January 3, 2018, 5:09am UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719 "2018-01-03T05:09:17Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hatim5253](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@Hatim5253](https://dmap-community.ductus.global/u/Hatim5253)\
**Post date:** [January 3, 2018, 5:09am UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/1 "2018-01-03T05:09:17Z")

</div>

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](mailto: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

---

<div class="post-metadata">

**Author:** ![mnovak](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mnovak/32/183_2.png) [@mnovak](https://dmap-community.ductus.global/u/mnovak)\
**Post date:** [January 3, 2018, 12:34pm UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/2 "2018-01-03T12:34:38Z")

</div>

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
<?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>
]]>]]>

```

---

<div class="post-metadata">

**Author:** ![Hatim5253](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@Hatim5253](https://dmap-community.ductus.global/u/Hatim5253)\
**Post date:** [January 9, 2018, 4:50am UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/3 "2018-01-09T04:50:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mnovak](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mnovak/32/183_2.png) [@mnovak](https://dmap-community.ductus.global/u/mnovak)\
**Post date:** [January 15, 2018, 12:33pm UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/4 "2018-01-15T12:33:34Z")

</div>

Hello,

please see answer here:

> [@Copy-config \<target as url\> : Error " \<bad-element\>url\</bad-element\>"](http://discuss.tail-f.com/t/copy-config-target-as-url-error-bad-element-url-bad-element/518/2):
>
> 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](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…

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

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

```

```xml
<?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>
]]>]]>

```

---

<div class="post-metadata">

**Author:** ![Hatim5253](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@Hatim5253](https://dmap-community.ductus.global/u/Hatim5253)\
**Post date:** [February 1, 2018, 12:35pm UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/5 "2018-02-01T12:35:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [February 1, 2018, 1:53pm UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/6 "2018-02-01T13:53:48Z")

</div>

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

> [@URL Capability examples](http://discuss.tail-f.com/t/url-capability-examples/1533/8):
>
> 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\> \<so…

> [@URL Capability examples](http://discuss.tail-f.com/t/url-capability-examples/1533/2):
>
> 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/\> \</targ…

---

<div class="post-metadata">

**Author:** ![mnovak](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mnovak/32/183_2.png) [@mnovak](https://dmap-community.ductus.global/u/mnovak)\
**Post date:** [February 2, 2018, 9:48am UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/7 "2018-02-02T09:48:40Z")

</div>

```auto
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.

---

<div class="post-metadata">

**Author:** ![Hatim5253](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@Hatim5253](https://dmap-community.ductus.global/u/Hatim5253)\
**Post date:** [February 2, 2018, 9:55am UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/8 "2018-02-02T09:55:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mnovak](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mnovak/32/183_2.png) [@mnovak](https://dmap-community.ductus.global/u/mnovak)\
**Post date:** [February 2, 2018, 10:22am UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/9 "2018-02-02T10:22:06Z")

</div>

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

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

```xml
<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>

```

---

<div class="post-metadata">

**Author:** ![Hatim5253](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@Hatim5253](https://dmap-community.ductus.global/u/Hatim5253)\
**Post date:** [February 2, 2018, 10:29am UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/10 "2018-02-02T10:29:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mnovak](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mnovak/32/183_2.png) [@mnovak](https://dmap-community.ductus.global/u/mnovak)\
**Post date:** [February 2, 2018, 10:42am UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/11 "2018-02-02T10:42:08Z")

</div>

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

I have `ok` reponse (ConfD 6.5):

```auto
 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>

```

---

<div class="post-metadata">

**Author:** ![Hatim5253](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@Hatim5253](https://dmap-community.ductus.global/u/Hatim5253)\
**Post date:** [February 2, 2018, 10:57am UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/12 "2018-02-02T10:57:13Z")

</div>

"\<?xml version="1.0" encoding="utf-8"?\>  
  
  
application  
operation-failed  
error  
url-write-failed  
  
/rpc/copy-config/source/config/running  
  
application protocol error  
  
url  
  
  
"

---

<div class="post-metadata">

**Author:** ![mnovak](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mnovak/32/183_2.png) [@mnovak](https://dmap-community.ductus.global/u/mnovak)\
**Post date:** [February 2, 2018, 12:03pm UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/13 "2018-02-02T12:03:10Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [February 2, 2018, 1:10pm UTC](https://dmap-community.ductus.global/t/copy-config-operation/1719/14 "2018-02-02T13:10:20Z")

</div>

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.
