use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.
the class ExportSessionData method getPacketData.
private List<List<Object>> getPacketData() {
List<List<Object>> packetData = new ArrayList<>();
sessionMap.forEach((sessionKey, sessionData) -> {
for (PacketInfo packetInfo : packetsMap.get(sessionKey)) {
List<Object> data = new ArrayList<>(sessionData);
data.add(packetInfo.getPacketId());
data.add(packetInfo.getTimeStamp());
data.add(packetInfo.getDir());
data.add(ResourceBundleHelper.getEnumString(packetInfo.getTcpInfo()));
data.add(packetInfo.getPacket().getPayloadLen());
data.add(packetInfo.getTcpFlagString());
packetData.add(data);
}
});
return packetData;
}
use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.
the class PeriodicTransferImpl method determinePeriodicity.
/**
* Determine periodicity
*
* @param hostList
* @param objList
* @param ipList
*/
private void determinePeriodicity(Set<String> hostList, Set<String> objList, Set<InetAddress> ipList, List<Burst> burstCollection, Profile profile, List<Session> sessionlist) {
Set<String> hostPeriodicInfoSet = new HashSet<String>();
for (int i = 0; i < burstCollection.size(); i++) {
Burst burst = burstCollection.get(i);
if (burst.getBurstInfos() != BurstCategory.CLIENT_APP) {
continue;
}
if (isCloseSpacedBurst(i, burst, profile.getCloseSpacedBurstThreshold(), burstCollection)) {
continue;
}
Packet beginPacket = burst.getBeginPacket().getPacket();
if (beginPacket instanceof IPPacket) {
IPPacket iPkt = (IPPacket) beginPacket;
InetAddress iAddr = iPkt.getDestinationIPAddress();
if (isIpInIpList(ipList, hostPeriodicInfoSet, burst, iAddr)) {
periodicCount++;
continue;
}
iAddr = iPkt.getSourceIPAddress();
if (isIpInIpList(ipList, hostPeriodicInfoSet, burst, iAddr)) {
periodicCount++;
continue;
}
}
PacketInfo firstUplinkPayloadPacket = null;
for (PacketInfo pInfo : burst.getPackets()) {
if (pInfo.getDir() == PacketDirection.UPLINK && pInfo.getPayloadLen() > 0) {
firstUplinkPayloadPacket = pInfo;
break;
}
}
periodicCount += findPeriodicalBursts(hostPeriodicInfoSet, hostList, objList, burst, firstUplinkPayloadPacket, sessionlist);
}
diffPeriodicCount = hostPeriodicInfoSet.size();
}
use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.
the class PeriodicTransferImpl method diagnosisPeriodicRequest.
/**
* Burst data's analyzed to categorize the periodic bursts.
*/
private void diagnosisPeriodicRequest(List<Session> sessionlist, List<Burst> burstCollection, Profile profile) {
/*
* Represent lists of hosts, objects, and IPs requested via HTTP and
* timestamps when these requests were made.
*/
Map<String, List<Double>> requestedHost2tsList = new HashMap<String, List<Double>>();
Map<String, List<Double>> requestedObj2tsList = new HashMap<String, List<Double>>();
Map<InetAddress, List<Double>> connectedIP2tsList = new HashMap<InetAddress, List<Double>>();
// int count = 0;
for (Session tcpSession : sessionlist) {
// Get a list of timestamps of established sessions with each remote IP
if (!tcpSession.isUdpOnly()) {
PacketInfo firstPacket = tcpSession.getTcpPackets().get(0);
if (firstPacket.getTcpInfo() == TcpInfo.TCP_ESTABLISH) {
List<Double> res = connectedIP2tsList.get(tcpSession.getRemoteIP());
if (res == null) {
res = new ArrayList<Double>();
connectedIP2tsList.put(tcpSession.getRemoteIP(), res);
}
res.add(Double.valueOf(firstPacket.getTimeStamp()));
}
// Get a list of timestamps of HTTP requests to hosts/object names
for (HttpRequestResponseInfo hrri : tcpSession.getRequestResponseInfo()) {
PacketInfo pkt = hrri.getFirstDataPacket();
if (hrri.getDirection() == HttpDirection.REQUEST && pkt != null) {
Double ts0 = Double.valueOf(pkt.getTimeStamp());
if (hrri.getHostName() != null) {
List<Double> tempRequestHostEventList = requestedHost2tsList.get(hrri.getHostName());
if (tempRequestHostEventList == null) {
tempRequestHostEventList = new ArrayList<Double>();
requestedHost2tsList.put(hrri.getHostName(), tempRequestHostEventList);
}
tempRequestHostEventList.add(ts0);
}
if (hrri.getObjName() != null) {
String objName = hrri.getObjNameWithoutParams();
List<Double> tempRequestObjEventList = requestedObj2tsList.get(objName);
if (tempRequestObjEventList == null) {
tempRequestObjEventList = new ArrayList<Double>();
requestedObj2tsList.put(objName, tempRequestObjEventList);
}
tempRequestObjEventList.add(ts0);
}
}
}
}
}
// logger.info("done looping session");
Set<String> hostList = new HashSet<String>();
Set<String> objList = new HashSet<String>();
Set<InetAddress> ipList = new HashSet<InetAddress>();
// count = 0;
for (Map.Entry<String, List<Double>> iter : requestedHost2tsList.entrySet()) {
if (determinePeriodicity(iter.getValue(), profile)) {
hostList.add(iter.getKey());
}
// logger.info("count: "+count++);
}
// count = 0;
for (Map.Entry<String, List<Double>> iter : requestedObj2tsList.entrySet()) {
if (determinePeriodicity(iter.getValue(), profile)) {
objList.add(iter.getKey());
}
// logger.info("count: "+count++);
}
// count = 0;
for (Map.Entry<InetAddress, List<Double>> iter : connectedIP2tsList.entrySet()) {
if (determinePeriodicity(iter.getValue(), profile)) {
ipList.add(iter.getKey());
}
// logger.info("count: "+count++);
}
// logger.info("Done looping, now go to determinePeriodicity");
determinePeriodicity(hostList, objList, ipList, burstCollection, profile, sessionlist);
}
use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.
the class PeriodicTransferImpl method calculatePeriodicRepeatTime.
private void calculatePeriodicRepeatTime(List<Burst> burstCollection) {
int burstSize = burstCollection.size();
Burst lastPeriodicalBurst = null;
periodicCount = 0;
double minimumRepeatTime = Double.MAX_VALUE;
PacketInfo packetId = null;
for (int i = 0; i < burstSize; i++) {
Burst burst = burstCollection.get(i);
if (burst.getBurstCategory() == BurstCategory.PERIODICAL) {
if (periodicCount != 0) {
double time = burst.getBeginTime() - ((lastPeriodicalBurst != null) ? lastPeriodicalBurst.getBeginTime() : 0);
if (time < minimumRepeatTime) {
minimumRepeatTime = time;
packetId = burst.getFirstUplinkDataPacket();
if (packetId == null) {
packetId = burst.getBeginPacket();
}
}
}
lastPeriodicalBurst = burst;
periodicCount++;
}
}
if (minimumRepeatTime != Double.MAX_VALUE && this.periodicCount >= 3) {
minimumPeriodicRepeatTime = minimumRepeatTime;
}
}
use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.
the class UsingCacheImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
UsingCacheResult result = new UsingCacheResult();
if (tracedata.getCacheAnalysis() == null) {
return null;
}
double cacheHeaderRatio = 0.0;
boolean usingCache = false;
int validCount = 0;
int noCacheHeadersCount = 0;
PacketInfo noCacheHeaderFirstPacket = null;
for (CacheEntry entry : tracedata.getCacheAnalysis().getDiagnosisResults()) {
if (entry.getDiagnosis() != Diagnosis.CACHING_DIAG_REQUEST_NOT_FOUND && entry.getDiagnosis() != Diagnosis.CACHING_DIAG_INVALID_OBJ_NAME && entry.getDiagnosis() != Diagnosis.CACHING_DIAG_INVALID_REQUEST && entry.getDiagnosis() != Diagnosis.CACHING_DIAG_INVALID_RESPONSE) {
++validCount;
if (!entry.hasCacheHeaders()) {
if (noCacheHeadersCount == 0) {
noCacheHeaderFirstPacket = entry.getSessionFirstPacket();
}
++noCacheHeadersCount;
}
}
}
cacheHeaderRatio = validCount > 0 ? (100.0 * noCacheHeadersCount) / validCount : 0.0;
usingCache = cacheHeaderRatio <= 10.0;
if (usingCache) {
result.setResultType(BPResultType.PASS);
result.setResultText(textResultPass);
result.setResultExcelText(BPResultType.PASS.getDescription());
} else {
// ref. old analyzer give warning in this best practice
result.setResultType(BPResultType.WARNING);
String text = MessageFormat.format(textResults, ApplicationConfig.getInstance().getAppShortName(), NumberFormat.getIntegerInstance().format(cacheHeaderRatio));
result.setResultText(text);
result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.WARNING.getDescription(), NumberFormat.getIntegerInstance().format(cacheHeaderRatio)));
}
result.setCacheHeaderRatio(cacheHeaderRatio);
result.setNoCacheHeaderFirstPacket(noCacheHeaderFirstPacket);
result.setAboutText(aboutText);
result.setDetailTitle(detailTitle);
result.setLearnMoreUrl(learnMoreUrl);
result.setOverviewTitle(overviewTitle);
result.setExportAllCacheConPct(exportAllCacheConPct);
return result;
}
Aggregations