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

Adding fix for Stackswitch getting changed to normal switch post editing the device's info #187

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions plugins/modules/pnp_intent.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,9 @@ class instance for further use.
)
self.log("Response from 'get_device_by_id' API for device details: {0}".format(str(dev_details_response)), "DEBUG")

is_stack = False
if dev_details_response.get("deviceInfo").get("stack"):
is_stack = dev_details_response.get("deviceInfo").get("stack")
pnp_state = dev_details_response.get("deviceInfo").get("state")
self.log("PnP state of the device: {0}".format(pnp_state), "INFO")

Expand All @@ -953,6 +956,9 @@ class instance for further use.
return self

update_payload = {"deviceInfo": self.want.get('pnp_params')[0].get("deviceInfo")}
update_payload["deviceInfo"]["stack"] = is_stack

self.log("The request sent for 'update_device' API for device's config update: {0}".format(update_payload), "DEBUG")
update_response = self.dnac_apply['exec'](
family="device_onboarding_pnp",
function="update_device",
Expand Down
6 changes: 6 additions & 0 deletions plugins/modules/pnp_workflow_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,9 @@ class instance for further use.
)
self.log("Response from 'get_device_by_id' API for device details: {0}".format(str(dev_details_response)), "DEBUG")

is_stack = False
if dev_details_response.get("deviceInfo").get("stack"):
is_stack = dev_details_response.get("deviceInfo").get("stack")
pnp_state = dev_details_response.get("deviceInfo").get("state")
self.log("PnP state of the device: {0}".format(pnp_state), "INFO")

Expand All @@ -953,6 +956,9 @@ class instance for further use.
return self

update_payload = {"deviceInfo": self.want.get('pnp_params')[0].get("deviceInfo")}
update_payload["deviceInfo"]["stack"] = is_stack

self.log("The request sent for 'update_device' API for device's config update: {0}".format(update_payload), "DEBUG")
update_response = self.dnac_apply['exec'](
family="device_onboarding_pnp",
function="update_device",
Expand Down
Loading