Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: client/common_lib/power_strip.py

Issue 3465002: Add Sentry power strip control and cryptohome/sync stress test (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git
Patch Set: Mistake: iterations is already an autotest parameter for run_tests() Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | client/site_tests/platform_CryptohomeSyncStress/control » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import telnetlib, threading, time
6
7 # Controls Server Technology CW-16V1-C20M switched CDUs over Telnet
8 # Opens a new connection for every command to
9 # avoid threading and address space conflicts
10
11 class PowerStrip():
12 def __init__(self, host, user='admn', password='admn'):
13 self.host = host
14 self.user = user
15 self.password = password
16
17 def reboot(self, outlet, delay=0):
18 self.command('reboot', outlet, delay)
19
20 def off(self, outlet, delay=0):
21 self.command('off', outlet, delay)
22
23 def on(self, outlet, delay=0):
24 self.command('on', outlet, delay)
25
26 def command(self, command, outlet=1, delay=0):
27 if delay == 0:
28 self._do_command(command, outlet)
29 else:
30 threading.Timer(delay, self._do_command, (command, outlet)).start()
31
32 def _do_command(self, command, outlet=1):
33 tn = telnetlib.Telnet(self.host)
34 tn.read_until('Username: ')
35 tn.write(self.user + '\n')
36 tn.read_until('Password: ')
37 tn.write(self.password + '\n')
38 tn.read_until('Switched CDU: ')
39 tn.write('%s .a%d\n' % (command, outlet))
40 tn.read_some()
41 tn.close()
OLDNEW
« no previous file with comments | « no previous file | client/site_tests/platform_CryptohomeSyncStress/control » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698