public void setPort(int port) { m_config.setPort(port); }
public void setPort(int port) { m_config.setPort(port); }
public void setPort(int port) { m_config.setPort(port); }
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; } }
@Override public SnmpAgentConfig getAgentConfig(final InetAddress address, String location) { final SnmpAgentConfigProxyMapper mapper = SnmpAgentConfigProxyMapper.getInstance(); final SnmpAgentAddress agentAddress = mapper.getAddress(address); final String addressString = str(address); if (agentAddress == null) { LOG.debug( "No agent address mapping found for {}! Try adding a @JUnitSnmpAgent(host=\"{}\", resource=\"...\" entry...", addressString, addressString); return super.getAgentConfig(address, location); } final SnmpAgentConfig config = new SnmpAgentConfig(agentAddress.getAddress()); config.setProxyFor(address); config.setPort(agentAddress.getPort()); LOG.debug("proxying {} -> {}", addressString, agentAddress); return config; }
agentConfig.setPort(getPort());
@Override public SnmpAgentConfig getAgentConfig(final InetAddress address, String location) { final SnmpAgentConfigProxyMapper mapper = SnmpAgentConfigProxyMapper.getInstance(); final SnmpAgentAddress agentAddress = mapper.getAddress(address); final String addressString = str(address); if (agentAddress == null) { LOG.debug( "No agent address mapping found for {}! Try adding a @JUnitSnmpAgent(host=\"{}\", resource=\"...\" entry...", addressString, addressString); return super.getAgentConfig(address, location); } final SnmpAgentConfig config = new SnmpAgentConfig(agentAddress.getAddress()); config.setProxyFor(address); config.setPort(agentAddress.getPort()); LOG.debug("proxying {} -> {}", addressString, agentAddress); return config; }
private SnmpAgentConfig getAgentConfig(InetAddress ipaddr) { // Retrieve this interface's SNMP peer object SnmpAgentConfig agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(ipaddr); if (agentConfig == null) { throw new IllegalStateException("SnmpAgentConfig object not available for interface " + ipaddr); } agentConfig.hashCode(); // Set timeout and retries on SNMP peer object agentConfig.setTimeout(ParameterMap.getKeyedInteger(m_parameters, "timeout", agentConfig.getTimeout())); agentConfig.setRetries(ParameterMap.getKeyedInteger(m_parameters, "retry", ParameterMap.getKeyedInteger(m_parameters, "retries", agentConfig.getRetries()))); agentConfig.setPort(ParameterMap.getKeyedInteger(m_parameters, "port", agentConfig.getPort())); return agentConfig; }
/** * Gets the SNMP agent configuration. * * @return the SNMP agent configuration */ public SnmpAgentConfig getAgentConfig() { SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(destinationAddress, version.intValue()); if (destinationPort > 0) { config.setPort(destinationPort); } if ((version.isV1() || version.isV2()) && community != null) { config.setReadCommunity(community); } return config; }
agentConfig.setPort(ParameterMap.getKeyedInteger(m_parameters, "port", agentConfig.getPort()));
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 SnmpAgentConfig configureAgent(MonitoredService svc, Map<String, Object> parameters) { // Retrieve this interface's SNMP peer object // final SnmpAgentConfig agentConfig = getAgentConfig(svc, parameters); LOG.debug("poll: setting SNMP peer attribute for interface {}", InetAddressUtils.str(svc.getAddress())); agentConfig.setTimeout(ParameterMap.getKeyedInteger(parameters, "timeout", agentConfig.getTimeout())); agentConfig.setRetries(ParameterMap.getKeyedInteger(parameters, "retry", ParameterMap.getKeyedInteger(parameters, "retries", agentConfig.getRetries()))); agentConfig.setPort(ParameterMap.getKeyedInteger(parameters, "port", agentConfig.getPort())); return agentConfig; }
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; }
/** * <p>configureAgentPTR</p> * * @param agentConfig a {@link org.opennms.netmgt.snmp.SnmpAgentConfig} object. */ protected void configureAgentPTR(SnmpAgentConfig agentConfig) { if (getPort() > 0) { agentConfig.setPort(getPort()); } if (getTimeout() > 0) { agentConfig.setTimeout(getTimeout()); } if (getRetries() > -1) { agentConfig.setRetries(getRetries()); } }
ipAddr = InetAddressUtils.addr(getIpaddress()); SnmpAgentConfig agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(ipAddr); if (hasPort) agentConfig.setPort(port); if (hasTimeout) agentConfig.setTimeout(timeout); if (hasRetries) agentConfig.setRetries(retries);
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); } }
/** * <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; }