mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 11:18:03 +00:00
needed to look for exact strings on pexpect
This commit is contained in:
@@ -962,7 +962,7 @@ def main():
|
|||||||
if (args.series == "9800"):
|
if (args.series == "9800"):
|
||||||
if (command is None ):
|
if (command is None ):
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
logg.info("No command specified, going to log out.")
|
logg.info("9800 Command processed earlier will logout")
|
||||||
else:
|
else:
|
||||||
logg.info("Command[%s]"%command)
|
logg.info("Command[%s]"%command)
|
||||||
egg.sendline(command)
|
egg.sendline(command)
|
||||||
@@ -970,7 +970,7 @@ def main():
|
|||||||
logg.info("command sent {}".format(command))
|
logg.info("command sent {}".format(command))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
i = egg.expect(["WLC>","WLC#", "WLC(config)#","(config-wlan)#","(config-policy-tag)#",pexpect.TIMEOUT],timeout=3)
|
i = egg.expect_exact(["WLC>","WLC#", "WLC(config)#","(config-wlan)#","(config-policy-tag)#",pexpect.TIMEOUT],timeout=3)
|
||||||
print (egg.before.decode('utf-8', 'ignore'))
|
print (egg.before.decode('utf-8', 'ignore'))
|
||||||
if i == 0:
|
if i == 0:
|
||||||
logg.info("WLC> prompt received can send logout")
|
logg.info("WLC> prompt received can send logout")
|
||||||
@@ -979,12 +979,12 @@ def main():
|
|||||||
if i == 1:
|
if i == 1:
|
||||||
logg.info("WLC# prompt received needs exit to logout")
|
logg.info("WLC# prompt received needs exit to logout")
|
||||||
try:
|
try:
|
||||||
egg.sendline("exit")
|
egg.sendline("logout")
|
||||||
sleep(0.1)
|
sleep(0.1)
|
||||||
break
|
|
||||||
except:
|
except:
|
||||||
logg.info("9800 exception on exit")
|
logg.info("9800 exception on exit")
|
||||||
sleep(0.1)
|
sleep(0.1)
|
||||||
|
break
|
||||||
if i == 2:
|
if i == 2:
|
||||||
logg.info("WLC(config)# prompt received will send exit")
|
logg.info("WLC(config)# prompt received will send exit")
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user