Search in sources :

Example 66 with PacketInfo

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

the class TimeRangeAnalysisDialog method hasDataAfterFiltering.

private boolean hasDataAfterFiltering(AnalysisFilter filter) {
    List<PacketInfo> packetsInfoBeforeFilter = currentTraceResult.getTraceresult().getAllpackets();
    PacketAnalyzerImpl packetAnalyzerImpl = (PacketAnalyzerImpl) ((MainFrame) parent).getController().getAROService().getAnalyzer();
    List<PacketInfo> packetsInfoAfterFilter = packetAnalyzerImpl.filterPackets(filter, packetsInfoBeforeFilter);
    return packetsInfoAfterFilter.size() > 0;
}
Also used : PacketAnalyzerImpl(com.att.aro.core.packetanalysis.impl.PacketAnalyzerImpl) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo)

Example 67 with PacketInfo

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

the class GraphPanel method filterFlowTable.

// In 4.1.1, the method called refreshGraph()
public void filterFlowTable() {
    AROTraceData filteredSessionTraceData = getTraceData();
    double filteredStartTime = 0.0;
    double filteredEndTime = 0.0;
    double filteredDuration = filteredSessionTraceData.getAnalyzerResult().getTraceresult().getTraceDuration();
    List<Session> tcpsessionsList = new ArrayList<Session>();
    if (getTraceData() == null) {
        return;
    } else {
        TCPUDPFlowsTableModel model = (TCPUDPFlowsTableModel) parent.getJTCPFlowsTable().getModel();
        Map<String, Session> subSessionMap = model.getSessionMap();
        Map<String, Boolean> subcheckboxMap = model.getCheckboxMap();
        for (Map.Entry<String, Boolean> entry : subcheckboxMap.entrySet()) {
            if (entry.getValue()) {
                tcpsessionsList.add(subSessionMap.get(entry.getKey()));
            }
        }
        filteredSessionTraceData.getAnalyzerResult().setSessionlist(tcpsessionsList);
    }
    List<PacketInfo> packetsForSelectedSession = new ArrayList<PacketInfo>();
    for (Session tcpSession : tcpsessionsList) {
        if (tcpSession.getTcpPackets() != null) {
            packetsForSelectedSession.addAll(tcpSession.getTcpPackets());
        }
    }
    // when generating graph, make sure session is ordered by time stamp
    Collections.sort(packetsForSelectedSession, new Comparator<PacketInfo>() {

        @Override
        public int compare(PacketInfo p1, PacketInfo p2) {
            return (int) (p1.getTimeStamp() * 1000 - p2.getTimeStamp() * 1000);
        }
    });
    boolean selectedAllPackets = false;
    // Adding the TCP packets to the trace for getting redoing the analysis
    if (packetsForSelectedSession.size() > 0) {
        if (tcpsessionsList.size() == getAllTcpSessions()) {
            // For select all use all exiting packets
            filteredSessionTraceData.getAnalyzerResult().getTraceresult().setAllpackets(getAllPackets());
            selectedAllPackets = true;
        } else {
            // Collections.sort(packetsForSelectedSession);//?
            filteredSessionTraceData.getAnalyzerResult().getTraceresult().setAllpackets(packetsForSelectedSession);
        }
    }
    if (selectedAllPackets) {
        filteredStartTime = -0.01;
        filteredEndTime = filteredDuration;
    } else {
        int index = 0;
        for (Session tcpSession : tcpsessionsList) {
            if (tcpSession.getTcpPackets().size() != 0) {
                if (index == 0) {
                    filteredStartTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
                    filteredEndTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
                }
                if (filteredStartTime > tcpSession.getTcpPackets().get(0).getTimeStamp()) {
                    filteredStartTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
                }
                if (filteredEndTime < tcpSession.getTcpPackets().get(0).getTimeStamp()) {
                    filteredEndTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
                }
                index++;
            }
        }
        if (index == 0) {
            filteredStartTime = 0.0;
            filteredEndTime = 0.0;
        }
    }
    // for Analysis data particular time of the graph, some number is not clear..
    if (filteredStartTime > 0) {
        // adjust the time line axis number
        filteredStartTime = filteredStartTime - 2;
        if (filteredStartTime < 0) {
            filteredStartTime = -0.01;
        }
    }
    if (filteredStartTime < 0) {
        filteredStartTime = -0.01;
    }
    if (!selectedAllPackets) {
        if (filteredEndTime > 0) {
            // adjust the time line axis number
            filteredEndTime = filteredEndTime + 15;
        }
        if (filteredEndTime > filteredDuration) {
            filteredEndTime = filteredDuration;
        }
    }
    this.startTime = filteredStartTime;
    this.endTime = filteredEndTime;
    if (getTraceData() != null) {
        TimeRange timeRange = new TimeRange(filteredStartTime, filteredEndTime);
        AnalysisFilter filter = filteredSessionTraceData.getAnalyzerResult().getFilter();
        filter.setTimeRange(timeRange);
        filteredSessionTraceData.getAnalyzerResult().setFilter(filter);
        Statistic stat = ContextAware.getAROConfigContext().getBean(IPacketAnalyzer.class).getStatistic(packetsForSelectedSession);
        long totaltemp = 0;
        for (Session byteCountSession : tcpsessionsList) {
            totaltemp += byteCountSession.getBytesTransferred();
        }
        stat.setTotalByte(totaltemp);
        AbstractRrcStateMachine statemachine = ContextAware.getAROConfigContext().getBean(IRrcStateMachineFactory.class).create(packetsForSelectedSession, filteredSessionTraceData.getAnalyzerResult().getProfile(), stat.getPacketDuration(), filteredDuration, stat.getTotalByte(), timeRange);
        BurstCollectionAnalysisData burstcollectiondata = new BurstCollectionAnalysisData();
        if (stat.getTotalByte() > 0) {
            burstcollectiondata = ContextAware.getAROConfigContext().getBean(IBurstCollectionAnalysis.class).analyze(packetsForSelectedSession, filteredSessionTraceData.getAnalyzerResult().getProfile(), stat.getPacketSizeToCountMap(), statemachine.getStaterangelist(), filteredSessionTraceData.getAnalyzerResult().getTraceresult().getUserEvents(), filteredSessionTraceData.getAnalyzerResult().getTraceresult().getCpuActivityList().getCpuActivities(), tcpsessionsList);
        }
        filteredSessionTraceData.getAnalyzerResult().getStatistic().setTotalByte(stat.getTotalByte());
        filteredSessionTraceData.getAnalyzerResult().setStatemachine(statemachine);
        filteredSessionTraceData.getAnalyzerResult().setBurstCollectionAnalysisData(burstcollectiondata);
        refresh(filteredSessionTraceData);
    }
}
Also used : TCPUDPFlowsTableModel(com.att.aro.ui.model.diagnostic.TCPUDPFlowsTableModel) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ArrayList(java.util.ArrayList) Statistic(com.att.aro.core.packetanalysis.pojo.Statistic) AbstractRrcStateMachine(com.att.aro.core.packetanalysis.pojo.AbstractRrcStateMachine) IPacketAnalyzer(com.att.aro.core.packetanalysis.IPacketAnalyzer) AROTraceData(com.att.aro.core.pojo.AROTraceData) Point(java.awt.Point) TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) BurstCollectionAnalysisData(com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData) Map(java.util.Map) EnumMap(java.util.EnumMap) TreeMap(java.util.TreeMap) IRrcStateMachineFactory(com.att.aro.core.packetanalysis.IRrcStateMachineFactory) Session(com.att.aro.core.packetanalysis.pojo.Session)

Example 68 with PacketInfo

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

the class BurstCollectionAnalysisImpl method analyze.

@Override
public BurstCollectionAnalysisData analyze(List<PacketInfo> packets, Profile profile, Map<Integer, Integer> packetSizeToCountMap, List<RrcStateRange> rrcstaterangelist, List<UserEvent> usereventlist, List<CpuActivity> cpuactivitylist, List<Session> sessionlist) {
    BurstCollectionAnalysisData data = new BurstCollectionAnalysisData();
    Set<Integer> mss = calculateMssLargerPacketSizeSet(packetSizeToCountMap);
    List<Burst> burstCollection = groupIntoBursts(packets, profile, mss, rrcstaterangelist);
    data.setBurstCollection(burstCollection);
    if (!burstCollection.isEmpty()) {
        int longBurstCount = analyzeBursts(burstCollection, usereventlist, cpuactivitylist, profile);
        data.setLongBurstCount(longBurstCount);
        double totalEnergy = computeBurstEnergyRadioResource(rrcstaterangelist, burstCollection, profile);
        data.setTotalEnergy(totalEnergy);
        List<BurstAnalysisInfo> burstAnalysisInfo = analyzeBurstStat(burstCollection);
        data.setBurstAnalysisInfo(burstAnalysisInfo);
        PacketInfo shortestPacket = findShortestPeriodPacketInfo(burstCollection);
        data.setShortestPeriodPacketInfo(shortestPacket);
    }
    return data;
}
Also used : BurstAnalysisInfo(com.att.aro.core.packetanalysis.pojo.BurstAnalysisInfo) Burst(com.att.aro.core.packetanalysis.pojo.Burst) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) BurstCollectionAnalysisData(com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)

Example 69 with PacketInfo

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

the class BurstCollectionAnalysisImpl method findShortestPeriodPacketInfo.

/**
 * Method to find the different periodic connection and periodic duration.
 */
private PacketInfo findShortestPeriodPacketInfo(List<Burst> burstCollection) {
    int burstSize = burstCollection.size();
    Burst lastPeriodicalBurst = null;
    int periodicPacketCounter = 0;
    double minRepeatTime = Double.MAX_VALUE;
    PacketInfo pktId = null;
    double time = 0;
    for (int i = 0; i < burstSize; i++) {
        Burst burst = burstCollection.get(i);
        if (burst.getBurstCategory() == BurstCategory.PERIODICAL) {
            if (periodicPacketCounter != 0) {
                time = burst.getBeginTime() - ((lastPeriodicalBurst != null) ? lastPeriodicalBurst.getBeginTime() : 0);
                if (time < minRepeatTime) {
                    minRepeatTime = time;
                    pktId = burst.getFirstUplinkDataPacket();
                    if (null == pktId) {
                        pktId = burst.getBeginPacket();
                    }
                }
            }
            periodicPacketCounter++;
            lastPeriodicalBurst = burst;
        }
    }
    return pktId;
}
Also used : Burst(com.att.aro.core.packetanalysis.pojo.Burst) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo)

Example 70 with PacketInfo

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

the class BurstCollectionAnalysisImpl method groupIntoBursts.

/**
 * Groups packets into Burst Collections
 * @return
 */
private List<Burst> groupIntoBursts(List<PacketInfo> packets, Profile profile, Set<Integer> mss, List<RrcStateRange> rrcstaterangelist) {
    List<Burst> burstCollection;
    // Validate that there are packets
    if (packets == null || packets.isEmpty()) {
        burstCollection = Collections.emptyList();
        return burstCollection;
    }
    ArrayList<Burst> result = new ArrayList<Burst>();
    double burstThresh = profile.getBurstTh();
    double longBurstThresh = profile.getLongBurstTh();
    List<PacketInfo> burstPackets = new ArrayList<PacketInfo>();
    // Step 1: Build bursts using burst time threshold
    PacketInfo lastPacket = null;
    for (PacketInfo packet : packets) {
        if ((lastPacket == null || (packet.getTimeStamp() - lastPacket.getTimeStamp() > burstThresh && !mss.contains(lastPacket.getPayloadLen()))) && (!burstPackets.isEmpty())) {
            result.add(new Burst(burstPackets));
            burstPackets.clear();
        }
        burstPackets.add(packet);
        lastPacket = packet;
    }
    result.add(new Burst(burstPackets));
    // Step 2: Remove promotion delays and merge bursts if possible
    Map<PacketInfo, Double> timestampList = normalizeCore(packets, rrcstaterangelist);
    List<Burst> newBurstColl = new ArrayList<Burst>(result.size());
    int size = result.size();
    Burst newBurst = result.get(0);
    for (int i = 0; i < size - 1; i++) {
        Burst bnext = result.get(i + 1);
        double time1 = timestampList.get(newBurst.getEndPacket());
        double time2 = timestampList.get(bnext.getBeginPacket());
        if ((time2 - time1) < burstThresh) {
            newBurst.merge(bnext);
        } else {
            newBurstColl.add(newBurst);
            newBurst = bnext;
        }
    }
    newBurstColl.add(newBurst);
    burstCollection = newBurstColl;
    // determine short/long IBTs
    size = burstCollection.size();
    for (int i = 0; i < size; i++) {
        Burst aBurst = burstCollection.get(i);
        // assert (aBurst.getEndTime() >= aBurst.getBeginTime());
        if (i < size - 1) {
            double ibt = burstCollection.get(i + 1).getBeginTime() - aBurst.getEndTime();
            // assert (ibt >= burstThresh);
            aBurst.setbLong((ibt > longBurstThresh));
        } else {
            aBurst.setbLong(true);
        }
    }
    return burstCollection;
}
Also used : Burst(com.att.aro.core.packetanalysis.pojo.Burst) ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo)

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