NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

SSH with Teststand

Solved!
Go to solution

I have a need to communicate with a device through SSH in my testsequence. So far I have found ExtraPutty and putty Plink, but neither seems to work perfectly for me. Extraputty has the functionality that I would like to have, which is interactive communication. However I've had issues with the reliability of several steps in Extraputty. Mostly with timing, as the steps don't always seem to wait for the time or the string that I have specified. Plink seems to work very well, but the issue is that it always opens a new connection, executes commands and then closes the connection. This is very slow when I need to input several commands and do measurements in between (each step calling Plink seems to take several seconds).

 

Has anyone found something similar to Extraputty that I could try?

0 Kudos
Message 1 of 9
(5,660 Views)

Hey jmog, 

 

I'd check out Using Telnet, SSH, RLOGIN, or RAW TCP Communications Protocol With NI Software for for reference. This provides two options for using Putty. The first is through a command-line interface. The second is to use port-forwarding along with LabWindows/CVI TCP functions. 

 

We've seen similar questions before. There has been mention of extraputty which is add on of putty (although I can't comment personally). This software offered an Telnet API. You can send and received data from TestStand.

 

Have you checked out any of the existing resources on SSH and TestStand?

CVI telnet ssh protocol

Using ExtraPutty for SSH Communication in TestStand
SSH-and-64-bit-Teststand Forum

 

Let us know how you get on.

Rebecca

0 Kudos
Message 2 of 9
(5,612 Views)

I have used Plink in the past. I agree that the new connection behavior can take a long time.  It helped to combine as many commands as possible into one script for every Plink call.  

 

I have never done this personally, but I was told that it would be possible to use Python to open your SSH session and Python will keep the session open.  TestStand can natively work with Python.  The thread below talks about this a little bit (though they use LabVIEW to communicate with Python).

https://lavag.org/topic/16982-ssh-needed/

 

Pulido Technologies LLC

0 Kudos
Message 3 of 9
(5,596 Views)

I also tried using LabVIEW (this package seems great if you want to use SSH with LV: http://www.labvolution.com/ssh-with-labview/ ).

 

So I created a couple of VIs I planned to use within my sequence and did manage to get the connection open and I was also able to communicate. The problem however seemed to be passing on the reference to the SSH connection inside Teststand: I was not able pass the reference to the next step in the sequence to be able to continue communication. I suspect the same issue might arise if I use python, but I will have to check it out. Thanks for the tip.

 

Rebecca: I did have a look at the other posts you mentioned, but could not find a solution...

0 Kudos
Message 4 of 9
(5,565 Views)

Hi

 

Maybe this could be interesting for you:

https://sourceforge.net/projects/realterm/

 

Currently I am using it for serial stuff. But it should work with Telnet as well.

AND most important for TestStand: Is has an .net interface which is working!

 

Regards

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
Message 5 of 9
(5,468 Views)

Hi j_dodek,

 

Would you happen to have any examples of how you are using realterm with teststand? I have not had the time to dig deeper in to this, but I have never used a .NET interface with teststand, so I think an example would be really helpful here.

0 Kudos
Message 6 of 9
(5,433 Views)

I'm using a .net module to make SSH sessions though Teststand. However at the moment it's part of some proprietary sw, which means i can't share it.

I'm looking into splitting it out in a more simple sw struture. Anyway just to say it can be done in .net and it can keep the connection alive throughout the whole test sequence.

So basically i only have to open the connection once and thereafter just pass the .net object to the next step using the connection.

0 Kudos
Message 7 of 9
(5,382 Views)

Nikolaj, this sounds exactly what I am after too. So the .NET module that you are using is custom made and not available to the public? If you could split it out and share it would be awesome!

 

I looked into Realterm and its .NET interface. It seems that it can be used for serial and telnet like said, but not SSH. At least I was not able to establish a connection to my device (Linux with SSH). I tried first with the GUI but to no avail.

0 Kudos
Message 8 of 9
(5,361 Views)
Solution
Accepted by topic author jmog

Actually, after looking into .NET libraries, I saw one of the other threads in this forum in new light: https://forums.ni.com/t5/NI-TestStand/SSH-and-64-bit-Teststand/td-p/2961873

 

This .NET solution mentioned in the thread seems to work really well after some initial testing: https://github.com/sshnet/SSH.NET

 

I am able to establish a connection and keep it alive to send commands and read responses. There is not too much documentation so this is mostly trial and error, but the basic functionality works. If only I could get a timeout for commands, this would be perfect...

Message 9 of 9
(5,355 Views)