Search in sources :

Example 61 with PacketInfo

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

the class ProfileFactoryImplTest method energyLTE_RRCStateIsLTE_IDLE_a.

@Test
public void energyLTE_RRCStateIsLTE_IDLE_a() {
    ProfileLTE profileLte03 = Mockito.mock(ProfileLTE.class);
    List<PacketInfo> packets = new ArrayList<PacketInfo>();
    when(profileLte03.getIdlePingTime()).thenReturn(1.0);
    when(profileLte03.getLteIdlePingPower()).thenReturn(1.0);
    when(profileLte03.getIdlePingPeriod()).thenReturn(9.0);
    when(profileLte03.getLteIdlePower()).thenReturn(1.0);
    double testResult = profilefactory.energyLTE(date.getTime() + 0.0, date.getTime() + 14750.0, RRCState.LTE_IDLE, profileLte03, packets);
    assertEquals(14750.0, testResult, 0.0);
}
Also used : ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) ProfileLTE(com.att.aro.core.configuration.pojo.ProfileLTE) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 62 with PacketInfo

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

the class ProfileFactoryImplTest method energyLTE_RRCStateIsLTE_CR_TAIL.

@Test
public void energyLTE_RRCStateIsLTE_CR_TAIL() {
    ProfileLTE profileLte04 = Mockito.mock(ProfileLTE.class);
    List<PacketInfo> packets = new ArrayList<PacketInfo>();
    when(profileLte04.getIdlePingTime()).thenReturn(1.0);
    when(profileLte04.getLteIdlePingPower()).thenReturn(1.0);
    when(profileLte04.getIdlePingPeriod()).thenReturn(2.0);
    when(profileLte04.getLteIdlePower()).thenReturn(1.0);
    double testResult = profilefactory.energyLTE(date.getTime() + 0.0, date.getTime() + 1000.0, RRCState.LTE_CR_TAIL, profileLte04, packets);
    assertEquals(0.0, testResult, 0.0);
}
Also used : ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) ProfileLTE(com.att.aro.core.configuration.pojo.ProfileLTE) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 63 with PacketInfo

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

the class ProfileFactoryImplTest method energyLTE_RRCStateIsLTE_DRX_LONG.

@Test
public void energyLTE_RRCStateIsLTE_DRX_LONG() {
    ProfileLTE profileLte05 = Mockito.mock(ProfileLTE.class);
    List<PacketInfo> packets = new ArrayList<PacketInfo>();
    when(profileLte05.getDrxLongPingPeriod()).thenReturn(5.0);
    when(profileLte05.getDrxLongPingPower()).thenReturn(1.0);
    when(profileLte05.getLteTailPower()).thenReturn(2.0);
    when(profileLte05.getDrxPingTime()).thenReturn(1.0);
    double testResult = profilefactory.energyLTE(date.getTime() + 0.0, date.getTime() + 1000.0, RRCState.LTE_DRX_LONG, profileLte05, packets);
    assertEquals(1800.0, testResult, 0.0);
}
Also used : ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) ProfileLTE(com.att.aro.core.configuration.pojo.ProfileLTE) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 64 with PacketInfo

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

the class UnsecureSSLVersionImplTest method getPacketAnalyzerResult.

private PacketAnalyzerResult getPacketAnalyzerResult(Set<String> unsecureSSLVersions) {
    Session session = mock(Session.class);
    PacketInfo info = mock(PacketInfo.class);
    TCPPacket tcpPacket = mock(TCPPacket.class);
    InetAddress address = mock(InetAddress.class);
    String ipAddress = "127.0.0.1";
    int port = 8080;
    List<Session> sessions = new ArrayList<>();
    sessions.add(session);
    List<PacketInfo> packetInfos = new LinkedList<>();
    packetInfos.add(info);
    packetAnalyzerResult.setSessionlist(sessions);
    when(session.getTcpPackets()).thenReturn(packetInfos);
    when(info.getPacket()).thenReturn(tcpPacket);
    when(tcpPacket.getUnsecureSSLVersions()).thenReturn(unsecureSSLVersions);
    when(address.getHostAddress()).thenReturn(ipAddress);
    when(session.getRemoteIP()).thenReturn(address);
    when(session.getRemotePort()).thenReturn(port);
    return packetAnalyzerResult;
}
Also used : TCPPacket(com.att.aro.core.packetreader.pojo.TCPPacket) ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) InetAddress(java.net.InetAddress) LinkedList(java.util.LinkedList) Session(com.att.aro.core.packetanalysis.pojo.Session)

Example 65 with PacketInfo

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

the class TimeRangeAnalysis method performTimeRangeAnalysis.

/**
 * Performs a TimeRangeAnalysis on the trace data.
 * TODO:  The calculation should not be in the UI - move elsewhere (Core)
 *
 * @return TimeRangeAnalysis The object containing TimeRangeAnalysis
 *         data.
 */
public static TimeRangeAnalysis performTimeRangeAnalysis(PacketAnalyzerResult analysisData, double analyzeBeginTime, double analyzeEndTime) {
    List<RrcStateRange> rrcCollection = analysisData.getStatemachine().getStaterangelist();
    List<PacketInfo> packets = analysisData.getTraceresult().getAllpackets();
    Profile profile = analysisData.getProfile();
    long payloadLength = 0;
    long totalBytes = 0;
    long uplinkBytes = 0;
    long downlinkBytes = 0;
    int packetNum = packets.size();
    for (int i = 0; i < packetNum; i++) {
        PacketInfo packetInfo = packets.get(i);
        if (packetInfo.getTimeStamp() >= analyzeBeginTime && packetInfo.getTimeStamp() <= analyzeEndTime) {
            payloadLength += packetInfo.getPayloadLen();
            totalBytes += packetInfo.getLen();
            if (packetInfo.getDir().equals(PacketDirection.UPLINK)) {
                uplinkBytes += packetInfo.getLen();
            } else if (packetInfo.getDir().equals(PacketDirection.DOWNLINK)) {
                downlinkBytes += packetInfo.getLen();
            }
        }
    }
    double energy = 0.0f;
    double activeTime = 0.0f;
    int collectionSize = rrcCollection.size();
    for (int i = 0; i < collectionSize; i++) {
        double beginTime;
        double endTime;
        RrcStateRange rrc = rrcCollection.get(i);
        if (rrc.getEndTime() < analyzeBeginTime) {
            continue;
        }
        if (rrc.getBeginTime() > analyzeEndTime) {
            continue;
        }
        if (rrc.getBeginTime() >= analyzeBeginTime) {
            beginTime = rrc.getBeginTime();
        } else {
            beginTime = analyzeBeginTime;
        }
        if (rrc.getEndTime() <= analyzeEndTime) {
            endTime = rrc.getEndTime();
        } else {
            endTime = analyzeEndTime;
        }
        RRCState rrcState = rrc.getState();
        IProfileFactory profileFactory = ContextAware.getAROConfigContext().getBean(IProfileFactory.class);
        energy += updateEnergy(analysisData, profile, beginTime, endTime, rrcState, profileFactory);
        activeTime += updateActiveTime(profile, beginTime, endTime, rrcState);
    }
    return new TimeRangeAnalysis(analyzeBeginTime, analyzeEndTime, totalBytes, uplinkBytes, downlinkBytes, payloadLength, activeTime, energy);
}
Also used : RRCState(com.att.aro.core.packetanalysis.pojo.RRCState) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) IProfileFactory(com.att.aro.core.configuration.IProfileFactory) Profile(com.att.aro.core.configuration.pojo.Profile)

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