xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: ian.jackson@eu.citrix.com
Cc: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Subject: [PATCH OSSTEST v2 11/20] Osstest/PDU: Add eth008.pm method to control the ARM rack PDU
Date: Wed, 29 Oct 2014 10:41:33 +0000	[thread overview]
Message-ID: <1414579302-6692-11-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1414579268.29975.13.camel@citrix.com>

This controls the eth008 relay board: http://www.robot-electronics.co.uk/htm/eth008tech.htm

Due to the use of the CGI interface this requires firmware version 4+.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: Pass username and password via a netrc file.
---
 Osstest/PDU/eth008.pm | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 Osstest/PDU/eth008.pm

diff --git a/Osstest/PDU/eth008.pm b/Osstest/PDU/eth008.pm
new file mode 100644
index 0000000..f56cfa0
--- /dev/null
+++ b/Osstest/PDU/eth008.pm
@@ -0,0 +1,73 @@
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2014 Citrix Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+package Osstest::PDU::eth008;
+
+use strict;
+use warnings;
+
+use Osstest;
+use Osstest::TestSupport;
+use IO::File;
+use File::Temp qw/ tempfile /;
+
+BEGIN {
+    use Exporter ();
+    our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
+    $VERSION     = 1.00;
+    @ISA         = qw(Exporter);
+    @EXPORT      = qw();
+    %EXPORT_TAGS = ( );
+
+    @EXPORT_OK   = qw();
+}
+
+sub new {
+    my ($class, $ho, $methname, $pdu, $user, $pass, $port, @opts) = @_;
+    return bless { Host => $ho,
+		   PDU => $pdu,
+		   User => $user,
+		   Pass => $pass,
+		   Port => $port,
+		   Opts => \@opts }, $class;
+}
+
+sub pdu_power_state {
+    my ($mo, $on) = @_;
+    my $op= $on ? "DOA" : "DOI"; # Digital Output (In)Active
+
+    # Use the CGI interface since it is less prone to being firewalled
+    # off, unlike the standard interface on port 17494. This is only
+    # available from firmware v4 onwards.
+
+    # Create a netrc file to avoid putting l/p on command line
+    my ($passfh, $passfilename) = tempfile( UNLINK => 1 );
+    print $passfh "machine $mo->{PDU} login $mo->{User} password $mo->{Pass}\n";
+
+    my $url = "http://$mo->{PDU}/io.cgi?$op$mo->{Port}=0";
+    my $cmd = "curl --silent --netrc --netrc-file $passfilename $url";
+
+    logm("$cmd");
+    open CURL, "$cmd |" or die "fork curl: $!";
+    
+    my $result = <CURL>;
+    close CURL or die "result curl: $!";
+
+    logm("$result");
+    die "curl failed" unless $result =~ /^Success! \d+/;
+}
+
+1;
-- 
2.1.1

  parent reply	other threads:[~2014-10-29 10:41 UTC|newest]

Thread overview: 168+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-29 10:41 [PATCH OSSTEST v2 00/20] support for ARM32 arndale and cubietruck platforms Ian Campbell
2014-10-29 10:41 ` [PATCH OSSTEST v2 01/20] standalone: Provide a helper to clear the host runvar Ian Campbell
2014-10-29 10:41 ` [PATCH OSSTEST v2 02/20] mg-debian-installer-update: Include any device tree blobs in the tftp dir Ian Campbell
2014-10-29 10:41 ` [PATCH OSSTEST v2 03/20] mg-debian-installer-update: Add more modules when creating initrd overlay Ian Campbell
2014-10-29 10:41 ` [PATCH OSSTEST v2 04/20] ts-host-install: Add fdtdir to PXE stanza if dtbs directory exists Ian Campbell
2014-10-29 10:41 ` [PATCH OSSTEST v2 05/20] ts-host-install: Refactor code to construct a Linux console= for a host Ian Campbell
2014-10-29 10:41 ` [PATCH OSSTEST v2 06/20] ts-host-install: include console before *and* after the -- marker Ian Campbell
2014-10-29 10:41 ` [PATCH OSSTEST v2 07/20] ts-host-install: Add option to boot debian-installer in rescue mode Ian Campbell
2014-10-29 10:41 ` [PATCH OSSTEST v2 08/20] ts-host-install: Add force-mac-address host flag Ian Campbell
2014-10-29 10:41 ` [PATCH OSSTEST v2 09/20] make-flight: Run a basic test on each arm platform Ian Campbell
2014-10-29 16:17   ` Ian Jackson
2014-10-29 10:41 ` [PATCH OSSTEST v2 10/20] standalone: Introduce "HostGroups" for use in OSSTEST_CONFIG Ian Campbell
2014-10-29 16:22   ` Ian Jackson
2014-10-29 16:34     ` Ian Campbell
2014-10-29 10:41 ` Ian Campbell [this message]
2014-10-29 16:27   ` [PATCH OSSTEST v2 11/20] Osstest/PDU: Add eth008.pm method to control the ARM rack PDU Ian Jackson
2014-10-29 16:39     ` Ian Campbell
2014-10-29 10:41 ` [PATCH OSSTEST v2 12/20] Osstest/Debian: Refactor code to set bootargs in u-boot script Ian Campbell
2014-10-29 10:41 ` [PATCH OSSTEST v2 13/20] Osstest/Debian: Install dtbs into target filesystem in /boot/dtbs Ian Campbell
2014-10-29 16:30   ` Ian Jackson
2014-10-29 10:41 ` [PATCH OSSTEST v2 14/20] Osstest/Debian: Support for loading an FDT from u-boot script Ian Campbell
2014-10-29 16:33   ` Ian Jackson
2014-10-29 10:41 ` [PATCH OSSTEST v2 15/20] Osstest/Debian: Add support for "ExtraInitramfsModules" host property Ian Campbell
2014-10-29 16:34   ` Ian Jackson
2014-10-29 10:41 ` [PATCH OSSTEST v2 16/20] Osstest/Debian: support adding a rootdelay property to bootargs Ian Campbell
2014-10-29 10:41 ` [PATCH OSSTEST v2 17/20] Osstest/Debian: Remove hardcoded midway specific addresses from boot.scr Ian Campbell
2014-10-10 12:00   ` [PATCH OSSTEST RFC 00/19] support for ARM32 arndale and cubietruck platforms Ian Campbell
2014-10-10 12:02     ` [PATCH RFC OSSTEST 01/19] standalone: Provide a helper to clear the host runvar Ian Campbell
2014-10-10 13:51       ` Ian Jackson
2014-10-10 13:53         ` Ian Campbell
2014-10-10 12:02     ` [PATCH RFC OSSTEST 02/19] Osstest/PDU: Add eth008.pm method to control the ARM rack PDU Ian Campbell
2014-10-10 13:56       ` Ian Jackson
2014-10-10 14:05         ` Ian Campbell
2014-10-10 12:02     ` [PATCH RFC OSSTEST 03/19] mg-debian-installer-update: Include any device tree blobs in the tftp dir Ian Campbell
2014-10-10 13:57       ` Ian Jackson
2014-10-10 12:02     ` [PATCH RFC OSSTEST 04/19] mg-debian-installer-update: Add more modules when creating initrd overlay Ian Campbell
2014-10-10 13:58       ` Ian Jackson
2014-10-10 14:08         ` Ian Campbell
2014-10-10 12:02     ` [PATCH RFC OSSTEST 05/19] ts-host-install: Add fdtdir to PXE stanza if dtbs directory exists Ian Campbell
2014-10-10 14:01       ` Ian Jackson
2014-10-10 14:08         ` Ian Campbell
2014-10-10 12:02     ` [PATCH RFC OSSTEST 06/19] ts-host-install: Refactor code to construct a Linux console= for a host Ian Campbell
2014-10-10 14:02       ` Ian Jackson
2014-10-10 12:02     ` [PATCH RFC OSSTEST 07/19] ts-host-install: include console before *and* after the -- marker Ian Campbell
2014-10-10 14:05       ` Ian Jackson
2014-10-10 12:02     ` [PATCH RFC OSSTEST 08/19] ts-host-install: Add option to boot debian-installer in rescue mode Ian Campbell
2014-10-10 14:06       ` Ian Jackson
2014-10-10 12:02     ` [PATCH RFC OSSTEST 09/19] ts-host-install: Add force-mac-address host flag Ian Campbell
2014-10-10 14:09       ` Ian Jackson
2014-10-10 14:12         ` Ian Campbell
2014-10-10 14:55           ` Ian Jackson
2014-10-10 12:02     ` [PATCH RFC OSSTEST 10/19] make-flight: Run a basic test on each arm platform Ian Campbell
2014-10-10 14:20       ` Ian Jackson
2014-10-10 14:27         ` Ian Campbell
2014-10-10 15:03           ` Ian Jackson
2014-10-27 13:20         ` Ian Campbell
2014-10-10 12:02     ` [PATCH RFC OSSTEST 11/19] standalone: Introduce "HostGroups" for use in OSSTEST_CONFIG Ian Campbell
2014-10-10 14:44       ` Ian Jackson
2014-10-10 14:48         ` Ian Campbell
2014-10-10 15:09           ` Ian Jackson
2014-10-10 12:02     ` [PATCH RFC OSSTEST 12/19] Osstest/Debian: Refactor code to set bootargs in u-boot script Ian Campbell
2014-10-10 14:31       ` Ian Jackson
2014-10-10 12:02     ` [PATCH RFC OSSTEST 13/19] Osstest/Debian: Install dtbs into target filesystem in /boot/dtbs Ian Campbell
2014-10-10 14:45       ` Ian Jackson
2014-10-10 14:49         ` Ian Campbell
2014-10-10 15:10           ` Ian Jackson
2014-10-10 15:14             ` Ian Campbell
2014-10-10 16:03               ` Ian Jackson
2014-10-10 12:02     ` [PATCH RFC OSSTEST 14/19] Osstest/Debian: Support for loading an FDT from u-boot script Ian Campbell
2014-10-10 14:29       ` Ian Jackson
2014-10-10 14:37         ` Ian Campbell
2014-10-10 15:05           ` Ian Jackson
2014-10-10 12:02     ` [PATCH RFC OSSTEST 15/19] Osstest/Debian: Add support for "ExtraInitramfsModules" host property Ian Campbell
2014-10-10 14:47       ` Ian Jackson
2014-10-10 14:50         ` Ian Campbell
2014-10-10 12:02     ` [PATCH RFC OSSTEST 16/19] Osstest/Debian: support adding a rootdelay property to bootargs Ian Campbell
2014-10-10 14:49       ` Ian Jackson
2014-10-10 12:02     ` [PATCH RFC OSSTEST 17/19] Osstest/Debian: Remove hardcoded midway specific addresses from boot.scr Ian Campbell
2014-10-10 14:30       ` Ian Jackson
2014-10-10 14:32         ` Ian Campbell
2014-10-29 16:37           ` [PATCH RFC OSSTEST 17/19] Osstest/Debian: Remove hardcoded midway specific addresses from boot.scr [and 1 more messages] Ian Jackson
2014-10-29 16:41             ` Ian Campbell
2014-10-10 12:02     ` [PATCH RFC OSSTEST 18/19] ts-kernel-build: Enable CONFIG_PHY_EXYNOS5250_SATA Ian Campbell
2014-10-10 14:31       ` Ian Jackson
2014-10-10 12:02     ` [PATCH RFC OSSTEST 19/19] Osstest/Debian: Workaround oddities in the u-boot script parser Ian Campbell
2014-10-10 14:48       ` Ian Jackson
2014-10-29 10:41 ` [PATCH OSSTEST v2 18/20] Osstest/Debian: Add "clk_ignore_unused" to default command line Ian Campbell
2014-10-29 16:39   ` Ian Jackson
2014-10-30 12:33     ` Ian Campbell
2014-10-30 12:45       ` Processed: " xen
2014-10-30 13:46       ` Ian Jackson
2014-11-11 16:50       ` Julien Grall
2014-11-12 10:07         ` Ian Campbell
2014-11-12 14:26           ` Julien Grall
2018-03-07 14:50             ` [OSSTEST PATCH v2 15/19] Add clk_ignore_unused for stretch for arm hosts Ian Jackson
2014-10-29 10:41 ` [PATCH OSSTEST v2 19/20] Osstest/Debian: Add 0x prefix to $filesize Ian Campbell
2014-10-29 16:40   ` Ian Jackson
2014-10-30 14:01     ` Ian Campbell
2014-10-30 14:22       ` Ian Campbell
2014-10-30 14:49       ` Ian Jackson
2014-10-30 14:51         ` Ian Campbell
2014-10-30 14:54           ` Ian Jackson
2014-10-30 15:03             ` Ian Campbell
2014-10-29 10:41 ` [PATCH OSSTEST v2 20/20] ts-kernel-build: Enable CONFIG_PHY_EXYNOS5250_SATA Ian Campbell
2014-10-29 16:51 ` [PATCH OSSTEST v2 00/20] support for ARM32 arndale and cubietruck platforms Ian Campbell
2014-10-29 17:13   ` Ian Jackson
2014-10-29 17:15     ` Ian Campbell
2014-10-30 11:30       ` Ian Jackson
2014-10-30 11:43         ` Ian Campbell
2014-10-30 12:07           ` Ian Jackson
2014-11-03 10:23       ` Ian Campbell
  -- strict thread matches above, loose matches on Subject: below --
2017-10-31 13:51 [OSSTEST PATCH v2 00/19] Upgrade to Stretch Wei Liu
2017-10-31 13:51 ` [OSSTEST PATCH v2 01/19] gitignore: ignore vim swap file Wei Liu
2017-10-31 13:51 ` [OSSTEST PATCH v2 02/19] ts-xen-build-prep: only install w3c-dtd-xhtml for suites <Stretch Wei Liu
2018-03-07 14:34   ` Ian Jackson
2017-10-31 13:51 ` [OSSTEST PATCH v2 03/19] ts-xen-build-prep: install packages for suites >jessie Wei Liu
2017-10-31 13:51 ` [OSSTEST PATCH v2 04/19] ts-xen-install: install some packages on stretch Wei Liu
2018-03-07 14:36   ` Ian Jackson
2017-10-31 13:51 ` [OSSTEST PATCH v2 05/19] Debian.pm: use sysvinit-core instead of systemd Wei Liu
2018-03-07 14:57   ` Ian Jackson
2017-10-31 13:51 ` [OSSTEST PATCH v2 06/19] ts-leak-check: suppress systemd-shim, which leaks in stretch Wei Liu
2017-10-31 13:51 ` [OSSTEST PATCH v2 07/19] ts-host-install: don't use the new nic naming scheme Wei Liu
     [not found]   ` <bca1c4ed-c061-3510-e80d-69802a8ac806@linaro.org>
2017-12-15 15:45     ` Julien Grall
2018-01-19 14:21       ` Wei Liu
2018-01-19 17:08         ` Ian Jackson
2018-01-19 17:12           ` Wei Liu
2018-01-19 17:56             ` Ian Jackson
2018-01-19 17:58               ` Wei Liu
2018-01-19 18:39                 ` Ian Jackson
2018-03-07 15:43                   ` Ian Jackson
2017-10-31 13:51 ` [OSSTEST PATCH v2 08/19] ts-guests-nbd-mirror: use target_{get, put}file_root to transfter cfg Wei Liu
2018-03-07 15:04   ` Ian Jackson
2018-05-08  8:14     ` Wei Liu
2017-10-31 13:51 ` [OSSTEST PATCH v2 09/19] ts-debian-fixup: merge origin extra= to our own Wei Liu
2018-03-07 15:06   ` Ian Jackson
2018-03-15 17:00     ` Wei Liu
2017-10-31 13:51 ` [OSSTEST PATCH v2 10/19] ts-debian-fixup: use correct resume device Wei Liu
2018-03-07 15:08   ` Ian Jackson
2017-10-31 13:51 ` [OSSTEST PATCH v2 11/19] ts-debian-hvm-install: disable new nic naming scheme Wei Liu
2018-03-07 15:09   ` Ian Jackson
2017-10-31 13:51 ` [OSSTEST PATCH v2 12/19] ts-xen-build-prep: install e2fslibs-dev Wei Liu
2018-03-07 15:10   ` Ian Jackson
2017-10-31 13:51 ` [OSSTEST PATCH v2 13/19] TestSupport: add dpkg option when installing packages Wei Liu
2018-03-07 15:11   ` Ian Jackson
2018-05-08  9:11     ` Wei Liu
2017-10-31 13:51 ` [OSSTEST PATCH v2 14/19] ts-guests-nbd-mirror: make it work with stretch Wei Liu
2018-03-07 14:45   ` Ian Jackson
2018-05-08  9:20     ` Wei Liu
2018-05-08  9:23       ` Wei Liu
2017-10-31 13:51 ` [OSSTEST PATCH v2 15/19] Add clk_ignore_unused for stretch for arm hosts Wei Liu
2017-10-31 13:52 ` [OSSTEST PATCH v2 16/19] Set mac address in interfaces(5) if force-mac-address is set Wei Liu
2018-03-07 15:13   ` Ian Jackson
2017-10-31 13:52 ` [OSSTEST PATCH v2 17/19] Skip bootloader installation for arm32 in Stretch Wei Liu
2018-03-07 14:48   ` Ian Jackson
2017-10-31 13:52 ` [OSSTEST PATCH v2 18/19] make-flight: don't test pvgrub for Xen XXX Wei Liu
2017-11-03 14:06   ` [OSSTEST PATCH 0/2] Keep pvgrub tests Wei Liu
2017-11-03 14:06     ` [OSSTEST PATCH 1/2] ts-debian-di-install: use gho to pick d-i Wei Liu
2017-11-03 14:45       ` Ian Jackson
2017-11-03 14:06     ` [OSSTEST PATCH 2/2] make-flight: guest should use jessie to test pvgrub Wei Liu
2017-11-03 19:29       ` Ian Jackson
2018-03-07 15:14   ` [OSSTEST PATCH v2 18/19] make-flight: don't test pvgrub for Xen XXX Ian Jackson
2017-10-31 13:52 ` [OSSTEST PATCH v2 19/19] Switch to Debian Stretch Wei Liu
2018-03-07 14:50   ` Ian Jackson
2017-10-31 18:42 ` [OSSTEST PATCH v2 00/19] Upgrade to Stretch Wei Liu
2017-11-01 10:05   ` Wei Liu
2018-02-20 13:38 ` Julien Grall
2018-02-20 14:40   ` Wei Liu
2018-02-20 15:13     ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414579302-6692-11-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).