Removed underscores for public Node methods. Minor cleanup & comments.

This commit is contained in:
Bob Lantz
2010-03-08 15:32:41 -08:00
parent 2626693241
commit 80be564274
12 changed files with 223 additions and 188 deletions
+8 -7
View File
@@ -5,7 +5,7 @@ Build a simple network from scratch, using mininet primitives.
This is more complicated than using the higher-level classes,
but it exposes the configuration details and allows customization.
This version uses the user datapath.
This version uses the user datapath and an explicit control network.
"""
from mininet.net import init
@@ -14,7 +14,8 @@ from mininet.util import createLink
from mininet.log import lg, info
def scratchNetUser( cname='controller', cargs='ptcp:' ):
# Create Network
"Create network from scratch using user switch."
# It's not strictly necessary for the controller and switches
# to be in separate namespaces. For performance, they probably
# should be in the root namespace. However, it's interesting to
@@ -32,15 +33,15 @@ def scratchNetUser( cname='controller', cargs='ptcp:' ):
info( '*** Configuring control network\n' )
controller.setIP( controller.intfs[ 0 ], '10.0.123.1', 24 )
switch.setIP( switch.intfs[ 0 ], '10.0.123.2', 24 )
info( '*** Configuring hosts\n' )
h0.setIP( h0.intfs[ 0 ], '192.168.123.1', 24 )
h1.setIP( h1.intfs[ 0 ], '192.168.123.2', 24 )
info( '*** Network state:\n' )
for node in controller, switch, h0, h1:
info( str( node ) + '\n' )
info( '*** Starting controller and user datapath\n' )
controller.cmd( cname + ' ' + cargs + '&' )
switch.cmd( 'ifconfig lo 127.0.0.1' )
@@ -57,9 +58,9 @@ def scratchNetUser( cname='controller', cargs='ptcp:' ):
switch.cmd( 'kill %ofprotocol' )
switch.deleteIntfs()
info( '\n' )
if __name__ == '__main__':
lg.setLogLevel( 'info' )
info( '*** Scratch network demo (user datapath)\n' )
init()
init()
scratchNetUser()