cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1590
Views
11
Helpful
2
Comments
frjansso
Cisco Employee
Cisco Employee

I was missing a feature to SSH to any device in the device list, so I created a toy python script that lists all devices and you can choose to ssh to one.

Please see SSH to a device in NSO's device list · GitHub.

# ~/dev/python-scripts/ssh_device.py

q: exit

d: enable paramiko debug

0: admin-DC-router-router-CSR-escDMZ-1

1: aws

2: escDMZ

3: escSJ

# 0

dc-router>en

Password:

dc-router#show run

Building configuration...

Current configuration : 1950 bytes

!

! Last configuration change at 23:05:09 UTC Mon Sep 18 2017

!

version 15.5

service timestamps debug datetime msec localtime show-timezone

service timestamps log datetime msec localtime show-timezone

no platform punt-keepalive disable-kernel-core

platform console virtual

!

hostname dc-router

!

boot-start-marker

boot-end-marker

!

!

enable secret 5 $1$oHBQ$yIaDet0t2LVM.jNIln8tB1

!

aaa new-model

!

!

!

--More--

2 Comments
alam.bilal
Cisco Employee
Cisco Employee

Nice!!!

Hi @frjansso I've tried using the code you posted with the paramiko library. I noticed that the interactions with a device are quite poor compared to bash SSH. The issues we've ran into are that certain interactions are "laggy". For example we if type a command, hit enter, then want to up arrow to use the command again, I don't see the last part on my screen. If I tab, then the command appears, but not unless I type tab or enter or some other user input. We have a similar effect when using something like left arrow key to go and change a value, it seems to "lag" behind the actual position. When I say lag, it's not a matter of time then it syncs up, it's like the most recent input occurs, but doesn't display. I was curious if you have ran into any similar issues like this using the paramiko library for your SSH python program.

 

Quick note, I used your code, then made a few adjustments so that I can run it from within NSO as a script (not an action).

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: