2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-22 11:10:24 +00:00

Merge pull request #3161 from xuweibj/atsmlt

Add testcase to setup/clear openbmc simulator
This commit is contained in:
Weihua Hu
2017-06-02 15:20:51 +08:00
committed by GitHub
3 changed files with 48 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
#!/bin/bash
flag=$1
mnhn=$2
cnhn=$3
if [ $flag = "-s" ]; then
cnip=`lsdef $cnhn -i bmc -c | awk -F '=' '{print $2}'`
echo $cnip > "/tmp/simulator"
mnip=`ping $mnhn -c 1 | grep "64 bytes from" |awk -F'(' '{print $2}'|awk -F')' '{print $1}'`
chdef $cnhn bmc=$mnip
elif [ $flag = "-c" ]; then
cnip=`cat /tmp/simulator`
chdef $cnhn bmc=$cnip
process=`ps aux | grep "simulator" | grep "python" | awk -F ' ' '{print $2}'`
kill $process
rm -rf "openbmc_simulator"
fi
exit $?

View File

@@ -0,0 +1,5 @@
start:clear_openbmc_simulator
description:clear evironment
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/setup_simulator/change_ip.sh -c $$MN $$CN
check:rc==0
end

View File

@@ -0,0 +1,24 @@
start:setup_openbmc_simulator
description:install dependent packaages, setup and start openbmc simulator
cmd:#!/bin/bash
os=`cat /etc/*release*`
if [[ "$os" =~ "Red Hat" ]] || [[ "$os" =~ "suse" ]]; then
yum install git
if [ $? != 0 ]; then
exit 1
fi
elif [[ "$os" =~ "ubuntu" ]]; then
apt-get install git
if [ $? != 0 ]; then
exit 1
fi
fi
exit 0
check:rc==0
cmd:cd /root/ && git clone git@github.com:xuweibj/openbmc_simulator.git
check:rc==0
cmd:/root/openbmc_simulator/simulator &
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/change_ip.sh -s $$MN $$CN
check:rc==0
end