From patchwork Fri Oct 10 12:02:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 38567 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6223E202DB for ; Fri, 10 Oct 2014 12:03:33 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id d17sf2113021eek.6 for ; Fri, 10 Oct 2014 05:03:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=jqeW4ScF9DZR5x3Bf6UTVibyc/o1JHK2GKHj2G0P3WM=; b=ASsfC53rK16K74OCBAlOuFusYvT23ouo5WFOBqjRVTYmBhdZ1fCUA3lmMQpkeq+UjZ 7oKgVvUPGKMyauhJoFNUm+oya4JEBKz6jQaOP/5+MG6A580y5hgBuf0fUMYhXF3agThp va1oLSoN0dplX4LMN+DYmggFlVsecynLVKjmMakof4Yood1K0nTSSlzCS1FUiQ1C0r47 4bTeVpTmTr7N9qSGxvAjLGKDAOgs381B3VPlOXUDopRf8XtRTrpu6xBRDpFes23p3dR9 gs8Po51a2BltSngM2/rT1lVwbVe1++zaSDr1xIRUcHdQAQVmcsdCJ+TgWc+Bc1FgJd0f e/cQ== X-Gm-Message-State: ALoCoQniRo6vhXX+Z575TrBiunx/+COqK0TVCWa0iELN9Rk3k8W/msBgdMpjOQAjk3KNWbLwBMvB X-Received: by 10.180.221.236 with SMTP id qh12mr971848wic.4.1412942612532; Fri, 10 Oct 2014 05:03:32 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.133 with SMTP id am5ls291525lac.54.gmail; Fri, 10 Oct 2014 05:03:32 -0700 (PDT) X-Received: by 10.152.5.130 with SMTP id s2mr4552600las.0.1412942612238; Fri, 10 Oct 2014 05:03:32 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by mx.google.com with ESMTPS id b6si8760586lbv.138.2014.10.10.05.03.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Oct 2014 05:03:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id 10so2991483lbg.18 for ; Fri, 10 Oct 2014 05:03:32 -0700 (PDT) X-Received: by 10.112.138.202 with SMTP id qs10mr4203101lbb.66.1412942611682; Fri, 10 Oct 2014 05:03:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp414303lbz; Fri, 10 Oct 2014 05:03:31 -0700 (PDT) X-Received: by 10.220.84.145 with SMTP id j17mr3770768vcl.29.1412942610186; Fri, 10 Oct 2014 05:03:30 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id 32si12025127qgc.1.2014.10.10.05.03.29 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 10 Oct 2014 05:03:30 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XcYuA-0002Je-BF; Fri, 10 Oct 2014 12:02:42 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XcYu8-0002JS-Gb for xen-devel@lists.xen.org; Fri, 10 Oct 2014 12:02:40 +0000 Received: from [85.158.143.35:40131] by server-2.bemta-4.messagelabs.com id 16/1C-04525-FDAC7345; Fri, 10 Oct 2014 12:02:39 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1412942558!11748672!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.12.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 9006 invoked from network); 10 Oct 2014 12:02:39 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-3.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 10 Oct 2014 12:02:39 -0000 X-IronPort-AV: E=Sophos;i="5.04,691,1406592000"; d="scan'208";a="181281170" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.3.181.6; Fri, 10 Oct 2014 08:02:37 -0400 Received: from kazak.uk.xensource.com ([10.80.2.80] helo=zakaz.uk.xensource.com) by ukmail1.uk.xensource.com with smtp (Exim 4.69) (envelope-from ) id 1XcYu4-0008TE-0M; Fri, 10 Oct 2014 13:02:37 +0100 Received: by zakaz.uk.xensource.com (sSMTP sendmail emulation); Fri, 10 Oct 2014 13:02:35 +0100 From: Ian Campbell To: Date: Fri, 10 Oct 2014 13:02:17 +0100 Message-ID: <1412942554-752-2-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1412942404.27111.12.camel@citrix.com> References: <1412942404.27111.12.camel@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Campbell , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH RFC OSSTEST 02/19] Osstest/PDU: Add eth008.pm method to control the ARM rack PDU X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: 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 --- Osstest/PDU/eth008.pm | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 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..da6af78 --- /dev/null +++ b/Osstest/PDU/eth008.pm @@ -0,0 +1,68 @@ +# 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 . + +package Osstest::PDU::eth008; + +use strict; +use warnings; + +use Osstest; +use Osstest::TestSupport; +use IO::File; + +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. + + my $url = "http://$mo->{PDU}/io.cgi?$op$mo->{Port}=0"; + my $cmd = "curl --silent --user $mo->{User}:$mo->{Pass} $url"; + + logm("$cmd"); + open CURL, "$cmd |" or die "fork curl: $!"; + + my $result = ; + close CURL or die "result curl: $!"; + + logm("$result"); + die "curl failed" unless $result =~ /^Success! \d+/; +} + +1;