mirror of https://github.com/apache/nifi.git
NIFI-13946 Fixed SNMP Integration Test Failures
This closes #9469 - Set 0.0.0.0 as listen address for ListenTrapSNMP - Removed SHA and MD5 protocols for SNMP Version 3 Signed-off-by: Joseph Witt <joewitt@apache.org>
This commit is contained in:
parent
c68f6910ba
commit
bc279b5e51
|
@ -23,14 +23,19 @@ import org.snmp4j.smi.UdpAddress;
|
|||
import org.snmp4j.transport.DefaultUdpTransportMapping;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
|
||||
public class SNMPManagerFactory {
|
||||
|
||||
private static final String ALL_ADDRESSES = "0.0.0.0";
|
||||
|
||||
public Snmp createSnmpManagerInstance(final SNMPConfiguration configuration) {
|
||||
final int port = configuration.getManagerPort();
|
||||
final Snmp snmpManager;
|
||||
try {
|
||||
final DefaultUdpTransportMapping transportMapping = new DefaultUdpTransportMapping(new UdpAddress(port));
|
||||
final InetAddress listenAddress = InetAddress.getByName(ALL_ADDRESSES);
|
||||
final UdpAddress udpAddress = new UdpAddress(listenAddress, port);
|
||||
final DefaultUdpTransportMapping transportMapping = new DefaultUdpTransportMapping(udpAddress);
|
||||
snmpManager = new Snmp(transportMapping);
|
||||
snmpManager.listen();
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -24,7 +24,7 @@ public class SNMPV3ConfigurationFactory implements SNMPConfigurationFactory {
|
|||
// V3 security (users are set in test agents)
|
||||
public static final String SECURITY_LEVEL = "authPriv";
|
||||
public static final String SECURITY_NAME = "SHAAES128";
|
||||
public static final String AUTH_PROTOCOL = "SHA";
|
||||
public static final String AUTH_PROTOCOL = "HMAC384SHA512";
|
||||
public static final String AUTH_PASSPHRASE = "SHAAES128AuthPassphrase";
|
||||
public static final String PRIV_PROTOCOL = "AES128";
|
||||
public static final String PRIV_PASSPHRASE = "SHAAES128PrivPassphrase";
|
||||
|
|
|
@ -21,10 +21,8 @@ import org.snmp4j.agent.mo.snmp.StorageType;
|
|||
import org.snmp4j.agent.mo.snmp.VacmMIB;
|
||||
import org.snmp4j.agent.security.MutableVACM;
|
||||
import org.snmp4j.mp.MPv3;
|
||||
import org.snmp4j.security.AuthMD5;
|
||||
import org.snmp4j.security.AuthSHA;
|
||||
import org.snmp4j.security.AuthHMAC384SHA512;
|
||||
import org.snmp4j.security.PrivAES128;
|
||||
import org.snmp4j.security.PrivDES;
|
||||
import org.snmp4j.security.SecurityLevel;
|
||||
import org.snmp4j.security.SecurityModel;
|
||||
import org.snmp4j.security.USM;
|
||||
|
@ -44,30 +42,12 @@ public class TestSNMPV3Agent extends TestAgent {
|
|||
|
||||
@Override
|
||||
protected void addUsmUser(final USM usm) {
|
||||
UsmUser user = new UsmUser(new OctetString("SHA"),
|
||||
AuthSHA.ID,
|
||||
new OctetString("SHAAuthPassword"),
|
||||
null,
|
||||
null);
|
||||
usm.addUser(user.getSecurityName(), usm.getLocalEngineID(), user);
|
||||
user = new UsmUser(new OctetString("SHADES"),
|
||||
AuthSHA.ID,
|
||||
new OctetString("SHADESAuthPassword"),
|
||||
PrivDES.ID,
|
||||
new OctetString("SHADESPrivPassword"));
|
||||
usm.addUser(user.getSecurityName(), usm.getLocalEngineID(), user);
|
||||
user = new UsmUser(new OctetString("MD5DES"),
|
||||
AuthMD5.ID,
|
||||
new OctetString("MD5DESAuthPassword"),
|
||||
PrivDES.ID,
|
||||
new OctetString("MD5DESPrivPassword"));
|
||||
usm.addUser(user.getSecurityName(), usm.getLocalEngineID(), user);
|
||||
user = new UsmUser(new OctetString("SHAAES128"),
|
||||
AuthSHA.ID,
|
||||
UsmUser user = new UsmUser(new OctetString("HMAC384SHA512"),
|
||||
AuthHMAC384SHA512.ID,
|
||||
new OctetString("SHAAES128AuthPassword"),
|
||||
PrivAES128.ID,
|
||||
new OctetString("SHAAES128PrivPassword"));
|
||||
usm.addUser(user.getSecurityName(), usm.getLocalEngineID(), user);
|
||||
usm.addUser(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue