cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2230
Views
0
Helpful
3
Replies

Netmiko find prompt before applying configuration

AJ01
Level 1
Level 1

I use Netmiko to ssh to a cisco router and I was trying to apply the BGP configuration using ssh_conn.send_config_set(). Below is a sample configuration to be applied. Expected behavior:
bgp router-id x.x.x.x should be configured under the vrf address family. For some reason, when I tested manually, router didn't change the prompt and hence applied all the configuration to the global mode instead of address family mode and resulted in a BGP flap. Is there any way to check the prompt before applying the configuration?

'''
R1(config)#router bgp asn
R1(config-router)#
R1(config-router)#no address-family ipv4 vrf vrf_name
R1(config-router)# address-family ipv4 vrf vrf_name
% Topology f959c5b8b::VPNv4 Unicast::base is currently being deconfigured.
R1(config-router)# bgp router-id x.x.x.x
'''
3 Replies 3

balaji.bandi
Hall of Fame
Hall of Fame

Get expect Mode config prompt and compare and before apply the config.

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Thanks for your response. Is there a way how you do that in Netmiko? I couldn't find the solution so far. I was using send_config_set() for sending the these commands in a list.

 

use pexpect as below :

 

https://pyneng.readthedocs.io/en/latest/book/18_ssh_telnet/

 

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help