/** * Builds target resource. * @param context Process context */ private void buildTargetResource(ProcessContext context) { if((this.transportMapping == null) || !this.transportMapping.isListening() || (this.snmp == null)) { try { this.transportMapping = new DefaultUdpTransportMapping(); this.snmp = new Snmp(this.transportMapping); if("SNMPv3".equals(context.getProperty(SNMP_VERSION).getValue())) { USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0); SecurityModels.getInstance().addSecurityModel(usm); } this.transportMapping.listen(); } catch (Exception e) { throw new IllegalStateException("Failed to initialize UDP transport mapping", e); } } if (this.snmpTarget == null) { this.snmpTarget = this.createSnmpTarget(context); } if (this.targetResource == null) { this.targetResource = this.finishBuildingTargetResource(context); } }
throw new KettleException( "Null Usm" ); } else { usm = new USM( SecurityProtocols.getInstance(), new OctetString( MPv3.createLocalEngineID() ), 0 ); usm.addUser( new OctetString( userName ), uu ); if ( log.isDebug() ) {
/** * Creates a MPv3 with a default local engine ID. */ public MPv3() { this(createLocalEngineID(), null); }
@Override public byte[] getLocalEngineID() { return MPv3.createLocalEngineID(); }
/** * Creates a MPv3 with a default local engine ID. */ public MPv3() { this(createLocalEngineID(), null); }
/** * Creates a MPv3 with a default local engine ID. */ public MPv3() { this(createLocalEngineID(), null); }
@Override public byte[] getLocalEngineID() { return MPv3.createLocalEngineID(); }
public TSM() { this(new OctetString(MPv3.createLocalEngineID()), false); }
private void initResponder(){ OctetString localEngineID=new OctetString(MPv3.createLocalEngineID()); this.responder = new SnmpRequest(this.requestHandler, log, localEngineID); } // add updateEngineBoots to USM constuctor call
public Agent(String address) throws IOException { // These files does not exist and are not used but has to be specified // Read snmp4j docs for more info super(new File("conf.agent"), new File("bootCounter.agent"), new CommandProcessor( new OctetString(MPv3.createLocalEngineID()))); this.address = address; }
private void initResponder(){ OctetString localEngineID=new OctetString(MPv3.createLocalEngineID()); this.responder = new SnmpRequest(this.requestHandler, log, localEngineID); } // add updateEngineBoots to USM constuctor call
public SNMPAgent(Properties properties) { super(new File(SNMPConstants.BC_FILE), new File(SNMPConstants.CONFIG_FILE), new CommandProcessor(new OctetString(MPv3.createLocalEngineID()))); this.properties = properties; String version = getProperty(SNMPConstants.SNMP_VERSION, SNMPConstants.SNMP_DEFAULT_VERSION); if (SNMPConstants.SNMP_VERSION_1.equals(version)) { this.snmpVersion = SnmpConstants.version1; } else if (SNMPConstants.SNMP_VERSION_2_C.equals(version)) { this.snmpVersion = SnmpConstants.version2c; } else { log.warn("Unsupported SNMP version: " + version + " - Using defaults"); this.snmpVersion = SnmpConstants.version1; } }
/** * Default constructor with random engine ID with the default enterprise ID and a zero engineBoots counter. * The security protocols instance defined by {@link org.snmp4j.security.SecurityProtocols#getInstance()} with the * default protocols is used. * * @since 2.2.4 */ public USM() { this(SecurityProtocols.getInstance().addDefaultProtocols(), new OctetString(MPv3.createLocalEngineID(randomID())), 0); }
/** * Default constructor with random engine ID with the default enterprise ID and a zero engineBoots counter. * The security protocols instance defined by {@link org.snmp4j.security.SecurityProtocols#getInstance()} with the * default protocols is used. * @since 2.2.4 */ public USM() { this(SecurityProtocols.getInstance().addDefaultProtocols(), new OctetString(MPv3.createLocalEngineID(randomID())), 0); }
public MockSnmpAgent(final File confFile, final URL moFile) { super(BOOT_COUNT_FILE, confFile, new CommandProcessor(new OctetString(MPv3.createLocalEngineID(new OctetString("MOCKAGENT"))))); m_moLoader.set(new PropertiesBackedManagedObject()); m_moFile.set(moFile); agent.setWorkerPool(ThreadPool.create("RequestPool", 4)); }
public SnapshotAgent(File bootCounterFile, File configFile, File snapshot) throws IOException { super(bootCounterFile, configFile, new CommandProcessor(new OctetString(MPv3.createLocalEngineID()))); // Alternatively: OctetString.fromHexString("00:00:00:00:00:00:02", ':'); agent.setWorkerPool(ThreadPool.create("RequestPool", 2)); this.snapshot = snapshot; }
public SnapshotAgent(File bootCounterFile, File configFile, File snapshot) throws IOException { super(bootCounterFile, configFile, new CommandProcessor(new OctetString(MPv3.createLocalEngineID()))); // Alternatively: OctetString.fromHexString("00:00:00:00:00:00:02", ':'); agent.setWorkerPool(ThreadPool.create("RequestPool", 2)); this.snapshot = snapshot; }
public MockSnmpAgent(final File confFile, final URL moFile) { super(BOOT_COUNT_FILE, confFile, new CommandProcessor(new OctetString(MPv3.createLocalEngineID(new OctetString("MOCKAGENT"))))); m_moLoader.set(new PropertiesBackedManagedObject()); m_moFile.set(moFile); agent.setWorkerPool(ThreadPool.create("RequestPool", 4)); }
public SNMPAgent(String udpAddress, File bootCounterFile, File configFile) throws IOException { super(bootCounterFile, configFile, new CommandProcessor( new OctetString(MPv3.createLocalEngineID()))); this.agent.setWorkerPool(ThreadPool.create("RequestPool", 4)); this.udpAddress = udpAddress; this.counters = new LinkedList<Counter>(); init(); loadConfig(ImportModes.REPLACE_CREATE); addShutdownHook(); getServer().addContext(new OctetString("public")); finishInit(); }
public void start () throws IOException { this.address = GenericAddress.parse ( this.connectionInformation.getAddress () ); this.transport = new DefaultUdpTransportMapping (); this.snmp = new Snmp ( this.transport ); //MPv3 mpv3 = (MPv3)_snmp.getMessageProcessingModel ( MessageProcessingModel.MPv3 ); final USM usm = new USM ( SecurityProtocols.getInstance (), new OctetString ( MPv3.createLocalEngineID () ), 0 ); SecurityModels.getInstance ().addSecurityModel ( usm ); this.snmp.listen (); }