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;
}
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;
}
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;
}
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;
}
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);
}
Aggregations