use of org.opennms.netmgt.config.datacollection.MibObject in project opennms by OpenNMS.
the class OnmsSnmpCollection method loadAttributeTypes.
/**
* <p>loadAttributeTypes</p>
*
* @param agent a {@link org.opennms.netmgt.collection.api.CollectionAgent} object.
* @param ifType a int.
* @return a {@link java.util.List} object.
*/
public List<SnmpAttributeType> loadAttributeTypes(SnmpCollectionAgent agent, int ifType) {
String sysObjectId = agent.getSysObjectId();
String hostAddress = agent.getHostAddress();
List<MibObject> oidList = getDataCollectionConfigDao().getMibObjectList(getName(), sysObjectId, hostAddress, ifType);
Map<String, AttributeGroupType> groupTypes = new HashMap<String, AttributeGroupType>();
List<SnmpAttributeType> typeList = new LinkedList<SnmpAttributeType>();
for (MibObject mibObject : oidList) {
String instanceName = mibObject.getInstance();
AttributeGroupType groupType = findGroup(groupTypes, mibObject);
SnmpAttributeType attrType = SnmpAttributeType.create(getResourceType(agent, instanceName), getName(), mibObject, groupType);
groupType.addAttributeType(attrType);
typeList.add(attrType);
}
LOG.debug("getAttributeTypes({}, {}): {}", agent, ifType, typeList);
return typeList;
}
use of org.opennms.netmgt.config.datacollection.MibObject in project opennms by OpenNMS.
the class OnmsSnmpCollection method loadAliasAttributeTypes.
/**
* <p>loadAliasAttributeTypes</p>
*
* @param agent a {@link org.opennms.netmgt.collection.api.CollectionAgent} object.
* @return a {@link java.util.List} object.
*/
public List<SnmpAttributeType> loadAliasAttributeTypes(SnmpCollectionAgent agent) {
IfAliasResourceType resType = getIfAliasResourceType(agent);
MibObject ifAliasMibObject = new MibObject();
ifAliasMibObject.setOid(".1.3.6.1.2.1.31.1.1.1.18");
ifAliasMibObject.setAlias("ifAlias");
ifAliasMibObject.setType("string");
ifAliasMibObject.setInstance("ifIndex");
ifAliasMibObject.setGroupName("aliasedResource");
ifAliasMibObject.setGroupIfType(AttributeGroupType.IF_TYPE_ALL);
AttributeGroupType groupType = new AttributeGroupType(ifAliasMibObject.getGroupName(), ifAliasMibObject.getGroupIfType());
SnmpAttributeType type = SnmpAttributeType.create(resType, resType.getCollectionName(), ifAliasMibObject, groupType);
return Collections.singletonList(type);
}
use of org.opennms.netmgt.config.datacollection.MibObject in project opennms by OpenNMS.
the class MockDataCollectionConfig method createMibObject.
private MibObject createMibObject(String alias, String oid, String instance, String type) {
MibObject mibObj = new MibObject();
mibObj.setGroupName("test");
mibObj.setAlias(alias);
mibObj.setOid(oid);
mibObj.setType(type);
mibObj.setInstance(instance);
mibObj.setGroupName("ifIndex".equals(instance) ? "interface" : "node");
mibObj.setGroupIfType("ifIndex".equals(instance) ? AttributeGroupType.IF_TYPE_ALL : AttributeGroupType.IF_TYPE_IGNORE);
return mibObj;
}
use of org.opennms.netmgt.config.datacollection.MibObject in project opennms by OpenNMS.
the class MockDataCollectionConfig method defineAttributeType.
public MibObject defineAttributeType(String alias, String oid, String instance, String type) {
MibObject mibObj = createAttributeType(alias, oid, instance, type);
getAttrMap().put(mibObj.getAlias(), mibObj);
getAttrMap().put(mibObj.getOid(), mibObj);
return mibObj;
}
use of org.opennms.netmgt.config.datacollection.MibObject in project opennms by OpenNMS.
the class MockDataCollectionConfig method addAttributeType.
public void addAttributeType(String alias, String oid, String inst, String type) {
MibObject attrType = getAttributeType(alias, oid, inst, type);
getAttrList().add(attrType);
}
Aggregations