Rewrite ACL port matching - #3723
Merged
Merged
Conversation
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)
Contributor
There was a problem hiding this comment.
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.portoperator dictionaries (eq/lt/gt/in/not_in/neq). - Rewrite/expand ACL entries in
netsim/modules/routing/acl.pyto 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_withvalue 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_withvalue 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_withvalue 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
DanPartelly
approved these changes
Jul 31, 2026
DanPartelly
left a comment
Collaborator
There was a problem hiding this comment.
Thank you. This ended up generating great usability improvements.
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.
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)