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

Method default

mininet/cli.py:416–441  ·  view source on GitHub ↗

Called on an input line when the command prefix is not recognized. Overridden to run shell commands when a node is the first CLI argument. Past the first CLI argument, node names are automatically replaced with corresponding IP addrs.

( self, line )

Source from the content-addressed store, hash-verified

414 self.mn.waitConnected()
415
416 def default( self, line ):
417 """Called on an input line when the command prefix is not recognized.
418 Overridden to run shell commands when a node is the first
419 CLI argument. Past the first CLI argument, node names are
420 automatically replaced with corresponding IP addrs."""
421
422 first, args, line = self.parseline( line )
423
424 if first in self.mn:
425 if not args:
426 error( '*** Please enter a command for node: %s <cmd>\n'
427 % first )
428 return
429 node = self.mn[ first ]
430 rest = args.split( ' ' )
431 # Substitute IP addresses for node names in command
432 # If updateIP() returns None, then use node name
433 rest = [ self.mn[ arg ].defaultIntf().updateIP() or arg
434 if arg in self.mn else arg
435 for arg in rest ]
436 rest = ' '.join( rest )
437 # Run cmd on node:
438 node.sendCmd( rest )
439 self.waitForNode( node )
440 else:
441 error( '*** Unknown command: %s\n' % line )
442
443 def waitForNode( self, node ):
444 "Wait for a node to finish, and print its output."

Callers 1

do_noechoMethod · 0.95

Calls 4

waitForNodeMethod · 0.95
updateIPMethod · 0.80
defaultIntfMethod · 0.45
sendCmdMethod · 0.45

Tested by

no test coverage detected