mirror of
				https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
				synced 2025-10-31 02:27:49 +00:00 
			
		
		
		
	Merge branch 'master' of github.com:Telecominfraproject/wlan-cloud-opensync-controller
This commit is contained in:
		| @@ -1048,7 +1048,7 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { | ||||
|  | ||||
|             LOG.debug("Received VideoVoiceReport {} for SIP call", videoVoiceReport); | ||||
|  | ||||
|             processRealTImeSipCallReportEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport); | ||||
|             processRealTimeSipCallReportEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport); | ||||
|  | ||||
|             processRealTimeSipCallStartEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport); | ||||
|  | ||||
| @@ -1068,111 +1068,65 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     protected void processRealTImeSipCallReportEvent(int customerId, long equipmentId, long eventTimestamp, | ||||
|             List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) { | ||||
|     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); | ||||
|  | ||||
|             if (callReport.hasClientMac() && callReport.getClientMac().isValidUtf8()) { | ||||
|                 cloudSipCallReportEvent.setClientMacAddress(MacAddress.valueOf(callReport.getClientMac().toStringUtf8())); | ||||
|             } | ||||
|             cloudSipCallReportEvent.setStatuses(processRtpFlowStats(callReport.getStatsList())); | ||||
|             cloudSipCallReportEvent.setEventType(RealTimeEventType.SipCallReport); | ||||
|             cloudSipCallReportEvent.setReportReason(SIPCallReportReason.GOT_PUBLISH); | ||||
|  | ||||
|             cloudSipCallReportEvent.setSipCallId(callReport.getWifiSessionId()); | ||||
|             cloudSipCallReportEvent.setAssociationId(callReport.getSessionId()); | ||||
|  | ||||
|             if (callReport.hasReason()) { | ||||
|                 cloudSipCallReportEvent.setReportReason(getCallReportReason(callReport.getReason())); | ||||
|             } | ||||
|             if (callReport.hasProviderDomain()) { | ||||
|                 cloudSipCallReportEvent.setProviderDomain(callReport.getProviderDomain()); | ||||
|             } | ||||
|  | ||||
|             if (callReport.getCodecsCount() > 0) { | ||||
|                 cloudSipCallReportEvent.setCodecs(callReport.getCodecsList()); | ||||
|             } | ||||
|  | ||||
|             if (callReport.hasChannel()) { | ||||
|                 cloudSipCallReportEvent.setChannel(callReport.getChannel()); | ||||
|             } | ||||
|  | ||||
|             if (callReport.hasBand()) { | ||||
|                 cloudSipCallReportEvent.setRadioType(OvsdbToWlanCloudTypeMappingUtility | ||||
|                         .getRadioTypeFromOpensyncStatsRadioBandType(callReport.getBand())); | ||||
|             } | ||||
|  | ||||
|             eventsList.add(cloudSipCallReportEvent); | ||||
|  | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private SIPCallReportReason getCallReportReason(CallReport.CallReportReason reason) { | ||||
|         if (reason != null) { | ||||
|             switch (reason) { | ||||
|                 case ROAMED_TO: | ||||
|                     return SIPCallReportReason.ROAMED_TO; | ||||
|                 case GOT_PUBLISH: | ||||
|                     return SIPCallReportReason.GOT_PUBLISH; | ||||
|                 case ROAMED_FROM: | ||||
|                     return SIPCallReportReason.ROAMED_FROM; | ||||
|                 default: | ||||
|                     return SIPCallReportReason.UNSUPPORTED; | ||||
|             } | ||||
|         } | ||||
|         return SIPCallReportReason.UNSUPPORTED; | ||||
|     } | ||||
|  | ||||
|     protected void processRealTimeSipCallStartEvent(int customerId, long equipmentId, long eventTimestamp, | ||||
|             List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) { | ||||
|         if (videoVoiceReport.hasCallStart()) { | ||||
| @@ -1182,8 +1136,8 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { | ||||
|             RealTimeSipCallStartEvent cloudSipCallStartEvent = new RealTimeSipCallStartEvent(customerId, equipmentId, | ||||
|                     eventTimestamp); | ||||
|  | ||||
|             if (apCallStart.hasClientMac()) { | ||||
|                 cloudSipCallStartEvent.setClientMacAddress(MacAddress.valueOf(apCallStart.getClientMac())); | ||||
|             if (apCallStart.hasClientMac() && apCallStart.getClientMac().isValidUtf8()) { | ||||
|                 cloudSipCallStartEvent.setClientMacAddress(MacAddress.valueOf(apCallStart.getClientMac().toStringUtf8())); | ||||
|             } | ||||
|  | ||||
|             if (apCallStart.hasDeviceInfo()) { | ||||
| @@ -1196,13 +1150,25 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { | ||||
|  | ||||
|             if (apCallStart.hasSessionId()) { | ||||
|                 cloudSipCallStartEvent.setAssociationId(apCallStart.getSessionId()); | ||||
|  | ||||
|             } | ||||
|  | ||||
|             if (apCallStart.hasWifiSessionId()) { | ||||
|                 cloudSipCallStartEvent.setAssociationId(apCallStart.getWifiSessionId()); | ||||
|             } | ||||
|  | ||||
|             if (apCallStart.getCodecsCount() > 0) { | ||||
|                 cloudSipCallStartEvent.setCodecs(apCallStart.getCodecsList()); | ||||
|             } | ||||
|  | ||||
|             if (apCallStart.hasChannel()) { | ||||
|                 cloudSipCallStartEvent.setChannel(apCallStart.getChannel()); | ||||
|             } | ||||
|  | ||||
|             if (apCallStart.hasBand()) { | ||||
|                 cloudSipCallStartEvent.setRadioType(OvsdbToWlanCloudTypeMappingUtility | ||||
|                         .getRadioTypeFromOpensyncStatsRadioBandType(apCallStart.getBand())); | ||||
|             } | ||||
|  | ||||
|             eventsList.add(cloudSipCallStartEvent); | ||||
|  | ||||
|         } | ||||
| @@ -1223,9 +1189,9 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { | ||||
|  | ||||
|             } | ||||
|  | ||||
|             if (apCallStop.hasClientMac()) { | ||||
|             if (apCallStop.hasClientMac() && apCallStop.getClientMac().isValidUtf8()) { | ||||
|  | ||||
|                 cloudSipCallStopEvent.setClientMacAddress(MacAddress.valueOf(apCallStop.getClientMac())); | ||||
|                 cloudSipCallStopEvent.setClientMacAddress(MacAddress.valueOf(apCallStop.getClientMac().toStringUtf8())); | ||||
|  | ||||
|             } | ||||
|  | ||||
| @@ -1256,6 +1222,27 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { | ||||
|  | ||||
|             } | ||||
|  | ||||
|             if (apCallStop.getStatsCount() > 0) { | ||||
|                 cloudSipCallStopEvent.setStatuses(processRtpFlowStats(apCallStop.getStatsList())); | ||||
|             } | ||||
|  | ||||
|             if (apCallStop.hasProviderDomain()) { | ||||
|                 cloudSipCallStopEvent.setProviderDomain(apCallStop.getProviderDomain()); | ||||
|             } | ||||
|  | ||||
|             if (apCallStop.getCodecsCount() > 0) { | ||||
|                 cloudSipCallStopEvent.setCodecs(apCallStop.getCodecsList()); | ||||
|             } | ||||
|  | ||||
|             if (apCallStop.hasChannel()) { | ||||
|                 cloudSipCallStopEvent.setChannel(apCallStop.getChannel()); | ||||
|             } | ||||
|  | ||||
|             if (apCallStop.hasBand()) { | ||||
|                 cloudSipCallStopEvent.setRadioType(OvsdbToWlanCloudTypeMappingUtility | ||||
|                         .getRadioTypeFromOpensyncStatsRadioBandType(apCallStop.getBand())); | ||||
|             } | ||||
|  | ||||
|             eventsList.add(cloudSipCallStopEvent); | ||||
|  | ||||
|         } | ||||
| @@ -1301,6 +1288,95 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private List<com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowStats> processRtpFlowStats(List<OpensyncStats.RtpFlowStats> stats) { | ||||
|         List<com.telecominfraproject.wlan.systemevent.equipment.realtime.RtpFlowStats> cloudRtpFlowStatsList = new ArrayList<>(); | ||||
|         for (RtpFlowStats apRtpFlowStats : stats) { | ||||
|  | ||||
|             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); | ||||
|  | ||||
|         } | ||||
|         return cloudRtpFlowStatsList; | ||||
|     } | ||||
|  | ||||
|     protected void processRtsStartSessionEvent(int customerId, long equipmentId, long eventTimestamp, | ||||
|             List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) { | ||||
|         if (videoVoiceReport.hasStreamVideoSessionStart()) { | ||||
|   | ||||
| @@ -7,6 +7,7 @@ import java.net.InetAddress; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.telecominfraproject.wlan.systemevent.models.SystemEvent; | ||||
| import org.junit.After; | ||||
| import org.junit.Before; | ||||
| import org.junit.Ignore; | ||||
| @@ -45,9 +46,6 @@ import com.telecominfraproject.wlan.firmware.FirmwareServiceInterface; | ||||
| import com.telecominfraproject.wlan.location.service.LocationServiceInterface; | ||||
| import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController; | ||||
| import com.telecominfraproject.wlan.profile.ProfileServiceInterface; | ||||
| import com.telecominfraproject.wlan.profile.models.ProfileContainer; | ||||
| import com.telecominfraproject.wlan.profile.models.ProfileType; | ||||
| import com.telecominfraproject.wlan.profile.rf.models.RfConfiguration; | ||||
| import com.telecominfraproject.wlan.routing.RoutingServiceInterface; | ||||
| import com.telecominfraproject.wlan.servicemetric.apnode.models.ApNodeMetrics; | ||||
| import com.telecominfraproject.wlan.servicemetric.apnode.models.StateUpDownError; | ||||
| @@ -57,6 +55,7 @@ import com.telecominfraproject.wlan.status.equipment.report.models.ActiveBSSIDs; | ||||
| import com.telecominfraproject.wlan.status.models.Status; | ||||
| import com.telecominfraproject.wlan.status.models.StatusDataType; | ||||
|  | ||||
| import sts.OpensyncStats; | ||||
| import sts.OpensyncStats.AssocType; | ||||
| import sts.OpensyncStats.ChannelSwitchReason; | ||||
| import sts.OpensyncStats.Client; | ||||
| @@ -260,6 +259,55 @@ public class OpensyncExternalIntegrationMqttMessageProcessorTest { | ||||
|         // TODO: implement me when wcs stats reports supported | ||||
|     } | ||||
|  | ||||
|     // Verify CallStart, CallStop and CallReport are properly processed and published as | ||||
|     // respective events (5 events in total) | ||||
|     @Test | ||||
|     public void testProcessMqttMessageStringMultipleVideoVoiceReport() { | ||||
|         OpensyncStats.VideoVoiceReport.Builder callStartVoiceReportBuilder = OpensyncStats.VideoVoiceReport.newBuilder(). | ||||
|                 setCallStart(getDefaultCallStart()); | ||||
|         OpensyncStats.VideoVoiceReport.Builder callReportGotPublishVoiceReportBuilder = OpensyncStats.VideoVoiceReport.newBuilder(). | ||||
|                 setCallReport(getDefaultCallReport(OpensyncStats.CallReport.CallReportReason.GOT_PUBLISH, 121, 1028, 1316, 1888, 298, 2, 100, 200)); | ||||
|         OpensyncStats.VideoVoiceReport.Builder callReportRoamedToVoiceReportBuilder = OpensyncStats.VideoVoiceReport.newBuilder(). | ||||
|                 setCallReport(getDefaultCallReport(OpensyncStats.CallReport.CallReportReason.ROAMED_TO, 123, 1020, 1116, 1345, 223, 0, 102, 203)); | ||||
|         OpensyncStats.VideoVoiceReport.Builder callReportRoamedFromVoiceReportBuilder = OpensyncStats.VideoVoiceReport.newBuilder(). | ||||
|                 setCallReport(getDefaultCallReport(OpensyncStats.CallReport.CallReportReason.ROAMED_FROM, 122, 1029, 1300, 1234, 111, 3, 101, 201)); | ||||
|         OpensyncStats.VideoVoiceReport.Builder callStopVoiceReportBuilder = OpensyncStats.VideoVoiceReport.newBuilder(). | ||||
|                 setCallStop(getDefaultCallStop()); | ||||
|         // Create report with multiple voiceReports in one | ||||
|         Report multipleVoiceReportsInOneReport = Report.newBuilder().addVideoVoiceReport(callStartVoiceReportBuilder). | ||||
|                 addVideoVoiceReport(callReportGotPublishVoiceReportBuilder). | ||||
|                 addVideoVoiceReport(callReportRoamedFromVoiceReportBuilder). | ||||
|                 addVideoVoiceReport(callReportRoamedToVoiceReportBuilder). | ||||
|                 addVideoVoiceReport(callStopVoiceReportBuilder). | ||||
|                 setNodeID("1"). | ||||
|                 build(); | ||||
|  | ||||
|         opensyncExternalIntegrationMqttProcessor.populateSipCallReport(null, multipleVoiceReportsInOneReport, 1, 2L, "TestAP", 12L); | ||||
|  | ||||
|         Mockito.verify(equipmentMetricsCollectorInterface, Mockito.times(1)).publishEventsBulk(Mockito.anyList()); | ||||
|     } | ||||
|  | ||||
|     // Create report with 1 voiceReports that contains multiple Calls | ||||
|     // Note that GOT_PUBLISH and ROAMED_FROM are ignored in the CallReport. ROAMED_TO overwrites them | ||||
|     @Test | ||||
|     public void testProcessMqttMessageStringOneVideoVoiceReport() { | ||||
|  | ||||
|         OpensyncStats.VideoVoiceReport.Builder videoVoiceReportBuilder = OpensyncStats.VideoVoiceReport.newBuilder(). | ||||
|                 setCallReport(getDefaultCallReport(OpensyncStats.CallReport.CallReportReason.GOT_PUBLISH, 121, 1028, 1316,1888, 298, 2, 100,200)). | ||||
|                 setCallReport(getDefaultCallReport(OpensyncStats.CallReport.CallReportReason.ROAMED_FROM, 122, 1029, 1300,1234, 111, 3, 101,201)). | ||||
|                 setCallReport(getDefaultCallReport(OpensyncStats.CallReport.CallReportReason.ROAMED_TO, 123, 1020, 1116,1345, 223, 0, 102,203)). | ||||
|                 setCallStart(getDefaultCallStart()). | ||||
|                 setCallStop(getDefaultCallStop()); | ||||
|         Report oneVoiceReportWithMultipleCallsInOneReport = Report.getDefaultInstance().toBuilder(). | ||||
|                 addVideoVoiceReport(videoVoiceReportBuilder). | ||||
|                 setNodeID("1"). | ||||
|                 build(); | ||||
|  | ||||
|         opensyncExternalIntegrationMqttProcessor.populateSipCallReport(null, oneVoiceReportWithMultipleCallsInOneReport, 1, 2L, "TestAP", 12L); | ||||
|  | ||||
|         Mockito.verify(equipmentMetricsCollectorInterface, Mockito.times(1)).publishEventsBulk(Mockito.anyList()); | ||||
|     } | ||||
|  | ||||
|     @Test | ||||
|     public void testpopulateNetworkProbeMetrics() throws Exception { | ||||
|  | ||||
| @@ -318,6 +366,74 @@ public class OpensyncExternalIntegrationMqttMessageProcessorTest { | ||||
|         return bssidList; | ||||
|     } | ||||
|  | ||||
|     private OpensyncStats.CallStart getDefaultCallStart() { | ||||
|         OpensyncStats.CallStart.Builder callStartBuilder = OpensyncStats.CallStart.newBuilder(); | ||||
|         callStartBuilder.setBand(RadioBandType.BAND5G); | ||||
|         callStartBuilder.setChannel(40); | ||||
|         callStartBuilder.addCodecs("110 opus/48000/2"); | ||||
|         callStartBuilder.addCodecs("102 iLBC/8000"); | ||||
|         callStartBuilder.setClientMac(ByteString.copyFrom("C0:9A:D0:76:A9:69".getBytes())); | ||||
|         callStartBuilder.setDeviceInfo("Test Device"); | ||||
|         callStartBuilder.setProviderDomain("skype"); | ||||
|         callStartBuilder.setSessionId(123L); | ||||
|         callStartBuilder.setWifiSessionId(1234L); | ||||
|  | ||||
|         return callStartBuilder.build(); | ||||
|     } | ||||
|  | ||||
|     private OpensyncStats.CallStop getDefaultCallStop() { | ||||
|         OpensyncStats.CallStop.Builder callStopBuilder = OpensyncStats.CallStop.newBuilder(); | ||||
|         callStopBuilder.setBand(RadioBandType.BAND5G); | ||||
|         callStopBuilder.setChannel(40); | ||||
|         callStopBuilder.addCodecs("110 opus/48000/2"); | ||||
|         callStopBuilder.addCodecs("102 iLBC/8000"); | ||||
|         callStopBuilder.setClientMac(ByteString.copyFrom("C0:9A:D0:76:A9:69".getBytes())); | ||||
|         callStopBuilder.setCallDuration(1230); | ||||
|         callStopBuilder.setProviderDomain("skype"); | ||||
|         callStopBuilder.setSessionId(123L); | ||||
|         callStopBuilder.setWifiSessionId(1234L); | ||||
|         callStopBuilder.setReason(OpensyncStats.CallStop.CallStopReason.BYE_OK); | ||||
|         callStopBuilder.addStats(getRtpFlowStats(121, 1380, 1400,3000, 119, 3, 205,350)); | ||||
|  | ||||
|         return callStopBuilder.build(); | ||||
|     } | ||||
|      | ||||
|     private OpensyncStats.RtpFlowStats getRtpFlowStats(int codec, int jitter, int latency, int totalPackets, | ||||
|                                                        int totalPacketsLost, int mos, int firstRtpSeq, int lastRtpSeq) { | ||||
|         OpensyncStats.RtpFlowStats.Builder rtpFlowStatsBuilder = OpensyncStats.RtpFlowStats.newBuilder(); | ||||
|         rtpFlowStatsBuilder.setCodec(codec); | ||||
|         rtpFlowStatsBuilder.setBlockCodecs(ByteString.copyFrom(new byte[] { (byte) 0xe6, 0x1 })); | ||||
|         rtpFlowStatsBuilder.setDirection(OpensyncStats.RtpFlowStats.RtpFlowDirection.RTP_DOWNSTREAM); | ||||
|         rtpFlowStatsBuilder.setRtpFlowType(OpensyncStats.RtpFlowStats.RtpFlowType.RTP_VOICE); | ||||
|         rtpFlowStatsBuilder.setJitter(jitter); | ||||
|         rtpFlowStatsBuilder.setLatency(latency); | ||||
|         rtpFlowStatsBuilder.setTotalPacketsSent(totalPackets); | ||||
|         rtpFlowStatsBuilder.setTotalPacketsLost(totalPacketsLost); | ||||
|         rtpFlowStatsBuilder.setMosx100(mos); | ||||
|         rtpFlowStatsBuilder.setRtpSeqFirst(firstRtpSeq); | ||||
|         rtpFlowStatsBuilder.setRtpSeqLast(lastRtpSeq); | ||||
|  | ||||
|         return rtpFlowStatsBuilder.build(); | ||||
|     } | ||||
|  | ||||
|     private OpensyncStats.CallReport getDefaultCallReport(OpensyncStats.CallReport.CallReportReason reason, int codec, | ||||
|                                                           int jitter, int latency, int totalPackets, int totalPacketsLost, | ||||
|                                                           int mos, int firstRtpSeq, int lastRtpSeq) { | ||||
|         OpensyncStats.CallReport.Builder callReportBuilder = OpensyncStats.CallReport.newBuilder(); | ||||
|         callReportBuilder.setBand(RadioBandType.BAND5G); | ||||
|         callReportBuilder.setChannel(40); | ||||
|         callReportBuilder.addCodecs("110 opus/48000/2"); | ||||
|         callReportBuilder.addCodecs("102 iLBC/8000"); | ||||
|         callReportBuilder.setClientMac(ByteString.copyFrom("C0:9A:D0:76:A9:69".getBytes())); | ||||
|         callReportBuilder.setProviderDomain("skype"); | ||||
|         callReportBuilder.setSessionId(123L); | ||||
|         callReportBuilder.setWifiSessionId(1234L); | ||||
|         callReportBuilder.setReason(reason); | ||||
|         callReportBuilder.addStats(getRtpFlowStats(codec, jitter, latency, totalPackets, totalPacketsLost, | ||||
|                 mos, firstRtpSeq, lastRtpSeq)); | ||||
|  | ||||
|         return callReportBuilder.build(); | ||||
|     } | ||||
|  | ||||
|     private List<EventReport> getOpensyncStatsEventReportsList() { | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Mike Hansen
					Mike Hansen