How to Use Spectrum REST API to Discover Devices
Release : All Supported Releases
Component : SPCAPP: Spectrum Applications
You would need to first find the model handle of the parent container (of type Network) and then use one of the below REST calls :
For the model Handle, you either need to search for the container which contains the device, and get the model handle there, or when you create a container it returns the model handle in the response.
You can specify the model handle of the "Universe" from Topology.
You need to use different attributes for SNMP or ICMP:
For SNMP devices:
HTTP: POST
URL:
http://<SERVER>:<PORT>/spectrum/restful/model?landscapeid=<LANDSCAPE HANDLE>&attr=0x1006e&val=<DEVICE NAME>&ipaddress=<IP ADDRESS>&port=161&commstring=%23v2%2f<SNMP COMMUNITY>&retry=1&timeout=1000&parentmh=<PARENT MODEL HANDLE>
Just a note, the example shows SNMPv2, if you want to use SNMPv1 you need to remove the '%23v2%2f' - this is the URL friendly '# v 2 /'. There are some characters which you need to convert to HTML friendly codes: e.g.: '<space>' becomes '%20' etc.
For ICMP devices:
HTTP: POST
URL:
http://<SERVER>:<PORT>/spectrum/restful/model?landscapeid=<LANDSCAPE HANDLE>&attr=0x1006e&val=<DEVICE NAME>&attr=0x12d7f&val=<IP ADDRESS>&mtypehandle=0x10001&mtypeid=0x10290&attr=0x1000e&val=7&retry=1&timeout=1000&parentmh=<PARENT MODEL HANDLE>
Note we also set the 'Value_When_Red" so it creates alarms instead of just staying in INITIAL mode for pingable models.
This will add the device, you will still need to send a 'discover connections' action to the device after discovering. This can sometimes time out and you can only run one at a time, so you need to have a script which manages the discover connections. This will error mention that another discover is in progress which you can check for (text to check for is 'Another discovery process is currently in progress.')
HTTP: GET
URL: http://<SERVER>:<PORT>/spectrum/restful/action/0x25e0022?mh=<MODEL HANDLE>
The information in this doc is taken from the following Communities post:
https://community.broadcom.com/communities/community-home/digestviewer/viewthread?MID=741647&_ga=2.55613547.1911933334.1580740799-1252016964.1574277697#bm579de683-c82a-4700-a72b-29eb05aaf23c
See KB doc 132906 for information on using action code is 0x25e0022 to Discover Connections:
https://ca-broadcom.wolkenservicedesk.com/external/article?articleId=132906