Refactor import service a little more
This commit is contained in:
parent
2f996fc3c4
commit
5caac97db1
|
@ -117,17 +117,14 @@ public class HighPerformanceKappaOrientDbNetdataImportService extends AbstractNe
|
||||||
Edge isContainedInEdge = this.og.addEdge("class:isContainedIn", this.tcpPacketVertex, this.ipPacketVertex, "isContainedIn");
|
Edge isContainedInEdge = this.og.addEdge("class:isContainedIn", this.tcpPacketVertex, this.ipPacketVertex, "isContainedIn");
|
||||||
// Track tcp connections
|
// Track tcp connections
|
||||||
TcpConnectionModel tcpConnection = this.getTcpConnectionFor(tcp);
|
TcpConnectionModel tcpConnection = this.getTcpConnectionFor(tcp);
|
||||||
// If connection exists ...
|
if(tcpConnection != null) { // If connection exists ...
|
||||||
if(tcpConnection != null) {
|
if(ts - tcpConnection.endTs < 2) { // ... and still "up to date" aka time difference < 2s
|
||||||
// ... and still "up to date" aka time difference < 2s
|
if(tcpConnection.sourceIp.equals(this.ipv4PacketModel.sourceIp)) {
|
||||||
if(ts - tcpConnection.endTs < 2) {
|
// Update connection data in direction SourceIp -> TargetIp
|
||||||
// Update tcpConnection data
|
tcpConnection.addVolumeSourceToTarget(this.tcpPacketModel.payloadSize);
|
||||||
if(tcpConnection.sourceIp.equals(this.ipPacketVertex.getProperty("sourceIp"))) {
|
|
||||||
// SourceIp -> TargetIp
|
|
||||||
tcpConnection.addVolumeSourceToTarget(tcp.getRawData().length - tcp.getHeader().length());
|
|
||||||
} else {
|
} else {
|
||||||
// TargetIp -> SourceIp
|
// Update connection data in direction TargetIp -> SourceIp
|
||||||
tcpConnection.addVolumeTargetToSource(tcp.getRawData().length - tcp.getHeader().length());
|
tcpConnection.addVolumeTargetToSource(this.tcpPacketModel.payloadSize);
|
||||||
}
|
}
|
||||||
tcpConnection.setEnd(ts, ms);
|
tcpConnection.setEnd(ts, ms);
|
||||||
}
|
}
|
||||||
|
@ -152,8 +149,7 @@ public class HighPerformanceKappaOrientDbNetdataImportService extends AbstractNe
|
||||||
|
|
||||||
private void addHostIfNew(Inet4Address ipAddress) {
|
private void addHostIfNew(Inet4Address ipAddress) {
|
||||||
if(this.knownHosts.containsKey(ipAddress)) {
|
if(this.knownHosts.containsKey(ipAddress)) {
|
||||||
// Host already known, nothing to do!
|
return; // Host already known, nothing to do!
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
// Check internal/external by IP
|
// Check internal/external by IP
|
||||||
boolean isInternal = ipAddress.isSiteLocalAddress(); // TODO: VERIFY IF THIS IS CORRECT!
|
boolean isInternal = ipAddress.isSiteLocalAddress(); // TODO: VERIFY IF THIS IS CORRECT!
|
||||||
|
@ -223,7 +219,6 @@ public class HighPerformanceKappaOrientDbNetdataImportService extends AbstractNe
|
||||||
}
|
}
|
||||||
|
|
||||||
public void afterImport() {
|
public void afterImport() {
|
||||||
// TODO: Link TcpConnections up with their tcpPackets!
|
|
||||||
System.out.println("All done. Processing collected TcpConnections ...");
|
System.out.println("All done. Processing collected TcpConnections ...");
|
||||||
for(LinkedList<TcpConnectionModel> connList : this.knownTcpConnections.values()) {
|
for(LinkedList<TcpConnectionModel> connList : this.knownTcpConnections.values()) {
|
||||||
for(TcpConnectionModel conn : connList) {
|
for(TcpConnectionModel conn : connList) {
|
||||||
|
|
Loading…
Reference in New Issue