Cisco Cisco License Manager SDK Bulletins

Page of 67
 
 
Guide 
© 2010 Cisco Systems, Inc. All rights reserved. This document is Cisco Public Information. 
Page 17 of 66 
Chapter 5: Adding Devices to Inventory 
 
How do I add new devices without going through discovery? 
 
Add new device by IP address 
 
Add new device by UDI 
Solution 
In this chapter, you learn how to create a device with a unique device identifier (UDI) or with an IP address. 
Create Device by UDI 
This API is mainly used in managing devices in an isolated network. See the “Two Stage Deployment” section of the 
following white paper for more information: 
http://www.cisco.com/en/US/prod/collateral/netmgtsw/ps5734/ps7138/white_paper_C11-562757.html
 
In a two-stage environment, you first create a device with its UDI and obtain a license with the UDI in a network that 
can access Cisco.com. In the second stage, you bring the server to a private network where the device resides, fill in 
device connection information, and poll or discover the device and deploy licenses obtained in the first stage. This 
chapter only covers the creation part. Obtaining licenses, polling licenses, and discovering devices are covered by 
other chapters. 
Assume you already instantiated the LicenseManager object (licMgr), logged in to the server, and obtained a valid 
token. This example creates a device with a UDI “C3900-SPE100/K9:FHH13010044” in a group called “myGroup”. 
The UDI is a unique ID used to identify a device and has the format of <ProductID>:<SerialNumber>. In this 
example, C3900-SPE100/K9 is the product ID, and FHH13010044 is the serial number. 
 
Create the group if it does not exist already. 
licMgr.createDeviceGroup(token, group); 
 
Create a device with a given UDI. 
String[] udis = { “C3900-SPE100/K9:FHH13010044” } 
DeviceStatus status =  
   licMgr.createDevicesByUDI(token, udis, group); 
 
Check the top-level return value to see whether the operation is successful. 
if (status.getErrorCode() != ClmErrors.SUCCESS) { 
   System.out.println(“Operation failed, msg: “ +  
   status.getErrorMessage()); 
   return; 
 
DeviceStatusItem[] items =  
   status.getDeviceStatusItems(); 
 
Check the return value for the individual item. In this example, there is only one item. 
for (int i = 0; i < udis.length; i++) { 
   if (items[i].getErrorCode()!=ClmErrors.SUCCESS) { 
      System.out.println(“Operation failed for UDI “  
      udis[i] + “, msg: “ + items[i].getErrorMessage());