cancel
Showing results for 
Search instead for 
Did you mean: 

XMC script -> Timeout during login to device

XMC script -> Timeout during login to device

StephanH
Valued Contributor III

Hello all,

I have a problem running python scripts on some switches. The scripts are started on the XMC.

Due to several radius servers and other parameters it takes more than 30 seconds until the CLI session (SSH) is established.


If I open a terminal in the XMC on these switches it works fine and there are no problems.

A connection with Putty works the same way. Of course you have to wait more than 30 seconds.

 

However, when I start a Python script it doesn't seem to wait long enough for the login to be successful.

 

There are now several timeouts that are maybe responsible for this.

On the one hand there is the timeout "Script Timeout per Device (secs)" which is defined directly in the GUI of the XMC when executing the script (default value is 60).
On the other hand there is also "emc_cli.setSessionTimeout(xxx)” and last but not least you can use “emc_cli.send("show ..., True, timeout)” to set the value how long it should wait for the response of a command.

 

I am not sure if one of these values should help me with my problem or if there is another one.

 

However, I have increased all values accordingly, but it does not work in any of the cases.

The result is always the same:

When the script starts nothing happens until the "Script Timeout per Device (secs)" from the GUI expires. Then I get the following result:
"Error: CLI session was closed" 

 

By the way: If I send a command in the XMC via "Device->Tasks->CLI Commands" I get the same error.

 

If I run the script for a switch where the authentication works faster everything works as it should.

 

Now the question: How can I make the script engine wait longer for authentication?

 

 

 

Regards Stephan
1 ACCEPTED SOLUTION

StephanH
Valued Contributor III

Hello Robert,

I found out that my problem is not related to the timeouts. In the debug you can see that the prompt detection is not working properly. However, I am working with GTAC to find a solution.

Regards Stephan

View solution in original post

3 REPLIES 3

StephanH
Valued Contributor III

Hello Robert,

I found out that my problem is not related to the timeouts. In the debug you can see that the prompt detection is not working properly. However, I am working with GTAC to find a solution.

Regards Stephan

Ludovico_Steven
Extreme Employee
emc_cli.setSessionTimeout() is working fine in XMC 8.5.4.23.
But that got broken in XMC 8.5.5.
There is a Jira for that:XMC-4131

Robert_Heydenbl
New Contributor II

Hello People, 

I happen to have a very similar problem with XMC Version 8.5 (did not test on 8.4; on 8.3 everything works just fine). 
I developed a Workflow which does a firmwareupgrade dependent on the configuration it was executed on. The download and installation of a new firmware takes longer than 30 seconds.

If I just run the command with ‘emc_cli.send(“<command>”)’, the workflow will fail with a message like “Error Session exceeded timeout of: 30 s”. So I made an adjustment like the following:

emc_cli.setSessionTimeout(<timeout_in_seconds>)
emc_cli.setCommandTimeout(<timeout_in_seconds>)
emc_cli.close()
emc_cli.send(“<command>”)

This always worked until (including) version 8.3. On 8.5, however, the new session timeout value seems to be ignored completely and I get the error message from above, again.
On 8.3 and lower, if a command exceeded the custom set timeout, the error message adjusted the timeout value. On 8.5, it always states 30s, regardles of what I set before.

Other values from the emc_cli object still seem to affect the interface behaviour (for example, I can set another IP-Address using emc_cli.setIpAddress(“<deviceIP>”), close the connection and then run commands on another device.)

Whats funny though, is that I get the correct value displayed when I read the session timeout (‘print str(emc_cli.getSessionTimeout()’) after setting it to a value suitable for my task. However, if I read it before setting a value, ‘emc_cli.getSessionTimeout()’ returns 0.

Now, as I’m unable to find documentation about the emc_cli object, I’m not quite sure if i use this correctly. Does anyone know some documentation about this API or knows another way to set the session timeout inside of a XMC-Python-Script, depending on ones needs?

 

GTM-P2G8KFN