03-05-2025 10:07 PM
I'm running XR 7.7.21 and am scripting some repetitive processes, specifically trying to execute a config mode command ("load config.txt") via a TCL script. I know of "ios_config" in previous OS versions, but that throws an "invalid command name" error in 7.7.21. Is "ios_config" gone from 7.7.21? If so, is there another way to accomplish this? I'm still learning TCL on XE and XR seems to be an entirely different beast. Thanks in advance.
03-05-2025 11:03 PM
Hello @serkit
In Cisco IOS XR 7.7.21, the ios_config
command is indeed not available. This command was used in older versions of IOS and IOS XE for executing configuration commands within a TCL script, but it is not supported in IOS XR. IOS XR has a different architecture and scripting environment compared to IOS and IOS XE, so some commands and methods differ.
To execute configuration commands in IOS XR using TCL, you can use the cfsys::exec
command to run CLI commands, including configuration commands. However, you need to be cautious when using this approach, as it may not provide the same level of error handling or feedback as ios_config
in IOS or IOS XE.
Hope This Helps!!!
AshSe
Community Etiquette:
03-07-2025 06:42 AM - edited 03-07-2025 06:44 AM
Thanks for that! Can you please elaborate on this command, and maybe include an example?
Edit: I attempted this command from the tcl shell and received an "invalid command name" error.
03-06-2025 12:29 AM
Hello @serkit
Why not using python ? For IOS-XR I think it is a better option...since it seems to have limitation about TCL on IOS-XR.
03-06-2025 04:11 AM
@serkit wrote:I'm running XR 7.7.21 and am scripting some repetitive processes, specifically trying to execute a config mode command ("load config.txt") via a TCL script. I know of "ios_config" in previous OS versions, but that throws an "invalid command name" error in 7.7.21. Is "ios_config" gone from 7.7.21? If so, is there another way to accomplish this jewellok? I'm still learning TCL on XE and XR seems to be an entirely different beast. Thanks in advance.
One option is to use the exec command within the script, allowing direct execution of CLI commands like exec("load config.txt"). Another approach is to use Embedded Event Manager (EEM) policies, which can trigger TCL scripts based on specific conditions, enabling automated configuration changes.
Additionally, for more advanced configuration management, you can implement NETCONF or gNMI, which offer programmatic interfaces to modify configurations and retrieve system state.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide