Skip to content

Instantly share code, notes, and snippets.

@tcuthbert
Last active May 17, 2016 02:27
Show Gist options
  • Save tcuthbert/125ad2ba5f59d7e8bb5275ec96b5c33e to your computer and use it in GitHub Desktop.
Save tcuthbert/125ad2ba5f59d7e8bb5275ec96b5c33e to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import time
import sys
from trigger.netdevices import NetDevices
from twisted.python import log
nd = NetDevices()
dev = nd.find('r1.demo.local')
dev.open()
# log.startLogging(sys.stdout)
while True:
d = None
r = dev.run_commands(['show version | in uptime'])
key = ('show version | in uptime',)
# import ipdb
# ipdb.set_trace()
while True:
if r.results:
print r.results
d = dev.run_commands(['show version | in uptime', 'show ip int brief'])
break
# if r.results is not None and r.results[key]:
# print 'Got results!'
# print r.results[key].strip()
# break
time.sleep(0.5)
try:
if d.results:
print d.results
except:
pass
print 'Sleeping 5 for next run...'
time.sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment