Last active
May 17, 2016 02:27
-
-
Save tcuthbert/125ad2ba5f59d7e8bb5275ec96b5c33e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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