summaryrefslogtreecommitdiffstats
path: root/Monitoring/MonitoringTool/PacketTracking/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'Monitoring/MonitoringTool/PacketTracking/scripts')
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/scripts/m2classpath.sh57
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/scripts/m2run57
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/scripts/matcher.sh55
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/scripts/netview.sh108
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/scripts/packet_tracking.conf49
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/scripts/packet_tracking.sh65
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/scripts/settings.xml31
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/scripts/start_ipfix_collector.sh3
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/scripts/start_matcher.sh3
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/scripts/start_probe.sh4
10 files changed, 432 insertions, 0 deletions
diff --git a/Monitoring/MonitoringTool/PacketTracking/scripts/m2classpath.sh b/Monitoring/MonitoringTool/PacketTracking/scripts/m2classpath.sh
new file mode 100644
index 0000000..b39c22e
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/scripts/m2classpath.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# Bootstrap CAN project
+#
+# ==[ START CONFIG ]==
+JAVA=java
+
+# ==[ END CONFIG ]==
+CMD=$1
+M2CLASSPATH=$2
+CLASSPATH_FILE=.m2classpath
+usage () {
+ cat <<EOT
+=======[ Maven Classpath extractor]=======
+
+Extracts maven class path for launching scripts.
+
+USAGE: this script should be called from within maven using
+ the exec-maven-plugin via "mvn compile exec:exec"
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.1</version>
+ <configuration>
+ <executable>../scripts/m2classpath.sh</executable>
+ <arguments>
+ <argument>create_classpath_file</argument>
+ <classpath />
+ </arguments>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+EOT
+}
+# ==[ create classh path file via maven ]==
+create_classpath_file () {
+ if [ "$M2CLASSPATH" != "" ]; then
+ echo "#=> Creating $CLASSPATH_FILE"
+ # FIXME worldmap target class path
+ echo ./target/classes:../../worldmap/target/classes:$M2CLASSPATH > $CLASSPATH_FILE
+ else
+ echo "ERROR: this script must be called via 'mvn compile exec:exec'"
+ fi
+}
+# ==[ main switch ]==
+case $CMD in
+ create_classpath_file)
+ create_classpath_file
+ ;;
+ *)
+ usage
+ ;;
+esac
+
diff --git a/Monitoring/MonitoringTool/PacketTracking/scripts/m2run b/Monitoring/MonitoringTool/PacketTracking/scripts/m2run
new file mode 100644
index 0000000..5297f1e
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/scripts/m2run
@@ -0,0 +1,57 @@
+#!/bin/sh
+# FhG-FOKUS NETwork Research
+#
+# Run java classes using .m2classpath
+#
+# Used DEBUG=1 for debugging;
+# ==[ CONFIG ]==
+
+# ==[ END CONFIG ]==
+class=$1
+if [ "$class" = "" ]; then
+ cat <<EOT
+=======[ m2 class runner ]=======
+
+USAGE: scripts/m2run java.class.name
+
+ Examples:
+
+ > scripts/m2run test.NmeTest
+
+ - if you can create a .m2prefix file to avoid typing the whole
+ path:
+
+ > cat .m2prefix
+ test
+ > scripts/m2run NmeTest
+
+ - additional arguments to java are passed via .m2args file
+
+EOT
+exit 1
+fi
+# checking for package prefix
+if [ -r .m2prefix ]; then
+ m2prefix=`head -1 .m2prefix`
+ class="$m2prefix.$class"
+fi
+if [ -r .m2args ]; then
+ m2args=`head -1 .m2args`
+fi
+
+
+
+
+CLASSPATH_FILE=.m2classpath
+if [ ! -f $CLASSPATH_FILE ]; then
+ echo "You need to run scripts/m2classpath.sh all before using this script. "
+fi
+echo "# Launching $class..."
+classpath=$cptest:`cat $CLASSPATH_FILE`:$CLASSPATH
+#cmd="java -Dsun.java2d.opengl=True -Dfile.encoding=UTF-8 $m2args -classpath $classpath $class $* "
+# it was slower using opengl engine
+cmd="java -Xmx256m -Dfile.encoding=UTF-8 $m2args -classpath $classpath $class $* "
+
+test -z $DEBUG || echo $cmd
+exec $cmd
+
diff --git a/Monitoring/MonitoringTool/PacketTracking/scripts/matcher.sh b/Monitoring/MonitoringTool/PacketTracking/scripts/matcher.sh
new file mode 100644
index 0000000..7bdf033
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/scripts/matcher.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+# matcher helper script
+#
+CMD=$1
+cd `dirname $0`/..; prjhome=$PWD/packetmatcher
+M2CLASSPATH=$prjhome/.m2classpath
+
+#
+# Usage
+#
+usage () {
+cat <<EOT
+#
+# Matcher
+#
+
+USAGE: matcher.sh start [OPTIONS]
+ matcher.sh clean
+
+Use "matcher.sh start -h" for help.
+
+EOT
+}
+#
+# Start Packet Matcher
+#
+start (){
+ if [ ! -r $M2CLASSPATH ]; then
+ echo "=== Extracting classpath (.m2classpath) ==="
+ cd $prjhome
+ mvn compile exec:exec -Dmaven.test.skip=true
+ fi
+ cd $prjhome
+# ../scripts/m2run de.fhg.fokus.net.packetmatcher.Matcher
+ ../scripts/m2run -Dmainclass=de.fhg.fokus.net.packetmatcher.Matcher org.kohsuke.args4j.Starter $*
+}
+
+
+#
+# MAIN
+#
+
+
+case $CMD in
+ clean)
+ echo "Removing $M2CLASSPATH"
+ rm -f $M2CLASSPATH
+ ;;
+ start)
+ shift
+ start $*
+ ;;
+ *)
+ usage
+esac
diff --git a/Monitoring/MonitoringTool/PacketTracking/scripts/netview.sh b/Monitoring/MonitoringTool/PacketTracking/scripts/netview.sh
new file mode 100644
index 0000000..8612aac
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/scripts/netview.sh
@@ -0,0 +1,108 @@
+#!/bin/sh
+# NetView helper script
+#
+CMD=$1
+
+#
+# Usage
+#
+usage () {
+cat <<EOT
+#
+# NetView maven helper script
+#
+
+USAGE: netview.sh {clean|build|start}
+
+EOT
+}
+#
+# Clean all
+#
+cleanall() {
+ save_dir=`pwd`
+ cd $buildhome/pt-api
+ if [ -r "./pom.xml" ]; then
+ echo "# cleaning pt-api # "
+ mvn clean
+ echo "# cleaning NetView"
+ cd $buildhome/netview
+ mvn clean
+ else
+ curr_dir=`pwd`
+ cat<<EOT
+ERROR: Could not find $curr_dir/pom.xml
+ Please checkout pt-api in the indicated location and try again.
+
+EOT
+ fi
+ cd $save_dir
+
+
+
+}
+#
+# Build all dependencies using maven
+#
+buildall () {
+ save_dir=`pwd`
+ cd $buildhome/netview
+ if [ -r "./pom.xml" ]; then
+ echo "#####################"
+ echo "# Building PT-API #"
+ echo "#####################"
+ cd $buildhome/pt-api
+ mvn compile install -Dmaven.test.skip=true
+ echo ""
+ echo "####################"
+ echo "# Building NetView #"
+ echo "####################"
+ cd $buildhome/netview
+ mvn compile exec:exec -Dmaven.test.skip=true
+ else
+ curr_dir=`pwd`
+ cat<<EOT
+ERROR: Could not find $curr_dir/pom.xml
+ Please checkout netview in the indicated location and try again.
+
+EOT
+ fi
+ cd $save_dir
+
+}
+#
+# Start NetView
+#
+start (){
+ if [ -r $buildhome/netview/.m2classpath ]; then
+ echo "Starting NetView"
+ cd $buildhome/netview
+ ../scripts/m2run de.fhg.fokus.net.netview.control.MainController
+ else
+ cat <<EOT
+ERROR: project not built. Assure you have mvn in the path and
+ run "netview.sh build"
+EOT
+ fi
+}
+
+
+#
+# MAIN
+#
+cd `dirname $0`/..;
+buildhome=$PWD
+
+case $CMD in
+ build)
+ buildall
+ ;;
+ clean)
+ cleanall
+ ;;
+ start)
+ start
+ ;;
+ *)
+ usage
+esac
diff --git a/Monitoring/MonitoringTool/PacketTracking/scripts/packet_tracking.conf b/Monitoring/MonitoringTool/PacketTracking/scripts/packet_tracking.conf
new file mode 100644
index 0000000..b3f7b40
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/scripts/packet_tracking.conf
@@ -0,0 +1,49 @@
+# PacketTracking in NOVI
+# Copyright (C) 2010 Fokus Fraunhofer <Julian.Vetter@fokus.fraunhofer.de>
+#
+
+ELTE='192.168.28.97'
+SMILAX1='192.168.28.29'
+SMILAX2='192.168.28.33'
+SMILAX3='192.168.28.37'
+SMILAX4='192.168.28.41'
+SMILAX5='192.168.28.45'
+NTUA1='192.168.28.161'
+NTUA2='192.168.28.165'
+
+
+NODES=
+NODES="$NODES ELTE"
+NODES="$NODES SMILAX1"
+NODES="$NODES SMILAX2"
+NODES="$NODES SMILAX3"
+NODES="$NODES SMILAX4"
+NODES="$NODES SMILAX5"
+NODES="$NODES NTUA1"
+NODES="$NODES NTUA2"
+
+INTERFACE="-i i:novi -r 100"
+#INTERFACE="-i s:localhost:12345"
+COLLECTOR="-C $ELTE"
+#COLLECTOR="-C localhost"
+TEMPLATE="-t min"
+# hash over "IP-Protocol,src-dst-ip,src-dst-port,8 byte payload" assume UDP packets
+#HASH_SELECTION="-S RAW9,12:8,20:4 -G 0 -J 0 -K 0"
+HASH_SELECTION="-S RAW9,12:8,20:4,40:8 -G 0 -J 0 -K 0"
+#HASH_SELECTION="-G 0 -J 0 -K 0 -s IP"
+
+ELTE_PARAMS="$INTERFACE -o 175001 $COLLECTOR $HASH_SELECTION $TEMPLATE"
+SMILAX1_PARAMS="$INTERFACE -o 160001 $COLLECTOR $HASH_SELECTION $TEMPLATE"
+SMILAX2_PARAMS="$INTERFACE -o 160002 $COLLECTOR $HASH_SELECTION $TEMPLATE"
+SMILAX3_PARAMS="$INTERFACE -o 160003 $COLLECTOR $HASH_SELECTION $TEMPLATE"
+SMILAX4_PARAMS="$INTERFACE -o 160004 $COLLECTOR $HASH_SELECTION $TEMPLATE"
+SMILAX5_PARAMS="$INTERFACE -o 160005 $COLLECTOR $HASH_SELECTION $TEMPLATE"
+NTUA1_PARAMS="$INTERFACE -o 22001 $COLLECTOR $HASH_SELECTION $TEMPLATE"
+NTUA2_PARAMS="$INTERFACE -o 22002 $COLLECTOR $HASH_SELECTION $TEMPLATE"
+
+SSH_PARAMS="-i /home/novi_novi/.ssh/novi_novi"
+
+WDIR='/home/novi_novi/pt/packet'
+
+IMPD_START='/home/novi_novi/pt/packet/start_probe.sh'
+IMPD_STOP='killall -9 impd4e'
diff --git a/Monitoring/MonitoringTool/PacketTracking/scripts/packet_tracking.sh b/Monitoring/MonitoringTool/PacketTracking/scripts/packet_tracking.sh
new file mode 100644
index 0000000..b160c8f
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/scripts/packet_tracking.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+# PacketTracking in NOVI
+# Copyright (C) 2011 Fokus Fraunhofer <Julian.Vetter@fokus.fraunhofer.de>
+#
+
+stop_probe()
+{
+ for NODE in $NODES; do
+ echo "Stopping probe on ${NODE} (${!NODE})"
+ ssh ${SSH_PARAMS} novi_novi@${!NODE} "sudo ${IMPD_STOP}"
+ done
+ exit 0
+}
+
+start_probe()
+{
+ for NODE in $NODES; do
+ echo "Starting probe on ${NODE} (${!NODE})"
+ PARAMS=${NODE}_PARAMS
+ PARAMS=${!PARAMS}
+ #echo "ssh ${SSH_PARAMS} novi_novi@${!NODE} 'sudo ${IMPD_START} $PARAMS'"
+ ssh ${SSH_PARAMS} novi_novi@${!NODE} "sudo ${IMPD_START} $PARAMS"
+ done
+}
+
+transfer()
+{
+ for NODE in $NODES; do
+ echo "Removing old dir from ${NODE} (${!NODE})"
+ ssh ${SSH_PARAMS} novi_novi@${!NODE} "rm -rf ${WDIR}"
+ ssh ${SSH_PARAMS} novi_novi@${!NODE} "mkdir -p /home/novi_novi/pt/packet"
+ echo "Transfering data to ${NODE} (${!NODE})"
+
+ #Copying all necessary files to the 'packet' directory
+ scp -r ${SSH_PARAMS} /home/novi_novi/pt/impd4e novi_novi@${!NODE}:${WDIR} 1> /dev/null
+ scp -r ${SSH_PARAMS} /home/novi_novi/pt/libipfix novi_novi@${!NODE}:${WDIR} 1> /dev/null
+ scp -r ${SSH_PARAMS} /home/novi_novi/pt/scripts/start_probe.sh novi_novi@${!NODE}:${WDIR} 1> /dev/null
+ done
+}
+
+helper()
+{
+ echo "usage: openepc-pt CONFIGURATION (start|stop|transfer|transfer_keys)"
+ echo " transfer Transfers the whole 'pt' directory to the target nodes"
+ echo " start Starts all probes on the devices"
+ echo " stop Stops all probes"
+ echo " help Show this help"
+
+}
+
+[ \! -z "$1" ] && [ -f "$1" ] && . "$1" || (echo "couldn't read configuration file"; exit 1)
+
+case $2 in
+"transfer")
+ transfer;;
+"start")
+ start_probe;;
+"stop")
+ stop_probe;;
+"help")
+ helper;;
+*)
+ helper;;
+esac
diff --git a/Monitoring/MonitoringTool/PacketTracking/scripts/settings.xml b/Monitoring/MonitoringTool/PacketTracking/scripts/settings.xml
new file mode 100644
index 0000000..87d7d06
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/scripts/settings.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+ <profiles>
+ <profile>
+ <id>pt</id>
+ <properties>
+ <pt.releases.repo.url>scpexe://svnsrv.fokus.fraunhofer.de/export/cc/ccnet/pt/var/www/m2</pt.releases.repo.url>
+ <pt.snapshots.repo.url>scpexe://svnsrv.fokus.fraunhofer.de/export/cc/ccnet/pt/var/www/m2</pt.snapshots.repo.url>
+ <pt.site.repo.url>scpexe://svnsrv.fokus.fraunhofer.de/export/cc/ccnet/pt/var/www/site</pt.site.repo.url>
+ </properties>
+ <repositories>
+ <repository>
+ <id>pt-repo</id>
+ <url>https://svnsrv.fokus.fraunhofer.de/www/cc/ccnet/pt/m2/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ </profile>
+ </profiles>
+ <activeProfiles>
+ <!-- make these profiles active all the time -->
+ <activeProfile>pt</activeProfile>
+ </activeProfiles>
+</settings>
diff --git a/Monitoring/MonitoringTool/PacketTracking/scripts/start_ipfix_collector.sh b/Monitoring/MonitoringTool/PacketTracking/scripts/start_ipfix_collector.sh
new file mode 100644
index 0000000..31e03fd
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/scripts/start_ipfix_collector.sh
@@ -0,0 +1,3 @@
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/novi_novi/pt/packet/libipfix/libmisc
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/novi_novi/pt/packet/libipfix/lib
+/home/novi_novi/pt/libipfix/collector/ipfix_collector
diff --git a/Monitoring/MonitoringTool/PacketTracking/scripts/start_matcher.sh b/Monitoring/MonitoringTool/PacketTracking/scripts/start_matcher.sh
new file mode 100644
index 0000000..ee10af3
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/scripts/start_matcher.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+cd ~/pt/scripts
+java -Dmainclass=de.fhg.fokus.net.packetmatcher.Matcher -jar ../jars/packetmatcher-1.0-SNAPSHOT-jar-with-dependencies.jar $*
diff --git a/Monitoring/MonitoringTool/PacketTracking/scripts/start_probe.sh b/Monitoring/MonitoringTool/PacketTracking/scripts/start_probe.sh
new file mode 100644
index 0000000..9b1e084
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/scripts/start_probe.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/novi_novi/pt/packet/libipfix/libmisc
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/novi_novi/pt/packet/libipfix/lib
+nohup /home/novi_novi/pt/packet/impd4e/impd4e $* >/dev/null 2>&1 < /dev/null &