DX NetOps

 View Only
Expand all | Collapse all

Spectrum Rest API and Maintenance Mode

  • 1.  Spectrum Rest API and Maintenance Mode

    Posted Jun 01, 2020 03:02 PM
    We have a workflow written in another tool that uses Rest commands to add devices to Spectrum (and other tools). We have been having a couple of problems with it. The devices are successfully added but they never go into the Network container specified in the command, they always get dumped into the Universe. Also the flow places the device in Maintenance Mode but this doesn't always work. The device shows InMaintenance is set to Yes in the information tab, but the condition is still Normal and the device is still being polled. Even the manual snmp poll button in the console can successfully contact the device and it shouldnt be able to if the device is in maintenance mode.


  • 2.  RE: Spectrum Rest API and Maintenance Mode

    Broadcom Employee
    Posted Jun 01, 2020 03:28 PM
    Dan,

    Can you send the work flow and the rest commands?

    Joe


  • 3.  RE: Spectrum Rest API and Maintenance Mode

    Posted Jun 01, 2020 03:43 PM
    The workflow is compiled in another tool and I wouldn't be able to export it. The rest URL I am using to add the device is:

    http://$ONECLICK:8080/spectrum/restful/model?landscapeid=$LANDSCAPE$ipaddress=$IP&commstring=$STRING$retry=2$timeout=10000&parentmh=$PARENT

    where
    $ONECLICK is the OneClick web server
    $LANDSCAPE is the landscape id (we have three)
    $IP is the ip address of the device being added
    $STRING is the snmpv3 string
    $PARENT is the model handle of the network container I want it placed in

    This successfully adds the device but fails to place it in the Network container, and instead places it in the Universe (which is where the Network containers are also located).

    The REST URL for maintenance mode is 

    http://$ONECLICK:8080/spectrum/restful/model/$MODELHANDLE?attr=0x1295d&val=false

    where
    $ONECLICK is the OneClick web server
    $MODELHANDLE is the model handle of the device

    This puts the IsManaged attribute to No, but the condition stays Normal and the device can still be polled.


  • 4.  RE: Spectrum Rest API and Maintenance Mode

    Posted Jun 01, 2020 04:41 PM
    Sorry some of those $ in the first URL should be & like so:

    http://$ONECLICK:8080/spectrum/restful/model?landscapeid=$LANDSCAPE&ipaddress=$IP&commstring=$STRING&retry=2&timeout=10000&parentmh=$PARENT


  • 5.  RE: Spectrum Rest API and Maintenance Mode

    Posted Jun 02, 2020 02:46 AM
    Your REST request is incomplete. As the documentation states, you should provide also relationid. Although you're specifying the parent MH, you should be specifying also the type of relation. I would assume that would be Collects (0x00010002).

    • http://<hostname><:portnumber>/spectrum/restful/model[?landscapeid=<landscape_handle>][&mtypeid=<mtype_handle>][&agentport=<snmp_port>][&commstring=<comm_str>][&retry=<retry_cnt>][&timeout=<timeout_val>][&ipaddress=<ip_address>][&parentmh=<model_handle>][&relationid=<rel_handle>][&attr=<attr_id>&val=<num>]


    ------------------------------
    Senior Consultant
    SolvIT Networks
    ------------------------------



  • 6.  RE: Spectrum Rest API and Maintenance Mode

    Broadcom Employee
    Posted Jun 02, 2020 07:27 AM
    For the maint mode issue, how long after model creation are you waiting before putting the model into maint mode? If could be model creation has not completed 100% before placing the model into maint mode.

    Joe


  • 7.  RE: Spectrum Rest API and Maintenance Mode

    Posted Jun 02, 2020 10:49 AM
    Adding the relationid doesn't help. The device is still dumped into the Universe instead of the container specified. Maybe Collects (0x10002) inst the right one for this but I don't know what the valid values are for relationid.

    As for the Maintenance mode issue, it probably isn't more than 90 seconds between the command to create the model and the command to place it in maintenance mode. If that is too soon, is there some attribute i can periodically check the value of to determine when the discovery is "finished" or do I have to just use a long sleep timer in the flow?


  • 8.  RE: Spectrum Rest API and Maintenance Mode

    Posted Jun 02, 2020 10:57 AM
    I placed a 5 minute timer between the model creation and the maintenance mode command and it still isn't placing it completely in MM. It looks like it is but it still says Normal and I can still poll it.


  • 9.  RE: Spectrum Rest API and Maintenance Mode

    Broadcom Employee
    Posted Jun 02, 2020 11:11 AM
    Dan,

    The only thing I can recommend at this time is create a case with Spectrum Support so they can get this into the lab for testing.

    Joe


  • 10.  RE: Spectrum Rest API and Maintenance Mode

    Posted Jun 02, 2020 11:25 AM
    Connect to vnmsh and issue a ./show relations commands. That will show you all the available relations. As the documentation states, the default is the Collects. Maybe the're something wrong with the product. Open a case to troubleshoot it.
    Did you try to create a relation post model creation? The model creation should return the model_handle of the newly created element. Try to construct a new association between that MH and the MH of what should be the parent container.

    ------------------------------
    Senior Consultant
    SolvIT Networks
    ------------------------------



  • 11.  RE: Spectrum Rest API and Maintenance Mode

    Posted Jun 02, 2020 01:47 PM
    The show associations on another model that was manually moved to the proper container does show that Collects is the correct relation. However despite specifying it in the Rest command a show associations of the test device shows its association as Collects with Universe instead of the container. It doesn't seem to paying any attention to the parameters specified. Also manually doing a create association on the test device with the container does NOT move it to the container, it stays in the Universe.


  • 12.  RE: Spectrum Rest API and Maintenance Mode
    Best Answer

    Posted Jun 02, 2020 02:42 PM
    Well the inability to change the relationid from Universe to another container from the command line failed because that command cannot update, have to destroy then create. I did discover that moving the parentmh and relationid parameters earlier in the Rest URL does allow the model the be placed in the proper container now. I didn't think the order of parameters mattered but it did for me. The maintenance mode is still an issue and I will open a ticket on that.