Skip to content

Commit

Permalink
Merge pull request #187 from abimishr/PNP_Code_Abinash
Browse files Browse the repository at this point in the history
Adding fix for Stackswitch getting changed to normal switch post editing the device's info
  • Loading branch information
madhansansel authored Mar 7, 2024
2 parents 81f0044 + a9a93ac commit 9f3df8b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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

0 comments on commit 9f3df8b

Please sign in to comment.