Diff list entries individually on Patch to remove stale config - #565
Open
felix-kaestner wants to merge 3 commits into
Open
felix-kaestner wants to merge 3 commits into
felix-kaestner wants to merge 3 commits into
Conversation
When the provider uses Patch (gNMI update) on a struct containing list fields, the device merges entries into existing config but never removes entries that are no longer desired. Stale list entries survive across reconciliations. Fix this by removing list fields from parent structs and managing each list entry as a standalone DataElement. The provider now fetches current entries from the device, patches each desired entry individually, and deletes any stale entries not present in the desired set. Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
Some NX-OS platforms return keepalive source and destination addresses with a /32 prefix (e.g. "10.1.1.1/32") while others return them as plain addresses (e.g. "10.1.1.1"). This inconsistency causes a false diff on every reconcile, triggering unnecessary gNMI Set requests. Introduce a Prefix type that normalizes both formats: UnmarshalText infers /32 for IPv4 (or /128 for IPv6) when the mask is absent, and MarshalText always includes it. Use this type for the VPC keepalive DestIP and SrcIP fields so the provider is idempotent regardless of platform behavior. Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
Merging this branch will decrease overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
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.
When the provider uses Patch (gNMI update) on a struct containing list fields, the device merges entries into existing config but never removes entries that are no longer desired. Stale list entries survive across reconciliations.
Fix this by removing list fields from parent structs and managing each list entry as a standalone DataElement. The provider now fetches current entries from the device, patches each desired entry individually, and deletes any stale entries not present in the desired set.