#NEWLINE# @ defer . inlineCallbacks #NEWLINE# def add_mtroute( self , finalPrompt , extraCommands = [ ] ) : #NEWLINE# #INDENT# sessionTerminated = False #NEWLINE# commands = [ ] #NEWLINE# commands . append ( { #NEWLINE# #INDENT# 'command' : 'mtrouter -a' , #NEWLINE# 'expect' : 'Adding a new MT Route\\: \\(ok\\: save, ko\\: exit\\)' , #NEWLINE# #UNINDENT# } ) #NEWLINE# for extraCommand in extraCommands : #NEWLINE# #INDENT# commands . append ( extraCommand ) #NEWLINE# if ( commands [ 'command' ] in [ 'ok' , 'ko' ] ) : #NEWLINE# #INDENT# sessionTerminated = True #NEWLINE# #UNINDENT# #UNINDENT# if ( not sessionTerminated ) : #NEWLINE# #INDENT# commands . append ( { #NEWLINE# #INDENT# 'command' : 'ok' , #NEWLINE# 'expect' : 'Successfully added MTRoute \\[' , #NEWLINE# 'wait' : 0.4 , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# ( yield self . _test ( finalPrompt , commands ) )