Skip to content

Rewrite ACL port matching - #3723

Merged
ipspace merged 2 commits into
devfrom
acl-port-rewrite
Jul 31, 2026
Merged

Rewrite ACL port matching#3723
ipspace merged 2 commits into
devfrom
acl-port-rewrite

Conversation

@ipspace

@ipspace ipspace commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Use <src|dst>.port. parameters to specify port matching parameters These parameters are rewritten into port/port_op/port_range values expected by the configuration templates, and expanded into multiple ACL entries if needed (resulting in six levels of Cartesian product)

Use <src|dst>.port.<op> parameters to specify port matching parameters
These parameters are rewritten into port/port_op/port_range values
expected by the configuration templates, and expanded into multiple
ACL entries if needed (resulting in six levels of Cartesian product)
@ipspace
ipspace requested a review from Copilot July 31, 2026 13:01
ipspace added a commit that referenced this pull request Jul 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the routing ACL data model to support the new <src|dst>.port.<op> port-matching syntax, rewrites it into the legacy port/port_op/port_range fields expected by configuration templates, and extends the ACL expansion logic to generate the required Cartesian-product ACL entries.

Changes:

  • Update ACL port schema to use src.port / dst.port operator dictionaries (eq/lt/gt/in/not_in/neq).
  • Rewrite/expand ACL entries in netsim/modules/routing/acl.py to translate port operators into template-ready fields and expand multi-value matches.
  • Refresh documentation and test topologies/expected outputs to reflect the new port syntax and expansion behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/topology/input/acl-simple.yml Adds new ACL port operator input cases (eq/not_in/in) and additional nodes/links for expansion coverage.
tests/topology/expected/acl-simple.yml Updates expected transformed topology and expanded per-node/per-AF ACL entries reflecting new port logic.
tests/integration/routing/31-acl-ipv6.yml Migrates IPv6 ACL integration test inputs to dst.port.<op> syntax.
tests/integration/routing/30-acl-ipv4.yml Migrates IPv4 ACL integration test inputs to dst.port.<op> syntax.
netsim/modules/routing/acl.py Implements port operator rewriting and entry expansion during AF ACL generation; adjusts node loopback handling.
netsim/modules/routing.yml Replaces legacy port_op/port_range schema with operator-based port dictionary schema.
docs/module/routing-acl.txt Updates ACL matching documentation to describe the new address/port matching structure.
Suppressed comments (3)

netsim/modules/routing.yml:306

  • The _invalid_with value uses an invalid YAML flow-mapping syntax ({ neq, in, not_in }) and will fail to parse; use a YAML list for a simple incompatibility set.
          _invalid_with: { neq, in, not_in }        # Full list of restrictions

netsim/modules/routing.yml:312

  • The _invalid_with value uses an invalid YAML flow-mapping syntax ({ neq, not_in }) and will fail to parse; use a YAML list for a simple incompatibility set.
          _invalid_with: { neq, not_in }            # Minimized to what's not already restricted

netsim/modules/routing.yml:318

  • The _invalid_with value uses an invalid YAML flow-mapping syntax ({ neq }) and will fail to parse; use a YAML list for a simple incompatibility set.
          _invalid_with: { neq }                    # Minimized to what's not already restricted

Comment thread netsim/modules/routing.yml Outdated
Comment thread netsim/modules/routing/acl.py
Comment thread docs/module/routing-acl.txt
@ipspace
ipspace requested a review from DanPartelly July 31, 2026 13:10

@DanPartelly DanPartelly 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.

Thank you. This ended up generating great usability improvements.

@ipspace
ipspace merged commit b71f238 into dev Jul 31, 2026
10 checks passed
@ipspace
ipspace deleted the acl-port-rewrite branch July 31, 2026 15:31
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.

3 participants