From 9dfad6d9dab31ad3f34b7c50b3e54ea797380644 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Fri, 11 Jan 2019 15:38:40 +0100 Subject: [PATCH] run: plugin for Allnet MSR powerplug The plugin was tested with ALL4176 but should support all modern Allnet MSR devices according to the documentation https://service.allnet.de/image-ftp/ftp/pub/allnet/MSR/JSON/JSON_MSR.zip It works just like the existing powerplug plugins by RUN_OPT += --include power_on/allnet --include power_off/allnet and uses the following parameters --power-on-allnet-host network address of device --power-on-allnet-user user for device --power-on-allnet-password password for device --power-on-allnet-port target port/socket of device --power-off-allnet-host network address of device --power-off-allnet-user user for device --power-off-allnet-password password for device --power-off-allnet-port target port/socket of device --- tool/run/power_off/allnet | 42 +++++++++++++++++++++++++++++++++++++++ tool/run/power_on/allnet | 42 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 tool/run/power_off/allnet create mode 100644 tool/run/power_on/allnet diff --git a/tool/run/power_off/allnet b/tool/run/power_off/allnet new file mode 100644 index 0000000000..0e3d4f7f33 --- /dev/null +++ b/tool/run/power_off/allnet @@ -0,0 +1,42 @@ +## +# Reset the target machine via ALLNET MSR poweplug (e.g., ALL4176) +# +# \param --power-off-allnet-host network address of device +# \param --power-off-allnet-user user for device +# \param --power-off-allnet-password password for device +# \param --power-off-allnet-port target port/socket of device +# + + +proc power_off_allnet_host { } { + return [get_cmd_arg_first --power-off-allnet-host 1] +} + + +proc power_off_allnet_user { } { + return [get_cmd_arg_first --power-off-allnet-user 1] +} + + +proc power_off_allnet_password { } { + return [get_cmd_arg_first --power-off-allnet-password 1] +} + + +proc power_off_allnet_port { } { + return [get_cmd_arg_first --power-off-allnet-port 1] +} + + +proc run_power_off { } { + set host [power_off_allnet_host] + set user [power_off_allnet_user] + set password [power_off_allnet_password] + set power_port [power_off_allnet_port] + + puts "switch port $power_port off" + + exec curl -s -o /dev/null -G -d id=$power_port -d set=0 "http://$user:$password@$host/xml/jsonswitch.php" + + return true +} diff --git a/tool/run/power_on/allnet b/tool/run/power_on/allnet new file mode 100644 index 0000000000..77f4dd2bfe --- /dev/null +++ b/tool/run/power_on/allnet @@ -0,0 +1,42 @@ +## +# Reset the target machine via ALLNET MSR poweplug (e.g., ALL4176) +# +# \param --power-on-allnet-host network address of device +# \param --power-on-allnet-user user for device +# \param --power-on-allnet-password password for device +# \param --power-on-allnet-port target port/socket of device +# + + +proc power_on_allnet_host { } { + return [get_cmd_arg_first --power-on-allnet-host 1] +} + + +proc power_on_allnet_user { } { + return [get_cmd_arg_first --power-on-allnet-user 1] +} + + +proc power_on_allnet_password { } { + return [get_cmd_arg_first --power-on-allnet-password 1] +} + + +proc power_on_allnet_port { } { + return [get_cmd_arg_first --power-on-allnet-port 1] +} + + +proc run_power_on { } { + set host [power_on_allnet_host] + set user [power_on_allnet_user] + set password [power_on_allnet_password] + set power_port [power_on_allnet_port] + + puts "switch port $power_port on" + + exec curl -s -o /dev/null -G -d id=$power_port -d set=1 "http://$user:$password@$host/xml/jsonswitch.php" + + return true +}