Hey has anyone figured out a way to use the SSH plug-in to configure a Cisco device with multiple commands starting with config t? From what I can see when a command is executed the execution channel is closed and multiple commands does not work. I believe a stream has to be established for this to work and I am struggling to create that stream native in vRO and the plugin. Single commands and queries work great it is just the chain of multiple commands that is not
Try if something like the following code to execute multiple commands in a single session will work:
var session = new SSHSession("10.23.34.45", "myusername");
session.connectWithPassword("mypassword");
session.executeCommand("echo 'start'", true);
session.executeCommand("ls -l /root", true);
session.executeCommand("ls -l /etc", true);
session.executeCommand("echo 'done'", true);
session.disconnect();
If it doesn't work, is it an option to put all your commands in a single script, upload the script on your host, and then run it?
That works well running standard ssh sessions but things are a little different with the CISCO devices. The SSH plugin opens the session, opens an execution channel, issues the command and closes the execution channel but leaves the session open if you do not disconnect. The CISCO devices are expecting the execution channel to stay open and that is why it is not accepting multiple commands at a time. Kinda like creating an SSH stream in powershell. I have this working in powershell but I am trying to keep things inside of vRO without having to proxy out to other system first.
Thank you for responding and sharing what you have
Cheers
Steve
Hi,
Did you find away to configure a cisco switch from vRO?
Kind regards
Mark
We do this to issue commands to Cisco MDS switches
<code>
zoneset name zoneset3 vsasn 3 ; member my_new_zone_1 ; member my_new_ozne_2
<code>
using the NXAPI, which basically takes an SSH command, so you can probably just send a semi-colon delimited string to the ssh session.
I've used expect scripting and an expect host to configure Cisco devices before.
You need to generate the expect script on the vRO side, pass the script to an expect host ( using something like GuestOPS), then execute the expect script against the Cisco device.
This doesnt easily pull cisco configs, but changes them well.