use of com.att.aro.core.packetanalysis.pojo.Termination in project VideoOptimzer by attdevsupport.
the class SessionManagerImpl method associatePacketToTCPSessionAndPopulateCollections.
private Session associatePacketToTCPSessionAndPopulateCollections(List<Session> sessions, Map<String, List<Session>> tcpSessions, PacketInfo packetInfo, TCPPacket tcpPacket) {
int localPort;
int remotePort;
Session session;
InetAddress localIP;
InetAddress remoteIP;
switch(packetInfo.getDir()) {
case UPLINK:
localIP = tcpPacket.getSourceIPAddress();
localPort = tcpPacket.getSourcePort();
remoteIP = tcpPacket.getDestinationIPAddress();
remotePort = tcpPacket.getDestinationPort();
break;
case DOWNLINK:
localIP = tcpPacket.getDestinationIPAddress();
localPort = tcpPacket.getDestinationPort();
remoteIP = tcpPacket.getSourceIPAddress();
remotePort = tcpPacket.getSourcePort();
break;
default:
localIP = tcpPacket.getSourceIPAddress();
localPort = tcpPacket.getSourcePort();
remoteIP = tcpPacket.getDestinationIPAddress();
remotePort = tcpPacket.getDestinationPort();
LOGGER.warn("29 - Unable to determine packet direction. Assuming Uplink");
break;
}
String sessionKey = localIP.getHostAddress() + " " + localPort + " " + remotePort + " " + remoteIP.getHostAddress();
if (!tcpSessions.containsKey(sessionKey)) {
session = new Session(localIP, remoteIP, remotePort, localPort, sessionKey);
sessions.add(session);
List<Session> tcpSessionList = new ArrayList<>();
tcpSessionList.add(session);
tcpSessions.put(sessionKey, tcpSessionList);
} else {
session = (tcpSessions.get(sessionKey)).get(tcpSessions.get(sessionKey).size() - 1);
if (tcpPacket.isSYN() && packetInfo.getDir().equals(PacketDirection.UPLINK)) {
if (!session.getUplinkPacketsSortedBySequenceNumbers().containsKey(tcpPacket.getSequenceNumber())) {
session = new Session(localIP, remoteIP, remotePort, localPort, sessionKey);
sessions.add(session);
tcpSessions.get(sessionKey).add(session);
} else {
tcpPacket.setRetransmission(true);
}
}
}
if (session.getBaseUplinkSequenceNumber() == 0 && packetInfo.getDir().equals(PacketDirection.UPLINK)) {
session.setBaseUplinkSequenceNumber(tcpPacket.getSequenceNumber());
}
if (session.getBaseDownlinkSequenceNumber() == 0 && packetInfo.getDir().equals(PacketDirection.DOWNLINK)) {
session.setBaseDownlinkSequenceNumber(tcpPacket.getSequenceNumber());
}
if (!session.getTcpPackets().isEmpty() && (tcpPacket.isFIN() || tcpPacket.isRST())) {
PacketInfo previousPacket = session.getTcpPackets().get(session.getTcpPackets().size() - 1);
double delay = packetInfo.getTimeStamp() - previousPacket.getTimeStamp();
session.setSessionTermination(new Termination(packetInfo, delay));
}
boolean packetAdditionComplete = session.addTcpPacket(packetInfo, tcpPacket.getSequenceNumber());
if (tcpPacket.isSYN()) {
if (packetInfo.getDir() == PacketDirection.UPLINK) {
session.addSynPackets(packetInfo);
} else if (packetInfo.getDir() == PacketDirection.DOWNLINK) {
session.addSynAckPackets(packetInfo);
}
}
session.setBytesTransferred(session.getBytesTransferred() + packetInfo.getPayloadLen());
if (!packetAdditionComplete) {
packetInfo.setTcpInfo(TcpInfo.TCP_DATA_DUP);
}
return session;
}
use of com.att.aro.core.packetanalysis.pojo.Termination in project VideoOptimzer by attdevsupport.
the class ConnectionStatisticsChartPanel method generateDataForChart.
private ConnectionStatisticsInfo generateDataForChart() {
ConnectionStatisticsInfo connectionStatisticsPojo = new ConnectionStatisticsInfo();
double sessionTermPct = 0.0;
int longBurstCount = 0;
if (traceDataModel != null && traceDataModel.getAnalyzerResult() != null) {
int termSessions = 0;
int properTermSessions = 0;
for (Session tcpSession : traceDataModel.getAnalyzerResult().getSessionlist()) {
if (!tcpSession.isUdpOnly()) {
Termination termination = tcpSession.getSessionTermination();
if (termination != null) {
++termSessions;
if (termination.getSessionTerminationDelay() <= SESSION_TERMINATION_THRESHOLD) {
++properTermSessions;
}
}
}
}
if (termSessions > 0) {
sessionTermPct = 100.0 * properTermSessions / termSessions;
}
longBurstCount = traceDataModel.getAnalyzerResult().getBurstCollectionAnalysisData().getLongBurstCount();
}
connectionStatisticsPojo.setSessionTermPct(sessionTermPct);
double tightlyCoupledTCPPct = 0.0;
if (traceDataModel != null && traceDataModel.getAnalyzerResult() != null) {
int burstSize = traceDataModel.getAnalyzerResult().getBurstCollectionAnalysisData().getBurstCollection().size();
int periodicBurstCount = 0;
for (Burst burstInfo : traceDataModel.getAnalyzerResult().getBurstCollectionAnalysisData().getBurstCollection()) {
BurstCategory bCategory = burstInfo.getBurstCategory();
if (bCategory == BurstCategory.PERIODICAL) {
periodicBurstCount += 1;
}
}
double nonPeriodicBurstPct = 100 - 100.0 * periodicBurstCount / burstSize;
connectionStatisticsPojo.setNonPeriodicBurstPct(nonPeriodicBurstPct);
int tightlyCoupledBurstCount = 0;
for (AbstractBestPracticeResult abstractResult : traceDataModel.getBestPracticeResults()) {
if (abstractResult.getBestPracticeType().equals(BestPracticeType.UNNECESSARY_CONNECTIONS) && abstractResult.getResultType() != BPResultType.NONE) {
UnnecessaryConnectionResult unnecessaryConnt = (UnnecessaryConnectionResult) abstractResult;
tightlyCoupledBurstCount = unnecessaryConnt.getTightlyCoupledBurstCount();
}
}
tightlyCoupledTCPPct = 100.0 * tightlyCoupledBurstCount / burstSize;
connectionStatisticsPojo.setTightlyCoupledTCPPct(tightlyCoupledTCPPct);
double longBurstPct = 0.0;
longBurstPct = 100.0 * longBurstCount / burstSize;
connectionStatisticsPojo.setLongBurstPct(longBurstPct);
}
return connectionStatisticsPojo;
}
use of com.att.aro.core.packetanalysis.pojo.Termination in project VideoOptimzer by attdevsupport.
the class SegmentTableModel method findTermination.
public Object findTermination(VideoEvent videoSegment) {
Object value = "";
Termination termination;
if ((termination = videoSegment.getSession().getSessionTermination()) != null) {
switch(termination.getPacket().getTcpFlagString()) {
case "AF":
case "F":
value = "FIN";
break;
case "AR":
case "R":
value = "RST";
break;
default:
break;
}
}
if (videoSegment.isFailedRequest()) {
value = "FAILED";
}
return value;
}
Aggregations