QuestionQ63
VerifiedDevice-Level Network AutomationAn engineer must apply an initial CLI configuration to a router connected to a terminal server for Day-0 setup. The engineer must automate Telnet login and configuration to the console port by using pexpect, then save the changes. Drag the code snippets from the bottom into the boxes in the code to create the artifact. Not every option is used.
Drag & Drop
import pexpect child = pexpect.("telnet 192.0.2.5 2001", =20) child.("Username:") child.("netops") child.expect("Password:") child.sendline("Cisco12345") child.expect(">") child.sendline("enable") child.expect("Password:") child.sendline("CiscoEnable") child.expect("#") child.sendline("configure terminal") child.expect("(config)#") child.sendline("hostname BR1-EDGE") child.sendline("interface GigabitEthernet1") child.sendline("ip address dhcp") child.sendline("no shutdown") child.sendline("end") child.sendline("write memory") child.expect("#") child.close()
Community Discussion