Skip to content

Fix empty container rendering and nested list merging in generated Junos config - #174

Merged
aburston merged 5 commits into
Juniper:masterfrom
vishalchainani:master
Nov 20, 2026
Merged

aburston merged 5 commits into
Juniper:masterfrom
vishalchainani:master

Conversation

@vishalchainani

Copy link
Copy Markdown
Collaborator

Summary

  1. Omit empty non-presence containers
  • 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 false leaves no longer create empty wrappers such as routing-options.

  • YANG presence containers keep their meaning. An explicitly supplied empty map still renders the container. Undefined, null, or false values omit it.

  • jtaf_json.py adds presence to the properties preserved in the pyang JSON schema, which the template depends on.

  • Tests: a new test_ansible_empty_containers.py renders the template and checks the empty, non-empty, presence, and disabled-presence cases. test_jtaf_json.py asserts that presence is preserved.

  • README: documents the rules. Roles and schemas must be regenerated to pick up the change.

  1. Preserve ESI and LACP settings when merging interfaces
  • jtaf_filters.py: merge_by_key now uses a new _merge_dict_by_key helper. Nested dictionaries are merged recursively, not replaced. Partial updates for the same interface, such as esi or aggregated_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.py refreshed from the template. Updating a workbook alone doesn't change the filter packaged in a deployment project.

@aburston

aburston commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Please fix the merge conflicts @vishalchainani

Vishal Chainani and others added 2 commits November 20, 2026 13:52
# 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
aburston merged commit 0eb79e1 into Juniper:master Nov 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants