mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-07-01 18:35:36 +00:00
add testcases for openbmc simulator delay response and modify timeout of async (#3431)
This commit is contained in:
@ -240,6 +240,7 @@ $::RESPONSE_OK = "200 OK";
|
||||
$::RESPONSE_SERVER_ERROR = "500 Internal Server Error";
|
||||
$::RESPONSE_SERVICE_UNAVAILABLE = "503 Service Unavailable";
|
||||
$::RESPONSE_METHOD_NOT_ALLOWED = "405 Method Not Allowed";
|
||||
$::RESPONSE_SERVICE_TIMEOUT = "504 Gateway Timeout";
|
||||
|
||||
#-----------------------------
|
||||
|
||||
@ -361,8 +362,9 @@ sub process_request {
|
||||
if ($request->{command}->[0] ne "getopenbmccons") {
|
||||
$cookie_jar = HTTP::Cookies->new({});
|
||||
$async = HTTP::Async->new(
|
||||
slots => 500,
|
||||
cookie_jar => $cookie_jar,
|
||||
timeout => 10,
|
||||
timeout => 60,
|
||||
max_request_time => 60,
|
||||
ssl_options => {
|
||||
SSL_verify_mode => 0,
|
||||
@ -954,7 +956,8 @@ sub deal_with_response {
|
||||
$status_info{ $node_info{$node}{cur_status} }->{process}->($node, $response);
|
||||
|
||||
return;
|
||||
|
||||
} elsif ($response->status_line eq $::RESPONSE_SERVICE_TIMEOUT) {
|
||||
$error = $::RESPONSE_SERVICE_TIMEOUT;
|
||||
} else {
|
||||
my $response_info = decode_json $response->content;
|
||||
if ($response->status_line eq $::RESPONSE_SERVER_ERROR) {
|
||||
|
@ -6,6 +6,8 @@ cnhn=$3 # CN hostname
|
||||
username=$4 # bmcusername
|
||||
password=$5 # bmcpassword
|
||||
nodes=$6 # number of IPs want to config
|
||||
delay_type=$7 # delay type "constant" or "random"
|
||||
delay_time=$8 # delay time
|
||||
|
||||
if [ $nodes -gt 10000 ]; then
|
||||
echo "Unsupported number of nodes: $nodes"
|
||||
@ -42,11 +44,16 @@ if [ $flag = "-s" ]; then
|
||||
|
||||
cd /root/ && git clone git@github.com:xuweibj/openbmc_simulator.git
|
||||
|
||||
if [ $nodes ]; then
|
||||
if [ $nodes ] && [ $nodes -gt 0 ]; then
|
||||
lsdef $cnhn -z > /tmp/$cnhn.stanza
|
||||
rmdef $cnhn
|
||||
|
||||
/root/openbmc_simulator/simulator -n $nic -r $range
|
||||
if [ $delay_type ] && [ $delay_time ]; then
|
||||
option_string="-d $delay_type -t $delay_time -n $nic -r $range"
|
||||
else
|
||||
option_string="-n $nic -r $range"
|
||||
fi
|
||||
/root/openbmc_simulator/simulator $option_string
|
||||
if [ $? != 0 ]; then
|
||||
echo "Start simulator Failed"
|
||||
exit 1
|
||||
@ -54,16 +61,20 @@ if [ $flag = "-s" ]; then
|
||||
|
||||
node_end=$[nodes-1]
|
||||
chdef -t group $cnhn mgt=openbmc bmc="|\D+(\d+)$|10.100.(1+((\$1)/100)).((\$1)%100+1)|" bmcusername=$username bmcpassword=$password
|
||||
chdef simulator_test_[0-$node_end] groups=$cnhn # use CN hostname as group, so when run command against CN will rpower against all nodes added here
|
||||
chdef simulator_test[0-$node_end] groups=$cnhn # use CN hostname as group, so when run command against CN will rpower against all nodes added here
|
||||
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
|
||||
if [ $delay_type ] && [ $delay_time ]; then
|
||||
/root/openbmc_simulator/simulator -d $delay_type -t $delay_time
|
||||
else
|
||||
/root/openbmc_simulator/simulator
|
||||
fi
|
||||
fi
|
||||
elif [ $flag = "-c" ]; then
|
||||
if [ $nodes ]; then
|
||||
if [ $nodes ] && [ $nodes -gt 0 ]; then
|
||||
/root/openbmc_simulator/simulator -c -n $nic -r $range
|
||||
rmdef $cnhn
|
||||
cat /tmp/$cnhn.stanza | mkdef -z
|
||||
|
@ -1,6 +1,6 @@
|
||||
start:setup_openbmc_simulator
|
||||
description:install dependent packaages, setup and start openbmc simulator
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -s $$MN $$CN
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -s $$MN $$CN $$bmcusername $$bmcpasswd 0
|
||||
check:rc==0
|
||||
end
|
||||
|
||||
@ -21,3 +21,27 @@ description:install dependent packaages, setup and start 5000 openbmc simulator
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -s $$MN $$CN $$bmcusername $$bmcpasswd 5000
|
||||
check:rc==0
|
||||
end
|
||||
|
||||
start:setup_openbmc_simulator_multiple_1000_delay_random_1m
|
||||
description:install dependent packaages, setup and start 1000 openbmc simulator with random that the most delay time 1 minute
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -s $$MN $$CN $$bmcusername $$bmcpasswd 1000 random 1m
|
||||
check:rc==0
|
||||
end
|
||||
|
||||
start:setup_openbmc_simulator_multiple_5000_delay_random_1m
|
||||
description:install dependent packaages, setup and start 5000 openbmc simulator with random that the most delay time 1 minute
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -s $$MN $$CN $$bmcusername $$bmcpasswd 5000 constant 1m
|
||||
check:rc==0
|
||||
end
|
||||
|
||||
start:setup_openbmc_simulator_multiple_1000_delay_random_1m30
|
||||
description:install dependent packaages, setup and start 1000 openbmc simulator with random that the most delay time 1m30s
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -s $$MN $$CN $$bmcusername $$bmcpasswd 1000 random 1m30
|
||||
check:rc==0
|
||||
end
|
||||
|
||||
start:setup_openbmc_simulator_multiple_1000_delay_random_30
|
||||
description:install dependent packaages, setup and start 1000 openbmc simulator with random that the most delay time 30s
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/simulator/config_simulator.sh -s $$MN $$CN $$bmcusername $$bmcpasswd 1000 random 0m30
|
||||
check:rc==0
|
||||
end
|
||||
|
Reference in New Issue
Block a user