Search in sources :

Example 6 with PacketAnalyzerResult

use of com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult in project VideoOptimzer by attdevsupport.

the class MetadataPanel method refresh.

/**
 * This method is called to check when VO refreshes(Traceload/Open VO) Based
 * on the flow load the values or empty text
 */
@Override
public void refresh(AROTraceData model) {
    PacketAnalyzerResult analyzerResults = model.getAnalyzerResult();
    AbstractTraceResult traceResults = analyzerResults.getTraceresult();
    if (traceResults != null) {
        if (traceResults.getTraceResultType() == TraceResultType.TRACE_DIRECTORY && metaDataHelper != null) {
            try {
                loadMetadataPanel(((TraceDirectoryResult) traceResults).getMetaData());
            } catch (Exception e) {
                clearDirResults();
            }
        } else {
            clearDirResults();
        }
    }
}
Also used : AbstractTraceResult(com.att.aro.core.packetanalysis.pojo.AbstractTraceResult) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) PrinterException(java.awt.print.PrinterException)

Example 7 with PacketAnalyzerResult

use of com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult in project VideoOptimzer by attdevsupport.

the class MultipleSimultnsConnImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult traceData) {
    traceDataResult = traceData;
    MultiSimultnsConnectionResult result = new MultiSimultnsConnectionResult();
    simultnsConnectionAllServersEntryList = new ArrayList<MultipleConnectionsEntry>();
    simultnsConnectionAllServersEntryMap = new TreeMap<Double, MultipleConnectionsEntry>();
    populateAllSimultConnList();
    for (Map.Entry<Double, MultipleConnectionsEntry> simultnsConnAllServersEntryMap : simultnsConnectionAllServersEntryMap.entrySet()) {
        if (simultnsConnAllServersEntryMap.getValue() != null) {
            simultnsConnectionAllServersEntryList.add(simultnsConnAllServersEntryMap.getValue());
        }
    }
    result.setResults(simultnsConnectionAllServersEntryList);
    String text = "";
    if (simultnsConnectionAllServersEntryList.isEmpty()) {
        result.setResultType(BPResultType.PASS);
        text = MessageFormat.format(textResultPass, simultnsConnectionAllServersEntryList.size());
        result.setResultText(text);
        result.setResultExcelText(BPResultType.PASS.getDescription());
    } else {
        result.setResultType(BPResultType.FAIL);
        result.setResultText(textResults);
        // TODO: Validate conditional statement
        result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.FAIL.getDescription(), simultnsConnectionAllServersEntryList.parallelStream().mapToInt(x -> x.getConcurrentSessions()).sum(), (simultnsConnectionAllServersEntryList.size() > 1 ? "s" : "")));
    }
    result.setAboutText(aboutText);
    result.setDetailTitle(detailTitle);
    result.setLearnMoreUrl(learnMoreUrl);
    result.setOverviewTitle(overviewTitle);
    return result;
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) MultiSimultnsConnectionResult(com.att.aro.core.bestpractice.pojo.MultiSimultnsConnectionResult) Session(com.att.aro.core.packetanalysis.pojo.Session) SessionValues(com.att.aro.core.packetanalysis.pojo.SessionValues) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) Value(org.springframework.beans.factory.annotation.Value) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) List(java.util.List) TreeMap(java.util.TreeMap) SimultnsUtil(com.att.aro.core.bestpractice.pojo.SimultnsUtil) IBestPractice(com.att.aro.core.bestpractice.IBestPractice) MultipleConnectionsEntry(com.att.aro.core.bestpractice.pojo.MultipleConnectionsEntry) Map(java.util.Map) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) Collections(java.util.Collections) SortedMap(java.util.SortedMap) MultipleConnectionsEntry(com.att.aro.core.bestpractice.pojo.MultipleConnectionsEntry) MultiSimultnsConnectionResult(com.att.aro.core.bestpractice.pojo.MultiSimultnsConnectionResult) TreeMap(java.util.TreeMap) Map(java.util.Map) SortedMap(java.util.SortedMap)

Example 8 with PacketAnalyzerResult

use of com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult in project VideoOptimzer by attdevsupport.

the class VideoBufferOccupancyImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    result = new BufferOccupancyResult();
    init(result);
    if ((streamingVideoData = tracedata.getStreamingVideoData()) != null && (videoStreamCollection = streamingVideoData.getVideoStreamMap()) != null && MapUtils.isNotEmpty(videoStreamCollection)) {
        bpResultType = BPResultType.CONFIG_REQUIRED;
        result.setResultExcelText(bpResultType.getDescription());
        selectedManifestCount = streamingVideoData.getSelectedManifestCount();
        hasSelectedManifest = (selectedManifestCount > 0);
        invalidCount = streamingVideoData.getInvalidManifestCount();
        if (selectedManifestCount == 0) {
            if (invalidCount == videoStreamCollection.size()) {
                result.setResultText(invalidManifestsFound);
            } else if (invalidCount > 0) {
                result.setResultText(noManifestsSelectedMixed);
            } else {
                result.setResultText(noManifestsSelected);
            }
        } else if (selectedManifestCount > 1) {
            result.setResultText(multipleManifestsSelected);
        } else if (hasSelectedManifest) {
            BufferOccupancyBPResult bufferBPResult = tracedata.getBufferOccupancyResult();
            BufferTimeBPResult bufferTimeBPResult = tracedata.getBufferTimeResult();
            double maxBufferInMB = 0;
            if (bufferBPResult != null && bufferBPResult.getBufferByteDataSet().size() > 0) {
                double megabyteDivisor = 1000 * 1000;
                // getMaxBuffer() returns in bytes
                maxBufferInMB = bufferBPResult.getMaxBuffer() / megabyteDivisor;
                List<Double> bufferDataSet = bufferBPResult.getBufferByteDataSet();
                // In MB
                result.setMinBufferByte(bufferDataSet.get(0) / megabyteDivisor);
                double bufferSum = bufferDataSet.stream().reduce((a, b) -> a + b).get();
                result.setAvgBufferByte((bufferSum / bufferDataSet.size()) / megabyteDivisor);
            } else {
                maxBufferInMB = 0;
            }
            if (bufferTimeBPResult != null && bufferTimeBPResult.getBufferTimeDataSet().size() > 0) {
                List<Double> bufferTimeDataSet = bufferTimeBPResult.getBufferTimeDataSet();
                result.setMinBufferTime(bufferTimeDataSet.get(0));
                result.setMaxBufferTime(bufferTimeDataSet.get(bufferTimeDataSet.size() - 1));
                double sum = bufferTimeDataSet.stream().reduce((a, b) -> a + b).get();
                result.setAvgBufferTime(sum / bufferTimeDataSet.size());
            }
            result.setSelfTest(true);
            result.setMaxBuffer(maxBufferInMB);
            double percentage = 0;
            double maxBufferSet = getVideoPrefMaxBuffer();
            if (maxBufferSet != 0) {
                percentage = (maxBufferInMB / maxBufferSet) * 100;
            }
            if (MapUtils.isEmpty(streamingVideoData.getStreamingVideoCompiled().getChunkPlayTimeList())) {
                result.setResultText(startUpDelayNotSet);
                bpResultType = BPResultType.CONFIG_REQUIRED;
            } else {
                if (percentage > 100) {
                    bpResultType = BPResultType.WARNING;
                }
                bpResultType = BPResultType.PASS;
                result.setResultText(MessageFormat.format(this.textResults, String.format("%.2f", percentage), String.format("%.2f", maxBufferInMB), String.format("%.2f", maxBufferSet)));
                result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), String.format("%.2f", percentage), String.format("%.2f", maxBufferInMB)));
            }
        }
    } else {
        result.setSelfTest(false);
        result.setResultText(noData);
        bpResultType = BPResultType.NO_DATA;
        result.setResultExcelText(bpResultType.getDescription());
    }
    result.setResultType(bpResultType);
    return result;
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) Setter(lombok.Setter) BufferOccupancyResult(com.att.aro.core.bestpractice.pojo.BufferOccupancyResult) Getter(lombok.Getter) MapUtils(org.apache.commons.collections.MapUtils) BufferOccupancyBPResult(com.att.aro.core.packetanalysis.pojo.BufferOccupancyBPResult) NonNull(lombok.NonNull) Autowired(org.springframework.beans.factory.annotation.Autowired) BufferTimeBPResult(com.att.aro.core.packetanalysis.pojo.BufferTimeBPResult) MessageFormat(java.text.MessageFormat) Value(org.springframework.beans.factory.annotation.Value) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) List(java.util.List) StreamingVideoData(com.att.aro.core.videoanalysis.pojo.StreamingVideoData) AccessLevel(lombok.AccessLevel) TreeMap(java.util.TreeMap) IBestPractice(com.att.aro.core.bestpractice.IBestPractice) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) IVideoUsagePrefsManager(com.att.aro.core.videoanalysis.IVideoUsagePrefsManager) Nonnull(javax.annotation.Nonnull) SortedMap(java.util.SortedMap) BufferOccupancyBPResult(com.att.aro.core.packetanalysis.pojo.BufferOccupancyBPResult) BufferOccupancyResult(com.att.aro.core.bestpractice.pojo.BufferOccupancyResult) BufferTimeBPResult(com.att.aro.core.packetanalysis.pojo.BufferTimeBPResult)

Example 9 with PacketAnalyzerResult

use of com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult in project VideoOptimzer by attdevsupport.

the class PacketAnalyzerImpl method analyzeTraceDirectory.

@Override
public PacketAnalyzerResult analyzeTraceDirectory(String traceDirectory, Profile profile, AnalysisFilter filter) throws FileNotFoundException {
    long bpStartTime = System.currentTimeMillis();
    TraceDirectoryResult result = tracereader.readTraceDirectory(traceDirectory);
    if (filter != null) {
        TimeRange tempTimeRange = filter.getTimeRange();
        if (tempTimeRange != null) {
            TraceDirectoryResult tempResult = (TraceDirectoryResult) pktTimeUtil.getTimeRangeResult(result, tempTimeRange);
            result.setAlarmInfos(tempResult.getAlarmInfos());
            result.setBatteryInfos(tempResult.getBatteryInfos());
            result.setBluetoothInfos(tempResult.getBluetoothInfos());
            result.setCameraInfos(tempResult.getCameraInfos());
            result.setGpsInfos(tempResult.getGpsInfos());
            result.setNetworkTypeInfos(tempResult.getNetworkTypeInfos());
            result.setRadioInfos(tempResult.getRadioInfos());
            result.setScreenStateInfos(tempResult.getScreenStateInfos());
            result.setUserEvents(tempResult.getUserEvents());
            result.setTemperatureInfos(tempResult.getTemperatureInfos());
            result.setLocationEventInfos(tempResult.getLocationEventInfos());
            result.setWifiInfos(tempResult.getWifiInfos());
            result.getCpuActivityList().updateTimeRange(tempTimeRange.getBeginTime(), tempTimeRange.getEndTime());
            result.setDeviceKeywordInfos(tempResult.getDeviceKeywordInfos());
            result.setAttenautionEvent(tempResult.getAttenautionEvent());
        }
    }
    PacketAnalyzerResult res = finalResult(result, profile, filter);
    result.setMetaData(metaDataHelper.initMetaData(res));
    GoogleAnalyticsUtil.getGoogleAnalyticsInstance().sendAnalyticsTimings(pktAnalysisTitle, System.currentTimeMillis() - bpStartTime, analysisCategory);
    LOGGER.debug(String.format("Time to process PacketAnalyzerImpl %s :%12.4f", pktAnalysisTitle, ((float) (System.currentTimeMillis() - bpStartTime)) / 3600.0));
    return res;
}
Also used : TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)

Example 10 with PacketAnalyzerResult

use of com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult 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)

Aggregations

PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)37 BaseTest (com.att.aro.core.BaseTest)11 ArrayList (java.util.ArrayList)11 Test (org.junit.Test)11 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)10 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)7 Session (com.att.aro.core.packetanalysis.pojo.Session)7 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)7 AROTraceData (com.att.aro.core.pojo.AROTraceData)6 BestPracticeType (com.att.aro.core.bestpractice.pojo.BestPracticeType)5 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)5 Packet (com.att.aro.core.packetreader.pojo.Packet)5 MainFrame (com.att.aro.ui.view.MainFrame)5 List (java.util.List)5 Profile (com.att.aro.core.configuration.pojo.Profile)4 AnalysisFilter (com.att.aro.core.packetanalysis.pojo.AnalysisFilter)4 Statistic (com.att.aro.core.packetanalysis.pojo.Statistic)4 File (java.io.File)4 IBestPractice (com.att.aro.core.bestpractice.IBestPractice)3 BPResultType (com.att.aro.core.bestpractice.pojo.BPResultType)3