start:lsdef_pdu_object description:list pdu object and it's attribute label:others,PDU cmd:lsdef -h check:output=~pdu cmd:mkdef $$PDU mgt=pdu nodetype=pdu groups=pdu check:rc==0 cmd:lsdef -t pdu check:rc==0 check:output=~$$PDU check:output=~pdu cmd:tabdump pdu check:rc==0 check:output=~$$PDU cmd:rmdef $$PDU check:rc==0 end start:mkdef_pdu_object description:create a pdu object and list it's attribute label:others,PDU cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu check:rc==0 cmd:lsdef -t pdu check:rc==0 check:output=~$$PDU check:output=~pdu cmd:rmdef $$PDU check:rc==0 cmd:lsdef $$PDU check:rc!=0 check:output=~Error: (\[.*?\]: )?Could not find an object named '$$PDU' cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu check:rc==0 cmd:chdef $$PDU machinetype=1u check:rc==0 cmd:lsdef $$PDU check:output=~1u cmd:rmdef $$PDU check:rc==0 end start:noderm_pdu_object description:create a pdu object and use noderm to remove it label:others,PDU cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu check:rc==0 cmd:lsdef -t pdu check:rc==0 check:output=~$$PDU check:output=~pdu cmd:tabdump pdu check:rc==0 check:output=~$$PDU cmd:noderm $$PDU check:rc==0 cmd:nodels check:output!~$$PDU cmd:tabdump pdu check:output!~$$PDU end start:pdu_communication description:Verify a pdu snmp communication label:others,PDU cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu check:rc==0 cmd:lsdef -t pdu check:rc==0 cmd:makehosts $$PDU check:rc==0 cmd:grep $$PDUIP /etc/hosts check:rc==0 cmd:snmpwalk -v1 -cpublic -mALL $$PDU .1.3.6.1.2.1.1 check:rc==0 check:output=~PDU check:output=~$$PDU cmd:rmdef $$PDU check:rc==0 end start:pdu_rinv description:Verify rinv works for pdu object label:others,PDU cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu check:rc==0 cmd:makehosts $$PDU check:rc==0 cmd:grep $$PDUIP /etc/hosts check:rc==0 cmd:snmpwalk -v1 -cpublic -mALL $$PDU .1.3.6.1.2.1.1 check:rc==0 cmd:rinv $$PDU check:rc==0 check:output=~$$PDU cmd:rmdef $$PDU check:rc==0 end start:pdu_rpower description:Verify rpower works for pdu object label:others,PDU cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu check:rc==0 cmd:makehosts $$PDU check:rc==0 cmd:grep $$PDUIP /etc/hosts check:rc==0 cmd:snmpwalk -v1 -cpublic -mALL $$PDU .1.3.6.1.2.1.1 check:rc==0 cmd:rpower $$PDU off check:rc==0 check:output=~$$PDU check:output=~off check:output!~on cmd:rpower $$PDU on check:rc==0 check:output=~$$PDU check:output=~on check:output!~off cmd:rpower $$PDU stat check:rc==0 check:output=~$$PDU check:output=~on check:output!~off cmd:rmdef $$PDU check:rc==0 end start:pdu_node_operation description:Verify operate node's pdu attribute could operate pdu label:others,PDU cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu check:rc==0 cmd:makehosts $$PDU check:rc==0 cmd:grep $$PDUIP /etc/hosts check:rc==0 cmd:snmpwalk -v1 -cpublic -mALL $$PDU .1.3.6.1.2.1.1 check:rc==0 cmd:lsdef $$CN |grep pdu|awk -F= '{print $2}' > /tmp/pduvalue cmd:oldpdu=`lsdef $$CN |grep pdu|awk -F= '{print $2}'`;chdef $$CN pdu=$$PDU:$$PORT,$oldpdu check:rc==0 cmd:lsdef $$CN -i pdu check:rc==0 cmd:rpower $$CN stat |awk -F: '{print $2}' > /tmp/cnstat check:rc==0 cmd:rpower $$CN pdustat check:rc==0 check:output=~$$CN: $$PDU outlet $$PORT is cmd:rpower $$CN pduoff check:rc==0 check:output=~$$CN: $$PDU outlet $$PORT is off cmd:rpower $$CN pduon check:rc==0 check:output=~$$CN: $$PDU outlet $$PORT is on cmd:oldpdu=`cat /tmp/pduvalue`;chdef $$CN pdu=$oldpdu cmd:if grep on /tmp/cnstat; then rpower $$CN on;fi check:rc==0 cmd:rmdef $$PDU check:rc==0 cmd:rm -rf /tmp/pduvalue cmd:rm -rf /tmp/cnstat end start:pdu_bad_config description:test bad config with pdu label:others,PDU cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu check:rc==0 cmd:makehosts $$PDU check:rc==0 cmd:grep $$PDUIP /etc/hosts check:rc==0 cmd:snmpwalk -v1 -cpublic -mALL $$PDU .1.3.6.1.2.1.1 check:rc==0 cmd:lsdef $$CN |grep pdu|awk -F= '{print $2}' > /tmp/pduvalue cmd:chdef $$CN pdu=$$PDU:1000 check:rc==0 cmd:lsdef $$CN -i pdu cmd:rpower $$CN pdustat check:rc!=0 check:output=~Error cmd:rpower $$CN pduon check:rc!=0 check:output=~Error cmd:rpower $$CN pduoff check:rc!=0 check:output=~Error cmd:oldpdu=`cat /tmp/pduvalue`;chdef $$CN pdu=$oldpdu cmd:rpower $$CN pduof check:rc!=0 check:outpu=~Unsupported command cmd:rmdef $$PDU end