using REST API for managing maintenance scheduling

book

Article ID: 196313

calendar_today

Updated On:

Products

CA Spectrum CA eHealth

Issue/Introduction

We are using REST API to manage our device maintenance schedules. What are the best practices? 

Environment

Release : 10.3

Component : Spectrum Core / SpectroSERVER

Resolution

A user can utilize RESTful commands to manage Maintenance mode on devices. 

The Schedule gets created per Landscape. If there is only one Landscape in the environment, then the Landscape does not have to be defined in the initial call to create the Schedule. However, in a DSS environment, the Schedule will need to be created on the same landscape as where the model to be associated with the schedule resides. To do this, the landscapeid must be determined. This is the same as landscape_handle, except landscapeid is in decimal format, and would need to be converted to hex for landscape_handle. 

First make a call on the model_handle to determine which Landscape it resides: 

http://<OC Host>:<PORT>/spectrum/restful/model/<Model MH>?attr=0x129ac

The returned landscapeid needs to be converted to hex. This can be scripted: https://www.rapidtables.com/convert/number/decimal-to-hex.html

String convertToHex(String landscapeID) {
var id = int.parse(landscapeID);
var hexVal = '0x' + id.toRadixString(16);
return hexVal;
}

 

A sample call to create the schedule: 

http://<oneclick_host>:<port>/spectrum/restful/model?mtypeid=0x10456&attr=0x129ac&val=0x100000&attr=0x12bbc&val=TestSchedule&attr=0x1298f&val=16&attr=0x1298e&val=20&attr=0x12993&val=54000&attr=0x129e4&val=29&attr=0x12992&val=06&attr=0x129e3&val=120&attr=0x12994&val=6

mtypeid=0x10456 = Schedule Model Type
attr=0x129ac = Landscape Handle
attr=0x12bbc = Schedule Name
attr=0x1298f = Hour
attr=0x1298e = Minute
attr=0x12993 = Duration
attr=0x129e4 = Day
attr=0x12992 = Month - (NOTE month is base-0, so Jan - 00, Feb = 01, etc)
attr=0x129e3 = Start Year
attr=0x12994 = Recurrence (1=Always, 2=Daily, 3=Weekly, 4=Monthly, 5=Yearly, 6=None)


The user must then obtain the model_handle of the Schedule, and the model to apply the schedule to

The next call sets the Association between the model and the schedule: 

http://<oneclick_host>:<port>/spectrum/restful/associations/relation/0x10034/leftmodel/<device_model_handle>/rightmodel/<sched_model_handle>

 



Additional Information

Restful Web API reference: https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/it-operations-management/spectrum/10-4-2/programming/web-services-api-reference.html