mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-02 11:37:49 +00:00
WIFI-769: Gateway Integration with AP and Cloud Backend
Publish events for VideoVoiceReport(s) received from AP.
This commit is contained in:
@@ -72,9 +72,23 @@ import com.telecominfraproject.wlan.status.equipment.report.models.OperatingSyst
|
||||
import com.telecominfraproject.wlan.status.equipment.report.models.RadioUtilizationReport;
|
||||
import com.telecominfraproject.wlan.status.models.Status;
|
||||
import com.telecominfraproject.wlan.status.models.StatusDataType;
|
||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeEventType;
|
||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeSipCallReportEvent;
|
||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeSipCallStartEvent;
|
||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeSipCallStopEvent;
|
||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeStreamingStartEvent;
|
||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeStreamingStartSessionEvent;
|
||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeStreamingStopEvent;
|
||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.SIPCallReportReason;
|
||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.SipCallStopReason;
|
||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.StreamingVideoType;
|
||||
import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
|
||||
|
||||
import sts.OpensyncStats;
|
||||
import sts.OpensyncStats.AssocType;
|
||||
import sts.OpensyncStats.CallReport;
|
||||
import sts.OpensyncStats.CallStart;
|
||||
import sts.OpensyncStats.CallStop;
|
||||
import sts.OpensyncStats.Client;
|
||||
import sts.OpensyncStats.ClientReport;
|
||||
import sts.OpensyncStats.DNSProbeMetric;
|
||||
@@ -95,6 +109,10 @@ import sts.OpensyncStats.NetworkProbe;
|
||||
import sts.OpensyncStats.RADIUSMetrics;
|
||||
import sts.OpensyncStats.RadioBandType;
|
||||
import sts.OpensyncStats.Report;
|
||||
import sts.OpensyncStats.RtpFlowStats;
|
||||
import sts.OpensyncStats.StreamingVideoServerDetected;
|
||||
import sts.OpensyncStats.StreamingVideoSessionStart;
|
||||
import sts.OpensyncStats.StreamingVideoStop;
|
||||
import sts.OpensyncStats.Survey;
|
||||
import sts.OpensyncStats.Survey.SurveySample;
|
||||
import sts.OpensyncStats.SurveyType;
|
||||
@@ -821,18 +839,380 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
|
||||
void populateSipCallReport(List<ServiceMetric> metricRecordList, Report report, int customerId, long equipmentId,
|
||||
String apId, long locationId) {
|
||||
// only in case it is not there, we will just use the time when we
|
||||
// received the report/event
|
||||
long eventTimestamp = System.currentTimeMillis();
|
||||
|
||||
|
||||
List<SystemEvent> eventsList = new ArrayList<>();
|
||||
for (VideoVoiceReport videoVoiceReport : report.getVideoVoiceReportList()) {
|
||||
|
||||
|
||||
|
||||
if (videoVoiceReport.hasTimestampMs()) {
|
||||
eventTimestamp = videoVoiceReport.getTimestampMs();
|
||||
}
|
||||
|
||||
LOG.debug("Received VideoVoiceReport {} for SIP call", videoVoiceReport);
|
||||
|
||||
|
||||
|
||||
processRealTImeSipCallReportEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport);
|
||||
|
||||
processRealTimeSipCallStartEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport);
|
||||
|
||||
processRealTimeSipCallStopEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport);
|
||||
|
||||
processRtsStartEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport);
|
||||
|
||||
processRtsStartSessionEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport);
|
||||
|
||||
processRtsStopEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport);
|
||||
|
||||
}
|
||||
|
||||
if (eventsList.size() > 0) {
|
||||
equipmentMetricsCollectorInterface.publishEventsBulk(eventsList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void processRealTImeSipCallReportEvent(int customerId, long equipmentId, long eventTimestamp,
|
||||
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
|
||||
if (videoVoiceReport.hasCallReport()) {
|
||||
|
||||
CallReport callReport = videoVoiceReport.getCallReport();
|
||||
List<com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowStats> cloudRtpFlowStatsList = new ArrayList<>();
|
||||
for (RtpFlowStats apRtpFlowStats : callReport.getStatsList()) {
|
||||
|
||||
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowStats cloudRtpStats = new com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowStats();
|
||||
|
||||
if (apRtpFlowStats.hasCodec()) {
|
||||
cloudRtpStats.setCodec(apRtpFlowStats.getCodec());
|
||||
}
|
||||
|
||||
if (apRtpFlowStats.hasBlockCodecs()) {
|
||||
cloudRtpStats.setBlockCodecs(apRtpFlowStats.getBlockCodecs().toByteArray());
|
||||
}
|
||||
|
||||
if (apRtpFlowStats.hasLatency()) {
|
||||
cloudRtpStats.setLatency(apRtpFlowStats.getLatency());
|
||||
}
|
||||
|
||||
if (apRtpFlowStats.hasRtpSeqFirst()) {
|
||||
cloudRtpStats.setFirstRTPSeq(apRtpFlowStats.getRtpSeqFirst());
|
||||
}
|
||||
|
||||
if (apRtpFlowStats.hasRtpSeqLast()) {
|
||||
cloudRtpStats.setLastRTPSeq(apRtpFlowStats.getRtpSeqLast());
|
||||
}
|
||||
|
||||
if (apRtpFlowStats.hasDirection()) {
|
||||
switch (apRtpFlowStats.getDirection()) {
|
||||
case RTP_DOWNSTREAM:
|
||||
cloudRtpStats.setDirection(
|
||||
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowDirection.DOWNSTREAM);
|
||||
break;
|
||||
case RTP_UPSTREAM:
|
||||
cloudRtpStats.setDirection(
|
||||
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowDirection.UPSTREAM);
|
||||
break;
|
||||
default:
|
||||
cloudRtpStats.setDirection(
|
||||
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowDirection.UNSUPPORTED);
|
||||
}
|
||||
}
|
||||
|
||||
if (apRtpFlowStats.hasRtpFlowType()) {
|
||||
switch (apRtpFlowStats.getRtpFlowType()) {
|
||||
case RTP_VIDEO:
|
||||
cloudRtpStats.setFlowType(
|
||||
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowType.VIDEO);
|
||||
break;
|
||||
case RTP_VOICE:
|
||||
cloudRtpStats.setFlowType(
|
||||
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowType.VOICE);
|
||||
break;
|
||||
default:
|
||||
cloudRtpStats.setFlowType(
|
||||
com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowType.UNSUPPORTED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (apRtpFlowStats.hasJitter()) {
|
||||
cloudRtpStats.setJitter(apRtpFlowStats.getJitter());
|
||||
}
|
||||
|
||||
if (apRtpFlowStats.hasTotalPacketsSent()) {
|
||||
cloudRtpStats.setTotalPacket(apRtpFlowStats.getTotalPacketsSent());
|
||||
}
|
||||
|
||||
if (apRtpFlowStats.hasTotalPacketsLost()) {
|
||||
cloudRtpStats.setTotalPacketLost(apRtpFlowStats.getTotalPacketsLost());
|
||||
}
|
||||
|
||||
if (apRtpFlowStats.hasMosx100()) {
|
||||
cloudRtpStats.setMosMultipliedBy100(apRtpFlowStats.getMosx100());
|
||||
}
|
||||
|
||||
if (apRtpFlowStats.hasPacketLossConsec()) {
|
||||
cloudRtpStats.setPacketLossConsecutive(apRtpFlowStats.getPacketLossConsec());
|
||||
}
|
||||
|
||||
if (apRtpFlowStats.hasPacketLossPercent()) {
|
||||
cloudRtpStats.setPacketLossPercentage(apRtpFlowStats.getPacketLossPercent());
|
||||
}
|
||||
|
||||
|
||||
cloudRtpFlowStatsList.add(cloudRtpStats);
|
||||
|
||||
}
|
||||
|
||||
|
||||
RealTimeSipCallReportEvent cloudSipCallReportEvent = new RealTimeSipCallReportEvent(customerId, equipmentId,
|
||||
eventTimestamp);
|
||||
cloudSipCallReportEvent.setClientMacAddress(MacAddress.valueOf(callReport.getClientMac()));
|
||||
cloudSipCallReportEvent.setStatuses(cloudRtpFlowStatsList);
|
||||
cloudSipCallReportEvent.setEventType(RealTimeEventType.SipCallReport);
|
||||
cloudSipCallReportEvent.setReportReason(SIPCallReportReason.GOT_PUBLISH);
|
||||
cloudSipCallReportEvent.setSipCallId(callReport.getWifiSessionId());
|
||||
cloudSipCallReportEvent.setAssociationId(callReport.getSessionId());
|
||||
|
||||
eventsList.add(cloudSipCallReportEvent);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRealTimeSipCallStartEvent(int customerId, long equipmentId, long eventTimestamp,
|
||||
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
|
||||
if (videoVoiceReport.hasCallStart()) {
|
||||
|
||||
CallStart apCallStart = videoVoiceReport.getCallStart();
|
||||
|
||||
RealTimeSipCallStartEvent cloudSipCallStartEvent = new RealTimeSipCallStartEvent(customerId, equipmentId,
|
||||
eventTimestamp);
|
||||
|
||||
if (apCallStart.hasClientMac()) {
|
||||
cloudSipCallStartEvent.setClientMacAddress(MacAddress.valueOf(apCallStart.getClientMac()));
|
||||
}
|
||||
|
||||
if (apCallStart.hasDeviceInfo()) {
|
||||
cloudSipCallStartEvent.setDeviceInfo(apCallStart.getDeviceInfo());
|
||||
}
|
||||
|
||||
if (apCallStart.hasProviderDomain()) {
|
||||
cloudSipCallStartEvent.setProviderDomain(apCallStart.getProviderDomain());
|
||||
}
|
||||
|
||||
if (apCallStart.hasSessionId()) {
|
||||
cloudSipCallStartEvent.setAssociationId(apCallStart.getSessionId());
|
||||
|
||||
}
|
||||
|
||||
if (apCallStart.hasWifiSessionId()) {
|
||||
cloudSipCallStartEvent.setAssociationId(apCallStart.getWifiSessionId());
|
||||
}
|
||||
|
||||
eventsList.add(cloudSipCallStartEvent);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRealTimeSipCallStopEvent(int customerId, long equipmentId, long eventTimestamp,
|
||||
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
|
||||
if (videoVoiceReport.hasCallStop()) {
|
||||
|
||||
CallStop apCallStop = videoVoiceReport.getCallStop();
|
||||
|
||||
RealTimeSipCallStopEvent cloudSipCallStopEvent = new RealTimeSipCallStopEvent(customerId, equipmentId,
|
||||
eventTimestamp);
|
||||
|
||||
if (apCallStop.hasCallDuration()) {
|
||||
|
||||
|
||||
cloudSipCallStopEvent.setCallDuration(apCallStop.getCallDuration());
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (apCallStop.hasClientMac()) {
|
||||
|
||||
cloudSipCallStopEvent.setClientMacAddress(MacAddress.valueOf(apCallStop.getClientMac()));
|
||||
|
||||
}
|
||||
|
||||
if (apCallStop.hasReason()) {
|
||||
|
||||
switch (apCallStop.getReason()) {
|
||||
case BYE_OK:
|
||||
cloudSipCallStopEvent.setReason(SipCallStopReason.BYE_OK);
|
||||
break;
|
||||
case CALL_DROPPED:
|
||||
cloudSipCallStopEvent.setReason(SipCallStopReason.DROPPED);
|
||||
break;
|
||||
|
||||
default:
|
||||
cloudSipCallStopEvent.setReason(SipCallStopReason.UNSUPPORTED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (apCallStop.hasSessionId()) {
|
||||
|
||||
cloudSipCallStopEvent.setAssociationId(apCallStop.getSessionId());
|
||||
|
||||
}
|
||||
|
||||
if (apCallStop.hasWifiSessionId()) {
|
||||
cloudSipCallStopEvent.setSipCallId(apCallStop.getWifiSessionId());
|
||||
|
||||
}
|
||||
|
||||
eventsList.add(cloudSipCallStopEvent);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRtsStartEvent(int customerId, long equipmentId, long eventTimestamp,
|
||||
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
|
||||
if (videoVoiceReport.hasStreamVideoServer()) {
|
||||
StreamingVideoServerDetected apStreamVideoServer = videoVoiceReport.getStreamVideoServer();
|
||||
RealTimeStreamingStartEvent rtsStartEvent = new RealTimeStreamingStartEvent(customerId, equipmentId,
|
||||
eventTimestamp);
|
||||
if (apStreamVideoServer.hasServerIp()) {
|
||||
try {
|
||||
rtsStartEvent
|
||||
.setServerIp(InetAddress.getByAddress(apStreamVideoServer.getServerIp().toByteArray()));
|
||||
} catch (UnknownHostException e) {
|
||||
LOG.error("Cannot get IP Address from {}", apStreamVideoServer.getServerIp(), e);
|
||||
}
|
||||
}
|
||||
if (apStreamVideoServer.hasStreamingVideoType()) {
|
||||
rtsStartEvent
|
||||
.setType(getCloudStreamingVideoTypeFromApReport(apStreamVideoServer.getStreamingVideoType()));
|
||||
}
|
||||
|
||||
if (apStreamVideoServer.hasServerDnsName()) {
|
||||
rtsStartEvent.setServerDnsName(apStreamVideoServer.getServerDnsName());
|
||||
}
|
||||
|
||||
if (apStreamVideoServer.hasClientMac()) {
|
||||
rtsStartEvent.setClientMacAddress(MacAddress.valueOf(apStreamVideoServer.getClientMac().toByteArray()));
|
||||
}
|
||||
|
||||
if (apStreamVideoServer.hasSessionId()) {
|
||||
rtsStartEvent.setSessionId(apStreamVideoServer.getSessionId());
|
||||
}
|
||||
|
||||
if (apStreamVideoServer.hasVideoSessionId()) {
|
||||
rtsStartEvent.setVideoSessionId(apStreamVideoServer.getVideoSessionId());
|
||||
}
|
||||
|
||||
eventsList.add(rtsStartEvent);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRtsStartSessionEvent(int customerId, long equipmentId, long eventTimestamp,
|
||||
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
|
||||
if (videoVoiceReport.hasStreamVideoSessionStart()) {
|
||||
StreamingVideoSessionStart apStreamVideoSessionStart = videoVoiceReport.getStreamVideoSessionStart();
|
||||
RealTimeStreamingStartSessionEvent rtsStartSessionEvent = new RealTimeStreamingStartSessionEvent(customerId,
|
||||
equipmentId, eventTimestamp);
|
||||
if (apStreamVideoSessionStart.hasClientMac()) {
|
||||
rtsStartSessionEvent.setClientMacAddress(
|
||||
MacAddress.valueOf(apStreamVideoSessionStart.getClientMac().toByteArray()));
|
||||
}
|
||||
|
||||
if (apStreamVideoSessionStart.hasServerIp()) {
|
||||
try {
|
||||
rtsStartSessionEvent.setServerIp(
|
||||
InetAddress.getByAddress(apStreamVideoSessionStart.getServerIp().toByteArray()));
|
||||
} catch (UnknownHostException e) {
|
||||
LOG.error("Cannot get IP Address from {}", apStreamVideoSessionStart.getServerIp(), e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (apStreamVideoSessionStart.hasSessionId()) {
|
||||
rtsStartSessionEvent.setSessionId(apStreamVideoSessionStart.getSessionId());
|
||||
|
||||
}
|
||||
|
||||
if (apStreamVideoSessionStart.hasStreamingVideoType()) {
|
||||
rtsStartSessionEvent.setType(
|
||||
getCloudStreamingVideoTypeFromApReport(apStreamVideoSessionStart.getStreamingVideoType()));
|
||||
|
||||
}
|
||||
|
||||
if (apStreamVideoSessionStart.hasVideoSessionId()) {
|
||||
rtsStartSessionEvent.setVideoSessionId(apStreamVideoSessionStart.getVideoSessionId());
|
||||
}
|
||||
eventsList.add(rtsStartSessionEvent);
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRtsStopEvent(int customerId, long equipmentId, long eventTimestamp,
|
||||
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
|
||||
if (videoVoiceReport.hasStreamVideoStop()) {
|
||||
StreamingVideoStop apStreamVideoStop = videoVoiceReport.getStreamVideoStop();
|
||||
RealTimeStreamingStopEvent rtsStopEvent = new RealTimeStreamingStopEvent(customerId, equipmentId,
|
||||
eventTimestamp);
|
||||
if (apStreamVideoStop.hasClientMac()) {
|
||||
rtsStopEvent.setClientMacAddress(MacAddress.valueOf(apStreamVideoStop.getClientMac().toByteArray()));
|
||||
}
|
||||
|
||||
if (apStreamVideoStop.hasDurationSec()) {
|
||||
rtsStopEvent.setDurationInSecs(apStreamVideoStop.getDurationSec());
|
||||
}
|
||||
|
||||
if (apStreamVideoStop.hasServerIp()) {
|
||||
try {
|
||||
rtsStopEvent.setServerIp(InetAddress.getByAddress(apStreamVideoStop.getServerIp().toByteArray()));
|
||||
} catch (UnknownHostException e) {
|
||||
LOG.error("Cannot get IP Address from {}", apStreamVideoStop.getServerIp(), e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (apStreamVideoStop.hasSessionId()) {
|
||||
rtsStopEvent.setSessionId(apStreamVideoStop.getSessionId());
|
||||
}
|
||||
|
||||
if (apStreamVideoStop.hasStreamingVideoType()) {
|
||||
|
||||
rtsStopEvent.setType(getCloudStreamingVideoTypeFromApReport(apStreamVideoStop.getStreamingVideoType()));
|
||||
|
||||
}
|
||||
|
||||
if (apStreamVideoStop.hasTotalBytes()) {
|
||||
rtsStopEvent.setTotalBytes(apStreamVideoStop.getTotalBytes());
|
||||
}
|
||||
|
||||
if (apStreamVideoStop.hasVideoSessionId()) {
|
||||
rtsStopEvent.setVideoSessionId(apStreamVideoStop.getVideoSessionId());
|
||||
}
|
||||
|
||||
eventsList.add(rtsStopEvent);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private StreamingVideoType getCloudStreamingVideoTypeFromApReport(
|
||||
sts.OpensyncStats.StreamingVideoType apReportStreamingVideoType) {
|
||||
switch (apReportStreamingVideoType) {
|
||||
case NETFLIX:
|
||||
return StreamingVideoType.NETFLIX;
|
||||
case YOUTUBE:
|
||||
return StreamingVideoType.YOUTUBE;
|
||||
|
||||
case PLEX:
|
||||
return StreamingVideoType.PLEX;
|
||||
|
||||
case UNKNOWN:
|
||||
return StreamingVideoType.UNKNOWN;
|
||||
|
||||
default:
|
||||
return StreamingVideoType.UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void populateApNodeMetrics(List<ServiceMetric> metricRecordList, Report report, int customerId, long equipmentId,
|
||||
@@ -1206,8 +1586,8 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
|
||||
for (RADIUSMetrics radiusMetrics : networkProbe.getRadiusProbeList()) {
|
||||
if (radiusMetrics.hasLatency()) {
|
||||
networkProbeMetrics.setRadiusLatencyInMs(radiusMetrics.getLatency());
|
||||
}
|
||||
networkProbeMetrics.setRadiusLatencyInMs(radiusMetrics.getLatency());
|
||||
}
|
||||
if (radiusMetrics.hasRadiusState()) {
|
||||
|
||||
switch (radiusMetrics.getRadiusState()) {
|
||||
@@ -1231,7 +1611,7 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
VLANMetrics vlanMetrics = networkProbe.getVlanProbe();
|
||||
if (vlanMetrics.hasVlanIF()) {
|
||||
networkProbeMetrics.setVlanIF(vlanMetrics.getVlanIF());
|
||||
}
|
||||
}
|
||||
if (vlanMetrics.hasDhcpState()) {
|
||||
|
||||
switch (vlanMetrics.getDhcpState()) {
|
||||
@@ -1246,8 +1626,8 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
break;
|
||||
default:
|
||||
networkProbeMetrics.setDhcpState(StateUpDownError.UNSUPPORTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vlanMetrics.hasLatency()) {
|
||||
networkProbeMetrics.setDhcpLatencyMs(vlanMetrics.getLatency());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user