mirror of
				https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
				synced 2025-10-31 18:47:57 +00:00 
			
		
		
		
	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:
		| @@ -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,26 +1196,25 @@ 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 (radiusMetrics.hasLatency()) { | ||||
|                     networkProbeMetrics.setRadiusLatencyInMs(radiusMetrics.getLatency());                 | ||||
|                 }  | ||||
|                     if (networkProbe.getVlanProbe().hasObsV200RadiusState()) { | ||||
|                         switch (networkProbe.getVlanProbe().getObsV200RadiusState()) { | ||||
|                 if (radiusMetrics.hasRadiusState()) { | ||||
|  | ||||
|                     switch (radiusMetrics.getRadiusState()) { | ||||
|                         case SUD_down: | ||||
|                             networkProbeMetrics.setRadiusState(StateUpDownError.disabled); | ||||
|                             break; | ||||
| @@ -1228,24 +1227,17 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { | ||||
|                         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 (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); | ||||
| @@ -1260,7 +1252,9 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { | ||||
|                             networkProbeMetrics.setDhcpState(StateUpDownError.UNSUPPORTED); | ||||
|                     }                    | ||||
|                 }                 | ||||
|  | ||||
|                 if (vlanMetrics.hasLatency()) { | ||||
|                     networkProbeMetrics.setDhcpLatencyMs(vlanMetrics.getLatency()); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             networkProbeMetricsList.add(networkProbeMetrics); | ||||
|   | ||||
| @@ -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")); | ||||
|  | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Mike Hansen
					Mike Hansen