From ba0bdf7fc4dce429d639301ad5ad0d1d1a43fee4 Mon Sep 17 00:00:00 2001 From: Ivan Pepelnjak Date: Wed, 7 Oct 2026 14:03:21 +0200 Subject: [PATCH] Add 'step_config' netmiko feature Netmiko does not exit the config mode after send_config_from_file on some devices (IOS XR). An explicit 'exit from config mode' is needed on those devices. Also: add 'commit' and 'exit_config_mode' results to debugging printout --- netsim/cli/initial/netmiko.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/netsim/cli/initial/netmiko.py b/netsim/cli/initial/netmiko.py index 3a4f2b3257..671152ae31 100644 --- a/netsim/cli/initial/netmiko.py +++ b/netsim/cli/initial/netmiko.py @@ -46,11 +46,13 @@ def deploy(n_data: Box,topology: Box,n_deploy: list) -> None: continue try: cfg_result = net_connect.send_config_from_file(cfg_file,error_pattern=netmiko_errors) - if log.debug_active('netmiko'): - print(f'Config {cfg_item} on {n_data.name}:\n{cfg_result}') log.info(f'Sent {cfg_item} configuration to {n_data.name}',module='netmiko') if _netmiko.has_commit(net_connect): - net_connect.commit() + cfg_result += net_connect.commit() + if features.get('netmiko.step_config',False): + cfg_result += net_connect.exit_config_mode() + if log.debug_active('netmiko'): + print(f'Config {cfg_item} on {n_data.name}:\n{cfg_result}') if cfg_item in ['normalize','initial']: net_connect.set_base_prompt() append_to_list(n_data._deploy,'success',cfg_item)