-
Notifications
You must be signed in to change notification settings - Fork 31
[Bug]: ACL Interface Assignment Should Be Unique per Interface and Direction #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I encountered this issue while developing a test case to validate the uniqueness of ACL assignments. The root cause appears to be an incorrect Currently, the uniqueness constraint is enforced on However, the correct constraint should be on This misconfiguration allows |
Fixes the unique constraint for ACLInterfaceAssignment by removing the access_list field from the uniqueness check. Ensures that only one ACL can be assigned per interface and direction. Adds validation tests to prevent multiple ACLs from being assigned in the same direction on the same interface. Fixes netbox-community#258
I'm a little torn on this one @pheus, what if say you had an ipv4 and ipv6 acl against the same interface which is a really common use case ? |
Thanks for bringing that up, @cruse1977! You’re absolutely right that a lot of folks want to bind both an IPv4 ACL and an IPv6 ACL on the same interface/direction. I’m going to remove the bugfix from PR #257 for now so I can think through a more flexible solution. I’ll follow up here once I have a proposal - any feedback in the meantime is welcome! |
ProposalTo support this while still enforcing uniqueness, one possible solution is to introduce an The uniqueness constraint would then be updated to: unique_together = (
"assigned_object_type",
"assigned_object_id",
"direction",
"address_family",
) This approach allows one ACL per address family in a given direction on a given interface. For example, it would permit both an ingress IPv4 ACL and an ingress IPv6 ACL on the same interface, while preventing multiple assignments for the same direction and address family. Let me know if this seems like a reasonable direction or if you'd prefer a different approach. If this falls outside the scope of the issue, I'm happy to open a separate feature request to explore it further. |
NetBox access-list plugin version
v1.8.1
NetBox version
v4.2.5
Steps to Reproduce
nb_shell
.Reproduction via
nb_shell
:Expected Behavior
The assignment should fail, as only one Access List should be assignable to an interface per direction.
Observed Behavior
The assignment via
nb_shell
succeeds, even though the Web UI correctly enforces this restriction.The text was updated successfully, but these errors were encountered: