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; } public MibObject createAttributeType(String alias, String oid, String instance, String type) {
/** * <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); }
aMibObject.setGroupName(groupName); aMibObject.setGroupIfType(groupIfType); aMibObject.setOid(mibObj.getOid());