netbox-acls icon indicating copy to clipboard operation
netbox-acls copied to clipboard

[Feature]: Support ACLRule‑attached remarks (sharing sequence)

Open pheus opened this issue 2 months ago • 1 comments

NetBox version

v4.4.1

Feature type

Change to existing model

Proposed functionality

Summary
Enable attached remarks on existing permit/deny ACLRules using the already‑present remark field. When a remark is set on a rule, render it adjacent to that rule and treat it as documentation for the same sequence/index (e.g., Cisco IOS‑XE style output). This can be delivered without schema changes.

Behavior & UI/UX

  • Allow setting remark on permit/deny ACLRules (in forms, API, and bulk edits).
  • In tables and rendered views, display an ACLRule’s attached remark immediately above the rule and visually associate it with the rule’s index (sequence).

Minimal implementation (no schema changes)

  • Use the existing remark text field on the same ACLRule row.
  • Keep current uniqueness on index intact; since the remark is stored on the same row, no duplicate index entries are introduced.

Optional enhancement (only if standalone remark rows must share an index with a rule)
Add a conditional uniqueness constraint so a standalone remark row may share the same index as a permit/deny rule while still preventing duplicate permit/deny indices. (Uses current field names.)

from django.db.models import Q

models.UniqueConstraint(
    fields=["access_list", "index"],
    condition=Q(action__in=["permit", "deny"]),
    name="uniq_aclrule_index_for_real_rules",
)

Testing

  • Rendering tests: attached remark appears adjacent to the rule and uses the same displayed sequence/index.

Use case

  • Mirrors common operational practice (e.g., IOS‑XE) where a comment is tied to the exact rule it documents- improving readability, reviews, and audits - without consuming an extra sequence number.
  • Keeps the data model stable; primarily a UX/serializer improvement.

External dependencies

  • None

pheus avatar Sep 25 '25 14:09 pheus