vyos.configdict: T5308: Remove workarounds for incorrect defaults in get_interface_dict #2052
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.
Change Summary
Note: this depends on PR:
#2010
Applying the revised vyos.xml lib (T5218) to
get_config_dict
, one can remove the workarounds needed inget_interface_dict
due to incorrect defaults on tag nodes (bug T2665).The original implementation of the vyos.xml lib adds defaults below a tag node name, irrespective of the existence of a corresponding tag node value, and at the wrong level; this required workarounds to delete and/or shift defaults before merging dicts.
That bug is corrected in the revision of the vyos.xml lib, merged in T5218.
As a first step, we remove the workarounds in
vyos.configdict.get_interface_dict
; this provides the same results without the workaround overhead, passes all smoketests and config tests. As get_interface_dict is a critical part of the vyos lib infrastructure, it is addressed first and as a separate task. Removing all other cases of T2665 workarounds will follow directly.Note that for compatibility this maintains the practice of merging 'recursive' defaults in
get_interface_dict
--- namely, those leaf nodes with default values that have an ancestor node in the config are merged into the result. The revisions to the xml lib andget_config_dict
also support providing 'non-recursive' defaults: those that have a parent in the config; cf. the discussion of invariants in PR #2010, above. We can consider maintaining this invariant going forward.Example, exhibiting the bug corrected in the second commit, below:
Types of changes
Related Task(s)
Component(s) name
Proposed changes
How to test
Checklist: