08-06-2018 01:21 AM - edited 03-01-2019 04:43 AM
Hi I'd like to ask about following .
When is "deviceId" key added to the config in pnp-project?
I'm working on making automation tool that register/delete config in pnp-project by python.
I found the config which that the status changes from PENDING to PROVISONED is registered in /pnp-device.
If that config is deleted in /pnp-project but still existing in /pnp-device then config that has same serialnumber of that config cannot registered with error( because same serial number is still existing in /pnp-device)
So I should delete config in /pnp-device in advance.
I'm thinking below algorism to implement deleting config in /pnp-device
1. GET DEVICEID by using get /pnp-project/{projectId}/device:a key is hostName.
2. DELETE DEVICE wiht 1's DEVICEID by using delete /pnp-device/{deviceId}
I want to make sure whether the config in /pnp-project has deviceId since the config is registered in /pnp-device or not.
If it is true , I think the above algorism can be worked.
KEN-ICHI
08-06-2018 01:28 AM - edited 08-06-2018 01:36 AM
Hi Ken,
you add the configId when you create a rule in the project.
This blog post explains it.
In this case the projectId is "60556ce0-8f79-402f-9343-d899a7059908", and i am adding a device with a configId.
POST URL https://sandboxapic.cisco.com/api/v1/pnp-project/60556ce0-8f79-402f-9343-d899a7059908/device
[
{
"platformId": "WS-C2960X-48FPD-L",
"hostName": "sw01",
"serialNumber": "12345676130",
"configId": "d300a372-ce55-4b02-9aac-b49e9c0d6e20",
"pkiEnabled": true
}
If you try to delete a file that is being used by a rule, it will tell you which devices are using it.
Adam
08-06-2018 03:34 AM
Hi Adam
Thank you for your quick reply.
I think your mention is how to create a device in /pnp-project.
I know it and saw your blog before.
I'm asking how to delete a device in /pnp-device.
(I try to use "delete /pnp-project/{projectId}/device/{deviceId}")
you can see attached file that shows API I try to use .
And I ask again.
When is deviceId key added to device in pnp-project?
The below is the result of "get /pnp-project/{projectId}/device"
I think the reason why this decvice has deviceId is because that the status is PROVISIONED.
Is it correct?
{
"response": [
{
"hostName": "TTTTTTTTTTT",
"platformId": "XXXXX-XXXX-XX-XX",
"serialNumber": "GL123456GQ",
"site": "B01",
"configId": "ab5138ad-dc2f-46a7-9028-d08c971d0d13",
"pkiEnabled": false,
"sudiRequired": false,
"apCount": "0",
"isMobilityController": "false",
"memberCount": 0,
"eulaAccepted": false,
"state": "PROVISIONED",
"stateDisplay": "Provisioned",
"lastStateTransitionTime": "2018-07-30 02:57:41.000950",
"lastContact": "2018-07-30 02:57:41.000950",
"deviceId": "abcde824-bafc-4f33-909a-20db8bad5ff9",
"authStatus": {
"type": "Unsupported",
"status": "Unsupported",
"errorMessage": null,
"timestamp": 1532919263690,
"certInfo": null
},
"aliases": [
"GL123456GQ"
],
"id": "abc0124b-8903-4250-b9e4-2f7c22e31fd2"
}
],
"version": "1.0"
}
KEN-ICHI
08-06-2018 03:47 AM
try DELETE
/pnp-project/{projectId}/device/abc0124b-8903-4250-b9e4-2f7c22e31fd2
You want the ID of the device Rule, not the device itself.
08-06-2018 04:21 AM
I know "/pnp-project by using /pnp-project/{projectId}/device/{deviceId}" execute to delete device rule.
The device which is already downloaded and the status is "PROVISIONED" is not completely deleted from APIC-EM by "/pnp-project by using /pnp-project/{projectId}/device/{deviceId}".
Because device is still existing in /pnp-device since the device is downloaded, isn't it ?
And if the device in /pnp-device is deleted we should use "delete /pnp-device/{deviceId}" with "deviceId" not "id" in device rule shouldn't we?
Then I ask you when "deviceId" is appeared in device rule?
08-06-2018 03:37 AM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide