File: ipmipower-serial.dev

package info (click to toggle)
powerman 2.4.4-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,432 kB
  • sloc: ansic: 19,458; sh: 7,225; yacc: 694; makefile: 455; lex: 272
file content (70 lines) | stat: -rw-r--r-- 1,651 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#
# $Id$
#
# This device configuration supports power control via the
# 'ipmipower' utility.
#
# This device file is identical to the ipmipower.dev device file,
# except that power control scripts are not ranged.  Therefore, power
# control operations are passed to ipmipower serially instead of in a
# range.
#
# This device file may be more useful than ipmipower.dev on networks
# that do not scale well and require power control operations to be
# sent out more slowly.  It may also be useful when ipmipower is
# executed with the --oem-power-type option.  A number of IPMI power
# controllable devices may not be able to handle power control
# operations quickly and the operations must be slowed down.
#
# off,delay,on used in place of IPMI cycle to ensure full command
# completion before returning to the user.
#
specification "ipmipowerserial" {
	timeout  	60

	script login {
		expect "ipmipower> "
	}
	script logout {
		send "quit\n"
	}
	script status_all {
		send "stat\n"
		foreachnode {
			expect "([^\n:]+): ([^\n]+)\n"
			setplugstate $1 $2 on="on" off="off"
		}
		expect "ipmipower> "
	}
	script status_beacon_all {
		send "identify-status\n"
		foreachnode {
			expect "([^\n:]+): ([^\n]+)\n"
			setplugstate $1 $2 on="on" off="off"
		}
		expect "ipmipower> "
	}
	script on {
		send "on %s\n"
		expect "ipmipower> "
	}
	script off {
		send "off %s\n"
		expect "ipmipower> "
	}
	script cycle {
		send "off %s\n"
		expect "ipmipower> "
		delay 5
		send "on %s\n"
		expect "ipmipower> "
	}
	script beacon_on {
		send "identify-on %s\n"
		expect "ipmipower> "
	}
	script beacon_off {
		send "identify-off %s\n"
		expect "ipmipower> "
	}
}