We have a TCL script that is used to configure our routers automatically.
The script is able to differentiate between our older IOS (ISR G2) devices and the newer 4K (IOS XE).
At start we check with some 'input' commands which router hardware we have.
The issue: ONLY in IOS XE
The method is simple. We send the command ("sh version| i 2911" or "sh version| i ISR4351") and if the router produces a response, then we are sure that the router is of "type" hardware. Then we load the correct image for that device.
#Determine platform
set PLATFORM unknown
if { ![string equal [exec show version | i ISR4351] ""] } { set PLATFORM 4351 }
if { ![string equal [exec show version | i ISR4321] ""] } { set PLATFORM 4321 }
if { ![string equal [exec show version | i IR829GW-LTE-GA-EK9] ""] } { set PLATFORM IR829 }
if { ![string equal [exec show version | i CISCO3945] ""] } { set PLATFORM 3945 }
if { ![string equal [exec show version | i CISCO2911] ""] } { set PLATFORM 2911 }
if { ![string equal [exec show version | i CISCO1941] ""] } { set PLATFORM 1941 }
BUT==== > What happens in IOS XE. And only on the IOS XE... The return the TCL interpreter sometimes hits on other 'hardware' tests... As a consequence, our 4K routers are seen as old hardware.
How we have sold it: We run the same command "3" times. If it is 3 times the same result, then it assumes it is that hardware. It is a solution, but it is maybe not the best.
My question:
Why does this happen on IOS XE.. can we force the command to be only parsed by the CLI interpreter... Or am I missing something... Does the IOS XE needs specific configurations for using TCL that differ from older IOS (what I do not seem to read)
Thank you a lot. Special question