Search in sources :

Example 16 with RrcStateRange

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

the class RrcStateRangeFactoryImplTest method Create3G_test15.

@Test
public void Create3G_test15() {
    // RRCState.STATE_FACH
    Profile3G profile3g = mock(Profile3G.class);
    when(profile3g.getProfileType()).thenReturn(ProfileType.T3G);
    when(profile3g.getIdleDchPromoAvg()).thenReturn(12000.0);
    when(profile3g.getIdleDchPromoMin()).thenReturn(1000.0);
    when(profile3g.getIdleDchPromoMax()).thenReturn(20000.0);
    when(profile3g.getFachDchPromoAvg()).thenReturn(1000.0);
    when(profile3g.getFachDchPromoMin()).thenReturn(2500.0);
    when(profile3g.getFachDchPromoMax()).thenReturn(6000.0);
    when(profile3g.getDchFachTimer()).thenReturn(1000.0);
    when(profile3g.getFachIdleTimer()).thenReturn(2000.0);
    double traceDuration = 2000.0;
    List<PacketInfo> packetlist = new ArrayList<PacketInfo>();
    when(pktInfoArray[0].getTimeStamp()).thenReturn(date.getTime() - 1500.0);
    when(pktInfoArray[0].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[0].getLen()).thenReturn(1000);
    when(pktInfoArray[0].getStateMachine()).thenReturn(RRCState.STATE_FACH);
    packetlist.add(pktInfoArray[0]);
    when(pktInfoArray[1].getTimeStamp()).thenReturn(date.getTime() + 1000.0);
    when(pktInfoArray[1].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[1].getLen()).thenReturn(1000);
    when(pktInfoArray[1].getStateMachine()).thenReturn(RRCState.STATE_FACH);
    packetlist.add(pktInfoArray[1]);
    when(pktInfoArray[2].getTimeStamp()).thenReturn(date.getTime() + 1500.0);
    when(pktInfoArray[2].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[2].getLen()).thenReturn(1000);
    when(pktInfoArray[2].getStateMachine()).thenReturn(RRCState.STATE_FACH);
    packetlist.add(pktInfoArray[2]);
    List<RrcStateRange> testList = rrcStateRangeFactory.create(packetlist, profile3g, traceDuration);
    assertEquals(1, testList.size());
}
Also used : ArrayList(java.util.ArrayList) Profile3G(com.att.aro.core.configuration.pojo.Profile3G) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 17 with RrcStateRange

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

the class RrcStateRangeFactoryImplTest method create3G_test2.

@Test
public void create3G_test2() {
    // promotestate is TAIL_DCH
    Profile3G profile3g = mock(Profile3G.class);
    when(profile3g.getProfileType()).thenReturn(ProfileType.T3G);
    when(profile3g.getIdleDchPromoAvg()).thenReturn(1000.0);
    when(profile3g.getIdleDchPromoMin()).thenReturn(1000.0);
    when(profile3g.getIdleDchPromoMax()).thenReturn(1000.0);
    when(profile3g.getFachDchPromoAvg()).thenReturn(1000.0);
    when(profile3g.getFachDchPromoMin()).thenReturn(1000.0);
    when(profile3g.getFachDchPromoMax()).thenReturn(1000.0);
    when(profile3g.getDchFachTimer()).thenReturn(1000.0);
    when(profile3g.getFachIdleTimer()).thenReturn(1000.0);
    double traceDuration = 2000.0;
    List<PacketInfo> packetlist = new ArrayList<PacketInfo>();
    when(pktInfoArray[0].getTimeStamp()).thenReturn(date.getTime() - 1500.0);
    when(pktInfoArray[0].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[0].getLen()).thenReturn(1000);
    when(pktInfoArray[0].getStateMachine()).thenReturn(RRCState.TAIL_DCH);
    packetlist.add(pktInfoArray[0]);
    when(pktInfoArray[1].getTimeStamp()).thenReturn(date.getTime() + 100.0);
    when(pktInfoArray[1].getDir()).thenReturn(PacketDirection.UPLINK);
    when(pktInfoArray[1].getLen()).thenReturn(1000);
    when(pktInfoArray[1].getStateMachine()).thenReturn(RRCState.STATE_DCH);
    packetlist.add(pktInfoArray[1]);
    List<RrcStateRange> testList = rrcStateRangeFactory.create(packetlist, profile3g, traceDuration);
    assertEquals(1, testList.size());
}
Also used : ArrayList(java.util.ArrayList) Profile3G(com.att.aro.core.configuration.pojo.Profile3G) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 18 with RrcStateRange

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

the class RrcStateRangeFactoryImplTest method Create3G_test9.

@Test
public void Create3G_test9() {
    // promoState == RRCState.STATE_DCH
    Profile3G profile3g = mock(Profile3G.class);
    when(profile3g.getProfileType()).thenReturn(ProfileType.T3G);
    when(profile3g.getIdleDchPromoAvg()).thenReturn(12000.0);
    when(profile3g.getIdleDchPromoMin()).thenReturn(1000.0);
    when(profile3g.getIdleDchPromoMax()).thenReturn(20000.0);
    when(profile3g.getFachDchPromoAvg()).thenReturn(1000.0);
    when(profile3g.getFachDchPromoMin()).thenReturn(2500.0);
    when(profile3g.getFachDchPromoMax()).thenReturn(6000.0);
    when(profile3g.getDchFachTimer()).thenReturn(5000.0);
    when(profile3g.getFachIdleTimer()).thenReturn(10000.0);
    double traceDuration = 2000.0;
    List<PacketInfo> packetlist = new ArrayList<PacketInfo>();
    when(pktInfoArray[0].getTimeStamp()).thenReturn(date.getTime() - 7500.0);
    when(pktInfoArray[0].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[0].getLen()).thenReturn(1000);
    when(pktInfoArray[0].getStateMachine()).thenReturn(RRCState.STATE_DCH);
    packetlist.add(pktInfoArray[0]);
    when(pktInfoArray[1].getTimeStamp()).thenReturn(date.getTime() + 10000.0);
    when(pktInfoArray[1].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[1].getLen()).thenReturn(1000);
    when(pktInfoArray[1].getStateMachine()).thenReturn(RRCState.STATE_DCH);
    packetlist.add(pktInfoArray[1]);
    when(pktInfoArray[2].getTimeStamp()).thenReturn(date.getTime() + 15000.0);
    when(pktInfoArray[2].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[2].getLen()).thenReturn(1000);
    when(pktInfoArray[2].getStateMachine()).thenReturn(RRCState.STATE_DCH);
    packetlist.add(pktInfoArray[2]);
    List<RrcStateRange> testList = rrcStateRangeFactory.create(packetlist, profile3g, traceDuration);
    assertEquals(1, testList.size());
}
Also used : ArrayList(java.util.ArrayList) Profile3G(com.att.aro.core.configuration.pojo.Profile3G) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 19 with RrcStateRange

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

the class TimeRangeAnalysis method performTimeRangeAnalysis.

/**
 * Performs a TimeRangeAnalysis on the trace data.
 * @param analysisData Packet analyzer result object
 */
private void performTimeRangeAnalysis(PacketAnalyzerResult analysisData) {
    if (analysisData != null) {
        List<RrcStateRange> rrcCollection = analysisData.getStatemachine().getStaterangelist();
        List<PacketInfo> packets = analysisData.getTraceresult().getAllpackets();
        if (controller != null) {
            PacketAnalyzerImpl packetAnalyzerImpl = (PacketAnalyzerImpl) (controller.getAROService().getAnalyzer());
            packets = packetAnalyzerImpl.filterPackets(analysisData.getFilter(), packets);
        }
        Profile profile = analysisData.getProfile();
        int packetNum = packets.size();
        for (int i = 0; i < packetNum; i++) {
            PacketInfo packetInfo = packets.get(i);
            if ((!ipv4Present || !ipv6Present) && packetInfo.getPacket() instanceof IPPacket) {
                IPPacket p = (IPPacket) packetInfo.getPacket();
                if (p.getIPVersion() == 4) {
                    ipv4Present = true;
                } else if (p.getIPVersion() == 6) {
                    ipv6Present = true;
                }
            }
            if (!tcpPresent && packetInfo.getPacket() instanceof TCPPacket) {
                tcpPresent = true;
            } else if ((!udpPresent || !dnsPresent) && packetInfo.getPacket() instanceof UDPPacket) {
                UDPPacket p = (UDPPacket) packetInfo.getPacket();
                udpPresent = true;
                if (p.isDNSPacket()) {
                    dnsPresent = true;
                }
            }
            if (packetInfo.getTimeStamp() >= startTime && packetInfo.getTimeStamp() <= endTime) {
                payloadLen += packetInfo.getPayloadLen();
                totalBytes += packetInfo.getLen();
                if (packetInfo.getDir().equals(PacketDirection.UPLINK)) {
                    uplinkBytes += packetInfo.getLen();
                } else if (packetInfo.getDir().equals(PacketDirection.DOWNLINK)) {
                    downlinkBytes += packetInfo.getLen();
                }
            }
        }
        int collectionSize = rrcCollection.size();
        for (int i = 0; i < collectionSize; i++) {
            double beginTime;
            double endTime;
            RrcStateRange rrc = rrcCollection.get(i);
            if (rrc.getEndTime() < this.startTime) {
                continue;
            }
            if (rrc.getBeginTime() > this.endTime) {
                continue;
            }
            if (rrc.getBeginTime() >= this.startTime) {
                beginTime = rrc.getBeginTime();
            } else {
                beginTime = this.startTime;
            }
            if (rrc.getEndTime() <= this.endTime) {
                endTime = rrc.getEndTime();
            } else {
                endTime = this.endTime;
            }
            RRCState rrcState = rrc.getState();
            rrcEnergy += updateEnergy(analysisData, profile, beginTime, endTime, rrcState);
            activeTime += updateActiveTime(profile, beginTime, endTime, rrcState);
        }
    }
}
Also used : RRCState(com.att.aro.core.packetanalysis.pojo.RRCState) TCPPacket(com.att.aro.core.packetreader.pojo.TCPPacket) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) UDPPacket(com.att.aro.core.packetreader.pojo.UDPPacket) Profile(com.att.aro.core.configuration.pojo.Profile) IPPacket(com.att.aro.core.packetreader.pojo.IPPacket)

Example 20 with RrcStateRange

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

the class RrcStateRangeFactoryImpl method createWiFi.

private List<RrcStateRange> createWiFi(List<PacketInfo> packetlist, ProfileWiFi profile, double traceDuration) {
    // Create results list
    ArrayList<RrcStateRange> result = new ArrayList<RrcStateRange>();
    // Iterate through packets in trace
    Iterator<PacketInfo> iter = packetlist.iterator();
    PacketInfo packet;
    if (iter.hasNext()) {
        // Track time of state changes
        double timer = 0.0;
        // Keep timestamp of previous packet in iteration
        packet = iter.next();
        packet.setStateMachine(RRCState.WIFI_ACTIVE);
        double last = packet.getTimeStamp();
        // Idle state till first packet is received
        result.add(new RrcStateRange(timer, last, RRCState.WIFI_IDLE));
        timer = last;
        while (iter.hasNext()) {
            packet = iter.next();
            packet.setStateMachine(RRCState.WIFI_ACTIVE);
            double curr = packet.getTimeStamp();
            // Check to see if we dropped to WiFi Active
            if (curr - last > profile.getWifiTailTime()) {
                timer = tailWiFi(result, timer, last, curr, profile);
                // If end of tail was reached, we need to the idle time before the next packet arrives
                if (timer < curr) {
                    result.add(new RrcStateRange(timer, curr, RRCState.WIFI_IDLE));
                    timer = curr;
                }
            }
            // Save current packet time as last packet for next iteration
            last = curr;
        }
        // Do final WiFi tail
        timer = tailWiFi(result, timer, last, traceDuration, profile);
        // Check for final idle time
        if (timer < traceDuration) {
            result.add(new RrcStateRange(timer, traceDuration, RRCState.WIFI_IDLE));
        }
    } else {
        // State is idle for the entire trace
        result.add(new RrcStateRange(0.0, traceDuration, RRCState.WIFI_IDLE));
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo)

Aggregations

RrcStateRange (com.att.aro.core.packetanalysis.pojo.RrcStateRange)59 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)48 ArrayList (java.util.ArrayList)47 BaseTest (com.att.aro.core.BaseTest)42 Test (org.junit.Test)42 Profile3G (com.att.aro.core.configuration.pojo.Profile3G)27 Profile (com.att.aro.core.configuration.pojo.Profile)23 RRCState (com.att.aro.core.packetanalysis.pojo.RRCState)22 ProfileLTE (com.att.aro.core.configuration.pojo.ProfileLTE)12 ProfileWiFi (com.att.aro.core.configuration.pojo.ProfileWiFi)9 RrcStateMachine3G (com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G)9 RrcStateMachineLTE (com.att.aro.core.packetanalysis.pojo.RrcStateMachineLTE)9 TCPPacket (com.att.aro.core.packetreader.pojo.TCPPacket)5 UDPPacket (com.att.aro.core.packetreader.pojo.UDPPacket)5 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)4 RrcStateMachineWiFi (com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi)4 DomainNameSystem (com.att.aro.core.packetreader.pojo.DomainNameSystem)4 CpuActivity (com.att.aro.core.peripheral.pojo.CpuActivity)4 InetAddress (java.net.InetAddress)4 HashSet (java.util.HashSet)4