cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
709
Views
0
Helpful
11
Replies

PnP Add Device API not accepting stackMemberList inside stackInfo

srajakri
Cisco Employee
Cisco Employee

API Endpoint

```

/dna/intent/api/v1/onboarding/pnp-device

```

 

PAYLOAD

{
"deviceInfo": {
"serialNumber": "FOC2724Y3SP",
"stack": "True",
"description": "string",
"pid": "C9300X-48HX",
"siteId": "fad85e73-6051-49ed-94e2-7c098c0a6721",
"sudiRequired": "False",
"hostname": "svlgold24-sw1",
"stackInfo": {
"supportsStackWorkflows": "True",
"isFullRing": "True",
"stackMemberList": [
{
"serialNumber": "FVH2814L9ZC",
"role": "Active",
"stackNumber": "1",
"priority": "13",
"pid": "C9300X-48HX"
},
{
"serialNumber": "FOC2724Y9AB",
"role": "Standby",
"stackNumber": "2",
"priority": "12",
"pid": "C9300X-48HX"
}
],

"totalMemberCount": "2"
}
}
}

'

RESPONSE

 

"stackInfo": {
"isFullRing": true,
"supportsStackWorkflows": true,
"totalMemberCount": 2,
"stackMemberList": [],
"validLicenseLevels": [
"Cisco DNA Essentials",
"Cisco DNA Advantage",
"IP Services",
"Lanbase"
]

 

stackMemberList always returns empty, please help

11 Replies 11

Try and update this line "stackMemberList": stack_info.get("stackMemberList", []),

 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Do you mean like this ?

```
"stackMemberList" : stack_info.get("stackMemberList", [{
"serialNumber": "FVH2814L9ZC",
"role": "Active",
"stackNumber": "1",
"priority": "13",
"pid": "C9300X-48HX"
}])

```

Yes, try this.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Where is 'stack_info' defined ? any documentation

Its a Python boolean flag (True/False), stack_info is a keyword argument used within a logging function, the get which is normally associated with dictionaries, and used to retrieve the value associated with a specific key. Here is a doc link https://docs.python.org/3/library/logging.html

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

srajakri
Cisco Employee
Cisco Employee

I'm sorry i didnt get you how the stack_info here is related to stack_info in logging module, i'm not even using logging module in my code , please provide payload example

Sorry i see what you mean, i thought you meant something else. Try if  "stack": "True" and "stackInfo.supportsStackWorkflows": "True" should be in the boolean values (true/false) instead of strings, something llike this maybe?

{
  "deviceInfo": {
    "stack": true,
    "stackInfo": {
      "supportsStackWorkflows": true,
      ...
    }
  }
}

 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

srajakri
Cisco Employee
Cisco Employee
pnp_import_info = [
{
"deviceInfo": {
"hostname": device_name,
"serialNumber": device_serial,
"pid": device_pid,
"sudiRequired": False,
"stack": True,
"userSudiSerialNos": [],
"aaaCredentials": {
"username": "",
"password": ""
}
},
"stackInfo": {
"supportsStackWorkflows": True,
"stackMemberList": [
{
"serialNumber": "FVH2814L2BB",
"role": "Active",
"stackNumber": "1",
"priority": "13",
"pid": device_pid
},
{
"serialNumber": "FOC2724Y3SP",
"role": "Standby",
"stackNumber": "2",
"priority": "12",
"pid": device_pid
}
],
"stackRingProtocol": "StackWise",
"totalMemberCount": "2"
}

}
]

srajakri
Cisco Employee
Cisco Employee

Above with boolean True aint working either. devices is added successfully as stack but stackMemberlist is not getting populated

Hmm thats odd, i wonder if this is an API handling issue? The new code you shared, the stackInfo is at the same level as deviceInfo in your payload, on the previous working example, stackInfo should be nested inside deviceInfo, try
 
pnp_import_info = [
    {
        "deviceInfo": {
            "hostname": device_name,
            "serialNumber": device_serial,
            "pid": device_pid,
            "sudiRequired": False,
            "stack": True,
            "userSudiSerialNos": [],
            "aaaCredentials": {
                "username": "",
                "password": ""
            },
            "stackInfo": {  # Moved inside deviceInfo
                "stackMemberList": [
                    {
                        "serialNumber": "FVH2814L2BB",
                        "role": "Active", 
                        "stackNumber": "1",
                        "priority": "13",
                        "pid": device_pid
                    },
                    {
                        "serialNumber": "FOC2724Y3SP",
                        "role": "Standby",
                        "stackNumber": "2",
                        "priority": "12",
                        "pid": device_pid
                    }
                ],
                "stackRingProtocol": "StackWise",
                "totalMemberCount": "2"
            }
        }
    }
]
Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

srajakri
Cisco Employee
Cisco Employee

Thank you, fixed that, but the stackmemberlist is still empty

 

'stackMemberList': []