|
To configure multiple devices, either the devices can be associated with the task individually or a device list can be associated with the task. The best choice is to associate a device list with the task for configuring multiple devices. The device list consists of a set of devices, grouped based on certain properties. When you want to execute a task over a set of devices, then those devices can be made as a device list and can be associated with the task, so that the task is executed over all the devices present in the device list.
An example "MultiTaskConfiguration.java" present in <Web NMS Home>/examples/configuration directory helps you to create tasks that configure multiple devices.
|
|
Note: While creating the device list, ensure that the devices associated are logically grouped. This helps in reusing the device list with other tasks. |
To create a device list, the following have to be done:
Create Device objects with all their properties using the methods in the Device() class.
|
Device d1 = new Device("device1", "161"); Device d2 = new Device("device2", "161"); ...... ...... Device d10 = new Device("device10", "161"); |
Get a DeviceList instance. To get this instance, give the names of the device list and the protocol as input and pass them to the appropriate constructor.
|
String deviceListName = "list1"; String protocol = "snmp"; DeviceList dlist = new DeviceList(deviceListName, protocol); |
Once you get this instance, pass the device array as parameters to the setDevices() method of DeviceList class. Get the DeviceList XML using getDeviceList() method. This XML is passed to the method saveDeviceList() of ConfigClientAPI to store the device list.
|
dlist.setDevices(new Device[] {d1,d2,d10}); String DeviceListXML = dlist.getDeviceList(); configclientapi.saveDeviceList(DeviceListXML); |
Once the device list gets stored, associate the tasks with this list at the time of its execution by using the method setDeviceList(String[] deviceListName) of TaskGenerator.
|
TaskGenerator tg = new TaskGenerator; tg.setDeviceList(String[] dlist); |
|