Search in sources :

Example 26 with PacketInfo

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

the class ExportSessionData method getPacketData.

private List<List<Object>> getPacketData() {
    List<List<Object>> packetData = new ArrayList<>();
    sessionMap.forEach((sessionKey, sessionData) -> {
        for (PacketInfo packetInfo : packetsMap.get(sessionKey)) {
            List<Object> data = new ArrayList<>(sessionData);
            data.add(packetInfo.getPacketId());
            data.add(packetInfo.getTimeStamp());
            data.add(packetInfo.getDir());
            data.add(ResourceBundleHelper.getEnumString(packetInfo.getTcpInfo()));
            data.add(packetInfo.getPacket().getPayloadLen());
            data.add(packetInfo.getTcpFlagString());
            packetData.add(data);
        }
    });
    return packetData;
}
Also used : ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) ArrayList(java.util.ArrayList) List(java.util.List)

Example 27 with PacketInfo

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

the class PeriodicTransferImpl method determinePeriodicity.

/**
 * Determine periodicity
 *
 * @param hostList
 * @param objList
 * @param ipList
 */
private void determinePeriodicity(Set<String> hostList, Set<String> objList, Set<InetAddress> ipList, List<Burst> burstCollection, Profile profile, List<Session> sessionlist) {
    Set<String> hostPeriodicInfoSet = new HashSet<String>();
    for (int i = 0; i < burstCollection.size(); i++) {
        Burst burst = burstCollection.get(i);
        if (burst.getBurstInfos() != BurstCategory.CLIENT_APP) {
            continue;
        }
        if (isCloseSpacedBurst(i, burst, profile.getCloseSpacedBurstThreshold(), burstCollection)) {
            continue;
        }
        Packet beginPacket = burst.getBeginPacket().getPacket();
        if (beginPacket instanceof IPPacket) {
            IPPacket iPkt = (IPPacket) beginPacket;
            InetAddress iAddr = iPkt.getDestinationIPAddress();
            if (isIpInIpList(ipList, hostPeriodicInfoSet, burst, iAddr)) {
                periodicCount++;
                continue;
            }
            iAddr = iPkt.getSourceIPAddress();
            if (isIpInIpList(ipList, hostPeriodicInfoSet, burst, iAddr)) {
                periodicCount++;
                continue;
            }
        }
        PacketInfo firstUplinkPayloadPacket = null;
        for (PacketInfo pInfo : burst.getPackets()) {
            if (pInfo.getDir() == PacketDirection.UPLINK && pInfo.getPayloadLen() > 0) {
                firstUplinkPayloadPacket = pInfo;
                break;
            }
        }
        periodicCount += findPeriodicalBursts(hostPeriodicInfoSet, hostList, objList, burst, firstUplinkPayloadPacket, sessionlist);
    }
    diffPeriodicCount = hostPeriodicInfoSet.size();
}
Also used : Packet(com.att.aro.core.packetreader.pojo.Packet) IPPacket(com.att.aro.core.packetreader.pojo.IPPacket) Burst(com.att.aro.core.packetanalysis.pojo.Burst) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) InetAddress(java.net.InetAddress) IPPacket(com.att.aro.core.packetreader.pojo.IPPacket) HashSet(java.util.HashSet)

Example 28 with PacketInfo

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

the class PeriodicTransferImpl method diagnosisPeriodicRequest.

/**
 * Burst data's analyzed to categorize the periodic bursts.
 */
private void diagnosisPeriodicRequest(List<Session> sessionlist, List<Burst> burstCollection, Profile profile) {
    /* 
		 * Represent lists of hosts, objects, and IPs requested via HTTP and
		 * timestamps when these requests were made.
		 */
    Map<String, List<Double>> requestedHost2tsList = new HashMap<String, List<Double>>();
    Map<String, List<Double>> requestedObj2tsList = new HashMap<String, List<Double>>();
    Map<InetAddress, List<Double>> connectedIP2tsList = new HashMap<InetAddress, List<Double>>();
    // int count = 0;
    for (Session tcpSession : sessionlist) {
        // Get a list of timestamps of established sessions with each remote IP
        if (!tcpSession.isUdpOnly()) {
            PacketInfo firstPacket = tcpSession.getTcpPackets().get(0);
            if (firstPacket.getTcpInfo() == TcpInfo.TCP_ESTABLISH) {
                List<Double> res = connectedIP2tsList.get(tcpSession.getRemoteIP());
                if (res == null) {
                    res = new ArrayList<Double>();
                    connectedIP2tsList.put(tcpSession.getRemoteIP(), res);
                }
                res.add(Double.valueOf(firstPacket.getTimeStamp()));
            }
            // Get a list of timestamps of HTTP requests to hosts/object names
            for (HttpRequestResponseInfo hrri : tcpSession.getRequestResponseInfo()) {
                PacketInfo pkt = hrri.getFirstDataPacket();
                if (hrri.getDirection() == HttpDirection.REQUEST && pkt != null) {
                    Double ts0 = Double.valueOf(pkt.getTimeStamp());
                    if (hrri.getHostName() != null) {
                        List<Double> tempRequestHostEventList = requestedHost2tsList.get(hrri.getHostName());
                        if (tempRequestHostEventList == null) {
                            tempRequestHostEventList = new ArrayList<Double>();
                            requestedHost2tsList.put(hrri.getHostName(), tempRequestHostEventList);
                        }
                        tempRequestHostEventList.add(ts0);
                    }
                    if (hrri.getObjName() != null) {
                        String objName = hrri.getObjNameWithoutParams();
                        List<Double> tempRequestObjEventList = requestedObj2tsList.get(objName);
                        if (tempRequestObjEventList == null) {
                            tempRequestObjEventList = new ArrayList<Double>();
                            requestedObj2tsList.put(objName, tempRequestObjEventList);
                        }
                        tempRequestObjEventList.add(ts0);
                    }
                }
            }
        }
    }
    // logger.info("done looping session");
    Set<String> hostList = new HashSet<String>();
    Set<String> objList = new HashSet<String>();
    Set<InetAddress> ipList = new HashSet<InetAddress>();
    // count = 0;
    for (Map.Entry<String, List<Double>> iter : requestedHost2tsList.entrySet()) {
        if (determinePeriodicity(iter.getValue(), profile)) {
            hostList.add(iter.getKey());
        }
    // logger.info("count: "+count++);
    }
    // count = 0;
    for (Map.Entry<String, List<Double>> iter : requestedObj2tsList.entrySet()) {
        if (determinePeriodicity(iter.getValue(), profile)) {
            objList.add(iter.getKey());
        }
    // logger.info("count: "+count++);
    }
    // count = 0;
    for (Map.Entry<InetAddress, List<Double>> iter : connectedIP2tsList.entrySet()) {
        if (determinePeriodicity(iter.getValue(), profile)) {
            ipList.add(iter.getKey());
        }
    // logger.info("count: "+count++);
    }
    // logger.info("Done looping, now go to determinePeriodicity");
    determinePeriodicity(hostList, objList, ipList, burstCollection, profile, sessionlist);
}
Also used : HashMap(java.util.HashMap) HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) ArrayList(java.util.ArrayList) List(java.util.List) InetAddress(java.net.InetAddress) HashMap(java.util.HashMap) Map(java.util.Map) Session(com.att.aro.core.packetanalysis.pojo.Session) HashSet(java.util.HashSet)

Example 29 with PacketInfo

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

the class PeriodicTransferImpl method calculatePeriodicRepeatTime.

private void calculatePeriodicRepeatTime(List<Burst> burstCollection) {
    int burstSize = burstCollection.size();
    Burst lastPeriodicalBurst = null;
    periodicCount = 0;
    double minimumRepeatTime = Double.MAX_VALUE;
    PacketInfo packetId = null;
    for (int i = 0; i < burstSize; i++) {
        Burst burst = burstCollection.get(i);
        if (burst.getBurstCategory() == BurstCategory.PERIODICAL) {
            if (periodicCount != 0) {
                double time = burst.getBeginTime() - ((lastPeriodicalBurst != null) ? lastPeriodicalBurst.getBeginTime() : 0);
                if (time < minimumRepeatTime) {
                    minimumRepeatTime = time;
                    packetId = burst.getFirstUplinkDataPacket();
                    if (packetId == null) {
                        packetId = burst.getBeginPacket();
                    }
                }
            }
            lastPeriodicalBurst = burst;
            periodicCount++;
        }
    }
    if (minimumRepeatTime != Double.MAX_VALUE && this.periodicCount >= 3) {
        minimumPeriodicRepeatTime = minimumRepeatTime;
    }
}
Also used : Burst(com.att.aro.core.packetanalysis.pojo.Burst) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo)

Example 30 with PacketInfo

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

the class UsingCacheImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    UsingCacheResult result = new UsingCacheResult();
    if (tracedata.getCacheAnalysis() == null) {
        return null;
    }
    double cacheHeaderRatio = 0.0;
    boolean usingCache = false;
    int validCount = 0;
    int noCacheHeadersCount = 0;
    PacketInfo noCacheHeaderFirstPacket = null;
    for (CacheEntry entry : tracedata.getCacheAnalysis().getDiagnosisResults()) {
        if (entry.getDiagnosis() != Diagnosis.CACHING_DIAG_REQUEST_NOT_FOUND && entry.getDiagnosis() != Diagnosis.CACHING_DIAG_INVALID_OBJ_NAME && entry.getDiagnosis() != Diagnosis.CACHING_DIAG_INVALID_REQUEST && entry.getDiagnosis() != Diagnosis.CACHING_DIAG_INVALID_RESPONSE) {
            ++validCount;
            if (!entry.hasCacheHeaders()) {
                if (noCacheHeadersCount == 0) {
                    noCacheHeaderFirstPacket = entry.getSessionFirstPacket();
                }
                ++noCacheHeadersCount;
            }
        }
    }
    cacheHeaderRatio = validCount > 0 ? (100.0 * noCacheHeadersCount) / validCount : 0.0;
    usingCache = cacheHeaderRatio <= 10.0;
    if (usingCache) {
        result.setResultType(BPResultType.PASS);
        result.setResultText(textResultPass);
        result.setResultExcelText(BPResultType.PASS.getDescription());
    } else {
        // ref. old analyzer give warning in this best practice
        result.setResultType(BPResultType.WARNING);
        String text = MessageFormat.format(textResults, ApplicationConfig.getInstance().getAppShortName(), NumberFormat.getIntegerInstance().format(cacheHeaderRatio));
        result.setResultText(text);
        result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.WARNING.getDescription(), NumberFormat.getIntegerInstance().format(cacheHeaderRatio)));
    }
    result.setCacheHeaderRatio(cacheHeaderRatio);
    result.setNoCacheHeaderFirstPacket(noCacheHeaderFirstPacket);
    result.setAboutText(aboutText);
    result.setDetailTitle(detailTitle);
    result.setLearnMoreUrl(learnMoreUrl);
    result.setOverviewTitle(overviewTitle);
    result.setExportAllCacheConPct(exportAllCacheConPct);
    return result;
}
Also used : PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) CacheEntry(com.att.aro.core.packetanalysis.pojo.CacheEntry) UsingCacheResult(com.att.aro.core.bestpractice.pojo.UsingCacheResult)

Aggregations

PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)119 ArrayList (java.util.ArrayList)92 BaseTest (com.att.aro.core.BaseTest)63 Test (org.junit.Test)63 RrcStateRange (com.att.aro.core.packetanalysis.pojo.RrcStateRange)48 Session (com.att.aro.core.packetanalysis.pojo.Session)33 TCPPacket (com.att.aro.core.packetreader.pojo.TCPPacket)30 Profile3G (com.att.aro.core.configuration.pojo.Profile3G)26 Profile (com.att.aro.core.configuration.pojo.Profile)25 InetAddress (java.net.InetAddress)25 RRCState (com.att.aro.core.packetanalysis.pojo.RRCState)21 ProfileLTE (com.att.aro.core.configuration.pojo.ProfileLTE)18 HashSet (java.util.HashSet)16 HttpRequestResponseInfo (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)14 UDPPacket (com.att.aro.core.packetreader.pojo.UDPPacket)14 Packet (com.att.aro.core.packetreader.pojo.Packet)11 HashMap (java.util.HashMap)11 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)9 DomainNameSystem (com.att.aro.core.packetreader.pojo.DomainNameSystem)9 IPPacket (com.att.aro.core.packetreader.pojo.IPPacket)9