Add NETCONF edit-config remediation rendering (#232)#280
Merged
Conversation
- WorkflowRemediation.remediation_netconf_xml() and formats.hconfig_to_netconf_xml() render a remediation between from_xml() trees as a NETCONF payload: negated nodes become nc:operation="delete" elements, additions use the default merge operation, and attribute-level changes raise InvalidConfigError. Keyed list-entry deletions are expressed by their key leaf, resolved against the running config when available; the standalone function falls back to value-bearing leaf deletes. - Fix XML ingestion to key an element whenever an identifying list_keys child exists rather than only when its tag repeats among siblings. Previously the same entry got different node text depending on sibling count, producing spurious delete-and-re-add diffs between configs with different list-entry counts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Completes the final scope of #232: remediation output that matches the XML input format.
WorkflowRemediation.remediation_netconf_xml()(plus standaloneformats.hconfig_to_netconf_xml()) renders the remediation between twoHConfig.from_xml()trees as a NETCONFedit-config-style payload: negated nodes becomenc:operation="delete"elements (namespaced viaxmlns:nc), additions use NETCONF's default merge operation, and attribute-level changes raise a clearInvalidConfigError(they have no NETCONF operation encoding).<interface nc:operation="delete"><name>eth1</name></interface>), resolved against the running config; without running-config context the standalone function falls back to value-bearing leaf deletes, which is correct for leaves and leaf-lists.list_keyschild exists; an identity is only mandatory when the tag actually repeats.Test plan
poetry run ./scripts/build.py lint-and-test— all linters pass, 698 tests, ≥95% coverage.🤖 Generated with Claude Code