DX NetOps

Expand all | Collapse all

Spectrum: Discovery via rest API

  • 1.  Spectrum: Discovery via rest API

    Posted Apr 17, 2015 02:38 AM

    Does anyone here know how to add a device via rest API into Spectrum? Ideally, directly into a specified container.

     

    What I'm trying to do is to find a replacement for Spectrum discovery via rest. Any suggestions or code examples are welcome.

     

    Thanks,

    Dirk



  • 2.  Re: Spectrum: Discovery via rest API
    Best Answer

    Posted Apr 17, 2015 05:33 AM

    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 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>
    
    

     

    Hope this helps!



  • 3.  Re: Spectrum: Discovery via rest API

    Posted Apr 17, 2015 07:51 AM

    Hi Frank,

     

    Thank you very much. I think this will help.



  • 4.  Re: Spectrum: Discovery via rest API

    Posted Apr 17, 2015 08:21 AM

    You are welcome!

     

    I explained Container Structure creation here:

     

    https://communities.ca.com/message/101849965#101849965

     

    Otherwise if there's anything else, let me know!



  • 5.  Re: Spectrum: Discovery via rest API

    Posted Mar 09, 2018 04:01 AM

    Hi franktonjes.

    You are referring to an action 0x25e0022 I cannot find in the Spectrum documentation.

    https://docops.ca.com/ca-spectrum/10-2-3/en/programming/web-services-api-reference/how-to-use-the-ca-spectrum-web-servic… 

    Could you please tell us where you found it ?



  • 6.  Re: Spectrum: Discovery via rest API

    Posted Mar 09, 2018 05:28 AM

    Hi Yann,

     

    I managed to find it either via communities or raising a ticket with support. If I am struggling with something and think that there should be a way to do something (that is in the gui) via REST I raise a support ticket and they provide them.


    Regards,


    Frank



  • 7.  Re: Spectrum: Discovery via rest API

    Posted Sep 25, 2017 05:42 AM

    I used this below script .. (borrowed from this thread :) )

     

    http://10.33.230.90/spectrum/restful/model?landscapeid=0x100000&attr=0x1006e&val=hi&attr=0x12d7f&val=10.33.230.73&mtypehandle=0x10001&mtypeid=0x10290&attr=0x1000e&val=7&retry=1&timeout=1000&parentmh=10000

     

    Got this as output: "0x1019d2"

     

    then used this script: http://10.33.230.90/spectrum/restful/action/0x25e0022?mh=0x1019d2

    got "succesfull" as output

     

    But nothing seems to be coming on topology and spectrum landscape went to red after running this script, am doing this in soupui tool. as i dont have much knowledge on scripting.



  • 8.  Re: Spectrum: Discovery via rest API

    Posted Sep 28, 2017 04:31 AM

    When you say the landscape went red, do you mean the landscape died and you had to do a db restore and bring it up again? What version of Spectrum are you running?



  • 9.  Re: Spectrum: Discovery via rest API

    Posted Oct 26, 2017 04:03 AM

    No landscape didn't died , but was on red color with no events or alarms related to it . now devices are getting created , but some how it goes to lost and found tab .