Search in sources :

Example 6 with BestPracticeType

use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.

the class BPSelectionPanel method getGroupedBPPanel.

private Component getGroupedBPPanel(Category category) {
    List<BestPracticeType> bpItems = BestPracticeType.getByCategory(category);
    JPanel panel = new JPanel();
    noOfBestPractices = noOfBestPractices + bpItems.size();
    Dimension sectionDimention = new Dimension(350, 45 + 23 * bpItems.size());
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    panel.setPreferredSize(sectionDimention);
    panel.setMinimumSize(sectionDimention);
    panel.setMaximumSize(sectionDimention);
    final JCheckBox toggleAll = new JCheckBox("Select All");
    toggleAll.setForeground(Color.BLUE);
    toggleAll.addActionListener((e) -> setSelectedBoxes(bpItems, toggleAll.isSelected()));
    panel.add(toggleAll);
    selectAllList.add(toggleAll);
    for (BestPracticeType item : bpItems) {
        JCheckBox checkBox = new JCheckBox(item.getDescription());
        panel.add(checkBox);
        map.put(item.name(), checkBox);
    }
    TitledBorder border = BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), category.getDescription());
    border.setTitleColor(Color.BLUE);
    panel.setBorder(border);
    return panel;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) BoxLayout(javax.swing.BoxLayout) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder)

Example 7 with BestPracticeType

use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.

the class PacketAnalyzerImpl method finalResult.

protected PacketAnalyzerResult finalResult(AbstractTraceResult result, Profile profile, AnalysisFilter filter) {
    PacketAnalyzerResult data = new PacketAnalyzerResult();
    if (filter == null) {
        double endTime = result.getAllpackets().size() > 0 ? Math.max(result.getAllpackets().get(result.getAllpackets().size() - 1).getTimeStamp(), result.getTraceDuration()) : 0.0;
        result.setTimeRange(new TimeRange("Full", TimeRange.TimeRangeType.FULL, 0.0, endTime));
    } else {
        result.setTimeRange(filter.getTimeRange());
    }
    // List of packets included in analysis (application filtered)
    List<PacketInfo> filteredPackets;
    Profile aProfile = profile;
    if (aProfile == null) {
        // if the user doesn't load any profile.....
        aProfile = profilefactory.createLTEdefault();
        aProfile.setName("AT&T LTE");
    }
    // for the situation, filter out all no-ip packets and caused the allpackets is empty, need to refactor
    if (result != null && result.getAllpackets() != null && result.getAllpackets().size() == 0) {
        data.setTraceresult(result);
        return data;
    }
    /* Purpose of this code block is to finish building out the filter, if needed, for TimeRange analysis
		 * 
		 * This code block is excuted when:
		 *  1: time-range.json exists in trace folder
		 *  	a: and the json contains an entry with RangeType.AUTO
		 *  2: A TimeRange object was created and launched in TimeRangeEditorDialog
		 *  
		 *  AroController will have created an AnalysisFilter and so filter will not be null
		 *  
		 */
    try {
        if ((filter != null && filter.getTimeRange() != null && filter.getTimeRange().getPath() != null) || result.getAllAppNames().size() == 1) {
            String app = TraceDataReaderImpl.UNKNOWN_APPNAME;
            if (filter != null && filter.getAppSelections() != null && filter.getAppSelections().containsKey(app) && filter.getAppSelections().get(app).getIPAddressSelections().isEmpty()) {
                LOGGER.debug("AUTO Time Range analysis: add all found appIps to " + app + ", then store in the filter");
                ApplicationSelection appSelection = new ApplicationSelection(app, result.getAppIps().get(app));
                filter.getAppSelections().put(app, appSelection);
            }
        }
    } catch (Exception e) {
        LOGGER.error("Error handling TimeRange JSON data", e);
    }
    TimeRange timeRange = null;
    boolean isCSI = false;
    filteredPackets = new ArrayList<PacketInfo>();
    if (filter == null) {
        if (result != null) {
            filteredPackets = result.getAllpackets();
        }
    } else {
        // do the filter
        if (filter.isCSI() && filter.getManifestFilePath() != null) {
            isCSI = true;
        }
        timeRange = filter.getTimeRange();
        if (result != null) {
            filteredPackets = filterPackets(filter, result.getAllpackets());
        }
    }
    // Fix for Sev 2 Time Range Analysis Issue - DE187848
    if (result != null) {
        result.setAllpackets(filteredPackets);
        SessionManagerImpl sessionMangerImpl = (SessionManagerImpl) sessionmanager;
        sessionMangerImpl.setPcapTimeOffset(result.getPcapTimeOffset());
        // for iOS trace
        sessionmanager.setiOSSecureTracePath(result.getTraceDirectory());
        // Check if secure trace path exists
        if (result instanceof TraceDirectoryResult) {
            File file = new File(((SessionManagerImpl) sessionmanager).getTracePath());
            if (file.exists()) {
                ((TraceDirectoryResult) result).setSecureTrace(true);
            }
        }
    }
    Statistic stat = this.getStatistic(filteredPackets);
    List<Session> sessionList = sessionmanager.processPacketsAndAssembleSessions(filteredPackets);
    generateGetRequestMapAndPopulateLatencyStat(sessionList, stat);
    if (result != null && stat.getAppName() != null && stat.getAppName().size() == 1 && stat.getAppName().contains(TraceDataReaderImpl.UNKNOWN_APPNAME)) {
        stat.setAppName(new HashSet<String>(result.getAppInfos()));
    }
    // get Unanalyzed HTTPS bytes
    boolean isSecureTrace = result instanceof TraceDirectoryResult ? ((TraceDirectoryResult) result).isSecureTrace() : false;
    if (isSecureTrace) {
        stat.setTotalHTTPSBytesNotAnalyzed(getHttpsBytesNotAnalyzed(sessionList));
    } else {
        stat.setTotalHTTPSBytesNotAnalyzed(stat.getTotalHTTPSByte());
    }
    // stat is used to get some info for RrcStateMachine etc
    if (result != null) {
        LOGGER.debug("Starting pre processing in PAI");
        AbstractRrcStateMachine statemachine = statemachinefactory.create(filteredPackets, aProfile, stat.getPacketDuration(), result.getTraceDuration(), stat.getTotalByte(), timeRange);
        EnergyModel energymodel = energymodelfactory.create(aProfile, statemachine.getTotalRRCEnergy(), result.getGpsInfos(), result.getCameraInfos(), result.getBluetoothInfos(), result.getScreenStateInfos());
        BurstCollectionAnalysisData burstcollectiondata = burstcollectionanalyzer.analyze(filteredPackets, aProfile, stat.getPacketSizeToCountMap(), statemachine.getStaterangelist(), result.getUserEvents(), result.getCpuActivityList().getCpuActivities(), sessionList);
        data.clearBPResults();
        try {
            List<BestPracticeType> videoBPList = BestPracticeType.getByCategory(BestPracticeType.Category.VIDEO);
            data.setStreamingVideoData(videoTrafficCollector.clearData());
            if (CollectionUtils.containsAny(SettingsUtil.retrieveBestPractices(), videoBPList)) {
                if (isCSI || csiDataHelper.doesCSIFileExist(result.getTraceDirectory())) {
                    data.setStreamingVideoData(videoTrafficInferencer.inferVideoData(result, sessionList, (filter != null && filter.getManifestFilePath() != null) ? filter.getManifestFilePath() : result.getTraceDirectory()));
                } else {
                    data.setStreamingVideoData(videoTrafficCollector.collect(result, sessionList, requestMap));
                }
            }
        } catch (Exception ex) {
            LOGGER.error("Error in Video usage analysis :", ex);
            // Guarantee that StreamingVideoData is empty
            data.setStreamingVideoData(videoTrafficCollector.clearData());
            data.getStreamingVideoData().setFinished(true);
        }
        try {
            List<BestPracticeType> imageBPList = new ArrayList<>();
            imageBPList.add(BestPracticeType.IMAGE_MDATA);
            imageBPList.add(BestPracticeType.IMAGE_CMPRS);
            imageBPList.add(BestPracticeType.IMAGE_FORMAT);
            imageBPList.add(BestPracticeType.IMAGE_COMPARE);
            if (CollectionUtils.containsAny(SettingsUtil.retrieveBestPractices(), imageBPList)) {
                imageExtractor.execute(result, sessionList, requestMap);
            }
        } catch (Exception ex) {
            LOGGER.error("Error in Image extraction:" + ex.getMessage(), ex);
        }
        htmlExtractor.execute(result, sessionList, requestMap);
        // Calculate time range analysis
        double beginTime = 0.0d;
        double endTime = 0.0d;
        if (filter != null && filter.getTimeRange() != null) {
            beginTime = filter.getTimeRange().getBeginTime();
            endTime = filter.getTimeRange().getEndTime();
        } else {
            endTime = result.getTraceDuration();
        }
        data.setBurstCollectionAnalysisData(burstcollectiondata);
        data.setEnergyModel(energymodel);
        data.setSessionlist(sessionList);
        data.setStatemachine(statemachine);
        data.setStatistic(stat);
        data.setTraceresult(result);
        data.setProfile(aProfile);
        data.setFilter(filter);
        data.setDeviceKeywords(result.getDeviceKeywordInfos());
        data.setTimeRangeAnalysis(new TimeRangeAnalysis(beginTime, endTime, data));
    }
    return data;
}
Also used : ApplicationSelection(com.att.aro.core.packetanalysis.pojo.ApplicationSelection) ArrayList(java.util.ArrayList) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) Profile(com.att.aro.core.configuration.pojo.Profile) Statistic(com.att.aro.core.packetanalysis.pojo.Statistic) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) AbstractRrcStateMachine(com.att.aro.core.packetanalysis.pojo.AbstractRrcStateMachine) EnergyModel(com.att.aro.core.packetanalysis.pojo.EnergyModel) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) BurstCollectionAnalysisData(com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) File(java.io.File) Session(com.att.aro.core.packetanalysis.pojo.Session)

Example 8 with BestPracticeType

use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.

the class SettingsUtil method getUnselectedBestPractices.

private static List<BestPracticeType> getUnselectedBestPractices(List<BestPracticeType> bpList) {
    BestPracticeType[] allBP = BestPracticeType.values();
    List<BestPracticeType> ret = new ArrayList<>();
    List<BestPracticeType> pre = BestPracticeType.getByCategory(Category.PRE_PROCESS);
    pre.addAll(bpList);
    for (BestPracticeType bpt : allBP) {
        if (!pre.contains(bpt)) {
            ret.add(bpt);
        }
    }
    return ret;
}
Also used : ArrayList(java.util.ArrayList) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType)

Example 9 with BestPracticeType

use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.

the class VideoBestPractices method analyze.

public AROTraceData analyze(AROTraceData traceDataresult) {
    PacketAnalyzerResult result = null;
    if (null == traceDataresult) {
        return null;
    }
    result = traceDataresult.getAnalyzerResult();
    if (result == null) {
        return null;
    }
    VideoStallResult videoStallResult = null;
    VideoStartUpDelayResult videoStartUpDelayResult = null;
    BufferOccupancyResult bufferOccupancyResult = null;
    VideoNetworkComparisonResult videoNetworkComparisonResult = null;
    VideoTcpConnectionResult videoTcpConnectionResult = null;
    VideoChunkSizeResult videoChunkSizeResult = null;
    VideoChunkPacingResult videoChunkPacingResult = null;
    VideoRedundancyResult videoRedundancyResult = null;
    VideoConcurrentSessionResult videoConcurrentSessionResult = null;
    VideoVariableBitrateResult videoVariableBitrateResult = null;
    VideoAdaptiveBitrateLadderResult videoSegmentQualityResult = null;
    VideoResolutionQualityResult videoResolutionQualityResult = null;
    AudioStreamResult videoSeparateAudioResult = null;
    List<BestPracticeType> requests = BestPracticeType.getByCategory(Category.VIDEO);
    List<AbstractBestPracticeResult> bpResults = traceDataresult.getBestPracticeResults();
    List<AbstractBestPracticeResult> videoBestPracticeResults = aroService.analyze(result, requests);
    for (AbstractBestPracticeResult videoBPResult : videoBestPracticeResults) {
        BestPracticeType bpType = videoBPResult.getBestPracticeType();
        switch(bpType) {
            case VIDEO_STALL:
                videoStallResult = (VideoStallResult) videoBPResult;
                break;
            case STARTUP_DELAY:
                videoStartUpDelayResult = (VideoStartUpDelayResult) videoBPResult;
                break;
            case BUFFER_OCCUPANCY:
                bufferOccupancyResult = (BufferOccupancyResult) videoBPResult;
                break;
            case NETWORK_COMPARISON:
                videoNetworkComparisonResult = (VideoNetworkComparisonResult) videoBPResult;
                break;
            case TCP_CONNECTION:
                videoTcpConnectionResult = (VideoTcpConnectionResult) videoBPResult;
                break;
            case CHUNK_SIZE:
                videoChunkSizeResult = (VideoChunkSizeResult) videoBPResult;
                break;
            case CHUNK_PACING:
                videoChunkPacingResult = (VideoChunkPacingResult) videoBPResult;
                break;
            case VIDEO_REDUNDANCY:
                videoRedundancyResult = (VideoRedundancyResult) videoBPResult;
                break;
            case VIDEO_CONCURRENT_SESSION:
                videoConcurrentSessionResult = (VideoConcurrentSessionResult) videoBPResult;
                break;
            case VIDEO_VARIABLE_BITRATE:
                videoVariableBitrateResult = (VideoVariableBitrateResult) videoBPResult;
                break;
            case VIDEO_RESOLUTION_QUALITY:
                videoResolutionQualityResult = (VideoResolutionQualityResult) videoBPResult;
                break;
            case VIDEO_ABR_LADDER:
                videoSegmentQualityResult = (VideoAdaptiveBitrateLadderResult) videoBPResult;
                break;
            case AUDIO_STREAM:
                videoSeparateAudioResult = (AudioStreamResult) videoBPResult;
                break;
            default:
                break;
        }
    }
    sendGAVideoBPResult(videoBestPracticeResults);
    for (AbstractBestPracticeResult bestPractice : bpResults) {
        if (bestPractice instanceof VideoStallResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoStallResult);
        } else if (bestPractice instanceof VideoStartUpDelayResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoStartUpDelayResult);
        } else if (bestPractice instanceof BufferOccupancyResult) {
            bpResults.set(bpResults.indexOf(bestPractice), bufferOccupancyResult);
        } else if (bestPractice instanceof VideoNetworkComparisonResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoNetworkComparisonResult);
        } else if (bestPractice instanceof VideoTcpConnectionResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoTcpConnectionResult);
        } else if (bestPractice instanceof VideoChunkSizeResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoChunkSizeResult);
        } else if (bestPractice instanceof VideoChunkPacingResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoChunkPacingResult);
        } else if (bestPractice instanceof VideoChunkPacingResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoChunkPacingResult);
        } else if (bestPractice instanceof VideoRedundancyResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoRedundancyResult);
        } else if (bestPractice instanceof VideoConcurrentSessionResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoConcurrentSessionResult);
        } else if (bestPractice instanceof VideoVariableBitrateResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoVariableBitrateResult);
        } else if (bestPractice instanceof VideoResolutionQualityResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoResolutionQualityResult);
        } else if (bestPractice instanceof VideoAdaptiveBitrateLadderResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoSegmentQualityResult);
        } else if (bestPractice instanceof AudioStreamResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoSeparateAudioResult);
        }
    }
    traceDataresult.setBestPracticeResults(bpResults);
    return traceDataresult;
}
Also used : VideoRedundancyResult(com.att.aro.core.bestpractice.pojo.VideoRedundancyResult) VideoResolutionQualityResult(com.att.aro.core.bestpractice.pojo.VideoResolutionQualityResult) VideoNetworkComparisonResult(com.att.aro.core.bestpractice.pojo.VideoNetworkComparisonResult) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) VideoStallResult(com.att.aro.core.bestpractice.pojo.VideoStallResult) VideoConcurrentSessionResult(com.att.aro.core.bestpractice.pojo.VideoConcurrentSessionResult) VideoAdaptiveBitrateLadderResult(com.att.aro.core.bestpractice.pojo.VideoAdaptiveBitrateLadderResult) VideoTcpConnectionResult(com.att.aro.core.bestpractice.pojo.VideoTcpConnectionResult) VideoVariableBitrateResult(com.att.aro.core.bestpractice.pojo.VideoVariableBitrateResult) AudioStreamResult(com.att.aro.core.bestpractice.pojo.AudioStreamResult) BufferOccupancyResult(com.att.aro.core.bestpractice.pojo.BufferOccupancyResult) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) VideoChunkPacingResult(com.att.aro.core.bestpractice.pojo.VideoChunkPacingResult) VideoStartUpDelayResult(com.att.aro.core.bestpractice.pojo.VideoStartUpDelayResult) VideoChunkSizeResult(com.att.aro.core.bestpractice.pojo.VideoChunkSizeResult)

Example 10 with BestPracticeType

use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.

the class VideoChunksPlot method refreshPlot.

// StartupDelay calculations
public AROTraceData refreshPlot(XYPlot plot, AROTraceData traceData, double startTime, VideoEvent selectedChunk) {
    chunkPlayTime.clear();
    chunkPlayTime.put(selectedChunk, startTime);
    videoChunkPlotter.setChunkPlayTimeList(chunkPlayTime);
    setChunkPlayBackTimeCollection(traceData);
    bufferInSecondsPlot.setChunkPlayTimeMap(chunkPlayTime);
    populate(plot, traceData);
    AbstractBestPracticeResult startupDelayBPResult = videoChunkPlotter.refreshStartUpDelayBP(traceData);
    if (traceData.getAnalyzerResult().getStreamingVideoData().getStreamingVideoCompiled().getChunksBySegmentID().isEmpty()) {
        return refreshBPVideoResults(traceData, startupDelayBPResult, null, null);
    }
    bufferInSecondsPlot.populate(bufferTimeXYPlot, traceData);
    bufferOccupancyPlot.populate(bufferOccupancyXYPlot, traceData);
    refreshVCPlot(plot, traceData);
    AbstractBestPracticeResult stallBPResult = null;
    AbstractBestPracticeResult bufferOccupancyBPResult = null;
    List<BestPracticeType> bpList = SettingsUtil.retrieveBestPractices();
    if (bpList.contains(BestPracticeType.VIDEO_STALL)) {
        stallBPResult = videoChunkPlotter.refreshVideoStallBP(traceData);
    }
    if (bpList.contains(BestPracticeType.BUFFER_OCCUPANCY)) {
        bufferOccupancyBPResult = videoChunkPlotter.refreshVideoBufferOccupancyBP(traceData);
    }
    return refreshBPVideoResults(traceData, startupDelayBPResult, stallBPResult, bufferOccupancyBPResult);
}
Also used : AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType)

Aggregations

BestPracticeType (com.att.aro.core.bestpractice.pojo.BestPracticeType)16 ArrayList (java.util.ArrayList)10 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)6 Profile (com.att.aro.core.configuration.pojo.Profile)6 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)6 AROTraceData (com.att.aro.core.pojo.AROTraceData)6 BaseTest (com.att.aro.core.BaseTest)5 AnalysisFilter (com.att.aro.core.packetanalysis.pojo.AnalysisFilter)4 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)4 Test (org.junit.Test)4 Session (com.att.aro.core.packetanalysis.pojo.Session)3 FileNotFoundException (java.io.FileNotFoundException)3 IOException (java.io.IOException)3 IBestPractice (com.att.aro.core.bestpractice.IBestPractice)2 BufferOccupancyResult (com.att.aro.core.bestpractice.pojo.BufferOccupancyResult)2 PeriodicTransferResult (com.att.aro.core.bestpractice.pojo.PeriodicTransferResult)2 VideoChunkPacingResult (com.att.aro.core.bestpractice.pojo.VideoChunkPacingResult)2 VideoChunkSizeResult (com.att.aro.core.bestpractice.pojo.VideoChunkSizeResult)2 TsharkException (com.att.aro.core.exception.TsharkException)2 Packet (com.att.aro.core.packetreader.pojo.Packet)2