Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added rancid Cisco PoE control dev file #28

Merged
merged 2 commits into from
Jul 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ".*#"
}
}