/** * Normally this would return domain objects or something else than this... */ public List<List<String>> getTableAsStrings(OID[] oids) { TableUtils tUtils = new TableUtils(snmp, new DefaultPDUFactory()); @SuppressWarnings("unchecked") List<TableEvent> events = tUtils.getTable(getTarget(), oids, null, null); List<List<String>> list = new ArrayList<List<String>>(); for (TableEvent event : events) { if(event.isError()) { throw new RuntimeException(event.getErrorMessage()); } List<String> strList = new ArrayList<String>(); list.add(strList); for(VariableBinding vb: event.getColumns()) { strList.add(vb.getVariable().toString()); } } return list; }
TableRequest req = createTableRequest(target, columnOIDs, listener, null, lowerBoundIndex,
snmp.listen(); TableUtils tableUtils = new TableUtils(snmp, this); tableUtils.setMaxNumRowsPerPDU(maxRepetitions); Counter32 counter = new Counter32(); tableUtils.getDenseTable(target, columns, listener, counter, lowerBoundIndex, upperBoundIndex); tableUtils.getTable(target, columns, listener, counter, lowerBoundIndex, upperBoundIndex);
public TabularIterator(SnmpConnection starter, Collection<OID> oids) { if(starter != null && starter.isStarted()) { Target snmpTarget = starter.getConnection(); if(snmpTarget != null) { DefaultPDUFactory localfactory = new DefaultPDUFactory(); TableUtils tableRet = new TableUtils(starter.getSnmp(), localfactory); tableRet.setMaxNumColumnsPerPDU(30); OID[] oidTab = new OID[oids.size()]; oids.toArray(oidTab); tabIterator = tableRet.getTable(snmpTarget, oidTab, null, null).iterator(); } } }
OID lowerBoundIndex, OID upperBoundIndex) { getTable(target, columnOIDs, listener, userObject, lowerBoundIndex, upperBoundIndex, SparseTableMode.sparseTable);
/** * <p>fillTreeFromSNMP.</p> * * @param root a {@link net.itransformers.snmp2xml4j.snmptoolkit.Node} object. * @throws java.io.IOException if any. */ protected void fillTreeFromSNMP(Node root) throws IOException { CounterSupport.getInstance().addCounterListener(new DefaultCounterListener()); // AbstractTransportMapping transport = new DefaultUdpTransportMapping(localAddress); // TableUtils tutils = new TableUtils(snmp, pduFactory); fillTreeFromSNMP(root, tutils); }
isCheckLexicographicOrdering() ? new LastReceived(lastReceived) : null); sendRequest(pdu, target, columnsOfRequest);
@Override public Map<OID, Object> doSnmpGet(SnmpConnection cnx, Collection<OID> oids) { Target snmpTarget = cnx.getConnection(); Snmp snmp = cnx.getSnmp(); if(cnx.isStarted() && snmpTarget != null && snmp != null) { TableUtils tableRet = new TableUtils(snmp, cnx.getPdufactory()); tableRet.setMaxNumColumnsPerPDU(30); OID[] oidTab = new OID[oids.size()]; oids.toArray(oidTab); SnmpVars retValue = new SnmpVars(); for(TableEvent te: tableRet.getTable(snmpTarget, oidTab, null, null)) { if(!cnx.isStarted()) { retValue = new SnmpVars(); break; } if(!te.isError()) { retValue.join(te.getColumns()); } } return retValue; } return Collections.emptyMap(); } },
List table = tutils.getTable(getTarget(), oids, new OID("0"), null);
isCheckLexicographicOrdering() ? new LastReceived(lastReceived) : null); sendRequest(pdu, target, columnsOfRequest); } catch (Exception ex) {
private synchronized void listLoggers(Snmp snmp, Target target, PDUFactory pduFactory) { TableUtils tableUtils = new TableUtils(snmp, pduFactory); OID lowerBound = null; OID upperBound = null; String filter = (String) ArgumentParser.getValue(parameters, "filter", 0); if (filter != null) { OctetString filterString = new OctetString(filter); lowerBound = filterString.toSubIndex(true); upperBound = lowerBound.nextPeer(); } LoggerListListener lll = new LoggerListListener(); tableUtils.getTable(target, SNMP4J_LOGGER_OIDS, lll, this, lowerBound, upperBound); while (!lll.isFinished()) { try { wait(); } catch (InterruptedException ex) { } } }
snmp.listen(); TableUtils tableUtils = new TableUtils(snmp, this); tableUtils.setMaxNumRowsPerPDU(maxRepetitions); Counter32 counter = new Counter32(); tableUtils.getDenseTable(target, columns, listener, counter, lowerBoundIndex, upperBoundIndex); tableUtils.getTable(target, columns, listener, counter, lowerBoundIndex, upperBoundIndex);
TableRequest req = createTableRequest(target, columnOIDs, listener, null, lowerBoundIndex,
row.add(vb); if (isCheckLexicographicOrdering()) { OID requested = event.getRequest().get(c).getOid(); if (id.compareTo(requested) <= 0) { lastMinIndex) < 0))) { TableEvent tableEvent = getTableEvent(); if (isCheckLexicographicOrdering() && (tableEvent != null && tableEvent.status == TableEvent.STATUS_WRONG_ORDER && numLexicographicErrors >= ignoreMaxLexicographicRowOrderingErrors)) {
private synchronized void listLoggers(Snmp snmp, Target target, PDUFactory pduFactory) { TableUtils tableUtils = new TableUtils(snmp, pduFactory); OID lowerBound = null; OID upperBound = null; String filter = (String) ArgumentParser.getValue(parameters, "filter", 0); if (filter != null) { OctetString filterString = new OctetString(filter); lowerBound = filterString.toSubIndex(true); upperBound = lowerBound.nextPeer(); } LoggerListListener lll = new LoggerListListener(); tableUtils.getTable(target, SNMP4J_LOGGER_OIDS, lll, this, lowerBound, upperBound); while (!lll.isFinished()) { try { wait(); } catch (InterruptedException ex) { // ignore } } }
public int table() throws IOException { TableUtils tableUtils = new TableUtils(snmp, pduFactory); Integer maxRep = ((InnerPDUFactory) pduFactory).getMaxRepetitions(); if (maxRep != null) { tableUtils.setMaxNumRowsPerPDU(maxRep); tableUtils.getDenseTable(target, columns, listener, counter, lowerBoundIndex, upperBoundIndex); } else { tableUtils.getTable(target, columns, listener, counter, lowerBoundIndex, upperBoundIndex);
TableRequest req = createTableRequest(target, columnOIDs, listener, null, lowerBoundIndex,
row.add(vb); if (isCheckLexicographicOrdering()) { OID requested = event.getRequest().get(c).getOid(); if (id.compareTo(requested) <= 0) { ((rowCache.getFirst()).getRowIndex().compareTo(lastMinIndex) < 0))) { TableEvent tableEvent = getNextTableEvent(); if (isCheckLexicographicOrdering() && (tableEvent != null && tableEvent.status == TableEvent.STATUS_WRONG_ORDER && numLexicographicErrors >= ignoreMaxLexicographicRowOrderingErrors)) {
private synchronized void listLoggers(Snmp snmp, Target target, PDUFactory pduFactory) { TableUtils tableUtils = new TableUtils(snmp, pduFactory); OID lowerBound = null; OID upperBound = null; String filter = (String) ArgumentParser.getValue(parameters, "filter", 0); if (filter != null) { OctetString filterString = new OctetString(filter); lowerBound = filterString.toSubIndex(true); upperBound = lowerBound.nextPeer(); } LoggerListListener lll = new LoggerListListener(); tableUtils.getTable(target, SNMP4J_LOGGER_OIDS, lll, this, lowerBound, upperBound); while (!lll.isFinished()) { try { wait(); } catch (InterruptedException ex) { // ignore } } }
target.setSecurityName(dhKickstart); TableUtils tableUtils = new TableUtils(session, pduFactory); OID[] columns = new OID[] { oidUsmDHKickstartMyPublic, oidUsmDHKickstartMgrPublic, oidUsmDHKickstartSecurityName }; List<TableEvent> rows = tableUtils.getTable(target, columns, null, null);