run: rename powerplug to netio

The run plugin is not generic and works for NETIO4/NETIO230 powerplugs
only. Further, this opens the path for other vendor-specific powerplug
plugins.

Note, the plugin parameter for the addressed powerplug was renamed to

  --power-on-netio-host  resp.
  --power-off-netio-host
This commit is contained in:
Christian Helmuth 2015-09-08 08:31:37 +02:00
parent 6e15c6b707
commit 539e5212ab
8 changed files with 113 additions and 113 deletions

View File

@ -92,18 +92,18 @@ for output while loading the files via TFTP:
! --tftp-offset-dir /x86 \
! --include log/serial --log-serial-cmd 'picocom -b 115200 /dev/ttyUSB0'
Executing hw on a rpi using powerplug to reset the hardware, JTAG to load the
image and USB serial to capture the output:
Executing hw on a rpi using NETIO powerplug to reset the hardware, JTAG to load
the image and USB serial to capture the output:
!RUN_OPT = --include boot_dir/hw \
! --include power_on/powerplug --power-on-powerplug-ip 10.23.42.5 \
! --power-on-powerplug-user admin \
! --power-on-powerplug-password secret \
! --power-on-powerplug-port 1
! --include power_off/powerplug --power-off-powerplug-ip 10.23.42.5 \
! --power-off-powerplug-user admin \
! --power-off-powerplug-password secret \
! --power-off-powerplug-port 1
! --include power_on/netio --power-on-netio-host 10.23.42.5 \
! --power-on-netio-user admin \
! --power-on-netio-password secret \
! --power-on-netio-port 1
! --include power_off/netio --power-off-netio-host 10.23.42.5 \
! --power-off-netio-user admin \
! --power-off-netio-password secret \
! --power-off-netio-port 1
! --include load/jtag \
! --load-jtag-debugger /usr/share/openocd/scripts/interface/flyswatter2.cfg \
! --load-jtag-board /usr/share/openocd/scripts/interface/raspberrypi.cfg \

View File

@ -1,7 +1,7 @@
##
# Get output of the target machine via Intel AMT's SoL feature
#
# \param --amt-host IP address of target machine
# \param --amt-host network address of target machine
# \param --amt-password AMT password for target machine
#

View File

@ -1,5 +1,5 @@
proc power_plug_connect { server_ip user_name password } {
spawn telnet $server_ip 1234
proc power_netio_connect { host user_name password } {
spawn telnet $host 1234
set connection_id $spawn_id
expect -i $connection_id "KSHELL V1.*"
send -i $connection_id "login $user_name $password\n"

45
tool/run/power_off/netio Normal file
View File

@ -0,0 +1,45 @@
##
# Reset the target machine via NETIO4/NETIO230 powerplug by Koukaam
#
# \param --power-off-netio-host network address of device
# \param --power-off-netio-user user for device
# \param --power-off-netio-password password for device
# \param --power-off-netio-port target port of device
#
source [genode_dir]/tool/run/power_netio.inc
proc power_off_netio_host { } {
return [get_cmd_arg_first --power-off-netio-host 1]
}
proc power_off_netio_user { } {
return [get_cmd_arg_first --power-off-netio-user 1]
}
proc power_off_netio_password { } {
return [get_cmd_arg_first --power-off-netio-password 1]
}
proc power_off_netio_port { } {
return [get_cmd_arg_first --power-off-netio-port 1]
}
proc run_power_off { } {
set host [power_off_netio_host]
set user_name [power_off_netio_user]
set password [power_off_netio_password]
set power_port [power_off_netio_port]
set connection_id [power_netio_connect $host $user_name $password]
puts "switch port $power_port off"
send -i $connection_id "port $power_port 0\n"
expect -i $connection_id "250 OK"
}

View File

@ -1,45 +0,0 @@
##
# 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"
}

View File

@ -1,7 +1,7 @@
##
# Reset the target machine via Intel AMT
#
# \param --power-on-amt-host IP address of target machine
# \param --power-on-amt-host network address of target machine
# \param --power-on-amt-password AMT password for target machine
#

54
tool/run/power_on/netio Normal file
View File

@ -0,0 +1,54 @@
##
# Reset the target machine via NETIO4/NETIO230 powerplug by Koukaam
#
# \param --power-on-netio-host network address of device
# \param --power-on-netio-user user for device
# \param --power-on-netio-password password for device
# \param --power-on-netio-port target port of device
#
source [genode_dir]/tool/run/power_netio.inc
proc power_on_netio_host { } {
return [get_cmd_arg_first --power-on-netio-host 1]
}
proc power_on_netio_user { } {
return [get_cmd_arg_first --power-on-netio-user 1]
}
proc power_on_netio_password { } {
return [get_cmd_arg_first --power-on-netio-password 1]
}
proc power_on_netio_port { } {
return [get_cmd_arg_first --power-on-netio-port 1]
}
proc run_power_on { } {
set host [power_on_netio_host]
set user_name [power_on_netio_user]
set password [power_on_netio_password]
set power_port [power_on_netio_port]
set connection_id [power_netio_connect $host $user_name $password]
send -i $connection_id "port $power_port\n"
expect -i $connection_id -re {250 [0-9]+.*\n}
regexp -all {[0-9]+} $expect_out(0,string) power_status
if {!$power_status} {
puts "port $power_port is off - switching it on"
send -i $connection_id "port $power_port 1\n"
expect -i $connection_id "250 OK"
} else {
puts "port $power_port is on - reset port"
send -i $connection_id "port $power_port int\n"
expect -i $connection_id "250 OK"
}
}

View File

@ -1,54 +0,0 @@
##
# Reset the target machine via powerplug
#
# \param --power-on-powerplug-ip IP address of powerplug device
# \param --power-on-powerplug-user user for powerplug device
# \param --power-on-powerplug-password password for powerplug device
# \param --power-on-powerplug-port target port of powerplug device
#
source [genode_dir]/tool/run/powerplug.inc
proc power_on_powerplug_ip { } {
return [get_cmd_arg_first --power-on-powerplug-ip 1]
}
proc power_on_powerplug_user { } {
return [get_cmd_arg_first --power-on-powerplug-user 1]
}
proc power_on_powerplug_password { } {
return [get_cmd_arg_first --power-on-powerplug-password 1]
}
proc power_on_powerplug_port { } {
return [get_cmd_arg_first --power-on-powerplug-port 1]
}
proc run_power_on { } {
set server_ip [power_on_powerplug_ip]
set user_name [power_on_powerplug_user]
set password [power_on_powerplug_password]
set power_port [power_on_powerplug_port]
set connection_id [power_plug_connect $server_ip $user_name $password]
send -i $connection_id "port $power_port\n"
expect -i $connection_id -re {250 [0-9]+.*\n}
regexp -all {[0-9]+} $expect_out(0,string) power_status
if {!$power_status} {
puts "port $power_port is off - switching it on"
send -i $connection_id "port $power_port 1\n"
expect -i $connection_id "250 OK"
} else {
puts "port $power_port is on - reset port"
send -i $connection_id "port $power_port int\n"
expect -i $connection_id "250 OK"
}
}