Skip to content

The fix is to normalize source-prefix-list and destination-prefix-lis… - #845

Merged
chidanandpujar merged 23 commits into
Juniper:masterfrom
dineshbaburam91:acl
Aug 5, 2026
Merged

The fix is to normalize source-prefix-list and destination-prefix-lis…#845
chidanandpujar merged 23 commits into
Juniper:masterfrom
dineshbaburam91:acl

Conversation

@dineshbaburam91

@dineshbaburam91 dineshbaburam91 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Description

Fixes parsing of ACL prefix list fields in parsed state by normalizing single and multiple source-prefix-list and destination-prefix-list values into the schema-expected list of objects format.

Closes #


Collection Namespace

Collection namespace: juniper.device (source fix), junipernetworks.junos (tests)
Collection version (bumped to): Not bumped in this change set
Module(s) / plugin(s) changed:
juniper.device facts parser for ACLs
junipernetworks.junos unit test for junos_acls
junipernetworks.junos integration parsed test fixture/assertions for junos_acls


Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Feature / new module or plugin (non-breaking change that adds functionality)
  • Enhancement (improvement to existing module or plugin behaviour)
  • Breaking change (fix or feature that would cause existing playbooks / roles to behave differently)
  • Task / Chore (refactor, dependency update, CI, docs, etc.)

Fix Details

Root Cause

In parsed workflow for ACL facts, XML parsing could return prefix-list fields as a single scalar/dict for one entry, while the argspec requires list of dict objects. Validation then failed with dictionary requested, could not parse JSON or key=value.

Solution

Normalized source-prefix-list and destination-prefix-list in ACL facts parser into list form and object form expected by argspec.

Added normalization for single and multi-value source-prefix-list
Added normalization for single and multi-value destination-prefix-list
Added unit tests covering both single-entry normalization and multi-entry preservation
Updated integration parsed fixture/assertions to validate prefix-list behavior end-to-end


Versions Tested

Item Version
Collection namespace & version juniper.device 2.0.2 (local build/install), junipernetworks.junos (workspace)
Ansible / ansible-core ansible 12.1.0, ansible-core 2.21.1
Python 3.10.12
OS Ubuntu 22.04
Junos version 18.4R1
Junos platform vsrx
junos-eznc latest
ncclient latest

Sanity Test Results

  • Sanity tests pass with no new errors
ansible-test sanity
Sanity test output
Not run in this pass.

Unit Test Results

  • New or updated unit tests added under tests/unit/
  • All unit tests pass locally
python3.12 -m pytest
Unit test output
Passed
  • Code coverage has not decreased

Integration Test Results

  • Integration tests reviewed for impact
  • Affected integration tests pass (requires a live Junos device or vMX)
ansible-test network-integration --python 3.12 --inventory /root/pyez_ansible_release_validation1/ansible-junos-stdlib/ansible_collections/juniper/device/tests/integration/inventory.networking
Integration test output
Parsed validation for junos_acls passed (All assertions passed)

Checklist

Code Quality

  • Code follows the project's style guidelines
  • ansible-lint passes with no new errors
ansible-lint
  • flake8 / ruff reports no new errors (for Python files)
flake8 plugins/
# or
ruff check plugins/

Documentation

  • Module documentation (DOCUMENTATION, EXAMPLES, RETURN blocks) updated if parameters changed
  • CHANGELOG.rst / changelogs/fragments/ entry added
  • galaxy.yml version bumped if releasing

General

  • No hardcoded credentials, IP addresses, or sensitive data introduced
  • [] requirements.txt updated if new Python packages are required
  • Backward-compatible: existing playbooks will not break

Additional Notes

if term["from"].get("protocol"):
ace["protocol"] = term["from"]["protocol"]
if term["from"].get("payload-protocol"):
ace["protocol"] = term["from"]["payload-protocol"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if term["from"].get("protocol"):
ace["protocol"] = term["from"]["protocol"]
if term["from"].get("payload-protocol"):
ace["protocol"] = term["from"]["payload-protocol"] - payload-protocol silently overwrites protocol , check if this needs a separate key

@chidanandpujar chidanandpujar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@chidanandpujar
chidanandpujar merged commit 443a092 into Juniper:master Aug 5, 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