Forum Discussion
Thank you for the suggestion. This is the first time I am trying to script with Groovy and my overall scripting experience is pretty low, so forget me if I didn't use println(cli.before()) correctly.
------------
import com.santaba.agent.groovyapi.expect.Expect
host = hostProps.get("system.hostname");
user = hostProps.get("config.user");
pass = hostProps.get("config.pass");
cli=Expect.open(host, user, pass);
cli.expect("#");
println(cli.before()) <-------------------------
cli.send("terminal length 0\n");
cli.expect("#");
cli.send("show running-config all\n");
cli.expect(/Current configuration.*\n/);
cli.send("exit\n");
cli.expect("#exit");
config=cli.before();
config = config.replaceAll(/ntp clock-period \d+/,"ntp clock-period ");
cli.expectClose();
println config;
----------------------
With it added after the first section, I still got the same error. No change. I also tried the line after each section with no change.
Did I just use it wrong or is the script failing immediately?
Related Content
- 2 months ago
- 2 years ago
- 2 years ago