本文整理汇总了Python中device.Device.clearConfig方法的典型用法代码示例。如果您正苦于以下问题:Python Device.clearConfig方法的具体用法?Python Device.clearConfig怎么用?Python Device.clearConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类device.Device
的用法示例。
在下文中一共展示了Device.clearConfig方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import clearConfig [as 别名]
f = open('output.log', 'w', buffering=0)
DUT = Device('EOS', '10.52.2.222', 10022)
DUT.write('\n')
time.sleep(3)
print(DUT.read_until('Username'))
f.write(DUT.login())
for x in range(500):
# Sleep a random amount of time to change the timing slightly each iteration.
sleeptime = random.randrange(30)
print('*** Starting iteration %d with a %d second wait.***\n\n' % (x,sleeptime))
f.write('\n\n*** Starting iteration %d with a %d second wait.***\n\n' % (x,sleeptime))
print('Clearing config.')
DUT.clearConfig()
# It takes about 3 minutes to come back online.
output = DUT.read_until('Username:')
print('Logging into DUT')
output = output + DUT.login()
f.write(output)
time.sleep(sleeptime)
print('Appending the config.')
# append the backup config.
output = DUT.write(['config slot2/backup2.cfg append','y'])
# This should wait for the append to finish.
output = output + DUT.read_until_prompt()
f.write(output)
if 'MII' in output:
print('Found an issue')
break