6 test -z "$sw" -o -z "$PORT" && echo "Usage: sw-name port" && exit 1
10 snmp="snmpget -v 2c -c $COMMUNITY -Cf -Ov -OQ $sw"
14 echo "$sw $PORT "`$snmp IF-MIB::ifName.$PORT IF-MIB::ifAlias.$PORT IF-MIB::ifType.$PORT IF-MIB::ifOperStatus.$PORT IF-MIB::ifHighSpeed.$PORT`
20 status=`$snmp IF-MIB::ifOperStatus.$PORT`
21 read -p "# Press ENTER to toggle port which is now $status" wait_for_key
23 if [ "$status" = 'up' ] ; then
26 snmpset -v1 -c $COMMUNITY $sw IF-MIB::ifAdminStatus.$PORT i 2
29 snmpset -v1 -c $COMMUNITY $sw IF-MIB::ifAdminStatus.$PORT i 1
32 echo "# wait for port status change from $status"
33 while port_status | tee /dev/stderr | grep $status ; do