public void setVersion(int version) { m_config.setVersion(version); }
public void setVersion(int version) { m_config.setVersion(version); }
public void setVersion(int version) { m_config.setVersion(version); }
/** * <p>configureAgentVersion</p> * * @param agentConfig a {@link org.opennms.netmgt.snmp.SnmpAgentConfig} object. */ protected void configureAgentVersion(SnmpAgentConfig agentConfig) { if (getForceVersion() != null) { String version = getForceVersion(); // TODO: Deprecate the snmpv1, snmpv2, snmpv2c, snmpv3 params in favor of more-used v1, v2c, and v3 // @see http://issues.opennms.org/browse/NMS-7518 if ("v1".equalsIgnoreCase(version) || "snmpv1".equalsIgnoreCase(version)) { agentConfig.setVersion(SnmpAgentConfig.VERSION1); } else if ("v2".equalsIgnoreCase(version) || "v2c".equalsIgnoreCase(version) || "snmpv2".equalsIgnoreCase(version) || "snmpv2c".equalsIgnoreCase(version)) { agentConfig.setVersion(SnmpAgentConfig.VERSION2C); } else if ("v3".equalsIgnoreCase(version) || "snmpv3".equalsIgnoreCase(version)) { agentConfig.setVersion(SnmpAgentConfig.VERSION3); } } }
protected SnmpAgentConfig buildAgentConfig(String address, int port, String community, PDU pdu) throws UnknownHostException { SnmpAgentConfig config = new SnmpAgentConfig(); config.setAddress(InetAddress.getByName(address)); config.setPort(port); config.setVersion(pdu instanceof PDUv1 ? SnmpAgentConfig.VERSION1 : SnmpAgentConfig.VERSION2C); return config; }
protected SnmpAgentConfig buildAgentConfig(String address, int port, String community, PDU pdu) throws UnknownHostException { SnmpAgentConfig config = new SnmpAgentConfig(); config.setAddress(InetAddress.getByName(address)); config.setPort(port); config.setVersion(pdu instanceof PDUv1 ? SnmpAgentConfig.VERSION1 : SnmpAgentConfig.VERSION2C); return config; }
protected SnmpAgentConfig buildAgentConfig(String address, int port, String community, PDU pdu) throws UnknownHostException { SnmpAgentConfig config = new SnmpAgentConfig(); config.setAddress(InetAddress.getByName(address)); config.setPort(port); config.setVersion(pdu instanceof PDUv1 ? SnmpAgentConfig.VERSION1 : SnmpAgentConfig.VERSION2C); return config; }
public static SnmpAgentConfig fromMap(Map<String, String> map) { SnmpAgentConfig config = new SnmpAgentConfig(); if (map.get("address") != null) config.setAddress(InetAddrUtils.addr(map.get("address"))); if (map.get("proxyFor") != null) config.setProxyFor(InetAddrUtils.addr(map.get("proxyFor"))); if (map.get("port") != null) config.setPort(Integer.parseInt(map.get("port"))); if (map.get("timeout") != null) config.setTimeout(Integer.parseInt(map.get("timeout"))); if (map.get("retries") != null) config.setRetries(Integer.parseInt(map.get("retries"))); if (map.get("max-vars-per-pdu") != null) config.setMaxVarsPerPdu(Integer.parseInt(map.get("max-vars-per-pdu"))); if (map.get("max-repetitions") != null) config.setMaxRepetitions(Integer.parseInt(map.get("max-repetitions"))); if (map.get("max-request-size") != null) config.setMaxRequestSize(Integer.parseInt(map.get("max-request-size"))); if (map.get("version") != null) config.setVersion(Integer.parseInt(map.get("version"))); if (map.get("security-level") != null) config.setSecurityLevel(Integer.parseInt(map.get("security-level"))); if (map.get("security-name") != null) config.setSecurityName(map.get("security-name")); if (map.get("auth-passphrase") != null) config.setAuthPassPhrase(map.get("auth-passphrase")); if (map.get("auth-protocol") != null) config.setAuthProtocol(map.get("auth-protocol")); if (map.get("priv-passphrase") != null) config.setPrivPassPhrase(map.get("priv-passphrase")); if (map.get("priv-protocol") != null) config.setPrivProtocol(map.get("priv-protocol")); if (map.get("context-name") != null) config.setContextName(map.get("context-name")); if (map.get("engine-id") != null) config.setEngineId(map.get("engine-id")); if (map.get("context-engine-id") != null) config.setContextEngineId(map.get("context-engine-id")); if (map.get("enterprise-id") != null) config.setEnterpriseId(map.get("enterprise-id")); if (map.get("read-community") != null) config.setReadCommunity(map.get("read-community")); if (map.get("write-community") != null) config.setWriteCommunity(map.get("write-community")); return config; } }
agentConfig.setVersion(SnmpAgentConfig.VERSION1); } else if ("v2".equalsIgnoreCase(version) || "v2c".equalsIgnoreCase(version) || "snmpv2".equalsIgnoreCase(version) || "snmpv2c".equalsIgnoreCase(version)) { agentConfig.setVersion(SnmpAgentConfig.VERSION2C); } else if ("v3".equalsIgnoreCase(version) || "snmpv3".equalsIgnoreCase(version)) { agentConfig.setVersion(SnmpAgentConfig.VERSION3);
public SnmpAgentConfig getAgentConfig(final InetAddress agentInetAddress, String location, final int requestedSnmpVersion) { getReadLock().lock(); try { if (getSnmpConfig() == null) { final SnmpAgentConfig agentConfig = new SnmpAgentConfig(agentInetAddress); if (requestedSnmpVersion == SnmpAgentConfig.VERSION_UNSPECIFIED) { agentConfig.setVersion(SnmpAgentConfig.DEFAULT_VERSION); } else { agentConfig.setVersion(requestedSnmpVersion); } return agentConfig; } final SnmpAgentConfig agentConfig = new SnmpAgentConfig(agentInetAddress); // Now set the defaults from the getSnmpConfig() setSnmpAgentConfig(agentConfig, new Definition(), requestedSnmpVersion); // Set the values from best matching definition final AddressSnmpConfigVisitor visitor = new AddressSnmpConfigVisitor(agentInetAddress, location); getSnmpConfig().visit(visitor); final Definition matchingDef = visitor.getDefinition(); if (matchingDef != null) { setSnmpAgentConfig(agentConfig, matchingDef, requestedSnmpVersion); } return agentConfig; } finally { getReadLock().unlock(); } }
protected SnmpAgentConfig buildAgentConfig(String address, int port, int securityLevel, String securityName, String authPassPhrase, String authProtocol, String privPassPhrase, String privProtocol, PDU pdu) throws UnknownHostException, Exception { if (! (pdu instanceof ScopedPDU)) { throw new SnmpException("PDU is not a ScopedPDU (this should not happen)"); } SnmpAgentConfig config = new SnmpAgentConfig(); config.setAddress(InetAddress.getByName(address)); config.setPort(port); config.setVersion(SnmpAgentConfig.VERSION3); config.setSecurityLevel(securityLevel); config.setSecurityName(securityName); config.setAuthPassPhrase(authPassPhrase); config.setAuthProtocol(authProtocol); config.setPrivPassPhrase(privPassPhrase); config.setPrivProtocol(privProtocol); return config; }
protected SnmpAgentConfig buildAgentConfig(String address, int port, int securityLevel, String securityName, String authPassPhrase, String authProtocol, String privPassPhrase, String privProtocol, PDU pdu) throws UnknownHostException, Exception { if (! (pdu instanceof ScopedPDU)) { throw new SnmpException("PDU is not a ScopedPDU (this should not happen)"); } SnmpAgentConfig config = new SnmpAgentConfig(); config.setAddress(InetAddress.getByName(address)); config.setPort(port); config.setVersion(SnmpAgentConfig.VERSION3); config.setSecurityLevel(securityLevel); config.setSecurityName(securityName); config.setAuthPassPhrase(authPassPhrase); config.setAuthProtocol(authProtocol); config.setPrivPassPhrase(privPassPhrase); config.setPrivProtocol(privProtocol); return config; }
private void setCommonAttributes(final SnmpAgentConfig agentConfig, final Definition def, final int version) { agentConfig.setVersion(version); agentConfig.setPort(def.getPort()); agentConfig.setRetries(def.getRetry()); agentConfig.setTimeout((int)def.getTimeout()); agentConfig.setMaxRequestSize(def.getMaxRequestSize()); agentConfig.setMaxVarsPerPdu(def.getMaxVarsPerPdu()); agentConfig.setMaxRepetitions(def.getMaxRepetitions()); InetAddress proxyHost = InetAddressUtils.addr(def.getProxyHost()); if (proxyHost != null) { agentConfig.setProxyFor(agentConfig.getAddress()); agentConfig.setAddress(proxyHost); } }
for (SnmpV3User user : snmpUsers) { SnmpAgentConfig config = new SnmpAgentConfig(); config.setVersion(SnmpConfiguration.VERSION3); config.setSecurityName(user.getSecurityName()); config.setAuthProtocol(user.getAuthProtocol());
for (SnmpV3User user : snmpUsers) { SnmpAgentConfig config = new SnmpAgentConfig(); config.setVersion(SnmpConfiguration.VERSION3); config.setSecurityName(user.getSecurityName()); config.setAuthProtocol(user.getAuthProtocol());
/** * <p>getAgentConfig</p> * * @return a {@link org.opennms.netmgt.snmp.SnmpAgentConfig} object. */ public SnmpAgentConfig getAgentConfig() { SnmpAgentConfig agentConfig = getCollectionAgent().getAgentConfig(); agentConfig.setPort(m_snmpCollection.getSnmpPort(agentConfig.getPort())); agentConfig.setRetries(m_snmpCollection.getSnmpRetries(agentConfig.getRetries())); agentConfig.setTimeout(m_snmpCollection.getSnmpTimeout(agentConfig.getTimeout())); agentConfig.setReadCommunity(m_snmpCollection.getSnmpReadCommunity(agentConfig.getReadCommunity())); agentConfig.setWriteCommunity(m_snmpCollection.getSnmpWriteCommunity(agentConfig.getWriteCommunity())); agentConfig.setProxyFor(m_snmpCollection.getSnmpProxyFor(agentConfig.getProxyFor())); agentConfig.setVersion(m_snmpCollection.getSnmpVersion(agentConfig.getVersion())); agentConfig.setMaxVarsPerPdu(m_snmpCollection.getSnmpMaxVarsPerPdu(agentConfig.getMaxVarsPerPdu())); agentConfig.setMaxRepetitions(m_snmpCollection.getSnmpMaxRepetitions(agentConfig.getMaxRepetitions())); agentConfig.setMaxRequestSize(m_snmpCollection.getSnmpMaxRequestSize(agentConfig.getMaxRequestSize())); agentConfig.setSecurityName(m_snmpCollection.getSnmpSecurityName(agentConfig.getSecurityName())); agentConfig.setAuthPassPhrase(m_snmpCollection.getSnmpAuthPassPhrase(agentConfig.getAuthPassPhrase())); agentConfig.setAuthProtocol(m_snmpCollection.getSnmpAuthProtocol(agentConfig.getAuthProtocol())); agentConfig.setPrivPassPhrase(m_snmpCollection.getSnmpPrivPassPhrase(agentConfig.getPrivPassPhrase())); agentConfig.setPrivProtocol(m_snmpCollection.getSnmpPrivProtocol(agentConfig.getPrivProtocol())); return agentConfig; }