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

Teun Vink
  • 17,233
  • 6
  • 44
  • 70
psniffer
  • 480
  • 5
  • 11

3 Answers3

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

hertitu
  • 2,648
  • 8
  • 11
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.

OzNetNerd
  • 2,337
  • 12
  • 17
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

Ronnie Royston
  • 4,399
  • 1
  • 12
  • 28