From ef35c93d175f43ed7e1a48f4cc2ac691d23a0634 Mon Sep 17 00:00:00 2001 From: Bernard Ogden Date: Wed, 20 Aug 2014 11:31:33 +0100 Subject: Experimental files for tcwg-lava-benchmarking --- bench-session-debian.yaml | 19 ++++++++++++++++++ bench-session-oe.yaml | 14 +++++++++++++ invoke_session_debian | 50 +++++++++++++++++++++++++++++++++++++++++++++++ invoke_session_oe | 48 +++++++++++++++++++++++++++++++++++++++++++++ setup_session_debian | 14 +++++++++++++ setup_session_oe | 14 +++++++++++++ stop_hacking_debian | 5 +++++ stop_hacking_oe | 5 +++++ 8 files changed, 169 insertions(+) create mode 100644 bench-session-debian.yaml create mode 100644 bench-session-oe.yaml create mode 100755 invoke_session_debian create mode 100755 invoke_session_oe create mode 100755 setup_session_debian create mode 100755 setup_session_oe create mode 100755 stop_hacking_debian create mode 100755 stop_hacking_oe diff --git a/bench-session-debian.yaml b/bench-session-debian.yaml new file mode 100644 index 0000000..1bb8e21 --- /dev/null +++ b/bench-session-debian.yaml @@ -0,0 +1,19 @@ +metadata: + name: bench-session-debian + format: "Lava-Test-Shell Test Definition 1.0" + description: "Benchmarking Session" + version: 1.0 + +params: + PUB_KEY: None + GATEWAY: 10.0.0.1 + +install: + deps: + - openssh-server + - wget + - make +run: + steps: + - ./setup_session_debian "$PUB_KEY" + - ./invoke_session_debian "$GATEWAY" diff --git a/bench-session-oe.yaml b/bench-session-oe.yaml new file mode 100644 index 0000000..f1f3664 --- /dev/null +++ b/bench-session-oe.yaml @@ -0,0 +1,14 @@ +metadata: + name: bench-session-oe + format: "Lava-Test-Shell Test Definition 1.0" + description: "SSH Benchmarking Session" + version: 1.0 + +params: + PUB_KEY: None + GATEWAY: 10.0.0.1 + +run: + steps: + - ./setup_session_oe "$PUB_KEY" + - ./invoke_session_oe "$GATEWAY" diff --git a/invoke_session_debian b/invoke_session_debian new file mode 100755 index 0000000..c344708 --- /dev/null +++ b/invoke_session_debian @@ -0,0 +1,50 @@ +#!/bin/bash +# Usage ./invoke_session + +# Hack for now until lava-test-shell is smart enough to know it's dispatcher ip +gateway=$1 +echo "Target's Gateway: $gateway" + +if ! grep 'invoke_session' /etc/rc.local +then + sed -i '/bin/a invoke_session &' /etc/rc.local +fi + +# Obtain target IP and Hostname +ip_addr=$(ifconfig `ip route get $gateway | cut -d ' ' -f3` | grep 'inet addr' |awk -F: '{split($2,a," "); print a[1] }') +hostname=$(cat /etc/hostname) + +# Set the PATH to use the LAVA api +echo "export PATH=/lava/bin/:$PATH" > ~/.bashrc + +echo "" +echo "" +echo "*********************************************************************************************" +echo -n "Please connect to: " +echo -n "ssh " +echo -n "-o UserKnownHostsFile=/dev/null " +echo -n "-o StrictHostKeyChecking=no " +echo -n "root@" +echo -n $ip_addr +echo -n " " +echo -n "(" +echo -n $hostname +echo ")" +echo "*********************************************************************************************" +echo "" +echo "" +mkdir -p /run +mkdir -p /run/hacking +echo $$ > /run/hacking/hacking.pid + +#suspend in a way that is portable across shells and doesn't involve a busy-wait +pid= +trap 'kill $pid + trap - SIGCONT' SIGCONT +echo "Benchmarking session active..." +sleep 999d& #timeout after 2 or 3 years... the job is likely to have a rather shorter timeout associated with it +pid=$! +wait + +echo "Benchmarking session ended..." +echo ": exiting" diff --git a/invoke_session_oe b/invoke_session_oe new file mode 100755 index 0000000..c97dd99 --- /dev/null +++ b/invoke_session_oe @@ -0,0 +1,48 @@ +#!/bin/sh +# Usage ./invoke_session + +# Hack for now until lava-test-shell is smart enough to know it's dispatcher ip +gateway=$1 +echo "Target's Gateway: $gateway" + +# Copy invoke session +cp /bin/invoke_session /etc/init.d/invoke_session + +# Obtain target IP and Hostname +ip_addr=$(ifconfig `ip route get $gateway | cut -d ' ' -f3` | grep 'inet addr' |awk -F: '{split($2,a," "); print a[1] }') +hostname=$(cat /etc/hostname) + +# Set the PATH to use the LAVA api +echo "export PATH=/lava/bin/:$PATH" > ~/.shrc + +echo "" +echo "" +echo "*********************************************************************************************" +echo -n "Please connect to: " +echo -n "ssh " +echo -n "-o UserKnownHostsFile=/dev/null " +echo -n "-o StrictHostKeyChecking=no " +echo -n "root@" +echo -n $ip_addr +echo -n " " +echo -n "(" +echo -n $hostname +echo ")" +echo "*********************************************************************************************" +echo "" +echo "" +mkdir -p /run +mkdir -p /run/hacking +echo $$ > /run/hacking/hacking.pid + +#suspend in a way that is portable across shells and doesn't involve a busy-wait +pid= +trap 'kill $pid + trap - SIGCONT' SIGCONT +echo "Benchmarking session active..." +sleep 999d& #timeout after 2 or 3 years... the job is likely to have a rather shorter timeout associated with it +pid=$! +wait + +echo "Benchmarking session ended..." +echo ": exiting" diff --git a/setup_session_debian b/setup_session_debian new file mode 100755 index 0000000..4352d2d --- /dev/null +++ b/setup_session_debian @@ -0,0 +1,14 @@ +#!/bin/bash +# Usage ./setup_session + +chmod a+x stop_hacking_debian +cp stop_hacking_debian /bin/stop_hacking +chmod a+x invoke_session_debian +cp invoke_session_debian /bin/invoke_session + +mkdir -p ~/.ssh/ +echo $1 >> ~/.ssh/authorized_keys +echo "Public Key Installed: $1" + +/etc/init.d/ssh restart +echo "sshd re-started" diff --git a/setup_session_oe b/setup_session_oe new file mode 100755 index 0000000..a5d9bcc --- /dev/null +++ b/setup_session_oe @@ -0,0 +1,14 @@ +#!/bin/sh +# Usage ./setup_session + +chmod a+x stop_hacking_oe +cp stop_hacking_oe /bin/stop_hacking +chmod a+x invoke_session_oe +cp invoke_session_oe /bin/invoke_session + +mkdir -p ~/.ssh/ +echo $1 >> ~/.ssh/authorized_keys +echo "Public Key Installed: $1" + +/etc/init.d/sshd restart +echo "sshd re-started" diff --git a/stop_hacking_debian b/stop_hacking_debian new file mode 100755 index 0000000..a872268 --- /dev/null +++ b/stop_hacking_debian @@ -0,0 +1,5 @@ +#!/bin/bash +kill -CONT `cat /run/hacking/hacking.pid` +rm -f /run/hacking/hacking.pid +rm ~/.ssh/authorized_keys +/etc/init.d/ssh stop diff --git a/stop_hacking_oe b/stop_hacking_oe new file mode 100755 index 0000000..ceb8977 --- /dev/null +++ b/stop_hacking_oe @@ -0,0 +1,5 @@ +#!/bin/sh +kill -CONT `cat /run/hacking/hacking.pid` +rm -f /run/hacking/hacking.pid +rm ~/.ssh/authorized_keys +/etc/init.d/sshd stop -- cgit v1.2.3