Highlighted
Absent Member.. Absent Member..
Absent Member..
204 views

Update a CI using Lauch button (HP CM -> HP UCMDB)

Hello,

I want to update a CI attributes in UCMDB with using Launch button in HP Configuration Manager.

From HP CM I recieve only possible context: ${ucmdbId}, ${ucmdbName}, ${ucmdbViewName}, ${ucmdbcmViewId}.

I don't recieve CI Type and I don't know how to update a CI without CI Type. Can someone help me with code?  

 

 

In working code I used CI Type "ig_rtr", but I don't want to.

 

import com.hp.ucmdb.api.UcmdbService;

import com.hp.ucmdb.api.topology.*;
import com.hp.ucmdb.api.types.CI;
import com.hp.ucmdb.api.types.UcmdbId;
public class DataInSample {
     static final String CIT_NAME_HOST ="ig_rtr";
     static final String ID = "76ccc860507162f0c6a1522be2926eb";
     static final String ATTRIBUTE_NAME_HOST_SERIAL_NUMBER = "ig_serialnumber";
     public static void main(String[] args) throws Exception{
         mergeNodesSample();
}
    public static void mergeNodesSample() throws Exception{
       final String sn = "SN5556";
       final TopologyUpdateService topologyUpdateService = getUcmdbService().getTopologyUpdateService() ;
       final TopologyUpdateFactory topologyUpdateFactory = topologyUpdateService.getFactory();
       final TopologyModificationData updateData = topologyUpdateFactory.createTopologyModificationData();
       final UcmdbId ucmdbId = topologyUpdateFactory.createTemporaryCIId(ID);
       final CI updatedCI = updateData.addCI(ucmdbId, CIT_NAME_HOST);
       updatedCI.setStringProperty(ATTRIBUTE_NAME_HOST_SERIAL_NUMBER, sn);
       topologyUpdateService.update(updateData);
}
/**
* Getting a connection
*/
public static UcmdbService getUcmdbService() throws Exception {
return CreateSDKConnectionSample.createSDKConnection();
}
}

 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.