1#!/bin/bash 2 3function runtest() { 4 5 $IPMITOOL $* 6 RETURN=$? 7 if [ $RETURN -ne 0 ]; then 8 echo "Test ipmitool $* failed with code $RETURN." 9 status=$(($status+1)) 10 fi 11} 12 13CHECK=`dmidecode | egrep '(Baseboard Management Controller|IPMI)'` 14if [ -z "$CHECK" ]; then 15 echo "BMC is not detected. Aborting." 16 exit 255 17fi 18 19IPMITOOL=`ls $POUNDER_OPTDIR/ipmitool*/src/ipmitool 2> /dev/null` 20if [ -z "$IPMITOOL" ]; then 21 IPMITOOL=`which ipmitool 2> /dev/null` 22 if [ -z "$IPMITOOL" ]; then 23 echo "Cannot find ipmitool; ipmitool utility not installed on system." 24 echo "Please install package containing ipmitool utility and re-run test." 25 exit -1 26 fi 27else 28 IPMITOOL="$POUNDER_OPTDIR/ipmitool*/src/ipmitool" 29fi 30 31status=0 32/etc/init.d/ipmi restart #maybe start 33RETURN=$? 34if [ $RETURN -ne 0 ]; then 35 echo "Could not start driver with code $RETURN." 36 status=$(($status+1)) 37 exit $status 38fi 39 40echo 41echo "ipmitool utility version: " 42runtest -V 43echo 44echo "OpenIPMI Driver version: " 45dmesg |grep ipmi |grep -i -m 1 version 46echo 47 48runtest bmc info 49if [ $status -eq 0 ]; then 50 BMC2=`$IPMITOOL bmc info | grep "IPMI Version" | cut -b 29` 51 #possibly log this stuff here 52 if [ $BMC2 -ge 2 ]; then 53 runtest firewall info lun 0 netfn 0 54 runtest firewall info lun 0 netfn 1 55 runtest firewall info lun 0 netfn 4 56 runtest firewall info lun 0 netfn 0 command 0 57 runtest firewall info lun 0 netfn 0 command 1 58 runtest firewall info lun 0 netfn 0 command 2 59 runtest firewall info lun 0 netfn 1 command 0 60 runtest firewall info lun 0 netfn 1 command 1 61 runtest firewall info lun 0 netfn 1 command 2 62 runtest firewall info lun 0 netfn 4 command 0 63 runtest firewall info lun 0 netfn 4 command 1 64 runtest firewall info lun 0 netfn 4 command 2 65 runtest firewall disable lun 0 netfn 0 command 2 66 runtest firewall enable lun 0 netfn 0 command 2 67 runtest firewall info lun 0 netfn 0 command 2 68 runtest channel getciphers ipmi 1 69 runtest channel getciphers sol 1 70 71 else 72 echo "BMC is not 2.0 compatible; skipping firewall tests." 73 fi 74fi 75runtest lan print 76runtest bmc getenables 77runtest channel info 0 78runtest channel info 1 79runtest channel info 2 80runtest channel info 14 81runtest channel info 15 82runtest channel authcap 1 1 83runtest channel authcap 1 2 84runtest channel authcap 1 3 85runtest channel authcap 1 4 86runtest channel getaccess 0x1 87runtest channel getaccess 0x2 88runtest chassis status 89runtest chassis identify 90runtest chassis restart_cause 91runtest chassis power status 92runtest pef info 93runtest pef status 94runtest pef list 95runtest sdr info 96runtest sdr list all 97runtest sdr list full 98runtest sdr list compact 99runtest sdr list event 100runtest sdr list mcloc 101runtest sdr list fru 102runtest sdr list generic 103runtest sdr type list 104runtest sdr entity 105runtest sel 106runtest sel info 107runtest sel list 108runtest sel elist 109runtest sel list 5 110runtest sel time get 111runtest sel writeraw testing 112runtest sel readraw testing 113runtest sensor list 114runtest session info all 115runtest session info active 116runtest user summary 0x1 117runtest user summary 0x2 118runtest user list 0x1 119runtest user list 0x2 120 121if [ $status -eq 255 ]; then 122 status=254 123fi 124 125 126 127exit $status 128