use of org.opennms.rancid.RWSResourceList in project opennms by OpenNMS.
the class InventoryService method getRancidNodeList.
/**
* <p>getRancidNodeList</p>
*
* @param nodeid a int.
* @param group a {@link java.lang.String} object.
* @return a java$util$Map object.
*/
public Map<String, Object> getRancidNodeList(int nodeid, String group) {
LOG.debug("getRancidlist start: nodeid: {} group: {}", nodeid, group);
Map<String, Object> nodeModel = getRancidNodeBase(nodeid);
String rancidName = (String) nodeModel.get("id");
List<InventoryWrapper> ranlist = new ArrayList<>();
RancidNode rn;
try {
rn = RWSClientApi.getRWSRancidNodeInventory(m_cp, group, rancidName);
nodeModel.put("devicename", rn.getDeviceName());
} catch (RancidApiException e) {
if (e.getRancidCode() == 2) {
LOG.debug("No Inventory found in CVS repository for nodeid:{} nodeLabel: {}", nodeid, rancidName);
} else {
nodeModel.put("RWSStatus", e.getLocalizedMessage());
LOG.error(e.getLocalizedMessage());
}
return nodeModel;
}
RWSResourceList versionList;
try {
versionList = RWSClientApi.getRWSResourceConfigList(m_cp, group, rancidName);
} catch (RancidApiException e) {
nodeModel.put("RWSStatus", e.getLocalizedMessage());
LOG.error(e.getLocalizedMessage());
return nodeModel;
}
List<String> versionListStr = versionList.getResource();
Iterator<String> iter1 = versionListStr.iterator();
String vs;
while (iter1.hasNext()) {
vs = iter1.next();
InventoryNode in = (InventoryNode) rn.getNodeVersions().get(vs);
InventoryWrapper inwr = new InventoryWrapper(in.getVersionId(), in.getCreationDate(), group, in.getConfigurationUrl());
ranlist.add(inwr);
}
nodeModel.put("grouptable", ranlist);
return nodeModel;
}
Aggregations