Search in sources :

Example 56 with PacketInfo

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

the class FilterApplicationsAndIpDialog method selectionReturnsData.

/*
	 * Compares user selection to trace data to determine 
	 * if all the trace data will be filtered out if user
	 * selection is applied. 
	 */
private boolean selectionReturnsData() {
    AnalysisFilter filter = getCurrentPktAnalyzerResult().getFilter();
    if (!filter.isIpv4Sel() && !filter.isIpv6Sel() && !filter.isTcpSel() && !filter.isUdpSel() && !filter.isDnsSelection()) {
        return false;
    }
    Collection<ApplicationSelection> appSel = filter.getApplicationSelections();
    List<IPAddressSelection> ipSel = new ArrayList<IPAddressSelection>();
    List<IPAddressSelection> ipSelChecked = new ArrayList<IPAddressSelection>();
    for (ApplicationSelection aSel : appSel) {
        ipSel.addAll(aSel.getIPAddressSelections());
    }
    for (IPAddressSelection iSel : ipSel) {
        if (iSel.isSelected()) {
            ipSelChecked.add(iSel);
        }
    }
    if (ipSelChecked.size() == 0) {
        return false;
    }
    List<PacketInfo> packetsInfo = getInitialPktAnalyzerResult().getTraceresult().getAllpackets();
    PacketAnalyzerImpl pktAnalyzer = (PacketAnalyzerImpl) ((MainFrame) parent).getController().getAROService().getAnalyzer();
    if (pktAnalyzer.filterPackets(filter, packetsInfo).size() > 0) {
        return true;
    }
    return false;
}
Also used : PacketAnalyzerImpl(com.att.aro.core.packetanalysis.impl.PacketAnalyzerImpl) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ApplicationSelection(com.att.aro.core.packetanalysis.pojo.ApplicationSelection) ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) IPAddressSelection(com.att.aro.core.packetanalysis.pojo.IPAddressSelection)

Example 57 with PacketInfo

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

the class SpriteImageImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    SpriteImageResult result = new SpriteImageResult();
    List<SpriteImageEntry> analysisResults = new ArrayList<SpriteImageEntry>();
    for (Session session : tracedata.getSessionlist()) {
        double lastTimeStamp = 0.0;
        HttpRequestResponseInfo lastReqRessInfo = null;
        HttpRequestResponseInfo secondReqRessInfo = null;
        boolean thirdOccurrenceTriggered = false;
        for (HttpRequestResponseInfo req : session.getRequestResponseInfo()) {
            if (req.getDirection() == HttpDirection.RESPONSE && req.getContentType() != null && req.getFirstDataPacket() != null && req.getContentType().contains("image/") && req.getContentLength() < IMAGE_SIZE_LIMIT) {
                PacketInfo pktInfo = req.getFirstDataPacket();
                if (lastTimeStamp == 0.0) {
                    lastTimeStamp = pktInfo.getTimeStamp();
                    lastReqRessInfo = req;
                    continue;
                } else {
                    if ((pktInfo.getTimeStamp() - lastTimeStamp) <= 5.0) {
                        if (!thirdOccurrenceTriggered) {
                            secondReqRessInfo = req;
                            thirdOccurrenceTriggered = true;
                            continue;
                        } else {
                            /* -At this stage 3 images found to be downloaded in 5 secs. store them.
								 * -fix for defect DE26829*/
                            analysisResults.add(new SpriteImageEntry(lastReqRessInfo));
                            analysisResults.add(new SpriteImageEntry(secondReqRessInfo));
                            analysisResults.add(new SpriteImageEntry(req));
                            /* -reset the variables to search more such images in this session
								 * -fix for defect DE26829 */
                            lastTimeStamp = 0.0;
                            lastReqRessInfo = null;
                            secondReqRessInfo = null;
                            thirdOccurrenceTriggered = false;
                        }
                    }
                    lastTimeStamp = pktInfo.getTimeStamp();
                    lastReqRessInfo = req;
                    secondReqRessInfo = null;
                    thirdOccurrenceTriggered = false;
                }
            }
        }
    }
    result.setAnalysisResults(analysisResults);
    String text = "";
    if (analysisResults.isEmpty()) {
        result.setResultType(BPResultType.PASS);
        text = MessageFormat.format(textResultPass, analysisResults.size());
        result.setResultText(text);
        result.setResultExcelText(BPResultType.PASS.getDescription());
    } else {
        result.setResultType(BPResultType.FAIL);
        text = MessageFormat.format(textResults, ApplicationConfig.getInstance().getAppShortName(), analysisResults.size());
        result.setResultText(text);
        result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.FAIL.getDescription(), analysisResults.size()));
    }
    result.setAboutText(aboutText);
    result.setDetailTitle(detailTitle);
    result.setLearnMoreUrl(learnMoreUrl);
    result.setOverviewTitle(overviewTitle);
    result.setExportAllNumberOfSpriteFiles(exportAllNumberOfSpriteFiles);
    return result;
}
Also used : SpriteImageResult(com.att.aro.core.bestpractice.pojo.SpriteImageResult) HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) SpriteImageEntry(com.att.aro.core.bestpractice.pojo.SpriteImageEntry) Session(com.att.aro.core.packetanalysis.pojo.Session)

Example 58 with PacketInfo

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

the class UnsecureSSLVersionImpl method getUnsecureSSLVersionsInSession.

/**
 * get unique unsecure SSL versions from a session
 * @param session
 * @return
 */
private Set<String> getUnsecureSSLVersionsInSession(Session session) {
    Set<String> unsecureSSLVersions = new HashSet<>();
    List<PacketInfo> packetInfos = session.getTcpPackets();
    for (PacketInfo info : packetInfos) {
        if (info.getPacket() instanceof TCPPacket) {
            TCPPacket tcpPacket = (TCPPacket) info.getPacket();
            unsecureSSLVersions.addAll(tcpPacket.getUnsecureSSLVersions());
        }
    }
    return unsecureSSLVersions;
}
Also used : TCPPacket(com.att.aro.core.packetreader.pojo.TCPPacket) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) HashSet(java.util.HashSet)

Example 59 with PacketInfo

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

the class HttpsUsageImplTest method domainNameTestSetup.

private PacketAnalyzerResult domainNameTestSetup(String ipAddressA, String ipAddressB, String sessionDomainName1, String sessionDomainName2, String sessionDomainName3) {
    Session session1 = mock(Session.class);
    Session session2 = mock(Session.class);
    Session session3 = mock(Session.class);
    InetAddress ipAddrA = mock(InetAddress.class);
    InetAddress ipAddrB = mock(InetAddress.class);
    when(ipAddrA.getHostAddress()).thenReturn(ipAddressA);
    when(ipAddrB.getHostAddress()).thenReturn(ipAddressB);
    when(session1.getRemoteIP()).thenReturn(ipAddrA);
    when(session1.getDomainName()).thenReturn(sessionDomainName1);
    when(session2.getRemoteIP()).thenReturn(ipAddrA);
    when(session2.getDomainName()).thenReturn(sessionDomainName2);
    when(session3.getRemoteIP()).thenReturn(ipAddrB);
    when(session3.getDomainName()).thenReturn(sessionDomainName3);
    TCPPacket tcpPacket1_1 = mock(TCPPacket.class);
    TCPPacket tcpPacket1_2 = mock(TCPPacket.class);
    TCPPacket tcpPacket2 = mock(TCPPacket.class);
    TCPPacket tcpPacket3 = mock(TCPPacket.class);
    when(tcpPacket1_1.containsSSLRecord()).thenReturn(false);
    when(tcpPacket1_2.containsSSLRecord()).thenReturn(false);
    when(tcpPacket2.containsSSLRecord()).thenReturn(false);
    when(tcpPacket3.containsSSLRecord()).thenReturn(false);
    PacketInfo packetInfo1_1 = mock(PacketInfo.class);
    PacketInfo packetInfo1_2 = mock(PacketInfo.class);
    PacketInfo packetInfo2 = mock(PacketInfo.class);
    PacketInfo packetInfo3 = mock(PacketInfo.class);
    when(packetInfo1_1.getLen()).thenReturn(2);
    when(packetInfo1_1.getPayloadLen()).thenReturn(1);
    when(packetInfo1_1.getPacket()).thenReturn(tcpPacket1_1);
    when(packetInfo1_2.getLen()).thenReturn(2);
    when(packetInfo1_2.getPayloadLen()).thenReturn(1);
    when(packetInfo1_2.getPacket()).thenReturn(tcpPacket1_2);
    when(packetInfo2.getLen()).thenReturn(2);
    when(packetInfo2.getPayloadLen()).thenReturn(1);
    when(packetInfo2.getPacket()).thenReturn(tcpPacket2);
    when(packetInfo3.getLen()).thenReturn(2);
    when(packetInfo3.getPayloadLen()).thenReturn(1);
    when(packetInfo3.getPacket()).thenReturn(tcpPacket3);
    List<PacketInfo> packetsInfo1 = new ArrayList<PacketInfo>();
    List<PacketInfo> packetsInfo2 = new ArrayList<PacketInfo>();
    List<PacketInfo> packetsInfo3 = new ArrayList<PacketInfo>();
    packetsInfo1.add(packetInfo1_1);
    packetsInfo1.add(packetInfo1_2);
    packetsInfo2.add(packetInfo2);
    packetsInfo3.add(packetInfo3);
    when(session1.getTcpPackets()).thenReturn(packetsInfo1);
    when(session2.getTcpPackets()).thenReturn(packetsInfo2);
    when(session3.getTcpPackets()).thenReturn(packetsInfo3);
    List<Session> sessions = new ArrayList<Session>();
    sessions.add(session1);
    sessions.add(session2);
    sessions.add(session3);
    pktAnalyzerResult.setSessionlist(sessions);
    return pktAnalyzerResult;
}
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) Session(com.att.aro.core.packetanalysis.pojo.Session)

Example 60 with PacketInfo

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

the class ProfileFactoryImplTest method energyLTE_RRCStateIsLTE_IDLE.

@Test
public void energyLTE_RRCStateIsLTE_IDLE() {
    ProfileLTE profileLte02 = Mockito.mock(ProfileLTE.class);
    List<PacketInfo> packets = new ArrayList<PacketInfo>();
    when(profileLte02.getIdlePingTime()).thenReturn(1.0);
    when(profileLte02.getLteIdlePingPower()).thenReturn(1.0);
    when(profileLte02.getIdlePingPeriod()).thenReturn(2.0);
    when(profileLte02.getLteIdlePower()).thenReturn(1.0);
    double testResult = profilefactory.energyLTE(date.getTime() + 0.0, date.getTime() + 1000.0, RRCState.LTE_IDLE, profileLte02, packets);
    assertEquals(1000.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)

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