2

I use paramiko from (www.paramiko.org) to automate logging into Cisco devices and then checking logs, interface stats, anything i want really.

When i log into a device i am into a Management VRF. I don't have internet access.

If i want to test something for a customer, i need to do something like

ping vrf CUSTOMER_A 8.8.8.8 source Vlan 250

What i would like to do is make use of python to do things like

wget

speedtest-cli from GitHub

basically emulate being on the customers end device

However, so far i have been unable to get close.

Has any fellow networkers ever tried something like this ?

A

11
  • How exactly do you expect to run those applications on a Cisco device? Also, which model and OS are you using?
    – Teun Vink
    Sep 26, 2016 at 10:33
  • I have no idea how i going to get them to run? The IOS could change dependent on what device i am going to connect to
    – psniffer
    Sep 26, 2016 at 10:35
  • You can't. You're comparing a router to a linux box, which (at least for Cisco) isn't the case.
    – Teun Vink
    Sep 26, 2016 at 10:37
  • Hmmmmm.... i am no so sure, what about ssh tunneling
    – psniffer
    Sep 26, 2016 at 10:59
  • 1
    And how would that help? You still wouldn't be able to run that software on the Cisco device.
    – Teun Vink
    Sep 26, 2016 at 11:04

3 Answers 3

1

On a Cisco Nexus device - depending on the model and the NXOS version it runs - you can get access to a bash shell, a Linux container and/or a Python interpreter (with possibility to import pure python modules).

E.g. for NXOS 7.x on the nexus3000:

About Bash

In addition to the NX-OS CLI, Cisco Nexus 3000 Series devices support access to the Bourne-Again SHell (Bash). Bash interprets commands that you enter or commands that are read from a shell script. Using Bash enables access to the underlying Linux system on the device and to manage the system.

And

About the Guest Shell

In addition to the NX-OS CLI and Bash access on the underlying Linux environment, the Cisco Nexus 3000 Series devices support access to a decoupled execution space running within a Linux Container (LXC) called the “Guest Shell”.

From within the Guest Shell the network-admin has the following capabilities:

Access to the network over Linux network interfaces.
Access to Cisco Nexus 3000 bootflash.
Access to Cisco Nexus 3000 volatile tmpfs.
Access to Cisco Nexus 3000 CLI.
Access to Cisco NX-API REST.
The ability to install and run python scripts.
The ability to install and run 32-bit and 64-bit Linux applications

.

Source: Cisco Nexus 3000 Series NX-OS Programmability Guide, Release 7.x

1

TTCP should suit your needs. The good news is that it's built into the OS so you don't need to download any scripts or applications on the router.

You can use it between two routers or even a router and a PC. Further to this, you have the choice of running TTCP, iperf, jperf, etc on the PC side.

Note though that TTCP on a router is process switched so it has the potential use 100% of the CPU's resources.

1

You can automate those tasks with Cisco's EEM using ttcp and have the results emailed to you - hourly, daily, weekly, whatever. This might be easiest.

You can also spin up a linux VM on many newer Cisco boxes.

If you'd rather do it from a remote machine, Python could certainly be used or even Microsoft sendkeys class.

Python examples here.

Sendkeys example here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.