Skip to content

Add ACL manage module for Routing Policies#266

Draft
skaszlik wants to merge 2 commits intoCiscoDevNet:developfrom
skaszlik:new_modeule-ACL
Draft

Add ACL manage module for Routing Policies#266
skaszlik wants to merge 2 commits intoCiscoDevNet:developfrom
skaszlik:new_modeule-ACL

Conversation

@skaszlik
Copy link
Copy Markdown

@skaszlik skaszlik commented Apr 23, 2026

New module to support Routing Policies - available in ND 4.1 and above.

Example playbook:

  - name: TEST4 - Create ACL with TCP port options
      cisco.nd.nd_acl:
        fabric: "{{ test_fabric }}"
        state: merged
        config:
          - name: "{{ ipv4_acl_tcp }}"
            type: ipv4
            entries:
              - sequence_number: 10
                action: permit
                protocol: tcp
                src: any
                dst: "{{ test_network_ipv4 }}"
                dst_port_action: equal_to
                dst_port: 80
              - sequence_number: 20
                action: permit
                protocol: tcp
                src: any
                dst: "{{ test_network_ipv4 }}"
                dst_port_action: equal_to
                dst_port: 443
              - sequence_number: 30
                action: permit
                protocol: tcp
                src: any
                dst: "{{ test_network_ipv4 }}"
                dst_port_action: port_range
                dst_port_range_start: 8080
                dst_port_range_end: 8090
              - sequence_number: 40
                action: permit
                protocol: tcp
                src: any
                dst: any
                src_port_action: greater_than
                src_port: 1024

Related Issue(s)

#240

Proposed Changes

New module cisco.nd.nd_acl

Test Notes

All test phases passed:
[OK] Merged state - create, merge, check mode
[OK] Replaced state - replace, check mode
[OK] Query state - all, specific, missing ACL
[OK] Deleted state - specific, bulk, check mode

Cisco Nexus Dashboard Version

ND4.2

Related ND API Resource Category

  • analyze
  • infa
  • [ x] manage
  • onemanage
  • other

Checklist

  • [ x] Latest commit is rebased from develop with merge conflicts resolved
  • New or updates to documentation has been made accordingly
  • Assigned the proper reviewers

…ists (ACLs)

- Implemented the nd_acl module to manage ACLs on Cisco Nexus Dashboard, supporting create, update, delete, and query operations for both IPv4 and IPv6 ACLs.
- Added comprehensive integration tests for the nd_acl module, ensuring functionality for creating, merging, replacing, and deleting ACLs, along with idempotency checks.
- Included version checks to ensure compatibility with ND 4.1 or later.
- Added new endpoints for managing Access Control Lists (ACLs) in the ND Manage API, including GET, POST, PUT, and DELETE operations.
- Introduced AclModel for ACL configuration, supporting serialization and validation.
- Created ManageAclOrchestrator to handle ACL operations, including state management and input validation.
- Updated integration tests to reflect changes in ACL management.
- Modified inventory configuration for testing with specific credentials and host details.
Copy link
Copy Markdown
Collaborator

@allenrobel allenrobel left a comment

Choose a reason for hiding this comment

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

Good work Sławomir! Just a few comments, please:

  1. Replace legacy annotations with modern equivalents
  2. Remove __metaclass__ = type where present
  3. Remove from __future__ import absolute_import, annotations, division, print_function and for files that need it, replace with from __future__ import annotations
  4. Add return type annotations to all methods that lack them

(DELETE /api/v1/manage/fabrics/{fabricName}/accessControlLists/{aclName})
"""

from __future__ import absolute_import, annotations, division, print_function
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.

No longer needed. Please remove.

Instead replace with the following so that modern annotations are accepted:

from __future__ import annotations

Comment applies to all files introduced in this PR.


from __future__ import absolute_import, annotations, division, print_function

from typing import ClassVar, Literal, Optional
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.

Remove Optional i.e.:

from typing import ClassVar, Literal

We should be using modern annotations throughout i.e.:

  • Dict -> dict
  • List -> list
  • Set -> set
  • Optional -> str | None (for example)
  • Union -> str | int (for example)

Please replace all legacy annotions (if any) with the above across all files commited in this PR.

Item-level endpoints also require an acl_name path parameter.
"""

acl_name: Optional[str] = Field(default=None, description="ACL name")
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.

Should be:

    acl_name: str | None = Field(default=None, description="ACL name")


acl_name: Optional[str] = Field(default=None, description="ACL name")

def set_identifiers(self, identifier: IdentifierKey = None):
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.

If a method has no return value signal that with an annotation.

    def set_identifiers(self, identifier: IdentifierKey = None) -> None:

Comment applies to all methods.

Comment thread plugins/modules/nd_acl.py

from __future__ import absolute_import, division, print_function

__metaclass__ = type
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.

__metaclass__ = type is no longer needed. Remove.

Same comment applies to all files in this PR where this is present.

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.

2 participants