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

add reprovision option to fabric_provision_device #184

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kuba-mazurkiewicz
Copy link
Collaborator

To reprovision fabric device, PUT request needs to be sent with the following body:

[
    {
        "id": "string",
        "siteId": "string",
        "networkDeviceId": "string"
    }
]

This essentially means that we have to invoke the Update method without making any changes.

To achieve this, I introduced a new attribute called reprovision of type Bool. This attribute indicates whether the device should be reprovisioned. If set to true, reprovisioning will be triggered on every Terraform apply.

Since this attribute is neither sent in POST and PUT requests nor populated by the API, I modified updateFromBody to set data.Reprovision to false:

data.Reprovision = types.BoolValue(false)

Additionally, I modified the Update method so that if plan.Reprovision is false, nothing is sent in the Update method.

@kuba-mazurkiewicz
Copy link
Collaborator Author

I also modified errorCode handling in catalystcenter_*_settings resources to include all error messages starting with NCND, as another error (NCND00010) has appeared.

Example error message:

│ Error: Client Error
│ 
│ Failed to delete object (PUT), got error: task '01955dcb-3228-753e-af81-407840346d43' failed: Global Settings Save is in progress..., NCND00010: An exception occurred while performing an action on
│ Common Settings, {"response":{"version":1741035352635,"progress":"Global Settings Save is in
│ progress...","endTime":1741035352635,"startTime":1741035352616,"errorCode":"NCND00010","serviceType":"NCND","isError":true,"failureReason":"NCND00010: An exception occurred while performing an action
│ on Common Settings","instanceTenantId":"650c8d0249ce15355112bd69","id":"01955dcb-3228-753e-af81-407840346d43"},"version":"1.0"}

Previously, only NCND01090 was handled

@kuba-mazurkiewicz
Copy link
Collaborator Author

and last change I did was to change all attributes in aaa_settings to optional to support setting up aaaNework without aaaClient and vice versa.

Based on API documentation they are both required, but documentation is wrong

aaaNetwork  (map, required): AAA/ISE network settings
aaaClient  (map, required): AAA/ISE client settings

You can send only aaaNetwork or aaaCilent in API PUT request and it works fine, you can also configure only one setting in GUI.

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.

1 participant