cancel
Showing results for 
Search instead for 
Did you mean: 

TCL Scripting in Oneview for Cisco devices - Invalid input

TCL Scripting in Oneview for Cisco devices - Invalid input

Nightrest
New Contributor
I am working on a TCL script that would role through ports on a Cisco chassis and check the vlan regardless of how many blades it had in it.

My issue is that if my script gets an error when i do a "show interface " command the script ends. I want the script to continue even if i encounter an error... I have read about docs about catch statements but havent been able to get them to work. Here is a snippet of my code...

code:
set var EGRESS "GigabitEthernet"
set var PortNumber 1
set var BladeNumber 0
set var ErrorOnBlade "% Invalid input detected at '^' marker."
while {$BladeNumber != 9} {
show interfaces $EGRESS $BladeNumber/0/$PortNumber switchport | include Access
if {[regexp $ErrorOnBlade $CLI.OUT] !=0} {
incr BladeNumber 1
}

while {$PortNumber != 25 } {
CLI show interfaces $EGRESS $BladeNumber/0/$PortNumber switchport | include Access
if {[regexp "Access Mode VLAN: $VLANID" $CLI.OUT] !=0} {
CLI config t
CLI interface $EGRESS 1/0/$PortNumber
CLI switchport mode access
CLI switchport access vlan $NEWVLANID
CLI exit
CLI exit
}

incr PortNumber 1
}
incr BladeNumber 1
set var PortNumber 1
puts $BladeNumber
}




OUTPUT


R-changed# show interfaces GigabitEthernet 0/0/1 switchport | include Access
^
% Invalid input detected at '^' marker.

R-changed#
** Aborting execution of script because cli-mode is set to abort-on-error *


Any help or ideas would be great.
1 REPLY 1

StephanH
Valued Contributor III
Hello Nightrest,

I think you have to add this line:

code:
set var abort_when_error no


Regards
Stephan
Regards Stephan
GTM-P2G8KFN