Commit 53a4f9a9 authored by Bc. Matúš Husovský's avatar Bc. Matúš Husovský
Browse files

# Namiesto applicationID ukladane do DB applicationName

parent 968b308c
#Thu, 05 Mar 2015 12:58:32 +0100
#Thu, 05 Mar 2015 19:47:54 +0100
/home/matus/Plocha/SLAmeterv2/novy_JXColl/jxcoll=
No preview for this file type
......@@ -3559,7 +3559,8 @@
</field>
<field name="applicationId" dataType="octetArray"
group="application" dataTypeSemantics="identifier"
group="application" beemSupported="true"
dataTypeSemantics="identifier"
elementId="95" applicability="all" status="current">
<description>
<paragraph>
......@@ -3574,8 +3575,16 @@
</paragraph>
</reference>
</field>
<field name="applicationName" dataType="string"
group="application" beemSupported="true"
dataTypeSemantics="identifier"
elementId="96" applicability="all" status="current">
<description>
<paragraph>
Specifies the name of an application.
</paragraph>
</description>
</field>
</fieldDefinitions>
......@@ -3,12 +3,7 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/home/matus/Plocha/SLAmeterv2/novy_JXColl/jxcoll/src/sk/tuke/cnl/bm/JXColl/IpfixDecoder.java</file>
<file>file:/home/matus/Plocha/SLAmeterv2/novy_JXColl/jxcoll/src/sk/tuke/cnl/bm/JXColl/accounting/AccountingRecordsExporter.java</file>
<file>file:/home/matus/Plocha/SLAmeterv2/novy_JXColl/jxcoll/src/sk/tuke/cnl/bm/JXColl/accounting/AccountingManager.java</file>
<file>file:/home/matus/Plocha/SLAmeterv2/novy_JXColl/jxcoll/src/sk/tuke/cnl/bm/JXColl/IpfixElements.java</file>
<file>file:/home/matus/Plocha/SLAmeterv2/novy_JXColl/jxcoll/src/sk/tuke/cnl/bm/JXColl/accounting/AccountingRecordsCache.java</file>
<file>file:/home/matus/Plocha/SLAmeterv2/novy_JXColl/jxcoll/src/sk/tuke/cnl/bm/JXColl/accounting/AccountingRecord.java</file>
</group>
</open-files>
</project-private>
......@@ -184,7 +184,7 @@ public class IpfixDecoder {
* @return String representation of the data given
*/
private static Object decodeStringType(ByteBuffer buffer) {
return new String(buffer.array(), Charset.forName("UTF-8"));
return new String(buffer.array(), Charset.forName("UTF-8")).trim();
}
/**
......
......@@ -6,6 +6,7 @@ package sk.tuke.cnl.bm.JXColl;
import sk.tuke.cnl.bm.DataFormatException;
import java.awt.image.DataBuffer;
import java.io.UnsupportedEncodingException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.util.Arrays;
......@@ -67,7 +68,7 @@ public class IpfixParser {
* @throws DataFormatException
* @throws TemplateException
*/
public IPFIXMessage parseIpfixMessage(ByteBuffer buffer, InetSocketAddress ipfixDevice, long time) throws DataFormatException, TemplateException {
public IPFIXMessage parseIpfixMessage(ByteBuffer buffer, InetSocketAddress ipfixDevice, long time) throws DataFormatException, TemplateException, UnsupportedEncodingException {
//data obalime do buffra pre lepsiu pracu s nimi
// ByteBuffer dataBuffer = ByteBuffer.wrap(data);
......@@ -107,7 +108,7 @@ public class IpfixParser {
* @throws IPFIXTemplateException When trying to add existing template or withdraw nonexistent one.
* @throws DataFormatException When data was corrupted.
*/
private void parseIpfixSet(IPFIXMessage message, ByteBuffer buffer, InetSocketAddress ipfixDevice) throws DataFormatException, TemplateException {
private void parseIpfixSet(IPFIXMessage message, ByteBuffer buffer, InetSocketAddress ipfixDevice) throws DataFormatException, TemplateException, UnsupportedEncodingException {
int positionBeginning = buffer.position();
......
......@@ -19,6 +19,7 @@
package sk.tuke.cnl.bm.JXColl;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
......@@ -210,7 +211,7 @@ public class RecordDispatcher {
* Datovy zaznam
*/
public synchronized void dispatchIPFIXRecord(IPFIXTemplateRecord template,
IPFIXDataRecord data, InetSocketAddress ipmb) {
IPFIXDataRecord data, InetSocketAddress ipmb) throws UnsupportedEncodingException {
// flowRecord (so sablonou) pre DB
if (Config.doPGexport) {
......
......@@ -43,7 +43,7 @@ public class AccountingRecord {
private long packetDeltaCount; // Tato hodnota ani nie je potrebna pre uctovanie
private int flowCount = 0;
private int applicationId;
private String applicationName;
/** Vytvara novu instanciu triedy */
public AccountingRecord() {
}
......@@ -63,9 +63,11 @@ public class AccountingRecord {
* @param octetCount Pocet bytov flowu
* @param packetCount Pocet paketov flowu
* @param applicationId Id aplikacneho protokolu pre flow
* @param applicationName Meno aplikacneho protokolu pre flow
*/
public AccountingRecord(byte[] srcIP, byte[] dstIP,byte[] srcMAC, byte[] dstMAC, short protocol, int srcPort, int dstPort,
short ipdscp, long firstFlowStart,long lastFlowEnd, boolean isMulticast, long octetCount, long packetCount, int applicationId){
short ipdscp, long firstFlowStart,long lastFlowEnd, boolean isMulticast, long octetCount, long packetCount, int applicationId,
String applicationName){
this.sourceIPv4Address = srcIP;
this.destinationIPv4Address = dstIP;
this.sourceMAC = srcMAC;
......@@ -80,6 +82,7 @@ public class AccountingRecord {
this.octetDeltaCount = octetCount;
this.packetDeltaCount = packetCount;
this.applicationId = applicationId;
this.applicationName = applicationName;
flowCount = 1;
}
......@@ -218,6 +221,15 @@ public class AccountingRecord {
public int getApplicationId(){
return applicationId;
}
/**
* Get metoda
* @return meno aplikácie účtovacieho záznamu
*/
public String getApplicationName(){
return applicationName;
}
/**
* Get metoda
* @return Pocet bytov uctovacieho zaznamu
......
......@@ -89,7 +89,7 @@ public class AccountingRecordsExporter {
//colNames = new String[12];
String[] colNames = {"collectorID","sourceipv4address","destinationipv4address","sourcemacaddress",
"destinationmacaddress","protocolidentifier","sourceport","destinationport","ipdiffservcodepoint",
"datetime","ismulticast","octetdeltacount","packetdeltacount","flowcount","applicationId"};
"datetime","ismulticast","octetdeltacount","packetdeltacount","flowcount","applicationName"};
while(e.hasMoreElements()){
ar = (AccountingRecord)e.nextElement();
......@@ -121,7 +121,7 @@ public class AccountingRecordsExporter {
values[11] = ar.getOctetDeltaCount();
values[12] = ar.getPacketDeltaCount();
values[13] = ar.getFlowCount() ;
values[14] = ar.getApplicationId();
values[14] = ar.getApplicationName();
//pgclient.insertdata("ACC_REC", json);
//log.debug("Inserting values: " + json);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment