NETCONF RPC using ncclient, how to remove XML namespace prefix tag 'nc:'?

955 Views Asked by At

I dont think this is an issue with ncclient, but I cant find option to turn off xml namespace prefix tagging.

ncclient sends this RPC,

<?xml version="1.0" encoding="UTF-8"?> <nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:cdad1414-956b-47e7-8efc-fee92888475c"> <nc:get-config> <nc:source> <nc:running /> </nc:source> </nc:get-config> </nc:rpc>

But, my device (Ericsson Telecom Packet Core elements) do not support xml namespace tags, and expect request to be formated as:

<?xml version="1.0" encoding="UTF-8"?> <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:cdad1414-956b-47e7-8efc-fee92888475c"> <get-config> <source> <running /> </source> </get-config> </rpc>

How can I turn off nc: ?

1

There are 1 best solutions below

0
On BEST ANSWER

You will have to contribute to ncclient to add code for ericsson under operations/third_party. Inherit RPC class and overwrite _wrap function to do the job.

https://github.com/ncclient/ncclient/tree/master/ncclient/operations/third_party

https://github.com/ncclient/ncclient/blob/master/ncclient/operations/rpc.py#L309