WIFI-442: APNOS Synthetic client RADIUS probes

Support changes to the Network Probe reporting from the MQTT messages
proto files.
Add/update JUnit tests in concert with above.
This commit is contained in:
Mike Hansen
2020-09-04 15:17:33 -04:00
parent 0869b875c9
commit 6f99d701f3
2 changed files with 39 additions and 45 deletions

View File

@@ -1165,30 +1165,30 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
DNSProbeMetric dnsProbeMetricFromAp = networkProbe.getDnsProbe();
DnsProbeMetric dnsProbeMetric = new DnsProbeMetric();
DnsProbeMetric cloudDnsProbeMetric = new DnsProbeMetric();
if (dnsProbeMetricFromAp.hasLatency()) {
networkProbeMetrics.setDnsLatencyMs(dnsProbeMetricFromAp.getLatency());
dnsProbeMetric.setDnsLatencyMs(dnsProbeMetricFromAp.getLatency());
cloudDnsProbeMetric.setDnsLatencyMs(dnsProbeMetricFromAp.getLatency());
}
if (dnsProbeMetricFromAp.hasState()) {
switch (dnsProbeMetricFromAp.getState()) {
case SUD_down:
networkProbeMetrics.setDnsState(StateUpDownError.disabled);
dnsProbeMetric.setDnsState(StateUpDownError.disabled);
cloudDnsProbeMetric.setDnsState(StateUpDownError.disabled);
break;
case SUD_up:
networkProbeMetrics.setDnsState(StateUpDownError.enabled);
dnsProbeMetric.setDnsState(StateUpDownError.enabled);
cloudDnsProbeMetric.setDnsState(StateUpDownError.enabled);
break;
case SUD_error:
networkProbeMetrics.setDnsState(StateUpDownError.error);
dnsProbeMetric.setDnsState(StateUpDownError.error);
cloudDnsProbeMetric.setDnsState(StateUpDownError.error);
break;
default:
networkProbeMetrics.setDnsState(StateUpDownError.UNSUPPORTED);
dnsProbeMetric.setDnsState(StateUpDownError.UNSUPPORTED);
cloudDnsProbeMetric.setDnsState(StateUpDownError.UNSUPPORTED);
}
}
@@ -1196,56 +1196,48 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
InetAddress ipAddress;
try {
ipAddress = InetAddress.getByName(dnsProbeMetricFromAp.getServerIP());
dnsProbeMetric.setDnsServerIp(ipAddress);
cloudDnsProbeMetric.setDnsServerIp(ipAddress);
} catch (UnknownHostException e) {
LOG.error("Could not get DNS Server IP from network_probe metrics", e);
}
}
dnsProbeResults.add(dnsProbeMetric);
dnsProbeResults.add(cloudDnsProbeMetric);
}
networkProbeMetrics.setDnsProbeResults(dnsProbeResults);
for (RADIUSMetrics radiusMetrics : networkProbe.getRadiusProbeList()) {
if (networkProbe.hasVlanProbe()) {
if (networkProbe.getVlanProbe().hasObsV200RadiusLatency()) {
networkProbeMetrics.setRadiusLatencyInMs(networkProbe.getVlanProbe().getObsV200RadiusLatency());
}
if (networkProbe.getVlanProbe().hasObsV200RadiusState()) {
switch (networkProbe.getVlanProbe().getObsV200RadiusState()) {
case SUD_down:
networkProbeMetrics.setRadiusState(StateUpDownError.disabled);
break;
case SUD_up:
networkProbeMetrics.setRadiusState(StateUpDownError.enabled);
break;
case SUD_error:
networkProbeMetrics.setRadiusState(StateUpDownError.error);
break;
default:
networkProbeMetrics.setRadiusState(StateUpDownError.UNSUPPORTED);
}
}
} else {
// take the average if we don't have from the VLAN Probe
if (radiusMetrics.hasLatencyAve()) {
networkProbeMetrics.setRadiusLatencyInMs(radiusMetrics.getLatencyAve());
if (radiusMetrics.hasLatency()) {
networkProbeMetrics.setRadiusLatencyInMs(radiusMetrics.getLatency());
}
if (radiusMetrics.hasRadiusState()) {
switch (radiusMetrics.getRadiusState()) {
case SUD_down:
networkProbeMetrics.setRadiusState(StateUpDownError.disabled);
break;
case SUD_up:
networkProbeMetrics.setRadiusState(StateUpDownError.enabled);
break;
case SUD_error:
networkProbeMetrics.setRadiusState(StateUpDownError.error);
break;
default:
networkProbeMetrics.setRadiusState(StateUpDownError.UNSUPPORTED);
}
}
}
if (networkProbe.hasVlanProbe()) {
VLANMetrics vlanMetrics = networkProbe.getVlanProbe();
if (vlanMetrics.hasVlanIF()) {
networkProbeMetrics.setVlanIF(vlanMetrics.getVlanIF());
}
if (vlanMetrics.hasDhcpLatency()) {
networkProbeMetrics.setDhcpLatencyMs(vlanMetrics.getDhcpLatency());
}
}
if (vlanMetrics.hasDhcpState()) {
switch (vlanMetrics.getDhcpState()) {
case SUD_down:
networkProbeMetrics.setDhcpState(StateUpDownError.disabled);
@@ -1258,9 +1250,11 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
break;
default:
networkProbeMetrics.setDhcpState(StateUpDownError.UNSUPPORTED);
}
}
}
if (vlanMetrics.hasLatency()) {
networkProbeMetrics.setDhcpLatencyMs(vlanMetrics.getLatency());
}
}
networkProbeMetricsList.add(networkProbeMetrics);

View File

@@ -246,10 +246,10 @@ public class OpensyncExternalIntegrationMqttMessageProcessorTest {
DNSProbeMetric dnsProbeMetric = DNSProbeMetric.getDefaultInstance().toBuilder().setLatency(10)
.setState(StateUpDown.SUD_up).setServerIP(ip.getHostName()).build();
RADIUSMetrics radiusProbeMetric = RADIUSMetrics.getDefaultInstance().toBuilder().setLatencyAve(10).build();
VLANMetrics vlanMetrics = VLANMetrics.getDefaultInstance().toBuilder().setDhcpLatency(10)
.setDhcpState(StateUpDown.SUD_up).setVlanIF("vlan-1").setObsV200RadiusLatency(15)
.setObsV200RadiusState(StateUpDown.SUD_up).build();
RADIUSMetrics radiusProbeMetric = RADIUSMetrics.getDefaultInstance().toBuilder().setLatency(10)
.setRadiusState(StateUpDown.SUD_up).setServerIP(ip.getHostName()).build();
VLANMetrics vlanMetrics = VLANMetrics.getDefaultInstance().toBuilder().setLatency(10)
.setDhcpState(StateUpDown.SUD_up).setVlanIF("vlan-1").build();
NetworkProbe networkProbe = NetworkProbe.getDefaultInstance().toBuilder().setVlanProbe(vlanMetrics)
.setDnsProbe(dnsProbeMetric).addRadiusProbe(radiusProbeMetric).build();
@@ -262,12 +262,12 @@ public class OpensyncExternalIntegrationMqttMessageProcessorTest {
assertNotNull(apNodeMetrics.getNetworkProbeMetrics());
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getDhcpLatencyMs() == 10);
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getDnsLatencyMs() == 10);
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getDhcpLatencyMs() == 10);
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getRadiusState().equals(StateUpDownError.enabled));
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getDhcpState().equals(StateUpDownError.enabled));
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getDnsState().equals(StateUpDownError.enabled));
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getRadiusLatencyInMs() == 15);
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getRadiusLatencyInMs() == 10);
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getVlanIF().equals("vlan-1"));
}