Add Option to Exclude XML Header for NETCONF Messages #195
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.