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

CISCO IOS-XR, Python3.7, Not able to run commands like 'ls' and 'df' o

Ann69
Level 1
Level 1

Cisco ios-xr router using CLI:

RP/0/RP0#show version

Thu Nov 25 07:53:59.103 UTC

Cisco IOS XR Software, Version 6.5.32.11I

Copyright (c) 2013-2020 by Cisco Systems, Inc.

RP/0/RP0#run

Thu Nov 25 07:54:05.231 UTC

[xr-vm_node0_RP0_CPU0:~]$df

Filesystem 1K-blocks Used Available Use% Mounted on

rootfs 3966080 1332040 2412860 36% /

76892 11848320 43% /mnt/ecu/vdd

[xr-vm_node0_RP0_CPU0:~]$

Using python: I am able to run show commands using Connect handler .send. Command:

from netmiko import ConnectHandler
import subprocess
Network_Device = {"host": "10.111.22.333", "username": "USER123", "password": "Pass123",     "device_type": "cisco_xr",}

Connect = ConnectHandler(**Network_Device)
Connect.enable()
version1 = "show version"
print(Connect.send_command(version1))

But not able to run 'df' or 'ls' commands, as not able to reach bash prompt i reach by running 'run' command on router.

I tried mcdvoice :

disk1files = subprocess.run("df", stdout=subprocess.PIPE)
print(disk1files.stdout.decode())

But seems its wrong. Please suggest the right library or code I can use here.

This is my first question here, so bear some silly questions or mistakes done in code

0 Replies 0
Review Cisco Networking for a $25 gift card