Skip to content

Commit

Permalink
Added support for <config> element to copy-config. (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
hschulzbln committed Feb 16, 2021
1 parent b776e6f commit 63bbbed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion netconf_client/ncclient.py
Expand Up @@ -312,7 +312,8 @@ def get_config(self, source="running", filter=None, with_defaults=None):
def copy_config(self, target, source, with_defaults=None):
"""Send a ``<copy-config>`` request
:param str source: The source datastore
:param str source: The source datastore or the <config> element
containing the complete configuration to copy.
:param str target: The destination datastore
Expand Down
5 changes: 4 additions & 1 deletion netconf_client/rpc.py
Expand Up @@ -65,7 +65,10 @@ def copy_config(target, source, filter=None, with_defaults=None, msg_id=None):
pieces = []
pieces.append("<copy-config>")
pieces.append("<target><{}/></target>".format(target))
pieces.append("<source><{}/></source>".format(source))
if source.startswith("<config"):
pieces.append("<source>{}</source>".format(source))
else:
pieces.append("<source><{}/></source>".format(source))
if with_defaults:
pieces.append(make_with_defaults(with_defaults))
pieces.append("</copy-config>")
Expand Down

0 comments on commit 63bbbed

Please sign in to comment.