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

View File

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