Add Option to Exclude XML Header for NETCONF Messages
Description:
This pull request introduces an option to exclude the XML header from NETCONF messages. The motivation behind this change stems from an issue encountered with certain devices, such as Calix's earlier platforms, where the inclusion of the XML header causes the system to misinterpret the message as an invalid XML document. This update provides flexibility by allowing users to disable the header when necessary.
Changes:
Added a new fieldExcludeHeader in the Driver struct to control whether the XML header is prepended to NETCONF messages.
Updated the serialize function to check the ExcludeHeader flag before appending the XML header. If ExcludeHeader is true, the header is omitted.
Updated the sendRPC function to pass the ExcludeHeader flag during serialization.
Added a new optionWithNetconfExcludeHeader in the options/netconf.go file to provide a user-friendly interface for enabling this behavior.
Reason for Change:
The addition of the ExcludeHeader flag resolves issues with NETCONF messages being rejected by certain devices that expect raw XML content without the standard XML declaration header.
Impact:
No changes to the default behavior. By default, the XML header will continue to be included unless explicitly disabled using the new option.
Devices that do not properly handle XML headers can now be supported by using the new WithNetconfExcludeHeader option.
Title:
Add Option to Exclude XML Header for NETCONF Messages
Description:
This pull request introduces an option to exclude the XML header from NETCONF messages. The motivation behind this change stems from an issue encountered with certain devices, such as Calix's earlier platforms, where the inclusion of the XML header causes the system to misinterpret the message as an invalid XML document. This update provides flexibility by allowing users to disable the header when necessary.
Changes:
ExcludeHeader
in theDriver
struct to control whether the XML header is prepended to NETCONF messages.serialize
function to check theExcludeHeader
flag before appending the XML header. IfExcludeHeader
istrue
, the header is omitted.sendRPC
function to pass theExcludeHeader
flag during serialization.WithNetconfExcludeHeader
in theoptions/netconf.go
file to provide a user-friendly interface for enabling this behavior.Reason for Change:
The addition of the
ExcludeHeader
flag resolves issues with NETCONF messages being rejected by certain devices that expect raw XML content without the standard XML declaration header.Impact:
WithNetconfExcludeHeader
option.