Skip to content
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

Provision workflow feature #440

Merged

Conversation

syed-khadeerahmed
Copy link

@syed-khadeerahmed syed-khadeerahmed commented Oct 22, 2024

Description

2 bugs fixed
Wireless provisioning getting TypeError: 'NoneType' object is not iterable
[IaC2][Provision]: Unexpected Success During Wireless Device Re-provisioning

Type of Change

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

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

primary_managed_ap_locations:
description:
- List of site locations allocated for the primary managed Access Points (APs).
- This is mandatory for provisioning wireless devices if the managed AP location is not set.
Copy link
Owner

Choose a reason for hiding this comment

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

We use required

- Required for provisioning wireless devices if the managed AP location is not set.

description:
- List of site locations allocated for the primary managed Access Points (APs).
- This is mandatory for provisioning wireless devices if the managed AP location is not set.
- Supported in Cisco Catalyst version 2.3.7.6 and above.
Copy link
Owner

Choose a reason for hiding this comment

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

    - Supported in Cisco Catalyst version 2.3.7.6 and later.

@@ -73,6 +73,20 @@
- This is mandatory for provisioning of wireless devices.
type: list
elements: str
primary_managed_ap_locations:
description:
- List of site locations allocated for the primary managed Access Points (APs).
Copy link
Owner

Choose a reason for hiding this comment

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

- List of site locations assigned to primary managed Access Points (APs).

elements: str
secondary_managed_ap_locations:
description:
- List of site locations allocated for the secondary managed Access Points (APs).
Copy link
Owner

Choose a reason for hiding this comment

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

- List of site locations assigned to secondary managed Access Points (APs).

secondary_managed_ap_locations:
description:
- List of site locations allocated for the secondary managed Access Points (APs).
- This is mandatory for provisioning wireless devices if the managed AP location is not set.
Copy link
Owner

Choose a reason for hiding this comment

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

- Required for provisioning wireless devices if the managed AP location is not set.

plugins/modules/provision_workflow_manager.py Show resolved Hide resolved
already_provisioned_site = self.find_device_site(device_id)

if already_provisioned_site != self.site_name:
self.log("inside new logic")
Copy link
Owner

Choose a reason for hiding this comment

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

self.log("Device re-provisioning logic triggered.", "INFO")

@@ -1049,7 +1119,7 @@ def provision_wired_device(self, to_provisioning, to_force_provisioning):
if status == "success":
if not to_force_provisioning:
self.result["changed"] = False
msg = "Device '{0}' is already provisioned.".format(self.validated_config.get("management_ip_address"))
msg = "wired Device '{0}' is already provisioned.".format(self.validated_config.get("management_ip_address"))
Copy link
Owner

Choose a reason for hiding this comment

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

Wired device
or
The wired device

if primary_ap_location:
self.log("Processing primary access point locations", "INFO")
for primary_sites in primary_ap_location:
self.log("Retrieving site ID for primary location: {0}".format(primary_ap_location), "DEBUG")
Copy link
Owner

Choose a reason for hiding this comment

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

Hope you wanted to print the primary_sites instead of primary_ap_location

self.log("Retrieving site ID for primary location: {0}".format(primary_sites), "DEBUG")

if secondary_ap_location:
self.log("Processing secondary access point locations", "INFO")
for secondary_sites in secondary_ap_location:
self.log("Retrieving site ID for secondary location: {0}".format(secondary_ap_location), "DEBUG")
Copy link
Owner

Choose a reason for hiding this comment

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

    self.log("Retrieving site ID for secondary location: {0}".format(secondary_sites), "DEBUG")

type: bool
default: false
ap_reboot_percentage:
description:
- The percentage of APs to reboot simultaneously during an upgrade.
- Must be an integer value, typically between 1 and 100, indicating the proportion of APs to upgrade at a time.
- Supported in Cisco Catalyst version 2.3.7.6 and later.
- Permissible values are - 5, 15, 25
Copy link
Owner

Choose a reason for hiding this comment

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

We're stating the value between 1 and 100. But here, we're saying that the allowed values are 5, 15, 25. Is that right? Also we specify the default value as 20..

If you want to stick with 5, 15, 20, and 25 as the permissible values, you could update the description like this:

- Must be one of the permissible values: 5, 15, 20, or 25, representing the proportion of APs to reboot at once.
 - Default value is 20.

Copy link
Author

Choose a reason for hiding this comment

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

yes, Madhan the permissible values - [5, 15, 25] and I have remove the default value as 20 and updated the code

type: dict
suboptions:
enable_rolling_ap_upgrade:
description:
- Enable or disable the rolling AP upgrade feature.
- If set to 'true', APs will be upgraded in batches based on the specified reboot percentage.
- Supported in Cisco Catalyst version 2.3.7.6 and later.
type: bool
default: false
ap_reboot_percentage:
description:
- The percentage of APs to reboot simultaneously during an upgrade.
- Must be an integer value, typically between 1 and 100, indicating the proportion of APs to upgrade at a time.
Copy link
Owner

Choose a reason for hiding this comment

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

Do we need this? Do we support it? can you check my earlier comment?

type: bool
default: false
ap_reboot_percentage:
description:
- The percentage of APs to reboot simultaneously during an upgrade.
- Must be an integer value, typically between 1 and 100, indicating the proportion of APs to upgrade at a time.
- Supported in Cisco Catalyst version 2.3.7.6 and later.
- Must be one of the permissible values - 5, 15, or 25, representing the proportion of APs to reboot at once.
Copy link
Owner

Choose a reason for hiding this comment

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

  - Must be either 5, 15 or 25 representing the proportion of APs to reboot at once.
  • 5 may mislead to -5

@madhansansel madhansansel merged commit c56556c into madhansansel:main Oct 24, 2024
5 of 6 checks passed
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