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

Unmarshaling problem with wireless profile endpoint #78

Open
3 tasks done
bl4ko opened this issue Feb 22, 2024 · 0 comments
Open
3 tasks done

Unmarshaling problem with wireless profile endpoint #78

bl4ko opened this issue Feb 22, 2024 · 0 comments

Comments

@bl4ko
Copy link

bl4ko commented Feb 22, 2024

Prerequisites

  • Have you tested the operation in the API directly?
  • Do you have the latest SDK version?
  • Review compability matrix

Describe the bug
Endpoint /dna/intent/api/v1/wireless/profile returns empty empty object per profile detail, with attribute enableFabric="" (see below), which breaks go marshaling with the following error:

wirelessProfiles, response, err := c.Wireless.GetWirelessProfile(nil)

output:

2024/02/22 10:13:20.887217 WARN RESTY json: cannot unmarshal string into Go struct field ResponseItemWirelessGetWirelessProfileProfileDetailsSSIDDetails.profileDetails.ssidDetails.enableFabric of type bool, Attempt 1
2024/02/22 10:13:20.887279 ERROR RESTY json: cannot unmarshal string into Go struct field ResponseItemWirelessGetWirelessProfileProfileDetailsSSIDDetails.profileDetails.ssidDetails.enableFabric of type bool
json: cannot unmarshal string into Go struct field ResponseItemWirelessGetWirelessProfileProfileDetailsSSIDDetails.profileDetails.ssidDetails.enableFabric of type bool

Postman example return value for endpoint (GET https://{{dnac}}/dna/intent/api/v1/wireless/profile)

[
    {
        "profileDetails": {
            "instanceUuid": "...",
            "name": "WiFi_Profile_Example",
            "ssidDetails": [
                {
                    "name": "example",
                    "enableFabric": false,
                    "flexConnect": {
                        "enableFlexConnect": false
                    },
                    "interfaceName": "example"
                },
                {
                    "enableFabric": "",
                    "flexConnect": {
                        "enableFlexConnect": false
                    },
                    "interfaceName": ""
                },
                {
                    "name": "example",
                    "enableFabric": false,
                    "flexConnect": {
                        "enableFlexConnect": false
                    },
                    "interfaceName": "example"
                },
            ],
            "sites": [
              "..."
            ]
        }
    },
    {
        "profileDetails": {
            "instanceUuid": "...",
            "name": "Wireless_Profile_Example2",
            "ssidDetails": [
                {
                    "name": "example",
                    "enableFabric": false,
                    "flexConnect": {
                        "enableFlexConnect": false
                    },
                    "interfaceName": "example"
                },
                { "...": "..."},
                {
                    "enableFabric": "",
                    "flexConnect": {
                        "enableFlexConnect": false
                    },
                    "interfaceName": ""
                }
            ],
            "sites": [
            "..."
            ]
        }
    }
]

Expected behavior
I think that empty objects should be filtered out and not break the whole endpoint.

Screenshots
dnac_debug

Environment (please complete the following information):

  • Cisco DNA Center Version and patch: 2.3.5.5-70026
  • Go Version: go1.21.4 linux/amd64
  • SDK version: v5.0.25
  • OS Version: Ubuntu 22.04.2 LTS
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

No branches or pull requests

1 participant