X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=test%2Fcsit%2Fsuites%2Flacp%2FLacp_Feature_OF13%2Fm;fp=test%2Fcsit%2Fsuites%2Flacp%2FLacp_Feature_OF13%2Fm;h=06900fcab4e9999918647c1572f64fe9296d8a04;hb=f5ac9314e6d79ce8d7c845ad69a0b4ed679563a1;hp=0000000000000000000000000000000000000000;hpb=9eb4f9adcdf680a15d5b50b3cabbe79febb5146f;p=integration%2Ftest.git diff --git a/test/csit/suites/lacp/Lacp_Feature_OF13/m b/test/csit/suites/lacp/Lacp_Feature_OF13/m new file mode 100755 index 0000000000..06900fcab4 --- /dev/null +++ b/test/csit/suites/lacp/Lacp_Feature_OF13/m @@ -0,0 +1,44 @@ +#!/bin/bash + +# Attach to a Mininet host and run a command + +if [ -z $1 ]; then + echo "usage: $0 host cmd [args...]" + exit 1 +else + host=$1 +fi + +pid=`ps ax | grep "mininet:$host$" | grep bash | grep -v mnexec | awk '{print $1};'` + +if echo $pid | grep -q ' '; then + echo "Error: found multiple mininet:$host processes" + exit 2 +fi + +if [ "$pid" == "" ]; then + echo "Could not find Mininet host $host" + exit 3 +fi + +if [ -z $2 ]; then + cmd='bash' +else + shift + cmd=$* +fi + +cgroup=/sys/fs/cgroup/cpu/$host +if [ -d "$cgroup" ]; then + cg="-g $host" +fi + +# Check whether host should be running in a chroot dir +rootdir="/var/run/mn/$host/root" +if [ -d $rootdir -a -x $rootdir/bin/bash ]; then + cmd="'cd `pwd`; exec $cmd'" + cmd="chroot $rootdir /bin/bash -c $cmd" +fi + +cmd="exec sudo mnexec $cg -a $pid $cmd" +eval $cmd