-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from sjthespian/master
Added rancid Cisco PoE control dev file
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ".*#" | ||
} | ||
} |