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

Add testcases for simulator multiple

This commit is contained in:
XuWei
2017-06-15 02:32:32 -04:00
parent e562f290ac
commit 0dce825785
4 changed files with 147 additions and 23 deletions

View File

@@ -1,21 +0,0 @@
#!/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}'`
if [ $process ]; then
kill $process
fi
rm -rf "openbmc_simulator"
fi
exit $?

View File

@@ -1,5 +1,23 @@
start:clear_openbmc_simulator
description:clear evironment
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/change_ip.sh -c $$MN $$CN
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -c $$MN $$CN
check:rc==0
end
start:clear_openbmc_simulator_multiple_100
description:clear evironment that simulate 100 OpenBMCs
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -c $$MN $$CN 100
check:rc==0
end
start:clear_openbmc_simulator_multiple_1000
description:clear evironment that simulate 1000 OpenBMCs
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -c $$MN $$CN 1000
check:rc==0
end
start:clear_openbmc_simulator_multiple_5000
description:clear evironment that simulate 5000 OpenBMCs
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -c $$MN $$CN 5000
check:rc==0
end

View File

@@ -0,0 +1,58 @@
#!/bin/bash
flag=$1
mnhn=$2
cnhn=$3
nodes=$4
mnip=`ping $mnhn -c 1 | grep "64 bytes from" |awk -F'(' '{print $2}'|awk -F')' '{print $1}'`
if [ $nodes ]; then
nic=`ip -4 -o a | grep $mnip | awk -F ' ' '{print $2}'`
if [ $nodes = "1000" ]; then
range=`echo $(echo 10.100.{1..10}.{1..100})`
elif [ $nodes = "5000" ]; then
range=`echo $(echo 10.100.{1..50}.{1..100})`
else
range=`echo $(echo 10.100.{1..10}.{1..10})`
fi
fi
if [ $flag = "-s" ]; then
if [ $nodes ]; then
lsdef $cnhn -z > /tmp/$cnhn.stanza
rmdef $cnhn
/root/openbmc_simulator/simulator -n $nic -r $range
if [ $nodes = "1000" ]; then
chdef -t group $cnhn mgt=openbmc bmc="|\D+(\d+)$|10.100.(1+((\$1)/100)).((\$1)%100+1)|" bmcusername=root bmcpassword=0penBmc
chdef simulator_test_[0-999] groups=$cnhn
elif [ $nodes = "5000" ]; then
chdef -t group $cnhn mgt=openbmc bmc="|\D+(\d+)$|10.100.(1+((\$1)/100)).((\$1)%100+1)|" bmcusername=root bmcpassword=0penBmc
chdef simulator_test_[0-4999] groups=$cnhn
else
chdef -t group $cnhn mgt=openbmc bmc="|\D+(\d+)$|10.100.(1+((\$1)/10)).((\$1)%10+1)|" bmcusername=root bmcpassword=0penBmc
chdef simulator_test_[0-99] groups=$cnhn
fi
else
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
/root/openbmc_simulator/simulator
fi
elif [ $flag = "-c" ]; then
if [ $nodes ]; then
/root/openbmc_simulator/simulator -c -n $nic -r $range
rmdef $cnhn
cat /tmp/$cnhn.stanza | mkdef -z
else
/root/openbmc_simulator/simulator -c
cnip=`cat /tmp/simulator`
chdef $cnhn bmc=$cnip
fi
rm -rf /root/openbmc_simulator
fi
exit $?

View File

@@ -19,6 +19,75 @@ 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
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -s $$MN $$CN
check:rc==0
end
start:setup_openbmc_simulator_multiple_100
description:install dependent packaages, setup and start 100 openbmc simulator
cmd:#!/bin/bash
os=`cat /etc/*release*`
if [[ "$os" =~ "Red Hat" ]] || [[ "$os" =~ "suse" ]]; then
yum install git -y
if [ $? != 0 ]; then
exit 1
fi
elif [[ "$os" =~ "ubuntu" ]]; then
apt-get install git -y
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:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -s $$MN $$CN 100
check:rc==0
end
start:setup_openbmc_simulator_multiple_1000
description:install dependent packaages, setup and start 1000 openbmc simulator
cmd:#!/bin/bash
os=`cat /etc/*release*`
if [[ "$os" =~ "Red Hat" ]] || [[ "$os" =~ "suse" ]]; then
yum install git -y
if [ $? != 0 ]; then
exit 1
fi
elif [[ "$os" =~ "ubuntu" ]]; then
apt-get install git -y
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:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -s $$MN $$CN 1000
check:rc==0
end
start:setup_openbmc_simulator_multiple_5000
description:install dependent packaages, setup and start 5000 openbmc simulator
cmd:#!/bin/bash
os=`cat /etc/*release*`
if [[ "$os" =~ "Red Hat" ]] || [[ "$os" =~ "suse" ]]; then
yum install git -y
if [ $? != 0 ]; then
exit 1
fi
elif [[ "$os" =~ "ubuntu" ]]; then
apt-get install git -y
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:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -s $$MN $$CN 5000
check:rc==0
end