Skip to content

Conversation

@koderchit
Copy link

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Description

Enhancement: Added capabilities to create, update, and delete Port Channels between LAN Automated devices.

Enhancement Description:
Added a new port_channel configuration module that allows creation, update, deletion of port channels and allows adding, updating, or removing interfaces in a Port Channel.

Testing Done:

  • Manual testing
  • Unit tests
  • Integration tests

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • All the sanity checks have been completed and the sanity test cases have been executed

Ansible Best Practices

  • Tasks are idempotent (can be run multiple times without changing state)
  • Variables and secrets are handled securely (e.g., using ansible-vault or environment variables)
  • Playbooks are modular and reusable
  • Handlers are used for actions that need to run on change

Documentation

  • All options and parameters are documented clearly.
  • Examples are provided and tested.
  • Notes and limitations are clearly stated.

Screenshots (if applicable)

Notes to Reviewers

1) managment-> management
2) Verify failing in creation coz get_have was not updated
@koderchit koderchit requested a review from maaliaj October 24, 2025 05:14
description: >
- Unique identifier for the Port Channel, assigned automatically by
Catalyst Center when the Port Channel is created.
- Cannot be specified during creation.

Choose a reason for hiding this comment

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

Change the language a bit: This value is system-assigned during creation and user provided value will be ignored. Catalyst Center will automatically provide a unique number upon creation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

- Unique identifier for the Port Channel within the device pair.
- This value is system-assigned during creation and user-provided
  values will be ignored. Catalyst Center automatically provides
  a unique number upon creation.
- Cannot be specified during create operations - system generates
  the value automatically.
- Can be used for update operations to target a specific existing
  Port Channel for modification (adding/removing interfaces).
- Can be used for delete operations to identify the specific
  Port Channel to remove from the device pair.
- When used for update/delete operations, eliminates the need to
  specify existing interface links for Port Channel identification.

… When validating the playbook using the validate_list_of_dict from validations.py, it was resulting in error and was not fetching the correct config because of invalid validation spec. Corrected the validation spec by removing options and changing integer to int.
@@ -307,6 +308,76 @@
device.
type: str
required: true
port_channel:
description: >
Configuration to create, update, or delete a Port Channel between two LAN
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we remove two..

    Configuration to create, update, or delete Port Channels between two LAN
    Automated devices in Cisco Catalyst Center. Port Channels aggregate
    multiple physical links between devices to provide increased bandwidth
    and redundancy.

suboptions:
source_device_management_ip_address:
description: >
- Management IP address of the source device.
Copy link
Collaborator

Choose a reason for hiding this comment

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

        Management IP address of the source device. At least one device
        identifier (IP address, MAC address, or serial number) must be
        provided for the source device. The device must be LAN Automated
        and in Reachable and Managed state in Cisco Catalyst Center inventory.

Can we explicitly specify "one source device identifier " must be provided?

required: false
source_device_mac_address:
description: >
- MAC address of the source device.
Copy link
Collaborator

Choose a reason for hiding this comment

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

    MAC address of the source device. Alternative to management IP
    address or serial number for device identification. The device
    must be LAN Automated and in Reachable and Managed state in
    Cisco Catalyst Center inventory.

type: str
required: false
source_device_serial_number:
description: >
Copy link
Collaborator

Choose a reason for hiding this comment

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

    Serial number of the source device. Alternative to management IP
    address or MAC address for device identification. The device must
    be LAN Automated and in Reachable and Managed state in Cisco
    Catalyst Center inventory.

required: false
destination_device_management_ip_address:
description: >
- Management IP address of the destination device.
Copy link
Collaborator

Choose a reason for hiding this comment

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

    Management IP address of the destination device. At least one device
    identifier (IP address, MAC address, or serial number) must be
    provided for the destination device. The device must be LAN Automated
    and in Reachable and Managed state in Cisco Catalyst Center inventory.

"DEBUG",
)

have_port_channel_config_list = self.have.get("port_channel")[i]
Copy link
Collaborator

Choose a reason for hiding this comment

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

    if config_index >= len(have_port_channel_data):
        self.log(
            "No existing port channel configuration found at index {0} - no deletion required".format(
                config_index
            ),
            "INFO"
        )
        self.no_port_channel_deleted.append(want_port_channel_config)
        continue

"INFO",
)

for i, want_port_channel_config in enumerate(port_channel):
Copy link
Collaborator

Choose a reason for hiding this comment

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

i -> config_index

"DEBUG",
)

have_port_channel_config_list = self.have.get("port_channel")[i]
Copy link
Collaborator

Choose a reason for hiding this comment

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

    if config_index >= len(have_port_channel_data):
        self.log(
            "No existing port channel configuration found at index {0} - deletion verification passed".format(
                config_index
            ),
            "INFO"
        )
        continue

self.log(
"Links were provided in the configuration for deletion. Verifying if links were properly removed.",
"DEBUG",
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

        if not isinstance(have_port_channel_config_list, list) or len(have_port_channel_config_list) == 0:
            self.log(
                "Invalid existing port channel configuration format at index {0}".format(
                    config_index
                ),
                "ERROR"
            )
            continue

type: str
required: false
port_channel_number:
description: >
Copy link
Collaborator

Choose a reason for hiding this comment

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

    Unique identifier for the Port Channel, automatically assigned by
    Cisco Catalyst Center upon creation. Cannot be specified during
    Port Channel creation. Used for update or delete operations to
    target a specific Port Channel without specifying individual links.
    When provided for delete operations, the entire Port Channel is
    removed regardless of links specified.

or

Unique identifier for the Port Channel with the following characteristics:
- Automatically assigned by Cisco Catalyst Center upon creation
- Cannot be specified during Port Channel creation
- Used for update or delete operations to target a specific Port Channel
- When provided for delete operations, the entire Port Channel is removed

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.

4 participants