MCPcopy Create free account
hub / github.com/mininet/mininet / do_source

Method do_source

mininet/cli.py:347–365  ·  view source on GitHub ↗

Read commands from an input file. Usage: source

( self, line )

Source from the content-addressed store, hash-verified

345 quietRun( 'stty echo' )
346
347 def do_source( self, line ):
348 """Read commands from an input file.
349 Usage: source <file>"""
350 args = line.split()
351 if len(args) != 1:
352 error( 'usage: source <file>\n' )
353 return
354 try:
355 with open( args[ 0 ] ) as self.inputFile:
356 while True:
357 line = self.inputFile.readline()
358 if len( line ) > 0:
359 self.onecmd( line )
360 else:
361 break
362 except IOError:
363 error( 'error reading file %s\n' % args[ 0 ] )
364 self.inputFile.close()
365 self.inputFile = None
366
367 def do_dpctl( self, line ):
368 """Run dpctl (or ovs-ofctl) command on all switches.

Callers 1

__init__Method · 0.95

Calls 2

readlineMethod · 0.80
closeMethod · 0.80

Tested by

no test coverage detected