From e989e56926972ebc67a0a0ada69caf0fc7274e30 Mon Sep 17 00:00:00 2001 From: Ivan Pepelnjak Date: Wed, 14 Oct 2026 18:05:34 +0200 Subject: [PATCH] Fix: Capture the whole error message with netmiko_regexp The netmiko error regexp is updated for EOS, IOS, and IOS XR to capture the whole error message. --- netsim/devices/eos.yml | 2 +- netsim/devices/ios.yml | 2 +- netsim/devices/xr.yml | 2 +- tests/config/README.md | 3 +++ tests/config/ios-netmiko.yml | 16 ++++++++++++++++ 5 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 tests/config/README.md create mode 100644 tests/config/ios-netmiko.yml diff --git a/netsim/devices/eos.yml b/netsim/devices/eos.yml index a086699b3c..d1c9f7f298 100644 --- a/netsim/devices/eos.yml +++ b/netsim/devices/eos.yml @@ -102,7 +102,7 @@ features: vpn: true netmiko: device_type: arista_eos - error_regexp: "^%" + error_regexp: "^%.*" ospf: unnumbered: true import: [ bgp, isis, ripv2, connected, static, vrf ] diff --git a/netsim/devices/ios.yml b/netsim/devices/ios.yml index aac0a97de4..6292a7c84d 100644 --- a/netsim/devices/ios.yml +++ b/netsim/devices/ios.yml @@ -106,7 +106,7 @@ features: netmiko: device_type: cisco_ios error_regexp: - - (?i:invalid|incomplete|ambiguous|error|overlap|enabled|bad) + - (?i:invalid|incomplete|ambiguous|error|overlap|enabled|bad).* ospf: unnumbered: true diff --git a/netsim/devices/xr.yml b/netsim/devices/xr.yml index ba0aa98213..15f6deb9d9 100644 --- a/netsim/devices/xr.yml +++ b/netsim/devices/xr.yml @@ -70,7 +70,7 @@ features: netmiko: device_type: cisco_xr delay: 2 # Wait two seconds before trying to configure the device - error_regexp: "^%" + error_regexp: "^%.*" step_config: True ospf: unnumbered: True diff --git a/tests/config/README.md b/tests/config/README.md new file mode 100644 index 0000000000..92f6fb32ce --- /dev/null +++ b/tests/config/README.md @@ -0,0 +1,3 @@ +The topologies in this directory prepare device-specific error conditions +that can be then tested manually with the "netlab config" command. They +are not (yet) meant to be used in an automated test. diff --git a/tests/config/ios-netmiko.yml b/tests/config/ios-netmiko.yml new file mode 100644 index 0000000000..4c133c4b68 --- /dev/null +++ b/tests/config/ios-netmiko.yml @@ -0,0 +1,16 @@ +plugin: [ files ] + +nodes: + sw: + device: iol + provider: clab + netlab_config_mode: netmiko + +files: + invalid.j2: | + nocommand noarg + ifname.j2: | + interface Ethernet 17/3 + no shutdown + +links: [ sw, sw ]