|
Packit |
857059 |
# BEGIN_ICS_COPYRIGHT8 ****************************************
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# Copyright (c) 2015, Intel Corporation
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# Redistribution and use in source and binary forms, with or without
|
|
Packit |
857059 |
# modification, are permitted provided that the following conditions are met:
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# * Redistributions of source code must retain the above copyright notice,
|
|
Packit |
857059 |
# this list of conditions and the following disclaimer.
|
|
Packit |
857059 |
# * Redistributions in binary form must reproduce the above copyright
|
|
Packit |
857059 |
# notice, this list of conditions and the following disclaimer in the
|
|
Packit |
857059 |
# documentation and/or other materials provided with the distribution.
|
|
Packit |
857059 |
# * Neither the name of Intel Corporation nor the names of its contributors
|
|
Packit |
857059 |
# may be used to endorse or promote products derived from this software
|
|
Packit |
857059 |
# without specific prior written permission.
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Packit |
857059 |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
857059 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
Packit |
857059 |
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
Packit |
857059 |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Packit |
857059 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Packit |
857059 |
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
Packit |
857059 |
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
Packit |
857059 |
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit |
857059 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# END_ICS_COPYRIGHT8 ****************************************
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# [ICS VERSION STRING: unknown]
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# This is an expect (tcl) library of procedures to aid ib stack testing
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# manditory setup
|
|
Packit |
857059 |
log_user 0; # disable detailed logging to stdout
|
|
Packit |
857059 |
|
|
Packit |
857059 |
package require tdom
|
|
Packit |
857059 |
|
|
Packit |
857059 |
#########################################################################################
|
|
Packit |
857059 |
# Name : stop_sm
|
|
Packit |
857059 |
# Input : host
|
|
Packit |
857059 |
# Return . none
|
|
Packit |
857059 |
# Description : stops the sm, opafm
|
|
Packit |
857059 |
#########################################################################################
|
|
Packit |
857059 |
proc stop_sm { host } {
|
|
Packit |
857059 |
set ret {}
|
|
Packit |
857059 |
target_root_sh $host
|
|
Packit |
857059 |
|
|
Packit |
857059 |
set host_os_id [get_target_os_id $host]
|
|
Packit |
857059 |
if { [ string equal "$host_os_id" "RHEL7-x86_64" ] || [ string equal "$host_os_id" "RHEL71-x86_64" ] || [ string equal "$host_os_id" "SLES12-x86_64" ] || [ string equal "$host_os_id" "RHEL72-x86_64" ] || [ string equal "$host_os_id" "SLES121-x86_64" ] } {
|
|
Packit |
857059 |
send_unix_cmd "systemctl stop opafm"
|
|
Packit |
857059 |
|
|
Packit |
857059 |
send_unix_cmd "systemctl -n 0 status opafm"
|
|
Packit |
857059 |
catch {expect_any 60 {"dead" "failed"} {"running"} out} ret
|
|
Packit |
857059 |
} else {
|
|
Packit |
857059 |
send_unix_cmd "service opafm stop"
|
|
Packit |
857059 |
catch {expect_any 60 {"Stopping IFS Fabric Manager" "Shutting down IFS Fabric Manager" "shutting down all instances"} {} out} ret
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
target_root_sh_exit
|
|
Packit |
857059 |
|
|
Packit |
857059 |
return $ret
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
#########################################################################################
|
|
Packit |
857059 |
# Name : start_sm
|
|
Packit |
857059 |
# Input : host
|
|
Packit |
857059 |
# Return . none
|
|
Packit |
857059 |
# Description : starts the sm, opafm
|
|
Packit |
857059 |
#########################################################################################
|
|
Packit |
857059 |
proc start_sm { host } {
|
|
Packit |
857059 |
set ret {}
|
|
Packit |
857059 |
target_root_sh $host
|
|
Packit |
857059 |
set host_os_id [get_target_os_id $host]
|
|
Packit |
857059 |
if { [ string equal "$host_os_id" "RHEL7-x86_64" ] || [ string equal "$host_os_id" "RHEL71-x86_64" ] || [ string equal "$host_os_id" "SLES12-x86_64" ] || [ string equal "$host_os_id" "RHEL72-x86_64" ] || [ string equal "$host_os_id" "SLES121-x86_64" ] } {
|
|
Packit |
857059 |
send_unix_cmd "systemctl start opafm"
|
|
Packit |
857059 |
|
|
Packit |
857059 |
send_unix_cmd "systemctl -n 0 status opafm"
|
|
Packit |
857059 |
catch {expect_any 60 {"running"} {"failed" "unknown" "dead" } out} ret
|
|
Packit |
857059 |
} else {
|
|
Packit |
857059 |
send_unix_cmd "service opafm start"
|
|
Packit |
857059 |
catch {expect_any 60 {"Starting IFS Fabric Manager"} {"unable to start" "not properly shutdown"} out } ret
|
|
Packit |
857059 |
sleep 30
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
target_root_sh_exit
|
|
Packit |
857059 |
|
|
Packit |
857059 |
return $ret
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
#########################################################################################
|
|
Packit |
857059 |
# Name : restart_sm
|
|
Packit |
857059 |
# Input : host
|
|
Packit |
857059 |
# Return . none
|
|
Packit |
857059 |
# Description : restarts the sm, opafm
|
|
Packit |
857059 |
#########################################################################################
|
|
Packit |
857059 |
proc restart_sm { host } {
|
|
Packit |
857059 |
set ret {}
|
|
Packit |
857059 |
target_root_sh $host
|
|
Packit |
857059 |
set host_os_id [get_target_os_id $host]
|
|
Packit |
857059 |
if { [ string equal "$host_os_id" "RHEL7-x86_64" ] || [ string equal "$host_os_id" "RHEL71-x86_64" ] || [ string equal "$host_os_id" "SLES12-x86_64" ] || [ string equal "$host_os_id" "RHEL72-x86_64" ] || [ string equal "$host_os_id" "SLES121-x86_64" ] } {
|
|
Packit |
857059 |
send_unix_cmd "systemctl restart opafm"
|
|
Packit |
857059 |
check_exit_status 60 0
|
|
Packit |
857059 |
} else {
|
|
Packit |
857059 |
send_unix_cmd "service opafm restart"
|
|
Packit |
857059 |
catch {expect_any 60 {"Stopping IFS Fabric Manager" "Shutting down IFS Fabric Manager" "shutting down all instances"} {} out} ret
|
|
Packit |
857059 |
sleep 25
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
target_root_sh_exit
|
|
Packit |
857059 |
return $ret
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
#########################################################################################
|
|
Packit |
857059 |
# Name : save_xml_file
|
|
Packit |
857059 |
# Input : host
|
|
Packit |
857059 |
# xml_file_loc - xml source
|
|
Packit |
857059 |
# xml_file_loc_saved - xml destination
|
|
Packit |
857059 |
# Return . none
|
|
Packit |
857059 |
# Description : Saves a backup of an xml file to be restored from later
|
|
Packit |
857059 |
#########################################################################################
|
|
Packit |
857059 |
proc save_xml_file { host xml_file_loc xml_file_loc_saved} {
|
|
Packit |
857059 |
set ret {}
|
|
Packit |
857059 |
set out {}
|
|
Packit |
857059 |
target_root_sh $host
|
|
Packit |
857059 |
send_unix_cmd "/bin/cp -pf $xml_file_loc $xml_file_loc_saved; echo DONE;"
|
|
Packit |
857059 |
catch {expect_any 60 {"DONE"} {"No such"} out } ret
|
|
Packit |
857059 |
debug_message "save_xml_file: out=$out"
|
|
Packit |
857059 |
target_root_sh_exit
|
|
Packit |
857059 |
|
|
Packit |
857059 |
return $ret
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
#########################################################################################
|
|
Packit |
857059 |
# Name : restore_xml_file
|
|
Packit |
857059 |
# Input : host
|
|
Packit |
857059 |
# xml_file_loc - xml to be overwritten
|
|
Packit |
857059 |
# xml_file_loc_saved - xml source
|
|
Packit |
857059 |
# Return . none
|
|
Packit |
857059 |
# Description : Restores xml from a saved backup (xml_file_loc_saved)
|
|
Packit |
857059 |
#########################################################################################
|
|
Packit |
857059 |
proc restore_xml_file { host xml_file_loc_saved xml_file_loc} {
|
|
Packit |
857059 |
set ret {}
|
|
Packit |
857059 |
set out {}
|
|
Packit |
857059 |
target_root_sh $host
|
|
Packit |
857059 |
send_unix_cmd "/bin/cp -pf $xml_file_loc_saved $xml_file_loc; echo DONE;"
|
|
Packit |
857059 |
catch {expect_any 60 {"DONE"} {"No such"} out } ret
|
|
Packit |
857059 |
debug_message "restore_xml_file: out=$out"
|
|
Packit |
857059 |
target_root_sh_exit
|
|
Packit |
857059 |
|
|
Packit |
857059 |
return $ret
|
|
Packit |
857059 |
}
|