Closed erick-abreu closed 5 years ago
Since the logs look normal probably going to need a bit more to go on here to figure out what's up. To start, what version of Netmiko are you running? Can you post your script/repl and (more/full) output from the repl or script where you're seeing the behavior and if possible the log from that same time -- and the log past where the show run output is coming in -- so we can hopefully see whats going on.
This is my full script
from netmiko import ConnectHandler
iosxr = ConnectHandler(host='sbx-iosxr-mgmt.cisco.com',
port = '8181',
username='admin',
password='C1sco12345',
device_type='cisco_xr')
#Sends a command to the device 'show run'
output = iosxr.send_command_expect('show run')
print(output)
When i print the output, some times it prints the result, and other times it just print some of the output, like the first line of the full reply.
>>> 0/CPU0:iosxr#
RP/0/RP0/CPU0:iosxr#
RP/0/RP0/CPU0:iosxr#show run
Wed Aug 7 00:12:36.891 UTC
From that output 00:12:36, i can see i got the configuration, but was not shown
DEBUG:netmiko:read_channel: RP/0/RP0/CPU0:iosxr#
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
RP/0/RP0/CPU0:iosxr#
RP/0/RP0/CPU0:iosxr#
DEBUG:netmiko:write_channel: show run
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
RP/0/RP0/CPU0:iosxr#
RP/0/RP0/CPU0:iosxr#
RP/0/RP0/CPU0:iosxr#show run
Wed Aug 7 00:12:36.891 UTC
DEBUG:netmiko:read_channel: Building configuration...
!! IOS XR Configuration version = 6.5.2
!! Last configuration change at Wed Aug 7 00:10:24 2019 by admin
!
hostname iosxr
domain name abc.inc
username admin
group root-lr
group cisco-support
secret 5 $1$k7Sg$3/RgUwUsA2x74RY0mwVlH1
!
tpa
vrf default
address-family ipv4
default-route mgmt
!
!
!
line console
exec-timeout 0 0
absolute-timeout 0
session-timeout 0
!
line default
exec-timeout 0 0
absolute-timeout 0
session-timeout 0
transport input ssh
!
call-home
service active
contact smart-licensing
profile CiscoTAC-1
active
destination transport-method http
!
!
interface MgmtEth0/RP0/CPU0/0
ipv4 address 10.10.20.175 255.255.255.0
ipv4 address 10.10.20.100 255.255.255.0 secondary
ipv4 address 192.168.0.1 255.255.255.0 secondary
!
interface GigabitEthernet0/0/0/0
ipv6 enable
!
interface GigabitEthernet0/0/0/1
ipv6 enable
!
interface GigabitEthernet0/0/0/2
ipv6 enable
!
interface GigabitEthernet0/0/0/3
ipv6 enable
!
interface GigabitEthernet0/0/0/4
ipv6 enable
!
interface GigabitEthernet0/0/0/5
ipv6 enable
!
interface GigabitEthernet0/0/0/6
ipv6 enable
!
router static
address-family ipv4 unicast
0.0.0.0/0 10.10.20.254
!
!
netconf agent tty
!
netconf-yang agent
ssh
!
ssh server v2
ssh server vrf default
ssh server netconf vrf default
end
RP/0/RP0/CPU0:iosxr#
DEBUG:netmiko:write_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel:
DEBUG:netmiko:read_channel: RP/0/RP0/CPU0:iosxr#
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
RP/0/RP0/CPU0:iosxr#
RP/0/RP0/CPU0:iosxr#
DEBUG:netmiko:write_channel: show run
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
RP/0/RP0/CPU0:iosxr#
RP/0/RP0/CPU0:iosxr#
DEBUG:netmiko:read_channel: show run
Wed Aug 7 00:12:40.687 UTC
Building configuration...
!! IOS XR Configuration version = 6.5.2
!! Last configuration change at Wed Aug 7 00:10:24 2019 by admin
!
hostname iosxr
domain name abc.inc
username admin
group root-lr
group cisco-support
secret 5 $1$k7Sg$3/RgUwUsA2x74RY0mwVlH1
!
tpa
vrf default
Can you try adding the following to your connect handler:
global_delay_factor=4
XR tends to be pretty slow so we may need to slow Netmiko down as well. I would expect to see some errors/exceptions though so that's a bit strange. Give that a go and let us know if it helps!
Nice @carlniger !! works like a charm! thanks a lot
Hi im having trouble trying to read show commands outputs from netmiko, when i do a send command, and try to print the result, it comes with no output.
I get this output:
Some times i get the desiring result, but then stops working.
In the log file i see the result but not printed:
Thanks in advance.