Open
Description
NetBox access-list plugin version
v1.8.1
NetBox version
v4.2.5
Steps to Reproduce
- Create a Device (with its dependencies).
- Create an Interface for the Device.
- Create an Access List "ACL1" (type: "standard") bound to the Device.
- Create an ACL Interface Assignment for the Interface with direction set to "ingress."
- Create another Access List "ACL2" (type: "standard") bound to the same Device.
- Attempt to assign "ACL2" to the same interface with the same direction via
nb_shell
.
Reproduction via nb_shell
:
from dcim.models import (
Device,
DeviceRole,
DeviceType,
Manufacturer,
Site,
VirtualChassis,
)
from netbox_acls.models import AccessList, ACLInterfaceAssignment
from ipam.models import Prefix
# Create Site
site = Site.objects.create(
name="Site 1",
slug="site-1",
)
# Create Manufacturer and Device Type
manufacturer = Manufacturer.objects.create(
name="Manufacturer 1",
slug="manufacturer-1",
)
device_type = DeviceType.objects.create(
manufacturer=manufacturer,
model="Device Type 1",
)
# Create Device Role
device_role = DeviceRole.objects.create(
name="Device Role 1",
slug="device-role-1",
)
# Create Device and Interface
device1 = Device.objects.create(
name="Device 1",
site=site,
device_type=device_type,
role=device_role,
)
device_interface1 = Interface.objects.create(
name="Interface 1",
device=device1,
type="1000baset",
)
# Create and Assign Access List 1
device_acl1 = AccessList.objects.create(
name="STANDARD_ACL1",
assigned_object=device1,
type="standard",
default_action="permit",
comments="STANDARD_ACL",
)
ACLInterfaceAssignment.objects.create(
access_list=device_acl1,
direction="ingress",
assigned_object=device_interface1,
)
# Create and Attempt to Assign Access List 2
device_acl2 = AccessList.objects.create(
name="STANDARD_ACL2",
assigned_object=device1,
type="standard",
default_action="permit",
comments="STANDARD_ACL",
)
acl_device_interface2 = ACLInterfaceAssignment(
access_list=device_acl2,
direction="ingress",
assigned_object=device_interface1,
)
acl_device_interface2.full_clean() # Expected to fail, but it succeeds
acl_device_interface2.save()
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.