Skip to content

Commit

Permalink
Pull out default snmp set to new method
Browse files Browse the repository at this point in the history
  • Loading branch information
mwodahl committed Mar 26, 2024
1 parent 1449bf0 commit fd31aea
Showing 1 changed file with 23 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,8 @@ public static class RSU extends OdeObject {
public RSU() {
super();

String defaultSnmpProtocol = System.getenv("DEFAULT_SNMP_PROTOCOL");
if (defaultSnmpProtocol != null) {
switch (defaultSnmpProtocol) {
case "FOURDOT1":
this.snmpProtocol = SnmpProtocol.FOURDOT1;
break;
case "NTCIP1218":
this.snmpProtocol = SnmpProtocol.NTCIP1218;
break;
default:
this.snmpProtocol = SnmpProtocol.FOURDOT1;
break;
}
} else {
this.snmpProtocol = SnmpProtocol.FOURDOT1;
}
setDefaultSnmpProtocol();

}

public RSU(String rsuTarget, String rsuUsername, String rsuPassword, int rsuRetries, int rsuTimeout) {
Expand All @@ -59,22 +45,8 @@ public RSU(String rsuTarget, String rsuUsername, String rsuPassword, int rsuRetr
this.rsuRetries = rsuRetries;
this.rsuTimeout = rsuTimeout;

String defaultSnmpProtocol = System.getenv("DEFAULT_SNMP_PROTOCOL");
if (defaultSnmpProtocol != null) {
switch (defaultSnmpProtocol) {
case "FOURDOT1":
this.snmpProtocol = SnmpProtocol.FOURDOT1;
break;
case "NTCIP1218":
this.snmpProtocol = SnmpProtocol.NTCIP1218;
break;
default:
this.snmpProtocol = SnmpProtocol.FOURDOT1;
break;
}
} else {
this.snmpProtocol = SnmpProtocol.FOURDOT1;
}
setDefaultSnmpProtocol();

}

public RSU(String rsuTarget, String rsuUsername, String rsuPassword, int rsuRetries, int rsuTimeout, SnmpProtocol snmpProtocol) {
Expand Down Expand Up @@ -138,6 +110,25 @@ public void setSnmpProtocol(SnmpProtocol snmpProtocol) {
this.snmpProtocol = snmpProtocol;
}

public void setDefaultSnmpProtocol() {
String defaultSnmpProtocol = System.getenv("DEFAULT_SNMP_PROTOCOL");
if (defaultSnmpProtocol != null) {
switch (defaultSnmpProtocol) {
case "FOURDOT1":
this.snmpProtocol = SnmpProtocol.FOURDOT1;
break;
case "NTCIP1218":
this.snmpProtocol = SnmpProtocol.NTCIP1218;
break;
default:
this.snmpProtocol = SnmpProtocol.FOURDOT1;
break;
}
} else {
this.snmpProtocol = SnmpProtocol.FOURDOT1;
}
}

@Override
public int hashCode() {
final int prime = 31;
Expand Down

0 comments on commit fd31aea

Please sign in to comment.