run: modularize run tool
This commit is contained in:
committed by
Christian Helmuth
parent
febca1b827
commit
c706b1c0a7
45
tool/run/power_off/powerplug
Normal file
45
tool/run/power_off/powerplug
Normal file
@@ -0,0 +1,45 @@
|
||||
##
|
||||
# Reset the target machine via powerplug
|
||||
#
|
||||
# \param --power-off-powerplug-ip IP address of powerplug device
|
||||
# \param --power-off-powerplug-user user for powerplug device
|
||||
# \param --power-off-powerplug-password password for powerplug device
|
||||
# \param --power-off-powerplug-port target port of powerplug device
|
||||
#
|
||||
|
||||
|
||||
source [genode_dir]/tool/run/powerplug.inc
|
||||
|
||||
|
||||
proc power_off_powerplug_ip { } {
|
||||
return [get_cmd_arg_first --power-off-powerplug-ip 1]
|
||||
}
|
||||
|
||||
|
||||
proc power_off_powerplug_user { } {
|
||||
return [get_cmd_arg_first --power-off-powerplug-user 1]
|
||||
}
|
||||
|
||||
|
||||
proc power_off_powerplug_password { } {
|
||||
return [get_cmd_arg_first --power-off-powerplug-password 1]
|
||||
}
|
||||
|
||||
|
||||
proc power_off_powerplug_port { } {
|
||||
return [get_cmd_arg_first --power-off-powerplug-port 1]
|
||||
}
|
||||
|
||||
|
||||
proc run_power_off { } {
|
||||
set server_ip [power_off_powerplug_ip]
|
||||
set user_name [power_off_powerplug_user]
|
||||
set password [power_off_powerplug_password]
|
||||
set power_port [power_off_powerplug_port]
|
||||
|
||||
set connection_id [power_plug_connect $server_ip $user_name $password]
|
||||
|
||||
puts "switch port $power_port off"
|
||||
send -i $connection_id "port $power_port 0\n"
|
||||
expect -i $connection_id "250 OK"
|
||||
}
|
||||
Reference in New Issue
Block a user