Repository navigation
Fix empty container rendering and nested list merging in generated Junos config - #174
Merged
Merged
Conversation
Contributor
|
Please fix the merge conflicts @vishalchainani |
# Conflicts: # README.md # jtaf_pyang_plugin/jtaf_json.py # jtaf_pyang_plugin/tests/test_jtaf_json.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
aburston
approved these changes
Nov 20, 2026
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
ansible.j2 now wraps containers in a conditional that renders them only when at least one supported child produces XML. Empty maps, unsupported values, and
falseleaves no longer create empty wrappers such asrouting-options.YANG presence containers keep their meaning. An explicitly supplied empty map still renders the container. Undefined,
null, orfalsevalues omit it.jtaf_json.py adds
presenceto the properties preserved in the pyang JSON schema, which the template depends on.Tests: a new
test_ansible_empty_containers.pyrenders the template and checks the empty, non-empty, presence, and disabled-presence cases.test_jtaf_json.pyasserts that presence is preserved.README: documents the rules. Roles and schemas must be regenerated to pick up the change.
jtaf_filters.py:
merge_by_keynow uses a new_merge_dict_by_keyhelper. Nested dictionaries are merged recursively, not replaced. Partial updates for the same interface, such asesioraggregated_ether_options.lacp, keep fields set by other groups.Scalar values from later entries still win. Nested lists at any depth merge by the same key and keep first-seen order.
Tests in test_script_coverage.py cover ESI/LACP preservation, deep list merging with later overrides, and custom merge keys with unkeyed items.
README: documents the merge behavior. Roles must be regenerated, or their
filter_plugins/jtaf_filters.pyrefreshed from the template. Updating a workbook alone doesn't change the filter packaged in a deployment project.