Hi,
I am trying to write a customized library for configuring routers. In my config proc I send a "List" of commands and "join" then with "\r". However, using send/expect in proc limits my ability to send one command at a time. I send a command and I check for prompt returned by router. What I want to do it send all the commands at once in a single send and then expect the prompt as against sending one command at a time. This is what I tried.
set cmd [join $cmd "\r"]
send -i $procid "$cmd\r"
expect -i $procid -re "$prompt#"
lappend buff $expect_out(buffer)
However, not all the commands get sent. Sending stops in the middle of the list and my program quits. I tried adding full_buffer in my expect statement (I don't know if thats the right use of it) and it did send all the commands, however, it halted after that and errored out saying it could not find the variable expect_out(buffer).
Any ideas how to achieve this?
Pls suggest.
Thanks,
I am trying to write a customized library for configuring routers. In my config proc I send a "List" of commands and "join" then with "\r". However, using send/expect in proc limits my ability to send one command at a time. I send a command and I check for prompt returned by router. What I want to do it send all the commands at once in a single send and then expect the prompt as against sending one command at a time. This is what I tried.
set cmd [join $cmd "\r"]
send -i $procid "$cmd\r"
expect -i $procid -re "$prompt#"
lappend buff $expect_out(buffer)
However, not all the commands get sent. Sending stops in the middle of the list and my program quits. I tried adding full_buffer in my expect statement (I don't know if thats the right use of it) and it did send all the commands, however, it halted after that and errored out saying it could not find the variable expect_out(buffer).
Any ideas how to achieve this?
Pls suggest.
Thanks,