I'm trying to to run a script to show all of the configuration and write them on files for juniper and CISCO routers. So far the CISCO script is working as it should but the thing is with the juniper router.
for ii in JUNIPER:
print ii
cmd2 = 'show configuration | display set'
conn.connect(ii)
conn.login(account1)
conn.execute(cmd2)
print conn.response
#filerouter = open(ii, "w")
#filerouter.write(conn.response)
#filerouter.close()
After getting the list of devices to query, I run this but it gets stuck as if there is a limit of buffer... -
If I attempt to do a different command:
("show configuration | display set | match destination ")
-- I get the output written on a file or screen.
C:\Python27>python.exe C:\User\suserrr\Downloads\shrun.py
'clear' is not recognized as an internal or external command,
operable program or batch file.
Generating configs for ROUTER: R1.test.site
Generating connect for ROUTER: R2.test.site
==============
===========
routername
Traceback (most recent call last):
File "C:\Users\userrr\Downloads\shrun.py", line 40, in <module>
conn.execute(cmd2)
File "C:\Python27\lib\site-packages\exscript-2.1.440-py2.7.egg\Exscript\protocols\Protocol.py", line 900, in execute
return self.expect_prompt()
File "C:\Python27\lib\site-packages\exscript-2.1.440-py2.7.egg\Exscript\protocols\Protocol.py", line 999, in expect_prompt
result = self.expect(self.get_prompt())
File "C:\Python27\lib\site-packages\exscript-2.1.440-py2.7.egg\Exscript\protocols\Protocol.py", line 980, in expect
result = self._expect(prompt)
File "C:\Python27\lib\site-packages\exscript-2.1.440-py2.7.egg\Exscript\protocols\Protocol.py", line 956, in _expect
result = self._domatch(to_regexs(prompt), True)
File "C:\Python27\lib\site-packages\exscript-2.1.440-py2.7.egg\Exscript\protocols\SSH2.py", line 329, in _domatch
if not self._fill_buffer():
File "C:\Python27\lib\site-packages\exscript-2.1.440-py2.7.egg\Exscript\protocols\SSH2.py", line 303, in _fill_buffer
raise TimeoutException(error)
Exscript.protocols.Exception.TimeoutException: Timeout while waiting for response from device
===========
==== Question - How do i get the script to RUN AND PROVIDE THE OUTPUT OF the command: show configuration | display set
the 2nd pic shows the error i get but if I change the command to: show configuration | display set | match description
I get the information requested. Am i missing to add something in the module so that exscript/python to avoid the timeout?