Skip to content

Commit

Permalink
Merge pull request #155 from madhansansel/main
Browse files Browse the repository at this point in the history
Stackswith getting changed to normal switch
  • Loading branch information
bvargasre authored Mar 7, 2024
2 parents 500e573 + af91d64 commit 03a90de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -827,3 +827,5 @@ releases:
attributes 'clear_mac_address_table', 'device_ip', 'resync_retry_count', 'resync_retry_interval',
'reprovision_wired_device', 'provision_wireless_device' were added.
Renamed argument from 'ip_address' to 'ip_address_list'.
- pnp_workflow_manager - Adding fix for Stackswitch getting changed to normal switch post editing the device's info.
- pnp_intent - Adding fix for Stackswitch getting changed to normal switch post editing the device's info.
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 03a90de

Please sign in to comment.