Skip to content

Commit

Permalink
Merge pull request #28 from sjthespian/master
Browse files Browse the repository at this point in the history
Added rancid Cisco PoE control dev file
  • Loading branch information
garlick authored Jul 20, 2018
2 parents 8adeaa0 + afb88fa commit 7403da3
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions etc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pkgsysconf_DATA = \
phantom.dev \
plmpower.dev \
powerman.dev \
rancid-cisco-poe.dev \
raritan-px4316.dev \
raritan-px5523.dev \
sentry_cdu.dev \
Expand Down
62 changes: 62 additions & 0 deletions etc/rancid-cisco-poe.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#
# Control POE on Cisco switches via rancid (http://www.shrubbery.net/rancid/)
#
# device "cisco-switch" "rancid-cisco-poe" "/usr/lib/rancid/bin/clogin hostname |&"
#
# Plug names are the device interface name:
# node "mydevice" "cisco-switch" "Gi2/0/1"
#
# The user running the powerman must have a .cloginrc file in its home directory
# with an appropriate configuration to allow querying and setting PoE status
#
specification "rancid-cisco-poe" {
timeout 10

script login {
expect ".*#"
}
script logout {
send "exit\n"
}
script status {
send "show power inline %s | section (on|off) \n"
expect "\r\n([^ ]+) +[^ ]+ +(on|off)"
setplugstate $1 $2 off="off" on="on"
expect ".*#"
}
script on {
send "conf t\n"
expect ".*\\(config\\)#"
send "int %s\n"
expect ".*\\(config-if\\)#"
send "no power inline never\n"
expect ".*\\(config-if\\)#"
send "end\n"
expect ".*#"
}
script off {
send "conf t\n"
expect ".*\\(config\\)#"
send "int %s\n"
expect ".*\\(config-if\\)#"
send "power inline never\n"
expect ".*\\(config-if\\)#"
send "end\n"
expect ".*#"
}
script cycle {
send "conf t\n"
expect ".*\\(config\\)#"
send "int %s\n"
expect ".*\\(config-if\\)#"
send "power inline never\n"
expect ".*\\(config-if\\)#"
delay 4
send "no power inline never\n"
expect ".*\\(config-if\\)#"
send "end\n"
expect ".*#"
send "off %s\n"
expect ".*#"
}
}

0 comments on commit 7403da3

Please sign in to comment.