Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Unable to capture the entire result in expect_out(

Posted by rsk (rsk), 7 October 2006
Hi,

   We are using TCL/Expect to send CLI commands to NE (network element).

We see that the expect_out(buffer) does not capture the complete output of the command. This happens for commands with huge output.

When we print the buffer we see that it displays only a part of output.

The output has totally 67274 lines,
but is displays from 66136 to 67117.

We get a timed out problem because the script expects to see the prompt (which should be the last line of buffer) after the output which is missing in the buffer.

We increased the buffer size (using match_max) and also the timeout value but the problem still exists.

Request you to give some pointers.


Regards
rsk


 

Posted by admin (Graham Ellis), 7 October 2006
I have seen several reports like this ... and I've usually recommended that the expect_out data is captured line by line rather than all into one big buffer.


Posted by rsk (rsk), 9 October 2006
We are not able to conclude on this problem, we see that the behaviour is not consistent. Sometimes it writes the complete output of the command into the buffer and sometimes it only writes few lines. what could be the reason.

Posted by admin (Graham Ellis), 9 October 2006
Inconsistent results are often caused by timing issues.   You set off a spawned process, and then you have your expect process do a bit of housekeeping and say "can I see xxxxx in the buffer".    Depending on how the remote operation / timesharing algorithm in your own computer get on, you'll match partial or whole return patterns.   The problem is especially common in you end an expect regular expression with a catch-all such as .* or any count, or if you have a near-timeout case.

How did you get on with my suggestion of receiving the response back line by line, rather than grabbing the whole response in one go?   Expecting up to \r or \n should have done wonders for you, even though it's a bit more coding.



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho