I need a script to find all disabled ports (ifAdminStatus=1) and un-shut them (or any other action) The problem is I cannot get the value by if command. Seems I'm missing something.
As you can see the value of ifAdminStatus for interface with index 20 is 1
...
Router(tcl)#snmp_getone Public ifAdminStatus.20 {<obj oid='ifAdminStatus.20' val='1'/>}
...
But I cannot get it with an If statement. Tested following syntaxes but did not succeed
...
Router(tcl)# Router(tcl)#if {snmp_getone Public ifAdminStatus.20 ==1 } {puts "Value=1"}syntax error in expression "snmp_getone Public ifAdminStatus.20 ==1 " Router(tcl)# Router(tcl)#if {'snmp_getone Public ifAdminStatus.20' ==1 } {puts "Value=1"}syntax error in expression "'snmp_getone Public ifAdminStatus.20' ==1 " Router(tcl)#if {[snmp_getone Public ifAdminStatus.20] ==1 } {puts "Value=1"}
...
I just like to have 1 returned if the value is 1. Then I should extend it to all ports and make array of interfaces, making actions, etc.
Any help would be appreciated.