def ApplyChangesOnTheFly(timeout=90): count = 0 status = ixNet.getAttribute('/globals/topology', '-applyOnTheFlyState') print 'Aplying changes on the fly:', status while status == "notAllowed": print " {count}: /globals/topology -applyOnTheFlyState --> {status}".format(count=count, status=status) status = ixNet.getAttribute('/globals/topology', '-applyOnTheFlyState') time.sleep(1) count += 1 if count > timeout: print "Waited for {count}".format(count=count) status = ixNet.getAttribute('/globals/topology', '-applyOnTheFlyState') if status == "allowed": ixNet.execute('applyOnTheFly', '/globals/topology') return 0 elif status == "nothingToApply": ixNet.execute('applyOnTheFly', '/globals/topology') return 0 else: print "Status unknown '$status'" return 1