Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Option to Exclude XML Header for NETCONF Messages #195

Merged
merged 2 commits into from
Sep 24, 2024

Conversation

mtuska
Copy link
Contributor

@mtuska mtuska commented Sep 24, 2024

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:

  • Added a new field ExcludeHeader 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 option WithNetconfExcludeHeader 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.

@carlmontanari
Copy link
Contributor

👋 hey @mtuska -- thanks for the detailed info and funny commit message :) -- LGTM!

@carlmontanari carlmontanari merged commit 9baa9c5 into scrapli:main Sep 24, 2024
7 checks passed
@mtuska mtuska deleted the xmlHeader branch September 24, 2024 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants